phetsims / projectile-motion

"Projectile Motion" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
15 stars 13 forks source link

Add ability to independently disable cannon height and angle adjustments #248

Closed arouinfar closed 3 years ago

arouinfar commented 3 years ago

For #244

Related issues https://github.com/phetsims/scenery/issues/1041 https://github.com/phetsims/scenery/issues/1116 https://github.com/phetsims/bending-light/issues/397

The cannon can be adjusted in two ways:

Clients should be able to independently disable these interactions (whether by pickableProperty or its successor).

zepumph commented 3 years ago

I actually though it was easier to instrument on the listeners themselves, since for the height one the listener was added to many Nodes. Having the flexibility to disable based on the Node and/or listener is really nice.

Please experiment with PhET-iO elements like these, and let me know what you think:

height: projectileMotion.introScreen.view.cannonNode.heightDragListener.enabledProperty

rotation: projectileMotion.introScreen.view.cannonNode.barrelTopDragListener.enabledProperty

zepumph commented 3 years ago

I also fixed the cursor, so that it can come from the input listener instead of each Node that the single listener is added to. This further simplifies the file. Now, disabled input listeners will show the default cursor.

arouinfar commented 3 years ago

The behavior is looking really nice. One (hopefully) minor request -- when cannonNode.heightDragListener.enabledProperty is false can the cueing arrows be hidden? image

zepumph commented 3 years ago

It has been done.

arouinfar commented 3 years ago

Looks good, thanks!