mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-25 03:02:31 +00:00
Give more space to AniControls if there aren't tags to display in the Timeline
This commit is contained in:
parent
7170762f08
commit
3bba9d05da
@ -1523,16 +1523,17 @@ void Timeline::onResize(ui::ResizeEvent& ev)
|
|||||||
{
|
{
|
||||||
gfx::Rect rc = ev.bounds();
|
gfx::Rect rc = ev.bounds();
|
||||||
setBoundsQuietly(rc);
|
setBoundsQuietly(rc);
|
||||||
|
setSeparatorX(m_separator_x);
|
||||||
|
|
||||||
gfx::Size sz = m_aniControls.sizeHint();
|
gfx::Size sz = m_aniControls.sizeHint();
|
||||||
m_aniControls.setBounds(
|
m_aniControls.setBounds(
|
||||||
gfx::Rect(
|
gfx::Rect(
|
||||||
rc.x,
|
rc.x,
|
||||||
rc.y+(visibleTagBands()-1)*oneTagHeight(),
|
rc.y+(visibleTagBands()-1)*oneTagHeight(),
|
||||||
std::min(sz.w, m_separator_x),
|
(!m_sprite || m_sprite->tags().empty() ? std::min(sz.w, rc.w):
|
||||||
|
std::min(sz.w, m_separator_x)),
|
||||||
oneTagHeight()));
|
oneTagHeight()));
|
||||||
|
|
||||||
setSeparatorX(m_separator_x);
|
|
||||||
updateScrollBars();
|
updateScrollBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2964,6 +2965,8 @@ void Timeline::regenerateRows()
|
|||||||
|
|
||||||
void Timeline::regenerateTagBands()
|
void Timeline::regenerateTagBands()
|
||||||
{
|
{
|
||||||
|
const bool oldEmptyTagBand = m_tagBand.empty();
|
||||||
|
|
||||||
// TODO improve this implementation
|
// TODO improve this implementation
|
||||||
std::vector<unsigned char> tagsPerFrame(m_sprite->totalFrames(), 0);
|
std::vector<unsigned char> tagsPerFrame(m_sprite->totalFrames(), 0);
|
||||||
std::vector<Tag*> bands(4, nullptr);
|
std::vector<Tag*> bands(4, nullptr);
|
||||||
@ -3001,8 +3004,13 @@ void Timeline::regenerateTagBands()
|
|||||||
if (m_tagFocusBand >= m_tagBands)
|
if (m_tagFocusBand >= m_tagBands)
|
||||||
m_tagFocusBand = -1;
|
m_tagFocusBand = -1;
|
||||||
|
|
||||||
if (oldVisibleBands != visibleTagBands())
|
if (oldVisibleBands != visibleTagBands() ||
|
||||||
|
// This case is to re-layout the timeline when the AniControl
|
||||||
|
// can use more/less space because there weren't tags and now
|
||||||
|
// there tags, or viceversa.
|
||||||
|
oldEmptyTagBand != m_tagBand.empty()) {
|
||||||
layout();
|
layout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Timeline::visibleTagBands() const
|
int Timeline::visibleTagBands() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user