@bobfrankston/winpos 2.0.49 → 2.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/screens.js +4 -2
package/package.json
CHANGED
package/screens.js
CHANGED
|
@@ -72,10 +72,12 @@ export function enumerateScreens() {
|
|
|
72
72
|
}
|
|
73
73
|
return screens;
|
|
74
74
|
}
|
|
75
|
+
// Tops within this many pixels are treated as the same row (DPI/rounding noise).
|
|
76
|
+
const ROW_TOLERANCE = 100;
|
|
75
77
|
export function sortScreens(screens) {
|
|
76
|
-
// Sort by top (descending), then by left (ascending)
|
|
78
|
+
// Sort by top (descending), then by left (ascending), with tolerance for rounding
|
|
77
79
|
return screens.sort((a, b) => {
|
|
78
|
-
if (a.bounds.Top
|
|
80
|
+
if (Math.abs(a.bounds.Top - b.bounds.Top) <= ROW_TOLERANCE)
|
|
79
81
|
return a.bounds.Left - b.bounds.Left;
|
|
80
82
|
return b.bounds.Top - a.bounds.Top;
|
|
81
83
|
});
|