Re: a minor confusion concerning mouse events

On Mon, Sep 12, 2011 at 7:38 AM, Rick <graham.rick@gmail.com> wrote:

> On Mon, Sep 12, 2011 at 10:22 AM, Olli Pettay <Olli.Pettay@helsinki.fi>
> wrote:
> > On 09/12/2011 01:46 AM, Tab Atkins Jr. wrote:
> >>
> >> On Sun, Sep 11, 2011 at 9:44 PM, Olli Pettay<Olli.Pettay@helsinki.fi>
> >>  wrote:
> >>>
> >>> On 09/10/2011 09:49 AM, Tab Atkins Jr. wrote:
> >>>>
> >>>> IE exposes the much more useful (non-bubbling) mouseenter and
> >>>> mouseleave events,
> >>>
> >>> mouseenter/leave are perhaps useful, but easily quite slow, since they
> >>> need to be fired a lot more often.
> >>
> >> Hm, this doesn't make sense to me.  Ignoring any optimizations based
> >> on registration, it seems like enter/leave are still fired *less* than
> >> over/out.  over/out get fired on *every* transition between elements.
> >
> > Right, when mouse moves from top of some element to top of some other
> > element, there is mouseout/mouseover
>
> I haven't read every bit of this thread, so I'm not sure if this has
> been mentioned.
>
> It's true, when you have a complex graphic, mouseover / mouseout
> events are thrown constantly, there is no simple way around this that
> won't break something else.  I can't visualize a way to fix it in the
> spec that is useful and not overly complex.
>
> The way to deal with the issue is to use the facilities that SVG
> provides.  Throwing up a mask element that is painted on top / last,
> is transparent, and exists solely as an event trap avoids all of these
> issues.  Some may call it a hack, I call it a simple elegant solution
> that negates these problems.
>
>
This is how flash buttons are designed as well.
A designer creates a transparent shape that defines a hit area that will
listen to the mouse events. Very often, the shape is the union of the up and
down states.

Rik

Received on Monday, 12 September 2011 17:11:48 UTC