mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +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();
|
||||
setBoundsQuietly(rc);
|
||||
setSeparatorX(m_separator_x);
|
||||
|
||||
gfx::Size sz = m_aniControls.sizeHint();
|
||||
m_aniControls.setBounds(
|
||||
gfx::Rect(
|
||||
rc.x,
|
||||
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()));
|
||||
|
||||
setSeparatorX(m_separator_x);
|
||||
updateScrollBars();
|
||||
}
|
||||
|
||||
@ -2964,6 +2965,8 @@ void Timeline::regenerateRows()
|
||||
|
||||
void Timeline::regenerateTagBands()
|
||||
{
|
||||
const bool oldEmptyTagBand = m_tagBand.empty();
|
||||
|
||||
// TODO improve this implementation
|
||||
std::vector<unsigned char> tagsPerFrame(m_sprite->totalFrames(), 0);
|
||||
std::vector<Tag*> bands(4, nullptr);
|
||||
@ -3001,8 +3004,13 @@ void Timeline::regenerateTagBands()
|
||||
if (m_tagFocusBand >= m_tagBands)
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
int Timeline::visibleTagBands() const
|
||||
|
Loading…
Reference in New Issue
Block a user