Revert "fix: Resolve canvas reference and duplicate currentTool declaration"
This reverts commit a948fab6194aa2f7bfd1039cba4d44191d1844fe.
This commit is contained in:
parent
a948fab619
commit
b7d12114d3
@ -38,7 +38,6 @@ function setTool(tool) {
|
||||
}
|
||||
|
||||
function handleMouseDown(e) {
|
||||
const canvas = document.getElementById('simulation-canvas');
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const x = e.clientX - rect.left;
|
||||
const y = e.clientY - rect.top;
|
||||
@ -58,7 +57,6 @@ function handleMouseDown(e) {
|
||||
}
|
||||
|
||||
function handleMouseMove(e) {
|
||||
const canvas = document.getElementById('simulation-canvas');
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const x = e.clientX - rect.left;
|
||||
const y = e.clientY - rect.top;
|
||||
@ -156,8 +154,6 @@ function draw(x, y) {
|
||||
function handleTouchStart(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const canvas = document.getElementById('simulation-canvas');
|
||||
|
||||
// Check if we have multiple touch points (for dragging)
|
||||
if (e.touches.length > 1) {
|
||||
isDragging = true;
|
||||
@ -180,7 +176,6 @@ function handleTouchStart(e) {
|
||||
function handleTouchMove(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const canvas = document.getElementById('simulation-canvas');
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
|
||||
if (isDragging && e.touches.length > 1) {
|
||||
@ -208,9 +203,6 @@ function handleTouchMove(e) {
|
||||
|
||||
// Set up event listeners
|
||||
window.addEventListener('load', function() {
|
||||
// Get canvas reference after it's defined
|
||||
const canvas = document.getElementById('simulation-canvas');
|
||||
|
||||
canvas.addEventListener('mousedown', handleMouseDown);
|
||||
canvas.addEventListener('mousemove', handleMouseMove);
|
||||
window.addEventListener('mouseup', handleMouseUp);
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Main game variables and initialization
|
||||
let canvas, ctx;
|
||||
// currentTool is already defined in input.js
|
||||
let currentTool = SAND;
|
||||
let lastFrameTime = 0;
|
||||
let fps = 0;
|
||||
let debugMode = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user