浏览代码

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)


正在加载...
取消
保存