Pārlūkot izejas kodu

Fix things being dragged out of bounds on the first mousemove

The site wasn't checking if the entity started in bounds until after
one instance of movement.
master
Fen Dweller pirms 6 gadiem
vecāks
revīzija
b5334c76cc
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. +8
    -0
      macrovision.js

+ 8
- 0
macrovision.js Parādīt failu

@@ -604,6 +604,14 @@ function clickDown(target, x, y) {
let entY = document.querySelector("#entities").getBoundingClientRect().y;
dragOffsetX = x - rect.left + entX;
dragOffsetY = y - rect.top + entY;

x = x - dragOffsetX;
y = y - dragOffsetY;
if (x >= 0 && x <= canvasWidth && y >= 0 && y <= canvasHeight) {
movingInBounds = true;
}


clickTimeout = setTimeout(() => { dragging = true }, 200)
target.classList.add("no-transition");
}


Notiek ielāde…
Atcelt
Saglabāt