diff main/OSCHandler.cpp @ 2011:b184e71f880d zoom

ZoomLevel fixes
author Chris Cannam
date Thu, 20 Sep 2018 11:45:55 +0100
parents 893f556cd5c9
children 0b15f3b16776
line wrap: on
line diff
--- 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);
+                }
             }
         }