Mercurial > fife-parpg
changeset 315:21999e058c7b
Made panels only try to dock when the window has moved
author | cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 14 Aug 2009 22:15:47 +0000 |
parents | 62d1eebd1487 |
children | 6add14ebe9f5 |
files | clients/editor/scripts/gui/panel.py |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)