From dc85063467177d65ad63c3565911b248cd665851 Mon Sep 17 00:00:00 2001 From: Joel McKinnon Date: Fri, 31 Jan 2020 08:08:39 -0800 Subject: [PATCH] added isDragging prop to prevent other drag actions --- src/plugins/condition/components/ConditionCollection.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/condition/components/ConditionCollection.vue b/src/plugins/condition/components/ConditionCollection.vue index 65a6de60d6..6821297e08 100644 --- a/src/plugins/condition/components/ConditionCollection.vue +++ b/src/plugins/condition/components/ConditionCollection.vue @@ -105,7 +105,8 @@ export default { conditionCollection: [], conditions: [], currentConditionIdentifier: this.currentConditionIdentifier || {}, - moveIndex: null + moveIndex: Number, + isDragging: false }; }, destroyed() { @@ -128,6 +129,7 @@ export default { methods: { setMoveIndex(index) { this.moveIndex = index; + this.isDragging = true; }, dropCondition(e) { let targetIndex = Array.from(document.querySelectorAll('.c-c__drag-ghost')).indexOf(e.target); @@ -159,10 +161,12 @@ export default { this.reorder(reorderPlan); e.target.classList.remove("dragging"); + this.isDragging = false; }, dragEnter(e) { + if (!this.isDragging) { return } let targetIndex = Array.from(document.querySelectorAll('.c-c__drag-ghost')).indexOf(e.target); - if (targetIndex > this.moveIndex) { targetIndex-- } + if (targetIndex > this.moveIndex) { targetIndex-- } // for 'downward' move if (this.moveIndex === targetIndex) { return } e.target.classList.add("dragging"); },