Hi Bernhard, I solved this problem last year. What I do is follows:
1. Setup my SVG in the following fashion: <svg> <g id="application" onmousemove="SPARK.handleMouseEvent(evt);" onmouseup="SPARK.handleMouseEvent(evt);" onmousedown="SPARK.handleMouseEvent(evt);" onclick="SPARK.handleMouseEvent(evt);" onkeypress="SPARK.handleKeyboardEvent(evt);" onkeydown="SPARK.handleKeyboardEvent(evt);" onkeyup="SPARK.handleKeyboardEvent(evt);"> <g id="eventCatcherLayer"> <!-- these rectangle catches all events and bubbles them to the application group --> <rect height="300%" width="300%" y="-100%" x="-100%" fill="white" opacity="0"/> </g> <!-- application goes here --> </g> </svg> 2. Authored my SPARK.es class. The following code is used for Mouse Events: function SPARK(){}; /** * The widget that currently has the keyboard focus. */ SPARK.KEYBOARD_FOCUS = null; /** * Let a widget request mouse focus. If another widget * already has mouse focus this action will fail. * @param in_widget The widget requesting keyboard focus. * @return If the widget successfully retrieved mouse focus. */ SPARK.requestMouseFocus = function( in_widget ) { var bSuccess = false; if( SPARK.MOUSE_FOCUS == null ) { SPARK.MOUSE_FOCUS = in_widget; bSuccess = true; } else if( SPARK.MOUSE_FOCUS == in_widget ) { bSuccess = true; } return( bSuccess ); }; /** * Release the widget from global mouse focus. * @param in_widget The widget to be removed from focus. * @return True if the widget had the mouse focus and it * was removed successfully. */ SPARK.releaseMouseFocus = function( in_widget ) { var bSuccess = false; if( SPARK.MOUSE_FOCUS == null ) { bSuccess = true; } else if( SPARK.MOUSE_FOCUS == in_widget ) { SPARK.MOUSE_FOCUS = null; bSuccess = true; } return( bSuccess ); }; /** * This will distribute the given event to the appropriate * widget that has mouse focus. */ SPARK.handleMouseEvent = function( evt ) { if( SPARK.MOUSE_FOCUS != null ) { SPARK.MOUSE_FOCUS.handleEvent( evt ); } }; 3. Then finally add the code into my ECMAScript object event handler to use this ability. /** * Handle mousedown events. * @param evt The mousedown event. */ JogDial.prototype.mousedown = function( evt ) { if( SPARK.requestMouseFocus(this) ) { // do stuff here evt.stopPropagation(); } }; /** * Handle mouseup events. * @param evt The mouseup event. */ JogDial.prototype.mouseup = function( evt ) { if( SPARK.releaseMouseFocus(this) ) { // do stuff here evt.stopPropagation(); } }; Here is the source for an example. Unfortunately the online demo isn't serving up the script properly off sourceforge, so you'll just have to read it for now (or download the sample). http://spark.sourceforge.net/resources/samples/etchasketch/source/jogdial.es http://spark.sourceforge.net/resources/samples/etchasketch/widgets/spark.es Cheers, Alastair Fettes http://spark.sourceforge.net --- In svg-developers@yahoogroups.com, "b_obert75" <[EMAIL PROTECTED]> wrote: > Hello, > > i do develop at the moment a small svg-application. i have a problem > with mouse events, like described below (copied from > http://www.svgopen.org/2005/paperAbstracts/AdvancedMouseEventModelForSVG-1.html): > > "The user clicks the mouse button on the scrollbar moving box and > starts dragging it. But before the mouse button is released the mouse > pointer - accidentally - goes out of the boundary of the scrollbar > (the reason can be a slow machine or intensive drawing) and the user > looses the mouse focus (mouse events stop being delivered to the > scrollbar mouse events handler function). The user releases the mouse > button while the mouse pointer is out of the scrollbar boundary and > then moves the mouse pointer back to be inside the scrollbar region. > Because the mouse events handler of the scrollbar stops receiving > mouse events once the mouse pointer is out of its boundary (or if the > mouse events are being captured on the background it will stop > receiving mouse events once the mouse pointer is out of the SVG > canvas), the mouse state of the widget becomes out of synch with the > real mouse state and that could cause all kinds of confusion." > > well, i do not know how to solve this - should i add event listeners > from svg to the parent document, or should i add listeners in the > surrounding html, which access the svg? what is a working way to > prevent the mouse from becoming out of synch here? i have tried many > things, but i can not find any solution. also, i have read here much, > but could not find a answer, so i did this first post. > > thank you very much for helping. > > bernhard ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/