count on class

This commit is contained in:
Colin Megill
2018-04-05 15:35:48 -07:00
parent 7aeb03c820
commit 23a71b71df
2 changed files with 9 additions and 5 deletions
@@ -43,6 +43,9 @@ class Expression extends React.Component {
return ( return (
<div> <div>
<div style={{margin: 10}}> <div style={{margin: 10}}>
<div style={{margin: 10, width: 300}}>
There are currently 10 cells selected, click a cell set button to store them.
</div>
<CellSetButton <CellSetButton
{...this.props} {...this.props}
eitherCellSetOneOrTwo={1}/> eitherCellSetOneOrTwo={1}/>
+5 -4
View File
@@ -51,6 +51,7 @@ class Graph extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.count = 0;
this.state = { this.state = {
drawn: false, drawn: false,
svg: null, svg: null,
@@ -76,7 +77,6 @@ class Graph extends React.Component {
const colorBuffer = regl.buffer(generateColors(count)) const colorBuffer = regl.buffer(generateColors(count))
const sizeBuffer = regl.buffer(generateSizes(count)) const sizeBuffer = regl.buffer(generateSizes(count))
regl.frame(({viewportWidth, viewportHeight}) => { regl.frame(({viewportWidth, viewportHeight}) => {
regl.clear({ regl.clear({
@@ -89,7 +89,7 @@ class Graph extends React.Component {
distance: camera.distance, distance: camera.distance,
color: colorBuffer, color: colorBuffer,
position: pointBuffer, position: pointBuffer,
count: count, count: this.count,
view: camera.view(), view: camera.view(),
scale: viewportHeight / viewportWidth scale: viewportHeight / viewportWidth
}) })
@@ -101,7 +101,7 @@ class Graph extends React.Component {
regl, regl,
pointBuffer, pointBuffer,
colorBuffer, colorBuffer,
sizeBuffer, sizeBuffer
}) })
} }
@@ -169,7 +169,7 @@ class Graph extends React.Component {
]); ]);
} }
sizes.push(cell["__selected__"] ? 4 : 1) sizes.push(cell["__selected__"] ? 4 : .2) /* make this a function of the number of total cells, including regraph */
} }
}) })
@@ -177,6 +177,7 @@ class Graph extends React.Component {
this.state.pointBuffer(positions) this.state.pointBuffer(positions)
this.state.colorBuffer(colors) this.state.colorBuffer(colors)
this.state.sizeBuffer(sizes) this.state.sizeBuffer(sizes)
this.count = positions.length
} }
} }
handleBrushSelectAction() { handleBrushSelectAction() {