浏览代码

Fix selection not working on Firefox

For whatever reason, I cannot seem to draw an SVG to a canvas.
Therefore, the selection test function does not work.
The current solution is to just skip the logic in Firefox and
use the standard bounding-box selection.
tags/v0.0.3
Fen Dweller 5 年前
父节点
当前提交
bd0b61c745
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. +10
    -1
      macrovision.js

+ 10
- 1
macrovision.js 查看文件

@@ -467,7 +467,14 @@ testCanvas.id = "test-canvas";

const testCtx = testCanvas.getContext("2d");
function testClick(event) {

// oh my god I can't believe I'm doing this

const target = event.target;
if (navigator.userAgent.indexOf("Firefox") != -1) {
clickDown(target.parentElement, event.clientX, event.clientY);
}
// Get click coordinates

let w = target.width;
@@ -504,7 +511,6 @@ 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
@@ -544,6 +550,9 @@ function displayEntity(entity, view, x, y) {

const img = document.createElement("img");
img.classList.add("entity-image");
img.addEventListener("dragstart", e => {
e.preventDefault();
});
const nameTag = document.createElement("div");
nameTag.classList.add("entity-name");
nameTag.innerText = entity.name;


正在加载...
取消
保存