Sfoglia il codice sorgente

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 anni fa
parent
commit
8221d29040
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. +2
    -0
      macrovision.js

+ 2
- 0
macrovision.js Vedi File

@@ -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)


Loading…
Annulla
Salva