mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-16 10:20:50 +00:00
Fix problem redrawing the main Tabs when the last tab is closed
For this, on AnimatedWidget, before we call onAnimationStop(), we set m_animation to 0 to know that there is no animation in progress. Tabs depends on m_animation to know if it needs extra space when there are no more tabs (the extra space is used to show the animation that to collapse Tabs).
This commit is contained in:
parent
8cb1892601
commit
c7379f6ecf
@ -31,7 +31,7 @@ namespace app {
|
||||
|
||||
// For each animation frame
|
||||
virtual void onAnimationStart() { }
|
||||
virtual void onAnimationStop() { }
|
||||
virtual void onAnimationStop(int animation) { }
|
||||
virtual void onAnimationFrame() { }
|
||||
|
||||
protected:
|
||||
@ -49,10 +49,11 @@ namespace app {
|
||||
}
|
||||
|
||||
void stopAnimation() {
|
||||
onAnimationStop();
|
||||
|
||||
int animation = m_animation;
|
||||
m_animation = 0;
|
||||
m_timer.stop();
|
||||
|
||||
onAnimationStop(animation);
|
||||
}
|
||||
|
||||
int animation() const {
|
||||
|
@ -672,7 +672,7 @@ void Tabs::onAnimationFrame()
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void Tabs::onAnimationStop()
|
||||
void Tabs::onAnimationStop(int animation)
|
||||
{
|
||||
if (m_list.empty()) {
|
||||
Widget* root = getRoot();
|
||||
|
@ -127,7 +127,7 @@ namespace app {
|
||||
void onResize(ui::ResizeEvent& ev) override;
|
||||
void onPreferredSize(ui::PreferredSizeEvent& ev) override;
|
||||
void onAnimationFrame() override;
|
||||
void onAnimationStop() override;
|
||||
void onAnimationStop(int animation) override;
|
||||
|
||||
private:
|
||||
void resetOldPositions();
|
||||
|
@ -163,7 +163,7 @@ void WorkspacePanel::adjustActiveViewBounds()
|
||||
gfx::Rect rc = getChildrenBounds();
|
||||
|
||||
// Preview to drop tabs in workspace
|
||||
if (animation() == ANI_DROPAREA) {
|
||||
if (m_leftTime+m_topTime+m_rightTime+m_bottomTime > 1e-4) {
|
||||
double left = double(m_leftTime) / double(ANI_DROPAREA_TICKS);
|
||||
double top = double(m_topTime) / double(ANI_DROPAREA_TICKS);
|
||||
double right = double(m_rightTime) / double(ANI_DROPAREA_TICKS);
|
||||
@ -198,9 +198,9 @@ void WorkspacePanel::removeDropViewPreview()
|
||||
}
|
||||
}
|
||||
|
||||
void WorkspacePanel::onAnimationStop()
|
||||
void WorkspacePanel::onAnimationStop(int animation)
|
||||
{
|
||||
if (animation() == ANI_DROPAREA)
|
||||
if (animation == ANI_DROPAREA)
|
||||
layout();
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace app {
|
||||
void onPaint(ui::PaintEvent& ev) override;
|
||||
void onResize(ui::ResizeEvent& ev) override;
|
||||
void onAnimationFrame() override;
|
||||
void onAnimationStop() override;
|
||||
void onAnimationStop(int animation) override;
|
||||
|
||||
private:
|
||||
int calculateDropArea(const gfx::Point& pos) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user