Skip to content

Commit 70da1af

Browse files
committed
Kit maps made privte to Kit class. #115
1 parent a9becae commit 70da1af

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

js/common/view/KitView.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class KitView extends Node {
3434
this.kit = kit;
3535

3636
// Maps for KitView elements.
37-
this.atomNodeMap = {}; // atom.id => AtomNode
38-
this.metadataMap = {}; // moleculeId => MoleculeControlsHBox
37+
const atomNodeMap = {}; // atom.id => AtomNode
3938

4039
// Layers
4140
const topLayer = new Node();
@@ -131,10 +130,10 @@ class KitView extends Node {
131130
const particleRemovedListener = atom => {
132131

133132
// 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 ];
138137
}
139138

140139
// Remove the atom from the bucket particles
@@ -151,7 +150,7 @@ class KitView extends Node {
151150
const atomNode = new AtomNode( atom );
152151

153152
// 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;
155154

156155
// Add the particle to the bucket atom layer and the bucket's particles.
157156
this.atomLayer.addChild( atomNode );
@@ -178,7 +177,6 @@ class KitView extends Node {
178177
// Get reference to atomNode and call the dragListener
179178
const atomNode = moleculeCollectingScreenView.kitPlayAreaNode.atomNodeMap[ atom.id ];
180179

181-
// REVIEW: KitPlayAreaNode is missing elements its atomNodeMap after completed collection.
182180
if ( atomNode ) {
183181
atomNode.dragListener.press( event, atomNode );
184182
}

0 commit comments

Comments
 (0)