Home & blog  /  Tag: drawing  /

Spraycan - vandalise your page

posted: 24 Jul '10 10:13 tags: fun, drawing, Javascript, jQuery

This is what Mitya does when he's bored. This allows you - or rather your site visitors - to take a break from reading your blurb and graffiti your page like it was a wall.

Once the ap starts, you paint by clicking and dragging on the screen. A toolbox allows you to pick the brush colour and size.

Click here to vandalise my homepage. I know, I know. I did tell you I was bored.

Head over here to download, get usage info or view a demo.

The only problem is that clicking and dragging always means selecting text. To my mind there's no way around this apart from in IE (which defines a special text select event, whereas in other browsers you can only return false from the onmouseodwn event - not really an option for a script that listens for mousedown to know when to start painting).

One possible fix would be to append brush strokes to a new, invisible canvass rather than to the itself. Then, during painting, calling event.stopPropagation() would ensure the drag action never made it as far as the body's text elements.

2 comments | post new