Skip to content

Commit

Permalink
Fix timeline configuration window bounds update when guiscale is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Gasparoken committed Jul 14, 2023
1 parent 6010a99 commit b7d597a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/app/ui/configure_timeline_popup.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2020-2023 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
Expand Down Expand Up @@ -73,6 +73,18 @@ ConfigureTimelinePopup::ConfigureTimelinePopup()
const bool visibleThumb = docPref().thumbnails.enabled();
m_box->thumbHSeparator()->setVisible(visibleThumb);
m_box->thumbBox()->setVisible(visibleThumb);

m_oldGuiscale = guiscale();
}

gfx::Rect ConfigureTimelinePopup::bounds()
{
gfx::Rect bounds(Widget::bounds());
if (m_oldGuiscale != guiscale()) {
bounds = Widget::bounds() * guiscale() / m_oldGuiscale;
m_oldGuiscale = guiscale();
}
return bounds;
}

Doc* ConfigureTimelinePopup::doc()
Expand Down
8 changes: 7 additions & 1 deletion src/app/ui/configure_timeline_popup.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Aseprite
// Copyright (C) 2001-2017 David Capello
// Copyright (C) 2023 Igara Studio S.A.
// Copyright (C) 2001-207 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
Expand Down Expand Up @@ -30,6 +31,10 @@ namespace app {
public:
ConfigureTimelinePopup();

// Returns the widget bounds, or scaled bounds
// if the guiscale has been changed.
gfx::Rect bounds();

protected:
bool onProcessMessage(ui::Message* msg) override;
void onChangePosition();
Expand All @@ -54,6 +59,7 @@ namespace app {

app::gen::TimelineConf* m_box;
bool m_lockUpdates;
int m_oldGuiscale;
};

} // namespace app
Expand Down

0 comments on commit b7d597a

Please sign in to comment.