3
0

Fix for the glitch affecting page blocks after a move

This commit is contained in:
Kelani Tolulope 2024-08-29 10:23:08 +01:00
parent fd511b9052
commit d157579a2d

View File

@ -40,8 +40,6 @@
style="touch-action: none;" style="touch-action: none;"
@move="onGridAction" @move="onGridAction"
@resize="onGridAction" @resize="onGridAction"
@moved="onBlockUpdated(index)"
@resized="onBlockUpdated(index)"
> >
<slot <slot
:block="blocks[item.i]" :block="blocks[item.i]"
@ -142,15 +140,18 @@ export default {
}, },
methods: { methods: {
onBlockUpdated (index) {
this.$emit('item-updated', index)
const { x, y, w, h } = this.layout[index]
this.blocks[index].xywh = [x, y, w, h]
},
onLayoutUpdated () { onLayoutUpdated () {
this.resizing = false this.resizing = false
this.blocks.forEach(({ xywh = [] }, idx) => {
const { x, y, w, h } = this.layout[idx]
const layoutXYWH = [x, y, w, h]
if (xywh.toString() === layoutXYWH.toString()) return
this.$emit('item-updated', idx)
this.blocks[idx].xywh = layoutXYWH
})
}, },
onGridAction () { onGridAction () {