mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-10 02:40:56 +08:00
draw scatterplot is now the inside of the loop, bring in queue
This commit is contained in:
@@ -16,21 +16,16 @@ const drawScatterplotCanvas = (
|
|||||||
opacityForDeselectedCells,
|
opacityForDeselectedCells,
|
||||||
expression,
|
expression,
|
||||||
scatterplotXXaccessor,
|
scatterplotXXaccessor,
|
||||||
scatterplotYYaccessor
|
scatterplotYYaccessor,
|
||||||
|
_currentCellSelectionMap,
|
||||||
) => {
|
) => {
|
||||||
|
|
||||||
/* clear canvas */
|
return (cell) => {
|
||||||
context.clearRect(0, 0, width, height);
|
|
||||||
|
|
||||||
const _currentCellSelectionMap = _.keyBy(currentCellSelection, "CellName"); /* move me to the reducer */
|
|
||||||
|
|
||||||
expression.data.cells.forEach((cell, i) => {
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
this is necessary until we are no longer getting expression for all cells, but only for 'world'
|
this is necessary until we are no longer getting expression for all cells, but only for 'world'
|
||||||
...which will mean refetching when we regraph, or 'go back up to all cells'
|
...which will mean refetching when we regraph, or 'go back up to all cells'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!_currentCellSelectionMap[cell.cellname]) { return }
|
if (!_currentCellSelectionMap[cell.cellname]) { return }
|
||||||
|
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
@@ -52,7 +47,39 @@ const drawScatterplotCanvas = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
context.fill();
|
context.fill();
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default _.debounce(drawScatterplotCanvas, 50)
|
export const drawScatterplotCanvasUsingRenderQueue = (
|
||||||
|
context,
|
||||||
|
xScale,
|
||||||
|
yScale,
|
||||||
|
currentCellSelection,
|
||||||
|
opacityForDeselectedCells,
|
||||||
|
expression,
|
||||||
|
scatterplotXXaccessor,
|
||||||
|
scatterplotYYaccessor
|
||||||
|
) => {
|
||||||
|
|
||||||
|
const _currentCellSelectionMap = _.keyBy(currentCellSelection, "CellName"); /* move me to the reducer */
|
||||||
|
|
||||||
|
const _renderLinesWithFunctionReturnedByQueue = renderQueue(
|
||||||
|
drawScatterplotCanvas(
|
||||||
|
context,
|
||||||
|
xScale,
|
||||||
|
yScale,
|
||||||
|
currentCellSelection,
|
||||||
|
opacityForDeselectedCells,
|
||||||
|
expression,
|
||||||
|
scatterplotXXaccessor,
|
||||||
|
scatterplotYYaccessor,
|
||||||
|
_currentCellSelectionMap,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
_renderLinesWithFunctionReturnedByQueue(expression.data.cells)
|
||||||
|
return _renderLinesWithFunctionReturnedByQueue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default _.debounce(drawScatterplotCanvasUsingRenderQueue, 50)
|
||||||
|
|||||||
Reference in New Issue
Block a user