From 22fedf90676b04ec4f4c2e894998aa48dad18d61 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Thu, 19 Mar 2020 14:02:12 -0400 Subject: [PATCH] Add a bandaid fix for things snapping wrongly --- macrovision.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/macrovision.js b/macrovision.js index 3baacc86..17c2b600 100644 --- a/macrovision.js +++ b/macrovision.js @@ -1437,6 +1437,19 @@ window.addEventListener("resize", () => { updateSizes(); }) +// TODO: further investigate why the tool initially starts out with wrong +// values under certain circumstances (seems to be narrow aspect ratios - +// maybe the menu bar is animating when it shouldn't) + +setTimeout(() => { + + entityX = document.querySelector("#entities").getBoundingClientRect().x; + console.log(entityX) + canvasWidth = document.querySelector("#display").clientWidth - 100; + canvasHeight = document.querySelector("#display").clientHeight - 50; + updateSizes(); +}, 250); + document.addEventListener("mousemove", (e) => { if (clicked) { const position = snapRel(abs2rel({ x: e.clientX - dragOffsetX, y: e.clientY - dragOffsetY }));