mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +00:00
Fix std::clamp() assert fail in ui::fit_bounds()
This commit is contained in:
parent
e6cd13d7e1
commit
5831cda066
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2019-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
@ -128,8 +128,8 @@ void fit_bounds(const Display* parentDisplay,
|
||||
if (fitLogic)
|
||||
fitLogic(workarea, frame, [](Widget* widget){ return widget->boundsOnScreen(); });
|
||||
|
||||
frame.x = std::clamp(frame.x, workarea.x, workarea.x2() - frame.w);
|
||||
frame.y = std::clamp(frame.y, workarea.y, workarea.y2() - frame.h);
|
||||
frame.x = std::clamp(frame.x, workarea.x, std::max(workarea.x, workarea.x2() - frame.w));
|
||||
frame.y = std::clamp(frame.y, workarea.y, std::max(workarea.y, workarea.y2() - frame.h));
|
||||
|
||||
// Set frame bounds directly
|
||||
window->setBounds(gfx::Rect(0, 0, frame.w / scale, frame.h / scale));
|
||||
|
Loading…
Reference in New Issue
Block a user