phetsims / area-builder

"Area Builder" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/area-builder
GNU General Public License v3.0
1 stars 2 forks source link

CT: TypeError: localRefToMovableShape is null #128

Closed jbphet closed 2 months ago

jbphet commented 2 months ago

There's a new CT failure on Area Builder. I haven't touched the code in here for eons, so it is most likely a change to common code.

jbphet commented 2 months ago

I've done some investigation and can now duplicate manually. Here are the steps:

  1. Load the sim, go to the "Games" screen
  2. Choose level 4
  3. Start dragging shapes from the creator area at the bottom onto the shape on the grid area
  4. Continue dragging new instances until the problem occurs

This sequence works fine in the published version (v1.1.35).

jbphet commented 2 months ago

The problem is occurring when the shape creator node is set to invisible. The drag listener function, and specifically the start function, is being altered in some way. There have been some recent changes to DragListener, so I'll ask the developer who made them and see if he has any insights.

jbphet commented 2 months ago

After looking at the commit logs for DragListener I talked with @jessegreenberg and then @jonathanolson, and learned that the drag listeners now have their input interrupted when the associated Node goes invisible, but the client can opt out of this. I tested the "opt out" change and it seemed to work, so I've now committed it. I'll keep an eye on CT.

For what it's worth, this code is using an old "toolbox" pattern that we may want to eventually replace, but it didn't seem worth it to do so today.

jbphet commented 2 months ago

CT didn't clear up, so I had to dig a bit further, and found that the parent node of ShapeCreatorNode also needed to opt out of interrupting input when going invisible. I've added that now and will (again) keep an eye on CT.

jbphet commented 2 months ago

CT has been clear since the 2nd fix was committed. Screenshot:

image

Closing.