working! & pretty smooth, with responsive extra click

This commit is contained in:
Colin Megill
2018-07-05 21:44:36 -04:00
parent 013c5fb078
commit aa6f38e0a3
+21 -1
View File
@@ -85,8 +85,11 @@ class Graph extends React.Component {
camera.tick(); camera.tick();
}); });
this.reglRenderState = "rendering";
this.setState({ this.setState({
regl, regl,
drawPoints,
pointBuffer, pointBuffer,
colorBuffer, colorBuffer,
sizeBuffer, sizeBuffer,
@@ -163,6 +166,16 @@ class Graph extends React.Component {
this.state.sizeBuffer({ data: this.renderCache.sizes, dimension: 1 }); this.state.sizeBuffer({ data: this.renderCache.sizes, dimension: 1 });
this.count = cellCount; this.count = cellCount;
this.state.regl._refresh();
this.reglDraw(
this.state.regl,
this.state.drawPoints,
this.state.sizeBuffer,
this.state.colorBuffer,
this.state.pointBuffer,
this.state.camera
);
} }
if ( if (
@@ -173,7 +186,7 @@ class Graph extends React.Component {
/* clear out whatever was on the div, even if nothing, but usually the brushes etc */ /* clear out whatever was on the div, even if nothing, but usually the brushes etc */
d3 d3
.select("#graphAttachPoint") .select("#graphAttachPoint")
.selectAll("*") .selectAll("svg")
.remove(); .remove();
const { svg, brush, brushContainer } = setupSVGandBrushElements( const { svg, brush, brushContainer } = setupSVGandBrushElements(
this.handleBrushSelectAction.bind(this), this.handleBrushSelectAction.bind(this),
@@ -184,6 +197,13 @@ class Graph extends React.Component {
this.setState({ svg, brush, brushContainer }); this.setState({ svg, brush, brushContainer });
} }
} }
componentDidUpdate() {
if (this.state.reglRender && this.reglRenderState === "rendering") {
console.log("yeah...");
this.state.reglRender.cancel();
this.reglRenderState = "paused";
}
}
handleBrushSelectAction() { handleBrushSelectAction() {
/* This conditional handles procedural brush deselect. Brush emits an event on procedural deselect because it is move: null */ /* This conditional handles procedural brush deselect. Brush emits an event on procedural deselect because it is move: null */
if (d3.event.sourceEvent !== null) { if (d3.event.sourceEvent !== null) {