Procházet zdrojové kódy

Add a bandaid fix for things snapping wrongly

tags/v0.1.0
Fen Dweller před 6 roky
rodič
revize
22fedf9067
1 změnil soubory, kde provedl 13 přidání a 0 odebrání
  1. +13
    -0
      macrovision.js

+ 13
- 0
macrovision.js Zobrazit soubor

@@ -1437,6 +1437,19 @@ window.addEventListener("resize", () => {
updateSizes(); 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) => { document.addEventListener("mousemove", (e) => {
if (clicked) { if (clicked) {
const position = snapRel(abs2rel({ x: e.clientX - dragOffsetX, y: e.clientY - dragOffsetY })); const position = snapRel(abs2rel({ x: e.clientX - dragOffsetX, y: e.clientY - dragOffsetY }));


Načítá se…
Zrušit
Uložit