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:
1 file changed
+3
-1
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user