phetsims / equality-explorer

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

Revise snapshot implementation #199

Closed pixelzoom closed 2 years ago

pixelzoom commented 2 years ago

The snapshot feature currently works correctly in the sim. But there are multiple deficiencies that are exposed by PhET-iO, including:

pixelzoom commented 2 years ago

Lot of work, many changes here. But the end result is much better, the Studio tree makes more sense, and there are fewer dynamic elements.

The first checklist item above was a bit of a compromise, but as I noted in SnapshotNode.ts:

// It's unfortunate that EquationNode is not created from snapshotProperty. But creating it from what's
// currently on the balance scale allows us to reuse the same code that displays the equation for the
// balance scale. And the end result is correct.
const equationNode = new EquationNode( scene.leftTermCreators, scene.rightTermCreators, {

Closing.

pixelzoom commented 2 years ago

Reopening. There are a couple of additional tasks to do:

pixelzoom commented 2 years ago

Using copies for Term for snapshots uses more memory than object literals, but still seems reasonable. Since it simplifies the implementation (and eventually the IOType), I think it's worth the extra memory resources.

Closing.

pixelzoom commented 2 years ago

Reopening. I neglected to dispose of the Terms created for the snapshots.

pixelzoom commented 2 years ago

Summary of the above changes:

Closing.