From 6f101523b4ae5592addf51339f13c0336f33503f Mon Sep 17 00:00:00 2001 From: "Michael \"Z\" Goddard" Date: Thu, 14 Feb 2019 16:05:30 -0500 Subject: [PATCH] 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. --- src/containers/stage.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/containers/stage.jsx b/src/containers/stage.jsx index a6204bab7..5cee4e89b 100644 --- a/src/containers/stage.jsx +++ b/src/containers/stage.jsx @@ -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,