From a58c03690c67ece67c6486cd78fb7a3a44a06b9c Mon Sep 17 00:00:00 2001 From: LoudSnorer Date: Wed, 15 Mar 2023 11:56:34 -0400 Subject: [PATCH] MouseRelease with ShiftModifer will zoom to 3 minutes before to 20 seconds after the mouse. --- oscar/Graphs/gGraph.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/oscar/Graphs/gGraph.cpp b/oscar/Graphs/gGraph.cpp index 2e79d789..8f550434 100644 --- a/oscar/Graphs/gGraph.cpp +++ b/oscar/Graphs/gGraph.cpp @@ -833,6 +833,7 @@ double gGraph::currentTime() const { return m_graphview->currentTime(); } + double gGraph::screenToTime(int xpos) { double w = m_rect.width() - left - right; @@ -1010,18 +1011,6 @@ void gGraph::mousePressEvent(QMouseEvent *event) return; } } - - /* - int w=m_lastbounds.width()-(right+m_marginright); - //int h=m_lastbounds.height()-(bottom+m_marginbottom); - //int x2,y2; - double xx=max_x-min_x; - //double xmult=xx/w; - if (x>left+m_marginleft && xtop+m_margintop && yhorizTravel() < mouse_movement_threshold) && (x > left && x < w + left && y > top && y < h)) { + if ((event->modifiers() & Qt::ShiftModifier) != 0) { + qint64 zz = (qint64)screenToTime(x); + qint64 zz_min,zz_max; + // set range 3 before and 20 second after. + zz_min = zz - 180000; // before ms + zz_max = zz + 20000; // after ms + m_graphview->SetXBounds(zz_min, zz_max, m_group); + return; + } // normal click in main area if (!m_blockzoom) { double zoom;