Skip to content

Commit 6f10152

Browse files
committed
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.
1 parent da65b41 commit 6f10152

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/containers/stage.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ class Stage extends React.Component {
320320
if (this.state.dragId) return;
321321
const drawableId = this.renderer.pick(x, y);
322322
if (drawableId === null) return;
323-
const drawableData = this.renderer.extractDrawable(drawableId, x, y);
324323
const targetId = this.props.vm.getTargetIdForDrawableId(drawableId);
325324
if (targetId === null) return;
326325

@@ -332,6 +331,9 @@ class Stage extends React.Component {
332331
// Dragging always brings the target to the front
333332
target.goToFront();
334333

334+
// Extract the drawable art
335+
const drawableData = this.renderer.extractDrawable(drawableId, x, y);
336+
335337
this.props.vm.startDrag(targetId);
336338
this.setState({
337339
isDragging: true,

0 commit comments

Comments
 (0)