mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
added isDragging prop to prevent other drag actions
This commit is contained in:
parent
04da88e3b4
commit
dc85063467
@ -105,7 +105,8 @@ export default {
|
|||||||
conditionCollection: [],
|
conditionCollection: [],
|
||||||
conditions: [],
|
conditions: [],
|
||||||
currentConditionIdentifier: this.currentConditionIdentifier || {},
|
currentConditionIdentifier: this.currentConditionIdentifier || {},
|
||||||
moveIndex: null
|
moveIndex: Number,
|
||||||
|
isDragging: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
@ -128,6 +129,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
setMoveIndex(index) {
|
setMoveIndex(index) {
|
||||||
this.moveIndex = index;
|
this.moveIndex = index;
|
||||||
|
this.isDragging = true;
|
||||||
},
|
},
|
||||||
dropCondition(e) {
|
dropCondition(e) {
|
||||||
let targetIndex = Array.from(document.querySelectorAll('.c-c__drag-ghost')).indexOf(e.target);
|
let targetIndex = Array.from(document.querySelectorAll('.c-c__drag-ghost')).indexOf(e.target);
|
||||||
@ -159,10 +161,12 @@ export default {
|
|||||||
this.reorder(reorderPlan);
|
this.reorder(reorderPlan);
|
||||||
|
|
||||||
e.target.classList.remove("dragging");
|
e.target.classList.remove("dragging");
|
||||||
|
this.isDragging = false;
|
||||||
},
|
},
|
||||||
dragEnter(e) {
|
dragEnter(e) {
|
||||||
|
if (!this.isDragging) { return }
|
||||||
let targetIndex = Array.from(document.querySelectorAll('.c-c__drag-ghost')).indexOf(e.target);
|
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 }
|
if (this.moveIndex === targetIndex) { return }
|
||||||
e.target.classList.add("dragging");
|
e.target.classList.add("dragging");
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user