From efc8c7bbfaf5ece767aa527f078674cd430d86e7 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Sun, 8 Jun 2008 12:27:23 +0000 Subject: [PATCH] Fixed graph for real git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1104 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/gui/widgets/graph.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/graph.cpp b/src/gui/widgets/graph.cpp index e58c9f6fc..6adba3d77 100644 --- a/src/gui/widgets/graph.cpp +++ b/src/gui/widgets/graph.cpp @@ -116,7 +116,7 @@ void graph::mouseMoveEvent ( QMouseEvent * _me ) // avoid mouse leaps int diff = x - m_lastCursorX; - + if( diff >= 1 ) { x = min( width() - 2, m_lastCursorX + 1); @@ -130,18 +130,19 @@ void graph::mouseMoveEvent ( QMouseEvent * _me ) x = m_lastCursorX; } - printf("%d %d %d %d\n", height(), skip, x, y); - y = max( 2, min( y, height()-3 ) ); changeSampleAt( x, y ); // update mouse - m_lastCursorX = x; + if( diff != 0 ) + { + m_lastCursorX = x; - QPoint pt = mapToGlobal( QPoint( x, y ) ); + QPoint pt = mapToGlobal( QPoint( x, y ) ); - QCursor::setPos( pt.x(), pt.y() ); + QCursor::setPos( pt.x(), pt.y() ); + } skip = true; } @@ -192,8 +193,6 @@ void graph::changeSampleAt(int _x, int _y) float range = minVal - maxVal; float val = ( _y*range/( height()-4 ) ) + maxVal; - printf("%d, (%d*%f/( %d-4 ) ) + %f \n", _x, _y, range, height(), maxVal ); - model()->setSampleAt( (int)( _x*xscale ), val ); }