mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-06 17:18:11 +08:00
fix state prop bug with camera transform (#1138)
This commit is contained in:
@@ -87,7 +87,7 @@ function renderThrottle(callback) {
|
|||||||
colorAccessor: state.colors.colorAccessor,
|
colorAccessor: state.colors.colorAccessor,
|
||||||
pointDilation: state.pointDilation
|
pointDilation: state.pointDilation
|
||||||
}))
|
}))
|
||||||
class Graph extends React.PureComponent {
|
class Graph extends React.Component {
|
||||||
computePointPositions = memoize((X, Y, modelTF) => {
|
computePointPositions = memoize((X, Y, modelTF) => {
|
||||||
/*
|
/*
|
||||||
compute the model coordinate for each point
|
compute the model coordinate for each point
|
||||||
@@ -340,7 +340,7 @@ class Graph extends React.PureComponent {
|
|||||||
selectionTool !== prevProps.selectionTool
|
selectionTool !== prevProps.selectionTool
|
||||||
) {
|
) {
|
||||||
// first time or change of selection tool
|
// first time or change of selection tool
|
||||||
stateChanges = { ...stateChanges, ...this.createToolSVG(true) };
|
stateChanges = { ...stateChanges, ...this.createToolSVG() };
|
||||||
} else if (prevProps.graphInteractionMode !== graphInteractionMode) {
|
} else if (prevProps.graphInteractionMode !== graphInteractionMode) {
|
||||||
// If lasso/zoom is switched
|
// If lasso/zoom is switched
|
||||||
stateChanges = {
|
stateChanges = {
|
||||||
@@ -394,7 +394,12 @@ class Graph extends React.PureComponent {
|
|||||||
.remove();
|
.remove();
|
||||||
|
|
||||||
// Don't render or recreate toolSVG if currently in zoom mode
|
// Don't render or recreate toolSVG if currently in zoom mode
|
||||||
if (graphInteractionMode !== "select") return { toolSVG: undefined };
|
if (graphInteractionMode !== "select") {
|
||||||
|
// don't return "change" of state unless we are really changing it!
|
||||||
|
const { toolSVG } = this.state;
|
||||||
|
if (toolSVG === undefined) return {};
|
||||||
|
else return { toolSVG: undefined };
|
||||||
|
}
|
||||||
|
|
||||||
let handleStart;
|
let handleStart;
|
||||||
let handleDrag;
|
let handleDrag;
|
||||||
@@ -724,7 +729,7 @@ class Graph extends React.PureComponent {
|
|||||||
const { responsive, graphInteractionMode } = this.props;
|
const { responsive, graphInteractionMode } = this.props;
|
||||||
const { modelTF, projectionTF, camera } = this.state;
|
const { modelTF, projectionTF, camera } = this.state;
|
||||||
|
|
||||||
const cameraTF = camera?.view();
|
const cameraTF = camera?.view()?.slice();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="graphWrapper">
|
<div id="graphWrapper">
|
||||||
|
|||||||
Reference in New Issue
Block a user