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: [],
|
||||
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");
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user