minor control fixes
This commit is contained in:
16
script.js
16
script.js
@@ -180,12 +180,12 @@ window.addEventListener("load", () => {
|
|||||||
drawGrid(sparseWorld);
|
drawGrid(sparseWorld);
|
||||||
});
|
});
|
||||||
|
|
||||||
//window.addEventListener("click", (event) => {
|
window.addEventListener("click", (event) => {
|
||||||
// const x = Math.round(event.clientX / spacing);
|
const x = Math.round(event.clientX / spacing);
|
||||||
// const y = Math.round(event.clientY / spacing);
|
const y = Math.round(event.clientY / spacing);
|
||||||
// saveSetArray(y,x, 1);
|
saveSetArray(sparseWorld, y,x, 1);
|
||||||
// console.log(`Koordinaten: (${x}, ${y})`);
|
console.log(`Koordinaten: (${x}, ${y})`);
|
||||||
//});
|
});
|
||||||
|
|
||||||
canvas.addEventListener("mousedown", (event) => {
|
canvas.addEventListener("mousedown", (event) => {
|
||||||
isDragging = true;
|
isDragging = true;
|
||||||
@@ -216,6 +216,10 @@ window.addEventListener("load", () => {
|
|||||||
isDragging = false;
|
isDragging = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
canvas.addEventListener("mouseout", () => {
|
||||||
|
isDragging = false;
|
||||||
|
});
|
||||||
|
|
||||||
// Grid beim Laden der Seite zeichnen
|
// Grid beim Laden der Seite zeichnen
|
||||||
drawGrid(sparseWorld);
|
drawGrid(sparseWorld);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user