move when the dragging drawable is extracted from the renderer

Extracting the drawable art data is very expensive. We should delay
doing that work as long as possible. As such it should wait until a few
more branching return statements before we extract it.
This commit is contained in:
Michael "Z" Goddard committed 2019-02-14 16:50:24 -05:00
1 parent da65b41366
commit 6f101523b4
1 file changed
+3 -1
+3 -1
View File
@@ -320,7 +320,6 @@ class Stage extends React.Component {
if (this.state.dragId) return;
const drawableId = this.renderer.pick(x, y);
if (drawableId === null) return;
const drawableData = this.renderer.extractDrawable(drawableId, x, y);
const targetId = this.props.vm.getTargetIdForDrawableId(drawableId);
if (targetId === null) return;
@@ -332,6 +331,9 @@ class Stage extends React.Component {
// Dragging always brings the target to the front
target.goToFront();
// Extract the drawable art
const drawableData = this.renderer.extractDrawable(drawableId, x, y);
this.props.vm.startDrag(targetId);
this.setState({
isDragging: true,