Commit 81548ced authored by Florian Müllner's avatar Florian Müllner

native-window-placement: Clarify some code

Add some intermediate variables for better legibility.

!60
parent a378e5fc
......@@ -112,10 +112,11 @@ class NaturalLayoutStrategy extends Workspace.LayoutStrategy {
overlap = false;
for (let i = 0; i < rects.length; i++) {
for (let j = 0; j < rects.length; j++) {
if (i != j && rects[i].adjusted(-WINDOW_PLACEMENT_NATURAL_GAPS, -WINDOW_PLACEMENT_NATURAL_GAPS,
WINDOW_PLACEMENT_NATURAL_GAPS, WINDOW_PLACEMENT_NATURAL_GAPS)
.overlap(rects[j].adjusted(-WINDOW_PLACEMENT_NATURAL_GAPS, -WINDOW_PLACEMENT_NATURAL_GAPS,
WINDOW_PLACEMENT_NATURAL_GAPS, WINDOW_PLACEMENT_NATURAL_GAPS))) {
let adjustments = [-1, -1, 1, 1]
.map(v => v *= WINDOW_PLACEMENT_NATURAL_GAPS);
let iAdjusted = rects[i].adjusted(...adjustments);
let jAdjusted = rects[j].adjusted(...adjustments);
if (i != j && iAdjusted.overlap(jAdjusted)) {
loopCounter++;
overlap = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment