updating scroll and overlay on timeline zoom

This commit is contained in:
Carlo "zED" Caputo 2016-10-09 16:02:51 -03:00
parent f0093a2d57
commit 1d53536709
2 changed files with 16 additions and 14 deletions

View File

@ -147,9 +147,6 @@ Timeline::Timeline()
, m_offset_count(0)
, m_scroll(false)
, m_fromTimeline(false)
, m_thumbnailsOverlayVisible(false)
, m_thumbnailsOverlayDirection(int(frameBoxWidth()*1.0),
int(frameBoxWidth()*0.5))
{
enableFlags(CTRL_RIGHT_CLICK);
@ -183,19 +180,26 @@ Timeline::~Timeline()
void Timeline::setZoom(double zoom)
{
m_zoom = MID(1.0, zoom, 10.0);
m_thumbnailsOverlayDirection = gfx::Point(int(frameBoxWidth()*1.0), int(frameBoxWidth()*0.5));
m_thumbnailsOverlayVisible = false;
}
void Timeline::setZoomAndSavePref(double zoom)
void Timeline::setZoomAndUpdate(double zoom)
{
if (zoom != m_zoom) {
setZoom(zoom);
updateScrollBars();
setViewScroll(viewScroll());
invalidate();
}
if (zoom != docPref().thumbnails.zoom()) {
docPref().thumbnails.zoom(zoom);
}
}
void Timeline::onThumbnailsPrefChange()
{
setZoom(docPref().thumbnails.zoom());
m_thumbnailsOverlayDirection = gfx::Point(int(frameBoxWidth()*1.0), int(frameBoxWidth()*0.5));
invalidate();
setZoomAndUpdate(docPref().thumbnails.zoom());
}
void Timeline::updateUsingEditor(Editor* editor)
@ -1071,8 +1075,7 @@ bool Timeline::onProcessMessage(Message* msg)
if (msg->altPressed()) {
double next_zoom = m_zoom + (dz < 0 ? -1 : 1);
setZoomAndSavePref(next_zoom);
invalidate();
setZoomAndUpdate(next_zoom);
}
else {
if (msg->ctrlPressed())
@ -1098,8 +1101,7 @@ bool Timeline::onProcessMessage(Message* msg)
break;
case kTouchMagnifyMessage:
setZoomAndSavePref(m_zoom + m_zoom * static_cast<ui::TouchMessage*>(msg)->magnification());
invalidate();
setZoomAndUpdate(m_zoom + m_zoom * static_cast<ui::TouchMessage*>(msg)->magnification());
break;
}

View File

@ -311,7 +311,7 @@ namespace app {
void drawCelOverlay(ui::Graphics* g);
void onThumbnailsPrefChange();
void setZoom(double zoom);
void setZoomAndSavePref(double zoom);
void setZoomAndUpdate(double zoom);
ui::ScrollBar m_hbar;
ui::ScrollBar m_vbar;