timeline hierarchical length signalling

This commit is contained in:
itsmattkc
2019-10-07 02:33:52 +11:00
parent f34eb0dfb6
commit 31f11cd87d
17 changed files with 215 additions and 188 deletions
+11
View File
@@ -39,6 +39,11 @@ void TimelineView::ZoomTool::MouseRelease(QMouseEvent *event)
{
double scale = parent()->scale_;
QPointF center_location = parent()->mapToScene(event->pos());
// Normalize zoom location for 1.0 scale
double scaled_x = center_location.x() / scale;
if (event->modifiers() & Qt::AltModifier) {
// Zoom out if the user clicks while holding Alt
scale *= 0.5;
@@ -49,4 +54,10 @@ void TimelineView::ZoomTool::MouseRelease(QMouseEvent *event)
parent()->SetScale(scale);
emit parent()->ScaleChanged(scale);
// Adjust zoom location for new scale
scaled_x *= scale;
center_location.setX(scaled_x);
parent()->centerOn(center_location);
}