Timeline: Limit the vertical separator min/max position (fix #2436)

This commit is contained in:
David Capello 2020-06-11 15:30:06 -03:00
parent 5a24a7c6b4
commit 7170762f08
2 changed files with 9 additions and 1 deletions

View File

@ -1064,7 +1064,7 @@ bool Timeline::onProcessMessage(Message* msg)
// we shouldn't change the hot (so the separator can be // we shouldn't change the hot (so the separator can be
// tracked to the mouse's released). // tracked to the mouse's released).
if (m_clk.part == PART_SEPARATOR) { if (m_clk.part == PART_SEPARATOR) {
m_separator_x = std::max(0, mousePos.x); setSeparatorX(mousePos.x);
layout(); layout();
return true; return true;
} }
@ -1532,6 +1532,7 @@ void Timeline::onResize(ui::ResizeEvent& ev)
std::min(sz.w, m_separator_x), std::min(sz.w, m_separator_x),
oneTagHeight())); oneTagHeight()));
setSeparatorX(m_separator_x);
updateScrollBars(); updateScrollBars();
} }
@ -4215,4 +4216,9 @@ void Timeline::setLayerCollapsedFlag(const layer_t l, const bool state)
} }
} }
void Timeline::setSeparatorX(int newValue)
{
m_separator_x = base::clamp(newValue, headerBoxWidth(), bounds().w-guiscale());
}
} // namespace app } // namespace app

View File

@ -357,6 +357,8 @@ namespace app {
void setLayerContinuousFlag(const layer_t layer, const bool state); void setLayerContinuousFlag(const layer_t layer, const bool state);
void setLayerCollapsedFlag(const layer_t layer, const bool state); void setLayerCollapsedFlag(const layer_t layer, const bool state);
void setSeparatorX(int newValue);
ui::ScrollBar m_hbar; ui::ScrollBar m_hbar;
ui::ScrollBar m_vbar; ui::ScrollBar m_vbar;
gfx::Rect m_viewportArea; gfx::Rect m_viewportArea;