--- a/graphics/GraphicCommons.py Wed Jan 30 09:52:57 2008 +0100
+++ b/graphics/GraphicCommons.py Wed Jan 30 18:48:05 2008 +0100
@@ -488,7 +488,7 @@
self.Dragging = True
# If a dragging have been initiated, refreshes the element state
if self.Dragging:
- dragx, dragy = self.ProcessDragging(movex, movey, scaling)
+ dragx, dragy = self.ProcessDragging(movex, movey, event.ShiftDown(), scaling)
self.oldPos.x += dragx
self.oldPos.y += dragy
return dragx, dragy
@@ -518,7 +518,7 @@
self.SetSize(width, height)
# Refreshes the element state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, scaling):
+ def ProcessDragging(self, movex, movey, centered, scaling):
handle_type, handle = self.Handle
# If it is a resize handle, calculate the values from resizing
if handle_type == HANDLE_RESIZE:
@@ -529,21 +529,35 @@
if scaling is not None:
movex = round(float(self.Pos.x + movex) / float(scaling[0])) * scaling[0] - self.Pos.x
x = movex
- width -= movex
+ if centered:
+ width -= 2 * movex
+ else:
+ width -= movex
elif handle[0] == 3:
if scaling is not None:
movex = round(float(self.Pos.x + width + movex) / float(scaling[0])) * scaling[0] - self.Pos.x - width
- width += movex
+ if centered:
+ x = -movex
+ width += 2 * movex
+ else:
+ width += movex
if handle[1] == 1:
movey = max(-self.BoundingBox.y, movey)
if scaling is not None:
movey = round(float(self.Pos.y + movey) / float(scaling[1])) * scaling[1] - self.Pos.y
y = movey
- height -= movey
+ if centered:
+ height -= 2 * movey
+ else:
+ height -= movey
elif handle[1] == 3:
if scaling is not None:
movey = round(float(self.Pos.y + height + movey) / float(scaling[1])) * scaling[1] - self.Pos.y - height
- height += movey
+ if centered:
+ y = -movey
+ height += 2 * movey
+ else:
+ height += movey
# Verify that new size is not lesser than minimum
min_width, min_height = self.GetMinSize()
if handle[0] != 2 and (width >= min_width or width > self.Size[0]):
@@ -1912,7 +1926,7 @@
return Graphic_Element.OnMotion(self, event, dc, scaling)
# Refreshes the wire state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, scaling):
+ def ProcessDragging(self, movex, movey, centered, scaling):
handle_type, handle = self.Handle
# A point has been handled
if handle_type == HANDLE_POINT:
@@ -1964,7 +1978,7 @@
return self.MoveSegment(handle[0], movex, movey, scaling)
# Execute the default method for a graphic element
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, scaling)
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
# Refreshes the wire model
def RefreshModel(self, move=True):