X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b2f6eb0606be607c176121ad4ae272e3112f44eb..3d2d9036037d9ee51f47d878c3dcef4af4a6ef41:/wxPython/wx/lib/ogl/_canvas.py diff --git a/wxPython/wx/lib/ogl/_canvas.py b/wxPython/wx/lib/ogl/_canvas.py index 105cfa22ab..00c22ab782 100644 --- a/wxPython/wx/lib/ogl/_canvas.py +++ b/wxPython/wx/lib/ogl/_canvas.py @@ -11,8 +11,6 @@ # Licence: wxWindows license #---------------------------------------------------------------------------- -from __future__ import division - import wx from _lines import LineShape from _composit import * @@ -31,13 +29,13 @@ def WhollyContains(contains, contained): w1, h1 = contains.GetBoundingBoxMax() w2, h2 = contained.GetBoundingBoxMax() - left1 = xp1-w1 / 2.0 - top1 = yp1-h1 / 2.0 + left1 = xp1 - w1 / 2.0 + top1 = yp1 - h1 / 2.0 right1 = xp1 + w1 / 2.0 bottom1 = yp1 + h1 / 2.0 - left2 = xp2-w2 / 2.0 - top2 = yp2-h2 / 2.0 + left2 = xp2 - w2 / 2.0 + top2 = yp2 - h2 / 2.0 right2 = xp2 + w2 / 2.0 bottom2 = yp2 + h2 / 2.0 @@ -46,7 +44,7 @@ def WhollyContains(contains, contained): class ShapeCanvas(wx.ScrolledWindow): - def __init__(self, parent = None, id=-1, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.BORDER, name="ShapeCanvas"): + def __init__(self, parent = None, id = -1, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.BORDER, name = "ShapeCanvas"): wx.ScrolledWindow.__init__(self, parent, id, pos, size, style, name) self._shapeDiagram = None @@ -95,10 +93,13 @@ class ShapeCanvas(wx.ScrolledWindow): # If we're very close to the position we started dragging # from, this may not be an intentional drag at all. if dragging: - dx = abs(dc.LogicalToDeviceX(x-self._firstDragX)) - dy = abs(dc.LogicalToDeviceY(y-self._firstDragY)) - if self._checkTolerance and (dx <= self.GetDiagram().GetMouseTolerance()) and (dy <= self.GetDiagram().GetMouseTolerance()): - return + if self._checkTolerance: + # the difference between two logical coordinates is a logical coordinate + dx = abs(x - self._firstDragX) + dy = abs(y - self._firstDragY) + toler = self.GetDiagram().GetMouseTolerance() + if (dx <= toler) and (dy <= toler): + return # If we've ignored the tolerance once, then ALWAYS ignore # tolerance in this drag, even if we come back within # the tolerance range. @@ -125,7 +126,7 @@ class ShapeCanvas(wx.ScrolledWindow): self._draggedShape.GetEventHandler().OnDragLeft(True, x, y, keys, self._draggedAttachment) self._oldDragX, self._oldDragY = x, y - elif evt.LeftUp and self._draggedShape and self._dragState == ContinueDraggingLeft: + elif evt.LeftUp() and self._draggedShape and self._dragState == ContinueDraggingLeft: self._dragState = NoDragging self._checkTolerance = True @@ -270,7 +271,9 @@ class ShapeCanvas(wx.ScrolledWindow): # the other objects # (b) to find the control points FIRST if they exist - for object in self.GetDiagram().GetShapeList()[::-1]: + rl = self.GetDiagram().GetShapeList()[:] + rl.reverse() + for object in rl: # First pass for lines, which might be inside a container, so we # want lines to take priority over containers. This first loop # could fail if we clickout side a line, so then we'll @@ -288,12 +291,12 @@ class ShapeCanvas(wx.ScrolledWindow): # to specify the nearest point to the centre of the line # as our hit criterion, to give the user some room for # manouevre. - if dist