Currently working on image editing with some drag&drop.
Having something functional on chrome, but on Safari, dragend
event returns stupid coordinates (e.clientX
and e.clientY
). Just tried on Firefox, and the values are now empty.
So this is supposed to return the mouse position on canvas when the user drops an image, which works great on Chrome, but on Safari clientX
is way too big and clientY
is negative...
sticker.addEventListener("dragend", (e) => {
let coords = new Array(
document.getElementById("canvas").getBoundingClientRect()
).map((rect) => {
console.log(e.clientX(e.clientY));
return [(e.clientX - rect.left)(e.clientY - rect.top)].join();
});
});