Closed duh102 closed 9 years ago
I was actually about to warn you that could happen. Can HTML5 canvas work in frame with scrollbar? I tried and it didn't work.
I'm going to redo the entire thing to be easier. The canvas can be removed and a table-wide onclick can be applied to each td, which can then report where it is based on where in the parent (the row) it is (to get the column number) and where the parent is in it's parent (the table) (to get the row number). Then the entire table can be scrolled however you like and it will work fine, no weird resize problems. All in theory, of course, might end up not panning out.
The canvas is actually what make the mouse buttondown drawing work. I tried implementing on each td and the result wasn't pretty.
I forgot. If the table can detect the mouse event and reports the cursor position then I think you can get rid of canvas.
Anything can have an on() event put onto it, and you can track dragging too.
Then I think that solves the problem.
http://jsfiddle.net/EZLxv/2/, for a demo (not mine)
Well, now it works for large mazes but you can't click single cells for some reason. I didn't have time to fix that, so I'm going to submit that as another bug and call this closed.
It breaks when the entire maze can't fit onscreen, and it has trouble with wide mazes where maze cells are smaller than normal size.