From 76868196cd8f1466316df572fedcc4eef3bbfea6 Mon Sep 17 00:00:00 2001 From: Matthew Bradbury Date: Thu, 7 Jun 2018 11:18:22 -0700 Subject: [PATCH] visualizer: (fixes #1210) Pyviz visualizer bounds are hardcoded --- src/visualizer/visualizer/core.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/visualizer/visualizer/core.py b/src/visualizer/visualizer/core.py index 7a6b29a5a..7206347bb 100644 --- a/src/visualizer/visualizer/core.py +++ b/src/visualizer/visualizer/core.py @@ -411,6 +411,22 @@ class Node(PyVizObject): if self._label_canvas_item is not None: self._label_canvas_item.set_properties(x=x, y=(y+self._size*3)) + # If the location of the point is now beyond the bounds of the + # canvas then those bounds now need to be increased + bounds = self.visualizer.canvas.get_bounds() + + (min_x, min_y, max_x, max_y) = bounds + + min_x = min(x, min_x) + min_y = min(y, min_y) + max_x = max(x, max_x) + max_y = max(y, max_y) + + new_bounds = (min_x, min_y, max_x, max_y) + + if new_bounds != bounds: + self.visualizer.canvas.set_bounds(*new_bounds) + def get_position(self): """! Get position function.