Przeglądaj źródła

Allow deselection of an entity by clicking within its bounding box

Clicks that hit the bounding box of any entity were unable to deselect, since
the canvas was not listening for mousedown events. It now is.
tags/v0.0.3
Fen Dweller 5 lat temu
rodzic
commit
8221d29040
1 zmienionych plików z 2 dodań i 0 usunięć
  1. +2
    -0
      macrovision.js

+ 2
- 0
macrovision.js Wyświetl plik

@@ -491,6 +491,7 @@ function testClick(event) {
const oldDisplay = target.style.display;
target.style.display = "none";
const newTarget = document.elementFromPoint(event.clientX, event.clientY);
console.log(newTarget);
newTarget.dispatchEvent(new MouseEvent(event.type, {
"clientX": event.clientX,
"clientY": event.clientY
@@ -594,6 +595,7 @@ document.addEventListener("DOMContentLoaded", () => {
})

world.addEventListener("mousedown", e => deselect());
document.querySelector("#display").addEventListener("mousedown", deselect);
document.addEventListener("mouseup", e => clickUp(e));
document.addEventListener("touchend", e => {
console.log(e)


Ładowanie…
Anuluj
Zapisz