Skip to content

Commit ebda80d

Browse files
authored
Fix the issue where minimap content gets clipped (#1600)
Bug: #1574 Cause: the graph in the bug contains no main graph node and all nodes are auxiliary nodes. As a result, the drawn nodes are shifted right by predefined amount for visuals. When measuring the bounding box of the scene to draw the minimap, we were using SVGGraphicsElement.getBBox which returned a tight BBox without concerning any whitespace. As a result, although we wanted the width from the origin to right edge of the right most node, we were omitting the origin to left most edge, resulting in clipped content in the minimap. Fix: measure the scene width from origin to the right edge of the content.
1 parent e2ba34c commit ebda80d

File tree

1 file changed

+8
-0
lines changed
  • tensorboard/plugins/graph/tf_graph_common

1 file changed

+8
-0
lines changed

tensorboard/plugins/graph/tf_graph_common/minimap.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ export class Minimap {
192192
let zoomTransform = $zoomG.attr('transform');
193193
$zoomG.attr('transform', null);
194194

195+
// https://github.com/tensorflow/tensorboard/issues/1598
196+
// Account for SVG content shift. SVGGraphicsElement.getBBox().width returns
197+
// width in pixel value of very tight bounding box of non-empty content.
198+
// Since we want to measure the sceneSize from the origin to the right most
199+
// edge of the right most node, we need to account for distance from the
200+
// origin to the left edge of the bounding box.
201+
sceneSize.height += sceneSize.y;
202+
sceneSize.width += sceneSize.x;
195203
// Since we add padding, account for that here.
196204
sceneSize.height += this.labelPadding * 2;
197205
sceneSize.width += this.labelPadding * 2;

0 commit comments

Comments
 (0)