Oh my, this reminds me on a very old project of mine from the early 90ies. I called it "graffiti" and it was a brickwall where you can – well – "paint" on.
However it was completely ASCII-text based – the wall drawn using ASCII characters, and the "paint" tools ASCII as well. It was designed to run in a BBS mailbox environment.
The wall could actually scroll horizontally on a 80x25 text screen.
Never got really finished... |
Remarks to the source code: 1) Is it necessary to send the grid to user DIV-by-DIV ? I think some client-side javaScript repeater can make it more elegant (and more tiny tiny for the banwidth) than the server-side one. (Maybe this would be too demanding for UI ??) 2) Why it isn't a simple (stylled) table? There is no need to absolute position every "pixel"; if it was divided into rows (I think in this case usage of the TABLE element woul'd be accurate)
3)
then you can get the ID of each pixel simply from the (DOM) position (n-th cell in n-th row) [ 4) see wery rough scrap here: http://eldar.cz/myf/pub/try_grid.html; pardon me if my notes are silly; I am not a programmer] |
Michael, I think your approach would be possible as well, you are right. During writing of the code I had some layout problems with a table (which I did try first, but IIRC there was always some spacing inbetween cells – and yeah, I know it's possible to get rid of this), so I quickly rewrote it to DIVs get it working.
As for using JavaScript to write the cells, right, I'm sure that's possible as well. For different reasons I usually try to have as much as possible on the server-side, and that's one of those cases. But both approaches are possible (maybe more a matter of taste). |