@@ -34,8 +34,7 @@ class KitView extends Node {
34
34
this . kit = kit ;
35
35
36
36
// Maps for KitView elements.
37
- this . atomNodeMap = { } ; // atom.id => AtomNode
38
- this . metadataMap = { } ; // moleculeId => MoleculeControlsHBox
37
+ const atomNodeMap = { } ; // atom.id => AtomNode
39
38
40
39
// Layers
41
40
const topLayer = new Node ( ) ;
@@ -131,10 +130,10 @@ class KitView extends Node {
131
130
const particleRemovedListener = atom => {
132
131
133
132
// Remove atom view elements from bucket node and delete the reference from atom node map
134
- if ( this . atomNodeMap [ atom . id ] ) {
135
- this . atomLayer . removeChild ( this . atomNodeMap [ atom . id ] ) ;
136
- this . atomNodeMap [ atom . id ] . dispose ( ) ;
137
- delete this . atomNodeMap [ atom . id ] ;
133
+ if ( atomNodeMap [ atom . id ] ) {
134
+ this . atomLayer . removeChild ( atomNodeMap [ atom . id ] ) ;
135
+ atomNodeMap [ atom . id ] . dispose ( ) ;
136
+ delete atomNodeMap [ atom . id ] ;
138
137
}
139
138
140
139
// Remove the atom from the bucket particles
@@ -151,7 +150,7 @@ class KitView extends Node {
151
150
const atomNode = new AtomNode ( atom ) ;
152
151
153
152
// Keep track of the atomNode by mapping to its atom's ID then add to atom layer
154
- this . atomNodeMap [ atom . id ] = atomNode ;
153
+ atomNodeMap [ atom . id ] = atomNode ;
155
154
156
155
// Add the particle to the bucket atom layer and the bucket's particles.
157
156
this . atomLayer . addChild ( atomNode ) ;
@@ -178,7 +177,6 @@ class KitView extends Node {
178
177
// Get reference to atomNode and call the dragListener
179
178
const atomNode = moleculeCollectingScreenView . kitPlayAreaNode . atomNodeMap [ atom . id ] ;
180
179
181
- // REVIEW: KitPlayAreaNode is missing elements its atomNodeMap after completed collection.
182
180
if ( atomNode ) {
183
181
atomNode . dragListener . press ( event , atomNode ) ;
184
182
}
0 commit comments