mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-28 11:58:12 +08:00
Put scaling back in the backend
This commit is contained in:
@@ -112,24 +112,20 @@ class Graph extends React.Component {
|
||||
return !shallowEqual(props.watchProps, prevProps.watchProps);
|
||||
}
|
||||
|
||||
computePointPositions = memoize(
|
||||
(X, Y, modelTF, spatialMetadata, imageUnderlay) => {
|
||||
/*
|
||||
computePointPositions = memoize((X, Y, modelTF) => {
|
||||
/*
|
||||
compute the model coordinate for each point
|
||||
*/
|
||||
console.log({ X }, { Y });
|
||||
const positions = new Float32Array(2 * X.length);
|
||||
for (let i = 0, len = X.length; i < len; i += 1) {
|
||||
const p = imageUnderlay?.isActive
|
||||
? this.rescalePointForSpatial(X[i], Y[i], spatialMetadata)
|
||||
: vec2.fromValues(X[i], Y[i]);
|
||||
vec2.transformMat3(p, p, modelTF);
|
||||
positions[2 * i] = p[0];
|
||||
positions[2 * i + 1] = p[1];
|
||||
}
|
||||
return positions;
|
||||
console.log({ X }, { Y });
|
||||
const positions = new Float32Array(2 * X.length);
|
||||
for (let i = 0, len = X.length; i < len; i += 1) {
|
||||
const p = vec2.fromValues(X[i], Y[i]);
|
||||
vec2.transformMat3(p, p, modelTF);
|
||||
positions[2 * i] = p[0];
|
||||
positions[2 * i + 1] = p[1];
|
||||
}
|
||||
);
|
||||
return positions;
|
||||
});
|
||||
|
||||
computePointColors = memoize((rgb) => {
|
||||
/*
|
||||
@@ -585,13 +581,7 @@ class Graph extends React.Component {
|
||||
const { currentDimNames } = layoutChoice;
|
||||
const X = layoutDf.col(currentDimNames[0]).asArray();
|
||||
const Y = layoutDf.col(currentDimNames[1]).asArray();
|
||||
const positions = this.computePointPositions(
|
||||
X,
|
||||
Y,
|
||||
modelTF,
|
||||
spatial.data,
|
||||
imageUnderlay
|
||||
);
|
||||
const positions = this.computePointPositions(X, Y, modelTF);
|
||||
|
||||
const colorTable = this.updateColorTable(colorsProp, colorDf);
|
||||
const colors = this.computePointColors(colorTable.rgb);
|
||||
@@ -809,8 +799,6 @@ class Graph extends React.Component {
|
||||
const { pointBuffer, colorBuffer, flagBuffer } = this.state;
|
||||
let needToRenderCanvas = false;
|
||||
|
||||
console.log("updateReglAndRender");
|
||||
|
||||
if (height !== prevAsyncProps?.height || width !== prevAsyncProps?.width) {
|
||||
needToRenderCanvas = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user