Re: Working shared whiteboard! (kind-of)



On Wed, 2005-03-23 at 01:10 -0500, David Malcolm wrote:
> I just committed my latest whiteboard code to CVS.  It's also something
> of a blackboard for now; screenshot available here:
> http://people.redhat.com/dmalcolm/yarrr/Whiteboard-Screenshot.png
> 
> Strokes start out client-side in red; they are drawn server-side in
> green.  The server-side image contains the version number, which is
> handy for debugging.
> 
> Unfortunately, I'm beset by coordinate-space issues; there doesn't seem
> to be a good cross-browser way of getting from mouse event coordinates
> to image coordinates for the whiteboard canvas.  So, as an evil kludge,
> I've moved the whiteboard to the top left of the page.

This is what the JS book says about the clientX, clientY properties of
MouseEvent:

These two properties specify the X and Y coordinates of the mouse
pointer, relative to the client area or browser window.  Note that these
coordinates do not take scrolling into account: if an even occurs at the
very top of the window, clientY is 0, regardless of how far down the
document has been scrolled. Unfortunately the Level 2 DOM does not
provide a standard way to translate these window coordinates to document
coordinates. In Netscape 6, you can add window.pageXOffset, and
window.pageYOffset, and in Internet Explorer you can add
document.body.scrollLeft and document.body.scrollTop.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an uncontrollable crooked paranormal investigator plagued by the memory 
of his family's brutal murder. She's an enchanted Bolivian hooker on her way 
to prison for a murder she didn't commit. They fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]