mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-04 16:58:11 +08:00
check if viewport has changed and render accordingly (#1996)
This commit is contained in:
@@ -731,11 +731,14 @@ class Graph extends React.Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
updateReglAndRender(asyncProps, prevAsyncProps) {
|
updateReglAndRender(asyncProps, prevAsyncProps) {
|
||||||
const { positions, colors, flags } = asyncProps;
|
const { positions, colors, flags, height, width } = asyncProps;
|
||||||
this.cachedAsyncProps = asyncProps;
|
this.cachedAsyncProps = asyncProps;
|
||||||
const { pointBuffer, colorBuffer, flagBuffer } = this.state;
|
const { pointBuffer, colorBuffer, flagBuffer } = this.state;
|
||||||
let needToRenderCanvas = false;
|
let needToRenderCanvas = false;
|
||||||
|
|
||||||
|
if (height !== prevAsyncProps?.height || width !== prevAsyncProps?.width) {
|
||||||
|
needToRenderCanvas = true;
|
||||||
|
}
|
||||||
if (positions !== prevAsyncProps?.positions) {
|
if (positions !== prevAsyncProps?.positions) {
|
||||||
pointBuffer({ data: positions, dimension: 2 });
|
pointBuffer({ data: positions, dimension: 2 });
|
||||||
needToRenderCanvas = true;
|
needToRenderCanvas = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user