phetsims / paper-land

Build and explore multimodal web interactives with pieces of paper!
https://phetsims.github.io/paper-land/
MIT License
19 stars 3 forks source link

Focus program paper affects markers on other program papers #253

Open terracoda opened 6 months ago

terracoda commented 6 months ago

Describe the bug When I move the focus program onto and off of the checked checkbox, the state of the checkbox is changes. The focus program seems to the coming in between the mark and the checkbox program and thus unintentionally hiding and then revealing the marker on the checkbox program causing checking and unchecking events to fire.

To Reproduce Steps to reproduce the behavior:

  1. Go to voicing-response-patterns space, look for 'checkbox-responses'
  2. Send to Playground
  3. Activate the programs and add a marker to the checkbox paper
  4. Move the focus program on and off of the checkbox paper ensuring to go over the marker.

https://github.com/phetsims/paper-land/assets/1902116/5cf68652-d19c-4b09-9feb-a0568bf8e319

jessegreenberg commented 6 months ago

The original paper-programs project supports only one program per marker. Relevant code is https://github.com/phetsims/paper-land/blob/4a2ce244ef4676061d696dbc042be105b66193a5/client/utils.js#L166-L196

https://github.com/phetsims/paper-land/blob/ad5fcbd116b83763962eedff69114cf0bc98ad36/client/board/LocalStorageBoardController.js#L568-L571

and the markers API https://github.com/janpaul123/paperprograms/blob/master/docs/api.md#marker-points

Lets discuss alternatives and decide if this is something we would like to work on changing.

brettfiedler commented 6 months ago

Possible options, not sure of cost of any:

  1. Choose the smaller program (very specific to our use case)
  2. Ignore programs without marker code (no contents in onMarkerAdded/Removed/ChangedPosition)
  3. Allow markers to trigger multiple programs (nothing would happen if no marker code)
brettfiedler commented 6 months ago

For now, we will try shifting the way we focus to a whisker instead of a position within bounds. If that is a problem we can revisit this. This might crop up elsewhere as a problem.