diff options
| author | Mike Will <myQwil@gmail.com> | 2024-10-28 09:39:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-28 13:39:05 +0000 |
| commit | 2c481202effe707451608e272b5a801f8c970052 (patch) | |
| tree | 90a9fa8dea4492fe72e42a9494c15bfc23628c9c /src/layout/IHyprLayout.cpp | |
| parent | 6cf193e1662f6f750e964a3e174ae017246b4d48 (diff) | |
layout: slight adjustments to snapping logic (#8273)
fixes some bugs with resizing and corner snapping
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
| -rw-r--r-- | src/layout/IHyprLayout.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index bd81500d..e3606532 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -464,14 +464,14 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA // corner snapping if (sourceBox.x == SURFBB.x + SURFBB.w || SURFBB.x == sourceBox.x + sourceBox.w) { if (corner & (CORNER_TOPLEFT | CORNER_TOPRIGHT) && canSnap(sourceBox.y, SURFBB.y, GAPSIZE)) { - snapUp(sourceBox.y, sourceBox.w, SURFBB.y); + snapUp(sourceBox.y, sourceBox.h, SURFBB.y); snaps |= SNAP_UP; } else if (corner & (CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT) && canSnap(end.y, SURFBB.y + SURFBB.h, GAPSIZE)) { snapDown(sourceBox.y, sourceBox.h, SURFBB.y + SURFBB.h); snaps |= SNAP_DOWN; } } - if (sourceBox.y == SURFBB.y + SURFBB.h || SURFBB.y == sourceBox.y + sourceBox.w) { + if (sourceBox.y == SURFBB.y + SURFBB.h || SURFBB.y == sourceBox.y + sourceBox.h) { if (corner & (CORNER_TOPLEFT | CORNER_BOTTOMLEFT) && canSnap(sourceBox.x, SURFBB.x, GAPSIZE)) { snapLeft(sourceBox.x, sourceBox.w, SURFBB.x); snaps |= SNAP_LEFT; @@ -512,7 +512,7 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA const double RATIO = beginSize.y / beginSize.x; if ((corner & (CORNER_TOPLEFT | CORNER_BOTTOMLEFT) && snaps & SNAP_LEFT) || (corner & (CORNER_TOPRIGHT | CORNER_BOTTOMRIGHT) && snaps & SNAP_RIGHT)) { - const double sizeY = sourceBox.h * RATIO; + const double sizeY = sourceBox.w * RATIO; if (corner & (CORNER_TOPLEFT | CORNER_TOPRIGHT)) sourceBox.y += sourceBox.h - sizeY; sourceBox.h = sizeY; |
