mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Fix some std::clamp() calls: max value cannot be less than min value
This commit is contained in:
parent
ab2d7f79a3
commit
2e1d50bf33
@ -2567,8 +2567,8 @@ void Editor::setZoomAndCenterInMouse(const Zoom& zoom,
|
||||
// extra space for the zoom)
|
||||
gfx::Rect visibleBounds = editorToScreen(
|
||||
getViewportBounds().createIntersection(gfx::Rect(gfx::Point(0, 0), canvasSize())));
|
||||
screenPos.x = std::clamp(screenPos.x, visibleBounds.x, visibleBounds.x2()-1);
|
||||
screenPos.y = std::clamp(screenPos.y, visibleBounds.y, visibleBounds.y2()-1);
|
||||
screenPos.x = std::clamp(screenPos.x, visibleBounds.x, std::max(visibleBounds.x, visibleBounds.x2()-1));
|
||||
screenPos.y = std::clamp(screenPos.y, visibleBounds.y, std::max(visibleBounds.y, visibleBounds.y2()-1));
|
||||
|
||||
spritePos = screenToEditor(screenPos);
|
||||
|
||||
|
@ -147,8 +147,8 @@ void fit_bounds(const Display* parentDisplay,
|
||||
if (fitLogic)
|
||||
fitLogic(displayBounds, frame, [](Widget* widget){ return widget->bounds(); });
|
||||
|
||||
frame.x = std::clamp(frame.x, 0, displayBounds.w - frame.w);
|
||||
frame.y = std::clamp(frame.y, 0, displayBounds.h - frame.h);
|
||||
frame.x = std::clamp(frame.x, 0, std::max(0, displayBounds.w - frame.w));
|
||||
frame.y = std::clamp(frame.y, 0, std::max(0, displayBounds.h - frame.h));
|
||||
|
||||
window->setBounds(frame);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user