Don't draw SVG items that would appear very small on screen, to speed up drawing.
--- a/src/contrib/visualizer/core.py Fri Dec 12 15:49:43 2008 +0000
+++ b/src/contrib/visualizer/core.py Mon Jan 26 17:10:02 2009 +0000
@@ -113,11 +113,16 @@
self.svg_item.props.parent = self.visualizer.canvas.get_root_item()
self.svg_item.props.pointer_events = 0
self.svg_item.lower(None)
- self.svg_item.props.visibility = goocanvas.ITEM_VISIBLE
+ self.svg_item.props.visibility = goocanvas.ITEM_VISIBLE_ABOVE_THRESHOLD
if width is not None:
self.svg_item.props.width = transform_distance_simulation_to_canvas(width)
if height is not None:
self.svg_item.props.height = transform_distance_simulation_to_canvas(height)
+
+ threshold1 = 10.0/self.svg_item.props.height
+ threshold2 = 10.0/self.svg_item.props.width
+ self.svg_item.props.visibility_threshold = min(threshold1, threshold2)
+
self.svg_align_x = align_x
self.svg_align_y = align_y
self._update_svg_position(x, y)