update(Dashboard pinned animation): also triggers the pinned animation when the target area of a drag action contains a pinned widget

This commit is contained in:
SimonGschnell
2025-04-15 11:16:20 +02:00
parent 88c4a04aea
commit fc0a09180a
2 changed files with 32 additions and 13 deletions
+30 -12
View File
@@ -427,7 +427,6 @@ export default {
dragOver(evt) {
if (!this.active)
return this.dragCancel();
this.checkPinnedWidgetAnimation();
if (this.updateCursor(evt)) {
switch(this.mode) {
@@ -514,18 +513,37 @@ export default {
}
},
checkPinnedWidgetAnimation(){
let itemAtPosition = this.items.filter(item => item.x == this.x && item.y == this.y).pop();
if (itemAtPosition && itemAtPosition.place[this.cols] && itemAtPosition.place[this.cols].pinned) {
let pinnedWidget = document.getElementById(itemAtPosition.widgetid);
let test = pinnedWidget.querySelector("[pinned='true']");
if (!test.classList.contains("denied-dragging-animation")) {
test.classList.add("denied-dragging-animation");
}
} else {
Array.from(document.getElementsByClassName("denied-dragging-animation"))?.forEach(ele => {
ele.classList.remove("denied-dragging-animation");
})
let itemAtPosition=[];
switch(this.mode){
case MODE_RESIZE:
for (let x = this.draggedItem.x; x <= this.x; x++) {
for (let y = this.draggedItem.y; y <= this.y; y++) {
this.items.forEach(item => {
if (item.x == x && item.y == y) {
itemAtPosition.push(item);
}
});
}
}
break;
case MODE_MOVE:
itemAtPosition = this.items.filter(item=>item.x == this.x && item.y == this.y);
break;
}
Array.from(document.getElementsByClassName("denied-dragging-animation"))?.forEach(ele => {
ele.classList.remove("denied-dragging-animation");
})
itemAtPosition.forEach(item=>{
if (item.place[this.cols] && item.place[this.cols].pinned) {
let pinnedWidget = document.getElementById(item.widgetid);
let pinNode = pinnedWidget.querySelector("[pinned='true']");
if (!pinNode.classList.contains("denied-dragging-animation")) {
pinNode.classList.add("denied-dragging-animation");
}
}
})
},
mouseDown(){
this.mode = MODE_MOUSE_DOWN;
+2 -1
View File
@@ -164,7 +164,8 @@ class GridLogic {
currItem.frame = this.getItemFrame(currItem);
const updates = this.add(currItem);
updates[item.index] = {index: item.index, w, h, x:item.x, y:item.y, resize:true};
if(updates)
updates[item.index] = {index: item.index, w, h, x:item.x, y:item.y, resize:true};
return updates;
}