phetsims / wave-on-a-string

"Wave on a String" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/wave-on-a-string
GNU General Public License v3.0
7 stars 8 forks source link

Add pickable: false to places for performance enhancement #37

Closed jonathanolson closed 10 years ago

jonathanolson commented 10 years ago

To determine what Node the mouse/touch is over (for drags, button presses, etc), Scenery traverses the tree. Right now, the only way to speed this up is to have { pickable: false } in the options to Nodes to tell Scenery to not traverse that part of the tree.

Pickable: false essentially won't allow any events to occur on those nodes, and can significantly improve performance. For instance, the y=0 line, the string, and the clamp/window/pole should all have 'pickable: false' set.

In this sim, it's probably also beneficial for performance to set the control panel backgrounds to 'pickable: false', and all of the control panel labels, tick marks, numeric displays, etc.

Hopefully in a future Scenery version this won't be as necessary (proposal in https://github.com/phetsims/scenery/issues/105)

jonathanolson commented 10 years ago

https://github.com/phetsims/scenery/issues/105 fixed, no longer an issue.