Comments (3)
Hi Gary,
Personaly I think the default behavior has it's use as well. I would
not want an ActorContainer to stop being selectable/draggable.
Wouldn't it be easier to override the behavior in your containers? You
could create a custom findActorAtPosition method on your container
that just calls the same method on its parent and checks if the
return value is the container itself, in that case returning null
Met vriendelijke groet,
Rob Boerman
Op Jan 21, 2012 om 5:54 heeft garymcleanhall
[email protected]
het volgende geschreven:
I have fixed a problem I had with your otherwise rather amazing CAAT library.
The problem was that I had two ActorContainers, each with their own ShapeActor children. These were both added to a scene and enableDrag was called on each ShapeActor. Only the last-added ActorContainer's children were responding to mouse events. The reason was that the findActorAtPosition() method would return 'this' if none of the children contained the mouse location. For what I was wanting to achieve, I needed only the ShapeActor children to be returned from this method, and never an ActorContainer.
Long story short, you can make an ActorContainer transparent to mouse events by replacing the final return statement of ActorContainer.findActorAtPosition() with this:
return this.constructor == CAAT.ActorContainer ? null : this;
In other words, "given that the mouse is not contained in one of my children, if I am purely an ActorContainer, admit that I haven't found an actor - otherwise, return this concrete subclass of ActorContainer."
Reply to this email directly or view it on GitHub:
#29
from caat.
Yeah, it'd certainly be more maintainable, but I'm just doing some mockups with CAAT at the moment to see if it meets my requirements. When I firm this up, I'll create a flag on ActorContainer or a new subclass to house this behavior.
Thanks
from caat.
Hi Gary,
the behavior for input routing is the same as that of DOM events, where on overlapping elements only the top most z-indexed one will receive notifications. CAAT defines a tree in its Scene graph, and thus, events get sent to top-most elements.
You solutions assumes you don't want a container to be a valid event's endpoint. Rob's suggestion will give a valid solution for your requirements, but i think it'll too specific for CAAT.
Thanks for your suggestion.
best,
-ibon
from caat.
Related Issues (20)
- audio loop issue in firefox
- Exact pixel hit detection HOT 2
- Rendering wrong when use director.enableResizeEvents(CAAT.Director.RESIZE_PROPORTIONAL) HOT 2
- Actor SetAsButton Touch not working on CocoonJS 1.3 ? HOT 3
- Actors with SpriteImage can't rotate or scale correctly with anchors HOT 6
- Is CAAT running well in mobile
- Wrong license creation produced invalid js files within build folder. HOT 1
- Bug in actor.js /setRotationAnchor()
- Inconsistencies when hiding actor after a end of a behavior
- Cannot Remove Directors
- CSS renderer seems to be broken
- Small bug in __mouseDownHandler in Director.js
- Stop sprite image animation HOT 4
- collision image HOT 5
- uncaught exception: adding to a container an element with parent. HOT 3
- Demo not working HOT 1
- disable ctrl rotation in actor with enableDrag true
- How to add a method on complete event of RotateBehavior HOT 2
- Need to allow user to enter his name for score submission
- Path management example starting point
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caat.