check if viewport has changed and render accordingly (#1996)

This commit is contained in:
Severiano Badajoz
2020-12-03 15:14:57 -08:00
committed by GitHub
parent c428242878
commit 0b91371ea8

View File

@@ -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;