mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibGfx: Reverse coordinate subtraction in Rect::constrained_to()
Fixes translating in the wrong direction or not at all in the case of a constraint at (0,0). This doesn't appear to be used anywhere yet but is needed in the upcoming patch.
This commit is contained in:
parent
85c542ab00
commit
2d64147f02
Notes:
sideshowbarker
2024-07-16 23:51:07 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/2d64147f02 Pull-request: https://github.com/SerenityOS/serenity/pull/18797
1 changed files with 2 additions and 2 deletions
|
@ -610,9 +610,9 @@ public:
|
|||
if (bottom() > constrain_rect.bottom())
|
||||
move_y = constrain_rect.bottom() - bottom();
|
||||
if (x() < constrain_rect.x())
|
||||
move_x = x() - constrain_rect.x();
|
||||
move_x = constrain_rect.x() - x();
|
||||
if (y() < constrain_rect.y())
|
||||
move_y = y() - constrain_rect.y();
|
||||
move_y = constrain_rect.y() - y();
|
||||
auto rect = *this;
|
||||
if (move_x != 0 || move_y != 0)
|
||||
rect.translate_by(move_x, move_y);
|
||||
|
|
Loading…
Reference in a new issue