Hi Urs, Urs Reupke <[EMAIL PROTECTED]> wrote on 04/23/2007 01:19:30 AM:
> I am currently toing with changes to my application's user interface. > > I want the displayed image to move according to mouse movements, > unless the button was pressed on top of a specific class of node. > To this end, I have registered an interactor that reacts when the mouse > button is pressed, and a DOM listener, that disables said interactor when the > cursor is inside the node class. > For now, this structure performs as intended, but I fear that it might > break when the document is modified later on. I would be worried about this as well. I don't think the order of event dispatch should be counted on. Especially since the DOM events are dispatched in a separate thread so a quick click/move would probably try and move the image before the DOM event disabled it. > Is there a best practice for cases like this, or could/should I just > replace the interactors by another set > of DOM listeners? The best practice is to stick to DOM Event listeners when you can. In this case the only slightly tricky bit is that you need to make sure that the canvas is fully covered by something (often a visiblity="hidden" rect with pointer-events="fill" that you ensure covers anything the canvas might show). Then you can register your listener on the root SVG and receive all mouse move events in the canvas. > > Thanks for your help > -Urs > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
