diff options
author | Sebastian Koslowski <sebastian.koslowski@gmail.com> | 2019-10-21 22:09:17 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2019-11-01 15:36:39 +0100 |
commit | 932121a62e30adb0a5c9d958e71b5756bdbd9f57 (patch) | |
tree | 0efe938b365f389e0ff1d6e0788924eeb0030daf /grc/gui/canvas/flowgraph.py | |
parent | 41095980ca9b9562b0c0b354b5a56404b91fe837 (diff) |
grc: include comments in flowgraph extent calculation (fixes #2854)
previously the extent (upper left und lower right bounding points)
only included blocks, ports and connections.
Diffstat (limited to 'grc/gui/canvas/flowgraph.py')
-rw-r--r-- | grc/gui/canvas/flowgraph.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/grc/gui/canvas/flowgraph.py b/grc/gui/canvas/flowgraph.py index 248ea3ba22..9657930f11 100644 --- a/grc/gui/canvas/flowgraph.py +++ b/grc/gui/canvas/flowgraph.py @@ -804,9 +804,15 @@ class FlowGraph(CoreFlowgraph, Drawable): return redraw def get_extents(self): - extent = 100000, 100000, 0, 0 - for element in self._elements_to_draw: - extent = (min_or_max(xy, e_xy) for min_or_max, xy, e_xy in zip( - (min, min, max, max), extent, element.get_extents() - )) + show_comments = Actions.TOGGLE_SHOW_BLOCK_COMMENTS.get_active() + def sub_extents(): + for element in self._elements_to_draw: + yield element.get_extents() + if element.is_block and show_comments and element.enabled: + yield element.get_extents_comment() + + extent = 10000000, 10000000, 0, 0 + cmps = (min, min, max, max) + for sub_extent in sub_extents(): + extent = [cmp(xy, e_xy) for cmp, xy, e_xy in zip(cmps, extent, sub_extent)] return tuple(extent) |