On Dec 19, Oliver Steele wrote:
[snip]
> I can get this if I add these lines to LzModeManager.handleMouseEvent:
>     if (eventStr == "onmouseover") view.setAttribute('mouseisover', true);
>     if (eventStr == "onmouseout") view.setAttribute('mouseisover', false);
>     if (eventStr == "onmousedown") view.setAttribute('mouseisdown', true);
>     if (eventStr == "onmouseup") view.setAttribute('mouseisup', false);
> 
> Does this sound reasonable?  I don't want to write a performance test to
> see if this is credible, so I thought I'd run it by your intuition
> instead.
This isn't a bad idea, and I've ended up writing this code a few times
myself. My intuition is that adding this everywhere might be a performance
hit. One optimization might be to see if anyone is looking for the event,
like this:
    if ( eventStr == "onmouseover" && view.onmouseisover ) 
        view.setAttribute('mouseisover', true);

One other thing to note: we could also implement a mouseview class, which
would be a component that extends view. It could have these properties,
and it could also fix the clickability problem that Scott Evans emailed to
this list a while ago. As reminder, the problem is this situation:

<view width="100" height="100" onmouseover="f()" onmouseout="g()">
    <view align="center" width="50" height="50" 
          onmouseover="h()" onmouseout="i()"/>
</view>

The problem is that g() gets called when the mouse enters the inner view,
even though this rarely what you want. The workaround for this is usually
to use the idle loop to check the mouse position to see if the mouse is
still over the outer view, rather than rely on the built-in onmouseout
event. This hypothetical mouseview could have a switch to enable this
behavior. I think I have a mild preference for a new class rather than
adding to the LFC, but remember: I'm a minimalist ;)

A
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to