Skip to content

Commit

Permalink
Merge pull request #3 from zalo/main
Browse files Browse the repository at this point in the history
  • Loading branch information
kotsoft authored May 16, 2024
2 parents 6c556d3 + 8ba7cee commit 3238340
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions run_0.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,24 @@ window.addEventListener("resize", () => {
simulator.resize(canvas.width, canvas.height);
});

window.addEventListener("mousemove", (e) => {
window.addEventListener("pointermove", (e) => {
simulator.mouseX = e.clientX;
simulator.mouseY = e.clientY;
});

window.addEventListener("mousedown", (e) => {
window.addEventListener("pointerdown", (e) => {
// Account for first-frame drags (mobile primarily)
simulator.mouseX = e.clientX;
simulator.mouseY = e.clientY;
simulator.mousePrevX = e.clientX;
simulator.mousePrevY = e.clientY;

if (e.button == 0) {
simulator.drag = true;
}
});

window.addEventListener("mouseup", (e) => {
window.addEventListener("pointerup", (e) => {
if (e.button == 0) {
simulator.drag = false;
}
Expand Down

0 comments on commit 3238340

Please sign in to comment.