# HG changeset patch # User Surkov Sergey # Date 1485440214 -10800 # Node ID 976ce8c6195d80a44cc13820cd8cefb99eed1608 # Parent fc39d658bd2f15bd76e9da386ea323b6e88d321c Correct element size, if block type or variable name is wider than block width. Previously, if size corrected, element changed position to the right (or down, if height is corrected). Now upper-left corner is fixed. diff -r fc39d658bd2f -r 976ce8c6195d editors/Viewer.py --- a/editors/Viewer.py Thu Jan 26 15:38:21 2017 +0300 +++ b/editors/Viewer.py Thu Jan 26 17:16:54 2017 +0300 @@ -972,6 +972,16 @@ return connector.GetEdge() return "none" + def CorrectElementSize(self, element, width, height): + min_width, min_height = element.GetMinSize() + if width < min_width: + width = min_width + if height < min_height: + height = min_height + if element.Size != (width, height): + element.SetSize(width, height) + element.RefreshModel() + #------------------------------------------------------------------------------- # Reset functions #------------------------------------------------------------------------------- @@ -1384,6 +1394,7 @@ if not self.CreateWires(connector, instance.id, input_connector.links, remaining_instances, selection): element.RefreshModel() element.RefreshConnectors() + self.CorrectElementSize(element, instance.width, instance.height) if selection is not None and selection[0].get(instance.id, False): self.SelectInGroup(element)