Skip to content
Snippets Groups Projects

Resolve "Implement basic functionality"

Merged Julian requested to merge 1-implement-basic-functionality into main
1 file
+ 5
4
Compare changes
  • Side-by-side
  • Inline
+ 5
4
@@ -145,7 +145,7 @@ export default {
@@ -145,7 +145,7 @@ export default {
let data = event.dataTransfer.getData("vueDrag/gridItem");
let data = event.dataTransfer.getData("vueDrag/gridItem");
if (!data) return;
if (!data) return;
let element = JSON.parse(data);
let element = JSON.parse(data);
let coords = this.getCoords(event.layerX, event.layerY);
let coords = this.getCoords(event.pageX, event.pageY);
if (element.context !== this.context || this.noHighlight) {
if (element.context !== this.context || this.noHighlight) {
this.$refs.highlightContainer.style.display = "none";
this.$refs.highlightContainer.style.display = "none";
@@ -185,7 +185,7 @@ export default {
@@ -185,7 +185,7 @@ export default {
return;
return;
}
}
let coords = this.getCoords(event.layerX, event.layerY);
let coords = this.getCoords(event.pageX, event.pageY);
let newPositionValid = true;
let newPositionValid = true;
@@ -233,9 +233,10 @@ export default {
@@ -233,9 +233,10 @@ export default {
this.$emit("itemChanged", element);
this.$emit("itemChanged", element);
},
},
getCoords(x, y) {
getCoords(x, y) {
 
let rect = this.$el.getBoundingClientRect();
return {
return {
x: Math.ceil(x / (this.$el.offsetWidth / this.cols)),
x: Math.ceil((x - rect.x - window.scrollX) / (rect.width / this.cols)),
y: Math.ceil(y / (this.$el.offsetHeight / this.rows)),
y: Math.ceil((y - rect.y - window.scrollY) / (rect.height / this.rows)),
};
};
},
},
getInt(property, item) {
getInt(property, item) {
Loading