mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-09-17 11:37:10 +03:00
fix: use correct min/max func and start val for finding closest window
This commit is contained in:
parent
10151209d3
commit
2548aa5dbd
@ -665,18 +665,21 @@ export class EngineImpl implements Engine {
|
||||
windowArray: EngineWindow[],
|
||||
dir: Direction
|
||||
): number {
|
||||
return windowArray.reduce((prevValue, window): number => {
|
||||
switch (dir) {
|
||||
case "up":
|
||||
return Math.min(window.geometry.maxY, prevValue);
|
||||
case "down":
|
||||
return Math.max(window.geometry.y, prevValue);
|
||||
case "left":
|
||||
return Math.min(window.geometry.maxX, prevValue);
|
||||
case "right":
|
||||
return Math.max(window.geometry.x, prevValue);
|
||||
}
|
||||
}, Infinity);
|
||||
return windowArray.reduce(
|
||||
(prevValue, window): number => {
|
||||
switch (dir) {
|
||||
case "up":
|
||||
return Math.max(window.geometry.maxY, prevValue);
|
||||
case "down":
|
||||
return Math.min(window.geometry.y, prevValue);
|
||||
case "left":
|
||||
return Math.max(window.geometry.maxX, prevValue);
|
||||
case "right":
|
||||
return Math.min(window.geometry.x, prevValue);
|
||||
}
|
||||
},
|
||||
dir === "up" || dir === "left" ? 0 : Infinity
|
||||
);
|
||||
}
|
||||
|
||||
private getClosestRelativeWindow(
|
||||
|
Loading…
Reference in New Issue
Block a user