phetsims / shred

A library of JavaScript code that is used in PhET simulations that depict atoms, subatomic particles, and atomic structure. This was originally created to contain the code that is shared between the "Build an Atom" and "Isotopes and Atomic Mass" simulations, thought it may be applied to additional simulations in the future.
GNU General Public License v3.0
1 stars 6 forks source link

Particle type should not be a Property #21

Closed samreid closed 7 years ago

samreid commented 7 years ago

@jbphet and I suspect that Particle.typeProperty became to be a Property because it used to be initialized in the PropertySet and PropertySet was refactored to Property. We should change it to being a normal (read-only) attribute instead of a Property because we never have an electron change into a proton (for instance).

Don't forget to fix the reference in phet-io as well.

jbphet commented 7 years ago

Done, closing.

jonathanolson commented 7 years ago

Looks like rutherford-scattering either didn't pick up changes or it wasn't pushed:

rutherford-scattering : fuzz : require.js : run
Uncaught TypeError: Cannot read property 'get' of undefined
TypeError: Cannot read property 'get' of undefined
    at https://bayes.colorado.edu/continuous-testing/snapshot-1488328981490/rutherford-scattering/js/rutherfordatom/view/RutherfordNucleusNode.js?bust=1488351486847:328:38
    at Array.forEach (native)
    at RutherfordNucleusNode.paintNucleusIcon (https://bayes.colorado.edu/continuous-testing/snapshot-1488328981490/rutherford-scattering/js/rutherfordatom/view/RutherfordNucleusNode.js?bust=1488351486847:301:16)
    at RutherfordNucleusNode.paintCanvas (https://bayes.colorado.edu/continuous-testing/snapshot-1488328981490/rutherford-scattering/js/rutherfordatom/view/RutherfordNucleusNode.js?bust=1488351486847:203:9)
    at RutherfordNucleusNode.canvasPaintSelf (https://bayes.colorado.edu/continuous-testing/snapshot-1488328981490/scenery/js/nodes/CanvasNode.js?bust=1488351486847:125:12)
    at RutherfordNucleusNode.renderToCanvasSelf (https://bayes.colorado.edu/continuous-testing/snapshot-1488328981490/scenery/js/nodes/Node.js?bust=1488351486847:3876:14)
    at RutherfordNucleusNode.renderToCanvasSubtree (https://bayes.colorado.edu/continuous-testing/snapshot-1488328981490/scenery/js/nodes/Node.js?bust=1488351486847:3892:12)
    at RutherfordNucleusNode.toCanvas (https://bayes.colorado.edu/continuous-testing/snapshot-1488328981490/scenery/js/nodes/Node.js?bust=1488351486847:4006:12)
    at RutherfordNucleusNode.toDataURL (https://bayes.colorado.edu/continuous-testing/snapshot-1488328981490/scenery/js/nodes/Node.js?bust=1488351486847:4030:12)
    at RutherfordNucleusNode.toImage (https://bayes.colorado.edu/continuous-testing/snapshot-1488328981490/scenery/js/nodes/Node.js?bust=1488351486847:4056:12)
Approximately 2/28/2017, 5:43:01 PM

nucleon.typeProperty is undefined.

refactoringIssuesCausedByNotUsingPropertySetStyleES5GetterSetter++

samreid commented 7 years ago

Can you help me understand the problem here? It looks like RutherfordNucleusNode is using nucleon.typeProperty and shred/Particle.js declares typeProperty. So I'm not sure how this is failing.

jonathanolson commented 7 years ago

shred/Particle.js declares typeProperty

After this issue, typeProperty became type in shred/Particle. Pull and fuzz, and it should fail out.

samreid commented 7 years ago

Ah, I get it. Particles don't change from "electron" to "neutron", so it doesn't make sense for their type to be an axon property. It looks like when we changed this we forgot others were using shred.

jonathanolson commented 7 years ago

Applied presumably what the fix would be, @jbphet can you review?

jbphet commented 7 years ago

Fix looks good, sorry for not catching this myself and making the change. Closing.