Giter Club home page Giter Club logo

Comments (3)

robboerman avatar robboerman commented on August 24, 2024

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.

garymcleanhall avatar garymcleanhall commented on August 24, 2024

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.

hyperandroid avatar hyperandroid commented on August 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.