draw scatterplot is now the inside of the loop, bring in queue

This commit is contained in:
Colin Megill
2018-03-01 10:40:44 -08:00
parent aa0ae5946f
commit 1441a4c7f0
@@ -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)