Removing return from reflow implementations

I don't think it will be necessary to wait for components to complete
re-rendering before moving on with the reflow process. Parent components
only depend on the bounding box and that is determined immediately when
reflow is called
This commit is contained in:
Jeff Avallone 2018-02-25 11:41:58 -05:00
parent 1e8ee71aef
commit 18bd368525
6 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ class Box extends React.PureComponent {
axisX2: useAnchors ? box.axisX2 + padding : box.width + 2 * padding axisX2: useAnchors ? box.axisX2 + padding : box.width + 2 * padding
}); });
return this.setStateAsync({ this.setStateAsync({
width: this.getBBox().width, width: this.getBBox().width,
height: box.height + 2 * padding, height: box.height + 2 * padding,
contentTransform: `translate(${ padding } ${ padding + labelBox.height })`, contentTransform: `translate(${ padding } ${ padding + labelBox.height })`,

View File

@ -35,7 +35,7 @@ class Image extends React.PureComponent {
const { padding } = this.props; const { padding } = this.props;
const box = this.children[0].getBBox(); const box = this.children[0].getBBox();
return this.setStateAsync({ this.setStateAsync({
width: Math.round(box.width + 2 * padding), width: Math.round(box.width + 2 * padding),
height: Math.round(box.height + 2 * padding) height: Math.round(box.height + 2 * padding)
}); });

View File

@ -93,7 +93,7 @@ class Loop extends React.PureComponent {
box.offsetX = this.contentOffset.x; box.offsetX = this.contentOffset.x;
box.offsetY = this.contentOffset.y; box.offsetY = this.contentOffset.y;
return this.setStateAsync({ this.setStateAsync({
labelTransform: `translate(${ this.getBBox().width - labelBox.width - 10 } ${ this.getBBox().height + 2 })`, labelTransform: `translate(${ this.getBBox().width - labelBox.width - 10 } ${ this.getBBox().height + 2 })`,
loopPaths: [ loopPaths: [
skip && skipPath(box, greedy), skip && skipPath(box, greedy),

View File

@ -14,7 +14,7 @@ class Pin extends React.PureComponent {
reflow() { reflow() {
const { radius } = this.props; const { radius } = this.props;
return this.setBBox({ this.setBBox({
width: radius * 2, width: radius * 2,
height: radius * 2 height: radius * 2
}); });

View File

@ -15,7 +15,7 @@ class Text extends React.PureComponent {
height: box.height height: box.height
}); });
return this.setStateAsync({ this.setStateAsync({
transform: `translate(${-box.x} ${-box.y})` transform: `translate(${-box.x} ${-box.y})`
}); });
} }

View File

@ -96,7 +96,7 @@ class VerticalLayout extends React.PureComponent {
offset += spacing + box.height; offset += spacing + box.height;
}); });
return this.setStateAsync({ this.setStateAsync({
childTransforms: this.updateChildTransforms(childBoxes), childTransforms: this.updateChildTransforms(childBoxes),
connectorPaths: withConnectors ? [ connectorPaths: withConnectors ? [
...childBoxes.map(box => this.makeCurve(box)), ...childBoxes.map(box => this.makeCurve(box)),