330 self.SetSize(width, height) |
330 self.SetSize(width, height) |
331 else: |
331 else: |
332 self.SetSize(LD_POWERRAIL_WIDTH, height) |
332 self.SetSize(LD_POWERRAIL_WIDTH, height) |
333 |
333 |
334 # Refreshes the powerrail state according to move defined and handle selected |
334 # Refreshes the powerrail state according to move defined and handle selected |
335 def ProcessDragging(self, movex, movey, centered, scaling): |
335 def ProcessDragging(self, movex, movey, event, scaling): |
336 handle_type, handle = self.Handle |
336 handle_type, handle = self.Handle |
337 # A connector has been handled |
337 # A connector has been handled |
338 if handle_type == HANDLE_CONNECTOR: |
338 if handle_type == HANDLE_CONNECTOR: |
339 movey = max(-self.BoundingBox.y, movey) |
339 movey = max(-self.BoundingBox.y, movey) |
340 if scaling is not None: |
340 if scaling is not None: |
341 position = handle.GetRelPosition() |
341 position = handle.GetRelPosition() |
342 movey = round(float(self.Pos.y + position.y + movey) / float(scaling[1])) * scaling[1] - self.Pos.y - position.y |
342 movey = round(float(self.Pos.y + position.y + movey) / float(scaling[1])) * scaling[1] - self.Pos.y - position.y |
343 self.MoveConnector(handle, movey) |
343 self.MoveConnector(handle, movey) |
344 return 0, movey |
344 return 0, movey |
345 else: |
345 else: |
346 return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling) |
346 return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling) |
347 |
347 |
348 # Refreshes the power rail model |
348 # Refreshes the power rail model |
349 def RefreshModel(self, move=True): |
349 def RefreshModel(self, move=True): |
350 self.Parent.RefreshPowerRailModel(self) |
350 self.Parent.RefreshPowerRailModel(self) |
351 # If power rail has moved and power rail is of type LEFT, refresh the model |
351 # If power rail has moved and power rail is of type LEFT, refresh the model |
459 rect = rect.Union(self.Input.GetConnectedRedrawRect(movex, movey)) |
459 rect = rect.Union(self.Input.GetConnectedRedrawRect(movex, movey)) |
460 if self.Output.IsConnected(): |
460 if self.Output.IsConnected(): |
461 rect = rect.Union(self.Output.GetConnectedRedrawRect(movex, movey)) |
461 rect = rect.Union(self.Output.GetConnectedRedrawRect(movex, movey)) |
462 return rect |
462 return rect |
463 |
463 |
464 def ProcessDragging(self, movex, movey, centered, scaling): |
464 def ProcessDragging(self, movex, movey, event, scaling): |
465 return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling, height_fac = 2) |
465 return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling, height_fac = 2) |
466 |
466 |
467 # Forbids to change the contact size |
467 # Forbids to change the contact size |
468 def SetSize(self, width, height): |
468 def SetSize(self, width, height): |
469 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
469 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
744 rect = rect.Union(self.Input.GetConnectedRedrawRect(movex, movey)) |
744 rect = rect.Union(self.Input.GetConnectedRedrawRect(movex, movey)) |
745 if self.Output.IsConnected(): |
745 if self.Output.IsConnected(): |
746 rect = rect.Union(self.Output.GetConnectedRedrawRect(movex, movey)) |
746 rect = rect.Union(self.Output.GetConnectedRedrawRect(movex, movey)) |
747 return rect |
747 return rect |
748 |
748 |
749 def ProcessDragging(self, movex, movey, centered, scaling): |
749 def ProcessDragging(self, movex, movey, event, scaling): |
750 return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling, height_fac = 2) |
750 return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, height_fac = 2) |
751 |
751 |
752 # Forbids to change the Coil size |
752 # Forbids to change the Coil size |
753 def SetSize(self, width, height): |
753 def SetSize(self, width, height): |
754 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
754 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
755 Graphic_Element.SetSize(self, width, height) |
755 Graphic_Element.SetSize(self, width, height) |