phetsims / circuit-construction-kit-common

"Circuit Construction Kit: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
10 stars 10 forks source link

Scissors don't always show when they should #895

Closed samreid closed 1 year ago

samreid commented 1 year ago

Vertex is not always cuttable by default. If you take out 1 wire and leave it close to the toolbox, then take out a 2nd wire further to the right, then connect them, there is no scissors for that vertex. If you reverse the order, everything is OK though. Awkward!

image
samreid commented 1 year ago

@matthew-blackman and I determined there is an ordering problem. When 2 vertices are joined, one is disposed. If the disposal happens afterwards, the cut button disappears. Maybe this disposal line is too greedy:

CCKCUtils.setInSceneGraph( false, circuitLayerNode.buttonLayer, cutButton );
samreid commented 1 year ago

After the commit, things are working much better. But the look of the disabled cut button is a bit paler, perhaps the opacity or grayscale is applied twice?

matthew-blackman commented 1 year ago

@samreid and I found that the disabled opacity of the cut button was consistent with the DISABLED_OPACITY constant in SceneryConstants.js. We also looked into the component tree using the joist helper, and did not see any node structure that was applying opacity twice to the cut button.

Noteworthy: The unbuilt version of the sim has a lower opacity for the disabled button than the version on the PhET website.