phetsims / mean-share-and-balance

"Mean: Share and Balance" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
2 stars 1 forks source link

Assertion when using alt input #295

Closed jessegreenberg closed 3 months ago

jessegreenberg commented 3 months ago

Found while working on #270. To reproduce:

Stack trace:

    at window.assertions.assertFunction (assert.js:45:13)
    at Plate.addSnackToTop (Plate.ts:282:15)
    at GroupSortInteractionView.sortGroupItem (DistributeScreenView.ts:323:20)
    at GroupSortInteractionView.onSortedValue (GroupSortInteractionView.ts:403:10)
    at KeyboardListener.fire [as _fire] (GroupSortInteractionView.ts:310:20)
    at Hotkey.fire (KeyboardListener.ts:324:16)
    at Hotkey.onPress (Hotkey.ts:227:12)
marlitas commented 3 months ago

Great catch! This was a bug because group sort was not caring wether a plate was maxed out on space or not. I adjusted the logic to skip a stack that is too full. This did add some complexity to the code, so please let me know if more documentation is required.

@jessegreenberg can you review and close if all looks well?

jessegreenberg commented 3 months ago

This is working well, thanks. We talked a bit over slack about how GroupSortInteraction works with sortGroupItem, change makes sense to me. Closing.