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.
--- 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)