Fixed bug when scroll in and out using wheel mouse in graph, range of data displayed could be out of bounds of whole data stored range
authorLaurent Bessard
Mon, 03 Jun 2013 11:52:13 +0200
changeset 1213 599e43ec921b
parent 1212 b351d3a7917c
child 1214 2ef048b5383c
Fixed bug when scroll in and out using wheel mouse in graph, range of data displayed could be out of bounds of whole data stored range
controls/DebugVariablePanel/DebugVariableGraphicPanel.py
--- a/controls/DebugVariablePanel/DebugVariableGraphicPanel.py	Mon Jun 03 11:11:46 2013 +0200
+++ b/controls/DebugVariablePanel/DebugVariableGraphicPanel.py	Mon Jun 03 11:52:13 2013 +0200
@@ -507,9 +507,10 @@
             if len(self.Ticks) > 0:
                 if tick is None:
                     tick = self.StartTick + self.CurrentRange / 2.
-                new_start_tick = tick - (tick - self.StartTick) * self.CurrentRange / current_range 
+                new_start_tick = min(tick - (tick - self.StartTick) * self.CurrentRange / current_range,
+                                     self.Ticks[-1] - self.CurrentRange)
                 self.StartTick = self.Ticks[numpy.argmin(numpy.abs(self.Ticks - new_start_tick))]
-                self.Fixed = self.StartTick < self.Ticks[-1] - self.CurrentRange
+                self.Fixed = new_start_tick < self.Ticks[-1] - self.CurrentRange
             self.ForceRefresh()
     
     def RefreshRange(self):