-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set listening automatically to true/false #483
Comments
I assume listening:false prevents the hitCanvas from being updated, which can be quite a performance saving in some cases (especially if you are not drawing simple primitives). By default I tend to set listening:false to all nodes unless they really need to handle events. It kinda feels like mouse/touch event listening behaviour could be defined in Kinetic the other way around: disabled by default and activated on the nodes that require user interaction (IIRC that's kinda what EaselJS does). |
precisely, I do have plans to auto toggle the listening property based on both user input (setters) and usage (on() method). coming soon |
update on this thread: For optimal performance, you may give the new FastLayers a try. When you just want to draw stuff as fast as possible, and you don't care about mouse interactions, node nesting, event pub/sub, etc, FastLayers are a really good choice. You instantiate them like this: var layer = new FastLayer(); I think this is an even better solution than managing the overhead of checking for situations when creating a hit canvas is required. Still, there may be cases where you want some shapes to be listened to, and others not, and for some reason you need them all in the same layer. In this case, the hit graph will still need to be generated for the shapes that need it, and Kinetic could auto toggle off listening for shapes that have no handlers bound to them. |
I think we should not do this. Main reason is event bubbling. User may listen events on parent, not on shape. So library code will be too complicated if we will add such functionality. It is MUCH easier to manually use |
When layer have many small Shapes KJS 4.5.2 down speed. If this, try set {listening: false} on Shape.
The text was updated successfully, but these errors were encountered: