changeset 2011:b184e71f880d zoom

ZoomLevel fixes
author Chris Cannam
date Thu, 20 Sep 2018 11:45:55 +0100 (2018-09-20)
parents b1e091bb126c
children 9a9eb3727eb7
files main/MainWindow.cpp main/OSCHandler.cpp repoint-lock.json
diffstat 3 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Thu Sep 20 10:46:01 2018 +0100
+++ b/main/MainWindow.cpp	Thu Sep 20 11:45:55 2018 +0100
@@ -3866,7 +3866,7 @@
     if (configuration.layer == LayerFactory::Spectrum) {
         pane->setPlaybackFollow(PlaybackScrollContinuous);
         pane->setFollowGlobalZoom(false);
-        pane->setZoomLevel(512);
+        pane->setZoomLevel(ZoomLevel(ZoomLevel::FramesPerPixel, 512));
     }
 
     if (configuration.layer != LayerFactory::TimeRuler &&
--- a/main/OSCHandler.cpp	Thu Sep 20 10:46:01 2018 +0100
+++ b/main/OSCHandler.cpp	Thu Sep 20 11:45:55 2018 +0100
@@ -497,8 +497,17 @@
             } else if (message.getArg(0).canConvert(QVariant::Double)) {
                 double level = message.getArg(0).toDouble();
                 Pane *currentPane = m_paneStack->getCurrentPane();
-                if (level < 1.0) level = 1.0;
-                if (currentPane) currentPane->setZoomLevel(int(lrint(level)));
+                ZoomLevel zoomLevel;
+                if (level >= 0.66) {
+                    zoomLevel = ZoomLevel(ZoomLevel::FramesPerPixel,
+                                          int(round(level)));
+                } else {
+                    zoomLevel = ZoomLevel(ZoomLevel::PixelsPerFrame,
+                                          int(round(1.0 / level)));
+                }
+                if (currentPane) {
+                    currentPane->setZoomLevel(zoomLevel);
+                }
             }
         }
 
--- a/repoint-lock.json	Thu Sep 20 10:46:01 2018 +0100
+++ b/repoint-lock.json	Thu Sep 20 11:45:55 2018 +0100
@@ -4,13 +4,13 @@
       "pin": "da86fb0bccb3"
     },
     "svcore": {
-      "pin": "53073777e591"
+      "pin": "8f9e9cff141d"
     },
     "svgui": {
-      "pin": "97c68bffbda6"
+      "pin": "646e713a4632"
     },
     "svapp": {
-      "pin": "9e15607531b2"
+      "pin": "15a566f26114"
     },
     "checker": {
       "pin": "2e8a5f665a07"