Преглед изворни кода

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 година
родитељ
комит
8221d29040
1 измењених фајлова са 2 додато и 0 уклоњено
  1. +2
    -0
      macrovision.js

+ 2
- 0
macrovision.js Прегледај датотеку

@@ -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…
Откажи
Сачувај