diff options
| author | zacoons <73414084+zacoons@users.noreply.github.com> | 2026-01-11 05:53:57 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-10 20:53:57 +0100 |
| commit | 8f8b31e7a66acb4eb3836aa2fe6d751e5889bdaa (patch) | |
| tree | 783b4a7e0e7658777277756c8b8148f023f64e6b /src/render/decorations/DecorationPositioner.cpp | |
| parent | 81e7498ec27156ee97aabba6fe4993412d98d1ab (diff) | |
decoration: take desiredExtents on all sides into account (#12935)
Diffstat (limited to 'src/render/decorations/DecorationPositioner.cpp')
| -rw-r--r-- | src/render/decorations/DecorationPositioner.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp index aa849bab..2982ba73 100644 --- a/src/render/decorations/DecorationPositioner.cpp +++ b/src/render/decorations/DecorationPositioner.cpp @@ -214,29 +214,23 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) { continue; } - auto desiredSize = 0; - if (LEFT) - desiredSize = wd->positioningInfo.desiredExtents.topLeft.x; - else if (RIGHT) - desiredSize = wd->positioningInfo.desiredExtents.bottomRight.x; - else if (TOP) - desiredSize = wd->positioningInfo.desiredExtents.topLeft.y; - else - desiredSize = wd->positioningInfo.desiredExtents.bottomRight.y; + const auto desiredExtents = wd->positioningInfo.desiredExtents; const auto EDGEPOINT = getEdgeDefinedPoint(wd->positioningInfo.edges, pWindow); Vector2D pos, size; if (EDGESNO == 4) { - pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL + desiredSize, stickyOffsetYT + desiredSize}; - size = wb.size() + Vector2D{stickyOffsetXL + stickyOffsetXR + desiredSize * 2, stickyOffsetYB + stickyOffsetYT + desiredSize * 2}; + stickyOffsetXL += desiredExtents.topLeft.x; + stickyOffsetXR += desiredExtents.bottomRight.x; + stickyOffsetYT += desiredExtents.topLeft.y; + stickyOffsetYB += desiredExtents.bottomRight.y; - stickyOffsetXL += desiredSize; - stickyOffsetXR += desiredSize; - stickyOffsetYT += desiredSize; - stickyOffsetYB += desiredSize; + pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYT}; + size = wb.size() + Vector2D{stickyOffsetXL + stickyOffsetXR, stickyOffsetYB + stickyOffsetYT}; } else if (LEFT) { + const auto desiredSize = desiredExtents.topLeft.x; + pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, -stickyOffsetYT}; pos.x -= desiredSize; size = {sc<double>(desiredSize), wb.size().y + stickyOffsetYB + stickyOffsetYT}; @@ -244,12 +238,16 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) { if (SOLID) stickyOffsetXL += desiredSize; } else if (RIGHT) { + const auto desiredSize = desiredExtents.bottomRight.x; + pos = wb.pos() + Vector2D{wb.size().x, 0.0} - EDGEPOINT + Vector2D{stickyOffsetXR, -stickyOffsetYT}; size = {sc<double>(desiredSize), wb.size().y + stickyOffsetYB + stickyOffsetYT}; if (SOLID) stickyOffsetXR += desiredSize; } else if (TOP) { + const auto desiredSize = desiredExtents.topLeft.y; + pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYT}; pos.y -= desiredSize; size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, sc<double>(desiredSize)}; @@ -257,6 +255,8 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) { if (SOLID) stickyOffsetYT += desiredSize; } else { + const auto desiredSize = desiredExtents.bottomRight.y; + pos = wb.pos() + Vector2D{0.0, wb.size().y} - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYB}; size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, sc<double>(desiredSize)}; |
