diff --git a/Graphs/gGraphView.cpp b/Graphs/gGraphView.cpp index 40a5a1c1..343dd90d 100644 --- a/Graphs/gGraphView.cpp +++ b/Graphs/gGraphView.cpp @@ -330,7 +330,7 @@ void gGraph::mouseMoveEvent(QMouseEvent * event) if (a1w) a2=w; m_selecting_area=true; - m_selection=QRect(a1-m_marginleft,0,a2-a1,m_height); + m_selection=QRect(a1-m_marginleft-1,0,a2-a1,m_height); m_graphview->updateGL(); } else if (event->buttons() & Qt::RightButton) { m_graphview->setPointClicked(event->pos()); @@ -434,7 +434,9 @@ void gGraph::mouseReleaseEvent(QMouseEvent * event) x2-=left+m_marginleft; y2-=top+m_margintop; if (x<0) x=0; + if (x2<0) x2=0; if (x>w) x=w; + if (x2>w) x2=w; if (!m_blockzoom) { double xx=max_x-min_x; double xmult=xx/double(w); @@ -442,6 +444,7 @@ void gGraph::mouseReleaseEvent(QMouseEvent * event) qint64 j2=min_x+xmult*x2; qint64 a1=MIN(j1,j2) qint64 a2=MAX(j1,j2) + //if (a1rmax_x) a2=rmax_x; m_graphview->SetXBounds(a1,a2,m_group); } else { @@ -451,6 +454,7 @@ void gGraph::mouseReleaseEvent(QMouseEvent * event) qint64 j2=rmin_x+xmult*x2; qint64 a1=MIN(j1,j2) qint64 a2=MAX(j1,j2) + //if (a1rmax_x) a2=rmax_x; m_graphview->SetXBounds(a1,a2,m_group); } @@ -788,10 +792,10 @@ void gGraphView::scrollbarValueChanged(int val) updateGL(); // do this on a timer? } } -void gGraphView::ResetBounds(short group) +void gGraphView::ResetBounds() //short group) { for (int i=0;igroup()==group) + //if (m_graphs[i]->group()==group) m_graphs[i]->ResetBounds(); } updateScale(); diff --git a/Graphs/gGraphView.h b/Graphs/gGraphView.h index e386882e..015d3da4 100644 --- a/Graphs/gGraphView.h +++ b/Graphs/gGraphView.h @@ -213,7 +213,7 @@ public: float scaleY() { return m_scaleY; } - void ResetBounds(short group=0); + void ResetBounds(); //short group=0); void SetXBounds(qint64 minx, qint64 maxx, short group=0); bool hasGraphs() { return m_graphs.size()>0; } diff --git a/daily.cpp b/daily.cpp index 72fb9231..f3603171 100644 --- a/daily.cpp +++ b/daily.cpp @@ -773,6 +773,7 @@ void Daily::Load(QDate date) UpdateEventsTree(ui->treeWidget,cpap); GraphView->ResetBounds(); + //GraphView->ResetBounds(1); GraphView->updateGL(); if (!cpap && !oxi) {