graphics/SFC_Objects.py
changeset 1846 14b40afccd69
parent 1782 5b6ad7a7fd9d
child 1847 6198190bc121
equal deleted inserted replaced
1845:3abde7651c38 1846:14b40afccd69
   458             movex = max(-self.BoundingBox.x, movex)
   458             movex = max(-self.BoundingBox.x, movex)
   459             movey = max(-self.BoundingBox.y, movey)
   459             movey = max(-self.BoundingBox.y, movey)
   460             if scaling is not None:
   460             if scaling is not None:
   461                 movex = round(float(self.Pos.x + movex) / float(scaling[0])) * scaling[0] - self.Pos.x
   461                 movex = round(float(self.Pos.x + movex) / float(scaling[0])) * scaling[0] - self.Pos.x
   462                 movey = round(float(self.Pos.y + movey) / float(scaling[1])) * scaling[1] - self.Pos.y
   462                 movey = round(float(self.Pos.y + movey) / float(scaling[1])) * scaling[1] - self.Pos.y
   463             action_block = None
       
   464             if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
   463             if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
   465                 self.Move(movex, movey)
   464                 self.Move(movex, movey)
   466                 self.RefreshConnected()
   465                 self.RefreshConnected()
   467                 return movex, movey
   466                 return movex, movey
   468             elif self.Initial:
   467             elif self.Initial:
   855     def GetMinSize(self):
   854     def GetMinSize(self):
   856         return SFC_TRANSITION_SIZE
   855         return SFC_TRANSITION_SIZE
   857 
   856 
   858     # Align input element with this step
   857     # Align input element with this step
   859     def RefreshInputPosition(self):
   858     def RefreshInputPosition(self):
   860         wires = self.Input.GetWires()
       
   861         current_pos = self.Input.GetPosition(False)
   859         current_pos = self.Input.GetPosition(False)
   862         input = self.GetPreviousConnector()
   860         input = self.GetPreviousConnector()
   863         if input:
   861         if input:
   864             input_pos = input.GetPosition(False)
   862             input_pos = input.GetPosition(False)
   865             diffx = current_pos.x - input_pos.x
   863             diffx = current_pos.x - input_pos.x
  1349         if move:
  1347         if move:
  1350             for output_connector in self.Outputs:
  1348             for output_connector in self.Outputs:
  1351                 wires = output_connector.GetWires()
  1349                 wires = output_connector.GetWires()
  1352                 if len(wires) != 1:
  1350                 if len(wires) != 1:
  1353                     return
  1351                     return
  1354                 current_pos = output_connector.GetPosition(False)
       
  1355                 output = wires[0][0].GetOtherConnected(self.Output)
  1352                 output = wires[0][0].GetOtherConnected(self.Output)
  1356                 output_pos = output.GetPosition(False)
       
  1357                 diffx = current_pos.x - output_pos.x
       
  1358                 output_block = output.GetParentBlock()
  1353                 output_block = output.GetParentBlock()
  1359                 if isinstance(output_block, SFC_Step):
  1354                 if isinstance(output_block, SFC_Step):
  1360                     output_block.MoveActionBlock(move)
  1355                     output_block.MoveActionBlock(move)
  1361                 wires[0][0].Move(move[0], move[1], True)
  1356                 wires[0][0].Move(move[0], move[1], True)
  1362                 if not isinstance(output_block, SFC_Divergence) or output_block.GetConnectors()["inputs"].index(output) == 0:
  1357                 if not isinstance(output_block, SFC_Divergence) or output_block.GetConnectors()["inputs"].index(output) == 0: