Skip to content

Commit

Permalink
Fix the issue where minimap content gets clipped (#1600)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stephanwlee authored Nov 8, 2018
1 parent e2ba34c commit ebda80d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tensorboard/plugins/graph/tf_graph_common/minimap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ export class Minimap {
let zoomTransform = $zoomG.attr('transform');
$zoomG.attr('transform', null);

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

0 comments on commit ebda80d

Please sign in to comment.