From: Robin Dunn Date: Wed, 10 Nov 2004 18:14:45 +0000 (+0000) Subject: OGL patch from Shane Holloway: X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ca8071ca9ffe47beab63b5a0070ccd463ed00dd1 OGL patch from Shane Holloway: Two simple problems found in the new python ogl code. First is the patch for _canvas.py. Essentially: dx = abs(dc.LogicalToDeviceX(x - self._firstDragX)) dy = abs(dc.LogicalToDeviceY(y - self._firstDragY)) was incorrect because (x,y) and (self._firstDragX, self._firstDragY) are both already in Logical coordinates. Therefore the difference between the two is also in logical coordinates, and the conversion call is an error. This bug surfaces when you have OGL on a scrollwin, and you are far from the origin of the canvas. The second change in _composit.py basically removes the assumption that the child is in both self._children and self._divisions. Causes many problems when it's not. ;) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/docs/CHANGES.txt b/wxPython/docs/CHANGES.txt index 41c070fa35..c91b8b2016 100644 --- a/wxPython/docs/CHANGES.txt +++ b/wxPython/docs/CHANGES.txt @@ -1,6 +1,33 @@ Recent Changes for wxPython ===================================================================== + +2.5.3.2 +------- + +OGL patch from Shane Holloway: + + Two simple problems found in the new python ogl code. First is + the patch for _canvas.py. Essentially: + + dx = abs(dc.LogicalToDeviceX(x - self._firstDragX)) + dy = abs(dc.LogicalToDeviceY(y - self._firstDragY)) + + was incorrect because (x,y) and (self._firstDragX, + self._firstDragY) are both already in Logical coordinates. + Therefore the difference between the two is also in logical + coordinates, and the conversion call is an error. This bug + surfaces when you have OGL on a scrollwin, and you are far from + the origin of the canvas. + + The second change in _composit.py basically removes the assumption + that the child is in both self._children and self._divisions. + Causes many problems when it's not. ;) + + + + + 2.5.3.1 ------- diff --git a/wxPython/wx/lib/ogl/_canvas.py b/wxPython/wx/lib/ogl/_canvas.py index f5f75a1457..00c22ab782 100644 --- a/wxPython/wx/lib/ogl/_canvas.py +++ b/wxPython/wx/lib/ogl/_canvas.py @@ -93,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. diff --git a/wxPython/wx/lib/ogl/_composit.py b/wxPython/wx/lib/ogl/_composit.py index fba79f3b73..d6913abc42 100644 --- a/wxPython/wx/lib/ogl/_composit.py +++ b/wxPython/wx/lib/ogl/_composit.py @@ -552,8 +552,10 @@ class CompositeShape(RectangleShape): """Removes the child from the composite and any constraint relationships, but does not delete the child. """ - self._children.remove(child) - self._divisions.remove(child) + if child in self._children: + self._children.remove(child) + if child in self._divisions: + self._divisions.remove(child) self.RemoveChildFromConstraints(child) child.SetParent(None)