diff view/Pane.cpp @ 1505:1819978526f9

Debug changes
author Chris Cannam
date Fri, 13 Sep 2019 17:26:11 +0100
parents 175770a13495
children bfacecf7ea7e
line wrap: on
line diff
--- a/view/Pane.cpp	Thu Sep 12 13:50:24 2019 +0100
+++ b/view/Pane.cpp	Fri Sep 13 17:26:11 2019 +0100
@@ -1485,7 +1485,9 @@
         return;
     }
 
-//    cerr << "mouseReleaseEvent" << endl;
+#ifdef DEBUG_PANE
+    SVCERR << "Pane[" << getId() << "]::mouseReleaseEvent" << endl;
+#endif
 
     ViewManager::ToolMode mode = ViewManager::NavigateMode;
     if (m_manager) mode = m_manager->getToolModeFor(this);
@@ -1980,9 +1982,11 @@
     if (m_dragMode == HorizontalDrag ||
         m_dragMode == FreeDrag) {
 
-        sv_frame_t frameOff = getFrameForX(e->x()) - getFrameForX(m_clickPos.x());
+        sv_frame_t fromFrame = getFrameForX(m_clickPos.x());
+        sv_frame_t toFrame = getFrameForX(e->x());
+        sv_frame_t frameOff = toFrame - fromFrame;
+
         sv_frame_t newCentreFrame = m_dragCentreFrame;
-        
         if (frameOff < 0) {
             newCentreFrame -= frameOff;
         } else if (newCentreFrame >= frameOff) {
@@ -1991,9 +1995,15 @@
             newCentreFrame = 0;
         }
 
-#ifdef DEBUG_PANE       
-        SVDEBUG << "Pane::dragTopLayer: newCentreFrame = " << newCentreFrame <<
-            ", models end frame = " << getModelsEndFrame() << endl;
+#ifdef DEBUG_PANE
+        SVDEBUG << "Pane::dragTopLayer: dragged from x = "
+                << m_clickPos.x() << " to " << e->x()
+                << ", from frame = " << fromFrame
+                << " to " << toFrame
+                << ", for frame offset of " << frameOff << endl;
+        SVDEBUG << "Pane::dragTopLayer: newCentreFrame = " << newCentreFrame
+                << ", dragCentreFrame = " << m_dragCentreFrame
+                << ", models end frame = " << getModelsEndFrame() << endl;
 #endif
 
         if (newCentreFrame >= getModelsEndFrame()) {