You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by yishayw <yi...@hotmail.com> on 2016/10/27 06:07:41 UTC

[FlexJS] DoubleClickEnabledBead ?

In flash doubleClick events are not dispatched unless
InterActiveObject.doubleClickEnabled is set to true. In HTML there's no such
property and dblclick is always dispatched. We'd like add doubleClickEnabled
to FlexJS and were thinking of doing it in a bead. 

The question is how to implement it on the JS side. One idea is to add an
event handler to dblclick with max priority and decide whether or not to
stop event propagation. The problem is I don't see a way to add priorities
to event handlers. 

Any ideas?



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-DoubleClickEnabledBead-tp56048.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] DoubleClickEnabledBead ?

Posted by Alex Harui <ah...@adobe.com>.

On 10/26/16, 11:58 PM, "yishayw" <yi...@hotmail.com> wrote:
>
>I was thinking that in general it could be nice to have an example of
>suppressing certain events in beads. The scenarios would be very similar
>to
>scenarios that require disabling all mouse events, which is what
>DisabledBead currently does. Sometimes there are a lot of event handlers
>on
>a single event and the simplest solution is to suppress the event rather
>than having all handlers check the target.
>

I think there may be more than one way to do this.  It may depend on what
you want to happen to any object behind the object under the mouse.  It is
one thing to suppress the event, and another to have it pass through to
the object behind.

What we end up doing may also depend on which event model we use which
depends on whether we wrap platform implementations or not.

If you don't need pass-through to objects behind, and aren't worried about
other beads on the strand listening for the event you want to block, I
think you can add a target listener in the strand setter and call
stopImmediatePropagation, and add a capture phase listener to the
topMostEventDispatcher.  Beads should have their strands set before most
other app-developer code starts to run.

There might be a better idea though.   I saw CSS pointer-events, but not
sure it works for non-SVG.

-Alex


Re: [FlexJS] DoubleClickEnabledBead ?

Posted by yishayw <yi...@hotmail.com>.
Alex Harui wrote
> On 10/26/16, 11:07 PM, "yishayw" &lt;

> yishayjobs@

> &gt; wrote:
> 
>>In flash doubleClick events are not dispatched unless
>>InterActiveObject.doubleClickEnabled is set to true. In HTML there's no
>>such
>>property and dblclick is always dispatched. We'd like add
>>doubleClickEnabled
>>to FlexJS and were thinking of doing it in a bead.
>>
>>The question is how to implement it on the JS side. One idea is to add an
>>event handler to dblclick with max priority and decide whether or not to
>>stop event propagation. The problem is I don't see a way to add priorities
>>to event handlers.
>>
>>Any ideas?
> 
> IMO, it depends a bit on your goals.  There are already some SWF-centric
> beads.  In fact, the simplest DisableBead mainly saves code in a SWF for
> instances that don't need disabled behavior.  On the JS side, I think it
> just flips the HTMLElement's disabled property.  But enable/disable is
> also in a bead in order to allow for different visual effects.
> 
> 
> Will all apps need double click events?  Or maybe 80% of apps?  Or is your
> goal to suppress dblclick in certain scenarios on the JS side?  If the
> goal is to suppress, what kind of scenarios require that?
> 
> One option is just to have UIBase set InterActiveObject.doubleClickEnabled
> to true in the constructor so each UIBase has the same behavior on both
> SWF and JS.  I'm not sure what the costs are of turning that flag on on
> the SWF side.  Or does Flash eat the second click event?
> 
> -Alex

I already added doubleClickEnabled=true to UIBase, which seems in line with
making FlexJS' behavior HTML like.

In our app, we turn doubleClickEnabled for components on and off depending
on whether or not they're editable. We could get around it by checking the
target in the event handler.

I was thinking that in general it could be nice to have an example of
suppressing certain events in beads. The scenarios would be very similar to
scenarios that require disabling all mouse events, which is what
DisabledBead currently does. Sometimes there are a lot of event handlers on
a single event and the simplest solution is to suppress the event rather
than having all handlers check the target.



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-DoubleClickEnabledBead-tp56048p56056.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] DoubleClickEnabledBead ?

Posted by Alex Harui <ah...@adobe.com>.
On 10/26/16, 11:07 PM, "yishayw" <yi...@hotmail.com> wrote:

>In flash doubleClick events are not dispatched unless
>InterActiveObject.doubleClickEnabled is set to true. In HTML there's no
>such
>property and dblclick is always dispatched. We'd like add
>doubleClickEnabled
>to FlexJS and were thinking of doing it in a bead.
>
>The question is how to implement it on the JS side. One idea is to add an
>event handler to dblclick with max priority and decide whether or not to
>stop event propagation. The problem is I don't see a way to add priorities
>to event handlers.
>
>Any ideas?

IMO, it depends a bit on your goals.  There are already some SWF-centric
beads.  In fact, the simplest DisableBead mainly saves code in a SWF for
instances that don't need disabled behavior.  On the JS side, I think it
just flips the HTMLElement's disabled property.  But enable/disable is
also in a bead in order to allow for different visual effects.


Will all apps need double click events?  Or maybe 80% of apps?  Or is your
goal to suppress dblclick in certain scenarios on the JS side?  If the
goal is to suppress, what kind of scenarios require that?

One option is just to have UIBase set InterActiveObject.doubleClickEnabled
to true in the constructor so each UIBase has the same behavior on both
SWF and JS.  I'm not sure what the costs are of turning that flag on on
the SWF side.  Or does Flash eat the second click event?

-Alex