phetsims / expression-exchange

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

Return coins that go off screen #32

Closed phet-steele closed 8 years ago

phet-steele commented 8 years ago

Something from the design doc @jbphet wanted in an issue:

An expression that goes off screen, when broken apart, needs to return coins inside the layout bounds.

I could see this also applying to combined coins which are close to the edge of the screen when they are broken apart.

jbphet commented 8 years ago

I've added code that moves coin terms that end up outside of the dev bounds to the top of the in-bounds play area. There is some detection and avoidance done of coin terms that are already in that space. I can't say that I think this approach is great, because it would be better to make the coin terms come in bounds and end up near the other coin terms that came from the same expression or composite coin term. The problem with doing this is that the algorithm for finding a good nearby location would be much more complex, given that it would have to handle cases where the expression is at the bottom of the bounds, or the top, or in a corner, or wherever. So, I'm going to assign this to @ariel-phet (and he can pass off to @amanda-phet if desired) to say whether the approach that I've just implemented is good enough considering that this is going to be a pretty unusual use case, or if I should work towards a more sophisticated redistribution algorithm. I would estimate 2-3 hours of development effort to come up with a significantly better alternative.

ariel-phet commented 8 years ago

I think this is good enough, we can see if problems arise in interviews, but you have made a good faith effort to deal with an issue that is an edge case. Closing