mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-19 23:56:11 +00:00
14 lines
708 B
TypeScript
14 lines
708 B
TypeScript
import { WindowProps } from '@/hooks/Mapper/components/ui-kit/WindowManager/WindowManager.tsx';
|
|
|
|
export function getWindowsBySides(windows: WindowProps[], containerWidth: number, containerHeight: number) {
|
|
const centerX = containerWidth / 2;
|
|
const centerY = containerHeight / 2;
|
|
|
|
const top = windows.filter(window => window.position.y + window.size.height / 2 < centerY);
|
|
const bottom = windows.filter(window => window.position.y + window.size.height / 2 >= centerY);
|
|
const left = windows.filter(window => window.position.x + window.size.width / 2 < centerX);
|
|
const right = windows.filter(window => window.position.x + window.size.width / 2 >= centerX);
|
|
|
|
return { top, bottom, left, right };
|
|
}
|