CAAT.Scene or - CAAT.Actor CAAT.ShapeActor - mouseEvent

Visto 206 veces
Saltar al primer mensaje no leído

FlashTang

no leída,
28 feb 2012, 2:19:1628/2/12
a CAAT javascript framework
Hi there
I asked a question about mouseEvent on github yesterday
The answer I got was "create a custom mouseMove method for
scene ,since Scene extends Actor"

I tried like so :

myScene.mouseDown=function(event){
console.log("mouseDown");
}


But it doesn't work , I tried Actor , the same result

then I tried CAAT.ShapeActor , it works only if there is no children
in it

If add some other ShapeActors to it (overlay it''s fill) , then parent
ShapeActor no longer responses mouseEvent

The ShapeActor overlays the fill , but The ShapeActor is part of
parent ShapeActor

Just like so :


myScene.addChild(stage)

// if don't add sa2 , mouseDown works
stage.addChild(sa2)

stage.mouseDown=function(event){
console.log("mouseDown");
}

P.S. stage is a ShapeActor , sa2 is also a ShapeActor ( or is an
Actor, Actor.setBackgroundImage)

But it doesn't work , did I miss something ?

Is a parameter that I can enable the mouseChildren (like ActionScript
> Sprite.mouseChildren=true)

Thanks

FlashTang

no leída,
28 feb 2012, 7:53:5728/2/12
a CAAT javascript framework

Hi CAAT dev team

Here is the simple code

Please give it a look when you have time :

http://dl.dropbox.com/u/29345465/other/caat-event.zip

Thanks a lot

FlashTang

no leída,
28 feb 2012, 8:00:5328/2/12
a CAAT javascript framework
Here is the show-how what I need (with flash)

http://dl.dropbox.com/u/29345465/other/AS3MouseEvent.zip

-Tang

hyperandroid

no leída,
28 feb 2012, 16:26:4928/2/12
a CAAT javascript framework
Will check into that, since CAAT input does not work that way when the
mouse exits the canvas object.
Will tell you something asap.

About why input is consumed by not the Actor you expect, I'll explain
a little bit how input works on CAAT.

By default, every CAAT Actor, regardless of its type is elligible to
have input sent to it. If want to disable this behavior globally, set
CAAT.Actor.prototype.mouseEnabled= false, or call enableEvents(false)
on every actor you don't want to have input events sent. Input system
has two working methods:

a) Direct input. This procedure, starts hierarchycally from the
director object, and starts traversing down the scene graph trying to
find a suitable Actor where the mouse cursor/touch event lies in.
Any actor won't have input events sent if, you call
enableEvents(false), is out of frame time, is not visible, or the
cursor/input is not inside actors bounding box.
Containers, first try to have their children consumed the input event,
and if not, it will be consumed by the container. That's the reason
for you Shape not getting input if it contains a child.

b) You may encounter situations where you want the input sent only to
either a group of actors, or have it tested on some Actors previously
to traverse the scene graph. You must take a look at the following
methods to see how it works:
+ enableInputList(number) : number of priority lists to set for
this scene. A priority list is a list of actors to
which are suitable to receive input
first. If no actor on the priority lists are under
the cursor, the whole scene graph is
traversed instead.
+ addActorToInputList( actor, index, position ) : add an actor to a
given priority list at certain position.
+ emptyInputList( index ) : remove all elements from a list.
+ removeActorFromInputList( actor, index ) : remove an actor from a
list, or if no index list is supplied remove
the actor from every list in which appears.

If none of the prioritized actors consume the input events, the
previos procedure will be rolled, and CAAT will start traversing the
scene graph.

you could also refresh your CAAT code, and look at demo 4
coordinates_org.html where you could see how both types, priority
lists and default input behave.
will check how to make input continue to be sent if dragging and the
mouse gets out of the scene.

Regards,
-ibon

FlashTang

no leída,
29 feb 2012, 8:23:5829/2/12
a CAAT javascript framework
"will check how to make input continue to be sent if dragging and the
mouse gets out of the scene. "

- Actually that's very useful thing

Thanks hyperandroid
- Tang

Egor Kuryanovich

no leída,
20 abr 2012, 22:37:0920/4/12
a caa...@googlegroups.com

Hi, hyperandroid!

Is there any news on this issue?

hyperandroid

no leída,
22 abr 2012, 3:48:5822/4/12
a caa...@googlegroups.com
Just updated CAAT with window scope input system.
Touch/Mouse now can drag out of the canvas boundaries and no other different behavior should be noticed.
Let me know how it works for you.

-ibon

Egor Kuryanovich

no leída,
22 abr 2012, 19:00:2222/4/12
a caa...@googlegroups.com

Hi, Ibon.


I have tested new version of CAAT and dragging now works really awesome!

But I noticed strange behavior of event bubbling. I've made a demo for this issue, check out online here or download it here. After loading try to click on any ui element. Then try to click on them after dragging of space actor. You will see the difference. Space actor onclick fires before expected event and it seems that you click through the layer.

By the way, there is one more problem with dragging, but it's not a regression of new version. You can notice that sometimes when you click on space actor with enabled dragging, the click event doesn't firing. I think it happens because of lack of dragging threshhold. I saw in the CAAT code that you disabled it for some reason. Is there any plans for enabling it in future versions?

воскресенье, 22 апреля 2012 г., 10:48:58 UTC+3 пользователь hyperandroid написал:
Just updated CAAT with window scope input system.
Touch/Mouse now can drag out of the canvas boundaries and no other different behavior should be noticed.
Let me know how it works for you.

-ibon

hyperandroid

no leída,
22 abr 2012, 21:12:2922/4/12
a caa...@googlegroups.com
Hey Egor,

thanks for your email.

El 23 de abril de 2012 01:00, Egor Kuryanovich <vtso...@gmail.com> escribió:

Hi, Ibon.


I have tested new version of CAAT and dragging now works really awesome!

But I noticed strange behavior of event bubbling. I've made a demo for this issue, check out online here or download it here. After loading try to click on any ui element. Then try to click on them after dragging of space actor. You will see the difference. Space actor onclick fires before expected event and it seems that you click through the layer.

I'm checking this right now.
 

By the way, there is one more problem with dragging, but it's not a regression of new version. You can notice that sometimes when you click on space actor with enabled dragging, the click event doesn't firing. I think it happens because of lack of dragging threshhold. I saw in the CAAT code that you disabled it for some reason. Is there any plans for enabling it in future versions?

yes you're right.
mouseClick is only fired in case you've not dragged the element.
the threshold code was commented, and will be re-enabled when i fix the bubbling error. now that i'm doing some ipad tests, it shows very useful, so that i can click on actors instead of always dragging them since on an ipad, it seems to be impossible to have mouseUp fired at the same pixel that mouseDown was.

will tell you something hopefully today.

regards,

-ibon

hyperandroid

no leída,
23 abr 2012, 0:33:2723/4/12
a caa...@googlegroups.com
Just pushed to github a new CAAT version.
This one fixes the 'bubbling' error. __mouseReleased was not resetting a flag.
It also contains code to keep a mouse threshold previous to start dragging. Let me know if this value, which is currently 5 pixels, should be revisited.

Thanks for spotting these bugs.

-ibon
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos