bug: wrong check for empty fields when adding new widgets (coordinates are based on 0,0 not 1,1)

This commit is contained in:
cgfhtw
2022-11-08 14:47:44 +01:00
parent 0e7343acfb
commit a5749a5ea2
+2 -2
View File
@@ -130,8 +130,8 @@ export default {
if (evt.target != this.$refs.container || !this.editMode)
return;
const rect = this.containerRect;
const gridX = Math.floor(this.gridWidth * (evt.clientX - rect.left) / this.$refs.container.clientWidth) + 1;
const gridY = Math.floor(this.gridHeight * (evt.clientY - rect.top) / this.$refs.container.clientHeight) + 1;
const gridX = Math.floor(this.gridWidth * (evt.clientX - rect.left) / this.$refs.container.clientWidth);
const gridY = Math.floor(this.gridHeight * (evt.clientY - rect.top) / this.$refs.container.clientHeight);
if (this.gridOccupiers[gridY * this.gridWidth + gridX] === undefined) {
let widget = { widget: 1, config: {}, place: {}, custom: 1 };
widget.place[this.gridWidth] = {