- pt = evt.GetPosition()
- newPos = wxPoint(self.dragShape.pos.x + (pt.x - self.dragStartPos.x),
- self.dragShape.pos.y + (pt.y - self.dragStartPos.y))
- if self.dragShape.fullscreen:
- newPos = self.ClientToScreen(newPos)
-
- self.dragImage.Move(newPos)
+ onShape = self.FindShape(evt.GetPosition())
+ unhiliteOld = false
+ hiliteNew = false
+
+ # figure out what to hilite and what to unhilite
+ if self.hiliteShape:
+ if onShape is None or self.hiliteShape is not onShape:
+ unhiliteOld = true
+
+ if onShape and onShape is not self.hiliteShape and onShape.shown:
+ hiliteNew = TRUE
+
+ # if needed, hide the drag image so we can update the window
+ if unhiliteOld or hiliteNew:
+ self.dragImage.Hide()
+
+ if unhiliteOld:
+ dc = wxClientDC(self)
+ self.hiliteShape.Draw(dc)
+ self.hiliteShape = None
+
+ if hiliteNew:
+ dc = wxClientDC(self)
+ self.hiliteShape = onShape
+ self.hiliteShape.Draw(dc, wxINVERT)
+
+ # now move it and show it again if needed
+ self.dragImage.Move(evt.GetPosition())
+ if unhiliteOld or hiliteNew:
+ self.dragImage.Show()