From 19dc033eae01a05aa77fe0ef06ea119d7c79c2b1 Mon Sep 17 00:00:00 2001 From: Paul Kaplan <pkaplan@media.mit.edu> Date: Tue, 24 Jul 2018 11:30:17 -0400 Subject: [PATCH] Bring sprites to front when they are being dragged. This solves the issue where in both player and editor mode, draggable sprites would not get popped to the front of the draw list. --- src/containers/stage.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/containers/stage.jsx b/src/containers/stage.jsx index 0ff48ef02..1ab84412e 100644 --- a/src/containers/stage.jsx +++ b/src/containers/stage.jsx @@ -309,11 +309,13 @@ class Stage extends React.Component { const targetId = this.props.vm.getTargetIdForDrawableId(drawableId); if (targetId === null) return; - // Only start drags on non-draggable targets in editor drag mode - if (!this.props.useEditorDragStyle) { - const target = this.props.vm.runtime.getTargetById(targetId); - if (!target.draggable) 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(); this.props.vm.startDrag(targetId); this.setState({ -- GitLab