Browse Source

wxGUI/mapswipe: fix tracking cursor in mirror mode

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60325 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 11 years ago
parent
commit
04cce71ca5
1 changed files with 6 additions and 6 deletions
  1. 6 6
      gui/wxpython/mapswipe/frame.py

+ 6 - 6
gui/wxpython/mapswipe/frame.py

@@ -76,6 +76,10 @@ class SwipeMapFrame(DoubleMapFrame):
         self.firstMapWindow.mapQueried.connect(self.Query)
         self.secondMapWindow.mapQueried.connect(self.Query)
 
+        # bind tracking cursosr to mirror it
+        self.firstMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt))
+        self.secondMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt))
+
         self.MapWindow = self.firstMapWindow # current by default
         self.firstMapWindow.zoomhistory = self.secondMapWindow.zoomhistory
         self.SetBindRegions(True)
@@ -114,7 +118,7 @@ class SwipeMapFrame(DoubleMapFrame):
 
         wx.CallAfter(self.CallAfterInit)
 
-    def TrackCursor(self, event, showInFirst):
+    def TrackCursor(self, event):
         """!Track cursor in one window and show cross in the other.
 
         Only for mirror mode.
@@ -123,7 +127,7 @@ class SwipeMapFrame(DoubleMapFrame):
             event.Skip()
             return
         coords = event.GetPosition()
-        if showInFirst:
+        if event.GetId() == self.secondMapWindow.GetId():
             self.firstMapWindow.DrawMouseCursor(coords=coords)
         else:
             self.secondMapWindow.DrawMouseCursor(coords=coords)
@@ -134,8 +138,6 @@ class SwipeMapFrame(DoubleMapFrame):
         """!Switch tracking direction"""
         super(SwipeMapFrame, self).ActivateFirstMap(event)
 
-        self.firstMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt, showInFirst = False))
-        self.secondMapWindow.Unbind(wx.EVT_MOTION)
         self.firstMapWindow.ClearLines()
         self.firstMapWindow.Refresh()
 
@@ -143,8 +145,6 @@ class SwipeMapFrame(DoubleMapFrame):
         """!Switch tracking direction"""
         super(SwipeMapFrame, self).ActivateSecondMap(event)
 
-        self.secondMapWindow.Bind(wx.EVT_MOTION,  lambda evt: self.TrackCursor(evt, showInFirst = True))
-        self.firstMapWindow.Unbind(wx.EVT_MOTION)
         self.secondMapWindow.ClearLines()
         self.secondMapWindow.Refresh()