function ev_canvas (ev) {
                // Firefox
                if (ev.layerX || ev.layerX == 0) {
                    ev._x = ev.layerX;
                    ev._y = ev.layerY;
                // Opera
                } else if (ev.offsetX || ev.offsetX == 0) {
                    ev._x = ev.offsetX;
                    ev._y = ev.offsetY;
                }

                // Call the event handler of the tool
                var func = tool[ev.type];
                if (func) {
                    func(ev);
                }
            }
// the mouse position relative to the <canvas> element
the mouse position relative to the  element
the mouse position relative to the element
function ev_canvas (ev) {
                if (ev.layerX || ev.layerX == 0) {
                    ev._x = ev.layerX;
                    ev._y = ev.layerY;
                } else if (ev.offsetX || ev.offsetX == 0) {
                    ev._x = ev.offsetX;
                    ev._y = ev.offsetY;
                }
                var func = tool[ev.type];
                if (func) {
                    func(ev);
                }
            }
function ev_canvas ( ev ) { if ( ev . layerX || ev . layerX == 0 ) { ev . _x = ev . layerX ; ev . _y = ev . layerY ; } else if ( ev . offsetX || ev . offsetX == 0 ) { ev . _x = ev . offsetX ; ev . _y = ev . offsetY ; } var func = tool [ ev . type ] ; if ( func ) { func ( ev ) ; } }
the mouse position relative to the <canvas> element
the mouse position relative to the <canvas > element
// Firefox // Opera // Call the event handler of the tool