# HG changeset patch # User cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1250288147 0 # Node ID 21999e058c7b7950dd4067c66ef7af89d1bd7bcc # Parent 62d1eebd1487f9736a637b0e25a43e2b15b49df9 Made panels only try to dock when the window has moved diff -r 62d1eebd1487 -r 21999e058c7b clients/editor/scripts/gui/panel.py --- a/clients/editor/scripts/gui/panel.py Fri Aug 14 21:40:38 2009 +0000 +++ b/clients/editor/scripts/gui/panel.py Fri Aug 14 22:15:47 2009 +0000 @@ -22,6 +22,8 @@ self._editor = scripts.editor.getEditor() + self._panel_startPos = (0, 0) + def setDocked(self, docked): """ Dock or undock the panel @@ -89,6 +91,8 @@ def mousePressed(self, event): if self.resizable is False: return + + self._panel_startPos = (self.x, self.y) ResizableBase.mousePressed(self, event) if self._rLeft or self._rRight or self._rTop or self._rBottom: @@ -96,23 +100,30 @@ self.real_widget.setMovable(False) # Don't let guichan move window while we resize def mouseDragged(self, event): + self._dragging = True if self._resize is False and self.isDocked() is False: + if (self.x, self.y) == self._panel_startPos: + return mouseX = self.x+event.getX() mouseY = self.y+event.getY() self._editor.getDockAreaAt(mouseX, mouseY, True) else: ResizableBase.mouseDragged(self, event) - def mouseReleased(self, event): + def mouseReleased(self, event): + didMove = False + if (self.x, self.y) != self._panel_startPos: + didMove = True + # Resize/move done self.real_widget.setMovable(self._movable) if self._resize: ResizableBase.mouseReleased(self, event) - elif self._movable: + elif self._movable and didMove: mouseX = self.x+event.getX() mouseY = self.y+event.getY() - + dockArea = self._editor.getDockAreaAt(mouseX, mouseY) if dockArea is not None: self._editor.dockWidgetTo(self, dockArea, mouseX, mouseY)