... | ... |
@@ -1554,6 +1554,10 @@ class DotWidget(gtk.DrawingArea): |
1554 | 1554 |
self.queue_draw() |
1555 | 1555 |
|
1556 | 1556 |
def zoom_image(self, zoom_ratio, center=False, pos=None): |
1557 |
+ # Constrain zoom ratio to a sane range to prevent numeric instability. |
|
1558 |
+ zoom_ratio = min(zoom_ratio, 1E4) |
|
1559 |
+ zoom_ratio = max(zoom_ratio, 1E-6) |
|
1560 |
+ |
|
1557 | 1561 |
if center: |
1558 | 1562 |
self.x = self.graph.width/2 |
1559 | 1563 |
self.y = self.graph.height/2 |