Skip to content
Snippets Groups Projects
Unverified Commit 8efb4359 authored by Benjamin Wheeler's avatar Benjamin Wheeler Committed by GitHub
Browse files

Revert "Only call Renderer.pick() on draggable targets in Stage.onStartDrag"

parent bd92b1ec
No related branches found
No related tags found
No related merge requests found
......@@ -342,29 +342,16 @@ class Stage extends React.Component {
}
onStartDrag (x, y) {
if (this.state.dragId) return;
// Targets with no attached drawable cannot be dragged.
let draggableTargets = this.props.vm.runtime.targets.filter(
target => Number.isFinite(target.drawableID)
);
// Because pick queries can be expensive, only perform them for drawables that are currently draggable.
// If we're in the editor, we can drag all targets. Otherwise, filter.
if (!this.props.useEditorDragStyle) {
draggableTargets = draggableTargets.filter(
target => target.draggable
);
}
if (draggableTargets.length === 0) return;
const draggableIDs = draggableTargets.map(target => target.drawableID);
const drawableId = this.renderer.pick(x, y, 1, 1, draggableIDs);
const drawableId = this.renderer.pick(x, y);
if (drawableId === null) return;
const targetId = this.props.vm.getTargetIdForDrawableId(drawableId);
if (targetId === null) return;
const target = this.props.vm.runtime.getTargetById(targetId);
// Do not start drag unless in editor drag mode or target is draggable
if (!(this.props.useEditorDragStyle || target.draggable)) return;
// Dragging always brings the target to the front
target.goToFront();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment