From 0b91371ea86f9f6bb6e8f6b85dcf309286542fa8 Mon Sep 17 00:00:00 2001 From: Severiano Badajoz Date: Thu, 3 Dec 2020 15:14:57 -0800 Subject: [PATCH] check if viewport has changed and render accordingly (#1996) --- client/src/components/graph/graph.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/graph/graph.js b/client/src/components/graph/graph.js index f2466b4d..473f8c27 100644 --- a/client/src/components/graph/graph.js +++ b/client/src/components/graph/graph.js @@ -731,11 +731,14 @@ class Graph extends React.Component { }); updateReglAndRender(asyncProps, prevAsyncProps) { - const { positions, colors, flags } = asyncProps; + const { positions, colors, flags, height, width } = asyncProps; this.cachedAsyncProps = asyncProps; const { pointBuffer, colorBuffer, flagBuffer } = this.state; let needToRenderCanvas = false; + if (height !== prevAsyncProps?.height || width !== prevAsyncProps?.width) { + needToRenderCanvas = true; + } if (positions !== prevAsyncProps?.positions) { pointBuffer({ data: positions, dimension: 2 }); needToRenderCanvas = true;