From 8ab83eaf41368f77603bbe68165044518aeaf994 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Thu, 16 Apr 2026 11:16:22 +0200 Subject: [PATCH] don't use place in gridlogic -> the current values should be in the root of the object --- public/js/components/Drop/Grid.js | 8 +++++--- public/js/composables/GridLogic.js | 10 +++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/public/js/components/Drop/Grid.js b/public/js/components/Drop/Grid.js index 40a1b1407..7fb6cd9ca 100644 --- a/public/js/components/Drop/Grid.js +++ b/public/js/components/Drop/Grid.js @@ -131,6 +131,7 @@ export default { y: item.y, w: item.w, h: item.h, + pinned: item.pinned, weight: item.weight || 0, data: item } @@ -150,7 +151,8 @@ export default { x: this.correctedPositionUpdates[item.index].x === undefined ? item.x : this.correctedPositionUpdates[item.index].x, y: this.correctedPositionUpdates[item.index].y === undefined ? item.y : this.correctedPositionUpdates[item.index].y, w: this.correctedPositionUpdates[item.index].w === undefined ? item.w : this.correctedPositionUpdates[item.index].w, - h: this.correctedPositionUpdates[item.index].h === undefined ? item.h : this.correctedPositionUpdates[item.index].h + h: this.correctedPositionUpdates[item.index].h === undefined ? item.h : this.correctedPositionUpdates[item.index].h, + pinned: item.pinned }; }); }, @@ -169,8 +171,8 @@ export default { x: this.tempPositionUpdates[item.index].x === undefined ? item.x : this.tempPositionUpdates[item.index].x, y: this.tempPositionUpdates[item.index].y === undefined ? item.y : this.tempPositionUpdates[item.index].y, w: this.tempPositionUpdates[item.index].w === undefined ? item.w : this.tempPositionUpdates[item.index].w, - h: this.tempPositionUpdates[item.index].h === undefined ? item.h : this.tempPositionUpdates[item.index].h - + h: this.tempPositionUpdates[item.index].h === undefined ? item.h : this.tempPositionUpdates[item.index].h, + pinned: item.pinned }; }); }, diff --git a/public/js/composables/GridLogic.js b/public/js/composables/GridLogic.js index b901d115d..a42c853a1 100644 --- a/public/js/composables/GridLogic.js +++ b/public/js/composables/GridLogic.js @@ -84,7 +84,7 @@ class GridLogic { } } move(item, x, y) { - if (item.data.place[this.w]?.pinned) + if (item.pinned) return []; if (item.x == x && item.y == y) return []; @@ -195,13 +195,13 @@ class GridLogic { let targetframe; switch(dir) { case DIR_UP: - if (this.data[index].data?.place[this.w]?.pinned || this.data[index].y - amount < 0) + if (this.data[index].pinned || this.data[index].y - amount < 0) return false; targetframe = this.data[index].frame.map(i => i-this.w*amount); move.y = -amount; break; case DIR_DOWN: - if (this.data[index].data?.place[this.w]?.pinned) + if (this.data[index].pinned) return false; if (this.data[index].y + this.data[index].h + amount > this.h) cost += .4; @@ -209,13 +209,13 @@ class GridLogic { move.y = amount; break; case DIR_LEFT: - if (this.data[index].data?.place[this.w]?.pinned || this.data[index].x - amount < 0) + if (this.data[index].pinned || this.data[index].x - amount < 0) return false; targetframe = this.data[index].frame.map(i => i-amount); move.x = -amount; break; case DIR_RIGHT: - if (this.data[index].data?.place[this.w]?.pinned || this.data[index].x + this.data[index].w + amount > this.w) + if (this.data[index].pinned || this.data[index].x + this.data[index].w + amount > this.w) return false; targetframe = this.data[index].frame.map(i => i+amount); move.x = amount;