diff options
author | 2016-04-25 08:54:21 -0800 | |
---|---|---|
committer | 2016-04-25 10:02:50 -0700 | |
commit | 9e4f8f61af7ae11ac5eb1d19be6b3baa42dae04d (patch) | |
tree | ebfe513549565fcac7823406bbf611d66c2e368e /tensorflow/tensorboard/components/tf-graph-common/lib/scene/minimap.ts | |
parent | 0306d9134780a447c48369de7346cd5ac56cfdf7 (diff) |
When the user switches tabs quickly, the zoom events contain NaNs that are now ignored. Also fix the minimap issue when the user tries zooming in before the scene is ready.
This should also fix the flaky test.
Change: 120716688
Diffstat (limited to 'tensorflow/tensorboard/components/tf-graph-common/lib/scene/minimap.ts')
-rw-r--r-- | tensorflow/tensorboard/components/tf-graph-common/lib/scene/minimap.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/scene/minimap.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/scene/minimap.ts index 8a987e78ed..d044bada30 100644 --- a/tensorflow/tensorboard/components/tf-graph-common/lib/scene/minimap.ts +++ b/tensorflow/tensorboard/components/tf-graph-common/lib/scene/minimap.ts @@ -113,7 +113,7 @@ export class Minimap { this.downloadCanvas = <HTMLCanvasElement>$minimap.select("canvas.download").node(); d3.select(this.downloadCanvas).style("display", "none"); - + this.update(); } /** @@ -139,7 +139,7 @@ export class Minimap { */ update(): void { // The origin hasn't rendered yet. Ignore making an update. - if (this.zoomG.childElementCount === 0) { + if (this.zoomG == null || this.zoomG.childElementCount === 0) { return; } let $download = d3.select("#graphdownload"); @@ -273,6 +273,10 @@ export class Minimap { * @param scale The scaling factor, or none to use the last used one. */ zoom(translate?: [number, number], scale?: number): void { + if (this.scaleMinimap == null) { + // Scene is not ready yet. + return; + } // Update the new translate and scale params, only if specified. this.translate = translate || this.translate; this.scaleMain = scale || this.scaleMain; |