Mercurial > hg > sonic-visualiser
comparison main/OSCHandler.cpp @ 2011:b184e71f880d zoom
ZoomLevel fixes
author | Chris Cannam |
---|---|
date | Thu, 20 Sep 2018 11:45:55 +0100 |
parents | 893f556cd5c9 |
children | 0b15f3b16776 |
comparison
equal
deleted
inserted
replaced
2010:b1e091bb126c | 2011:b184e71f880d |
---|---|
495 message.getArg(0).toString() == "fit") { | 495 message.getArg(0).toString() == "fit") { |
496 zoomToFit(); | 496 zoomToFit(); |
497 } else if (message.getArg(0).canConvert(QVariant::Double)) { | 497 } else if (message.getArg(0).canConvert(QVariant::Double)) { |
498 double level = message.getArg(0).toDouble(); | 498 double level = message.getArg(0).toDouble(); |
499 Pane *currentPane = m_paneStack->getCurrentPane(); | 499 Pane *currentPane = m_paneStack->getCurrentPane(); |
500 if (level < 1.0) level = 1.0; | 500 ZoomLevel zoomLevel; |
501 if (currentPane) currentPane->setZoomLevel(int(lrint(level))); | 501 if (level >= 0.66) { |
502 zoomLevel = ZoomLevel(ZoomLevel::FramesPerPixel, | |
503 int(round(level))); | |
504 } else { | |
505 zoomLevel = ZoomLevel(ZoomLevel::PixelsPerFrame, | |
506 int(round(1.0 / level))); | |
507 } | |
508 if (currentPane) { | |
509 currentPane->setZoomLevel(zoomLevel); | |
510 } | |
502 } | 511 } |
503 } | 512 } |
504 | 513 |
505 } else if (message.getMethod() == "zoomvertical") { | 514 } else if (message.getMethod() == "zoomvertical") { |
506 | 515 |