phetsims / number-compare

"Number Compare" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 0 forks source link

CT: multitouch fuzz issues #2

Closed samreid closed 1 year ago

samreid commented 1 year ago

When running with &fuzz&fuzzPointers=2, I see

Assertion failed: attempted to push away countingObject that was not over ten frame

assert.js:28 Uncaught Error: Assertion failed: attempted to push away countingObject that was not over ten frame
    at window.assertions.assertFunction (assert.js:28:13)
    at TenFrame.pushAwayCountingObject (TenFrame.ts:73:15)
    at OnesPlayAreaNode.ts:338:29
    at Array.forEach (<anonymous>)
    at OnesPlayAreaNode.tryToAddToTenFrame (OnesPlayAreaNode.ts:322:38)
    at OnesPlayAreaNode.tryToCombineNumbers (OnesPlayAreaNode.ts:255:15)
    at DragListener.end [as _end] (PaperNumberNode.ts:133:11)
    at DragListener.ts:394:25
    at DragListener.onRelease (PressListener.ts:752:17)
    at PhetioAction.execute (PhetioAction.ts:124:17)
chrisklus commented 1 year ago

Thanks @samreid! I was investigating this issue on Monday - it's interesting that it seems to happen only on multitouch when fuzzing. I was able to figure out how to reproduce without fuzzing on a regular sim run. The problem was happening because there were two separate comparisons to see if a counting object is on top of a tenFrame. One was using the true, visible center of the counting object, and the other was using the origin, which is unfortunately not the center of the Node because of how the positioning of the numbers works with the papers.

I looked into re-laying out the counting objects so those centers matched, but it wasn't worth trying to rewrite all of the positioning for the paper number digits, so I just factored out a check for true center of the counting object in tenFrame.ts. This has fixed the problem on my machine so I'm going to close, but will re-open if I see it again.