Skip to content

Commit 8bb7d22

Browse files
committed
Allow for the AllFilledNode to show again after it resets.
#135
1 parent 6ede9ff commit 8bb7d22

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

js/common/model/KitCollection.js

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ define( require => {
139139
this.collectionBoxes.forEach( box => { box.reset(); } );
140140
this.kits.forEach( kit => { kit.reset(); } );
141141
this.hasBlinkedOnce = false;
142+
this.allCollectionBoxesFilledProperty.reset();
142143
}
143144
}
144145

js/common/view/BAMScreenView.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ define( require => {
153153
kitPanel.reset();
154154
this.updateRefillButton();
155155

156-
// If the nextCollectionButton is present on screen dispose it.
156+
// If the nextCollectionButton is present on screen hide it.
157157
if ( this.children.includes( this.nextCollectionButton ) ) {
158-
this.removeChild( this.nextCollectionButton );
158+
this.nextCollectionButton.visible = false
159159
}
160160
},
161161
right: this.layoutBounds.right - BAMConstants.VIEW_PADDING * 1.3,

js/common/view/MoleculeCollectingScreenView.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ define( require => {
3737
super( kitCollectionList );
3838
this.kitCollectionList = kitCollectionList;
3939

40+
// @private
41+
this.hasShownOnce = false;
42+
4043
// @private {TextPushButton} Create a next collection button
4144
this.nextCollectionButton = new TextPushButton( nextCollectionString, {
4245
centerX: this.layoutBounds.centerX - 100,
@@ -110,6 +113,11 @@ define( require => {
110113
// notify attachment
111114
collectionAttachmentCallbacks.forEach( callback => { callback(); } );
112115

116+
// Affects whether the AllFilledNode will show after resetting.
117+
this.resetAllButton.addListener( () => {
118+
this.hasShownOnce = false;
119+
} );
120+
113121
// Adjust the center of the AllFilledNode
114122
this.visibleBoundsProperty.link( () => {
115123
this.allFilledNode.center = BAMConstants.STAGE_SIZE.center;
@@ -124,14 +132,14 @@ define( require => {
124132
*/
125133
addCollection( collection ) {
126134
const kitCollectionNode = BAMScreenView.prototype.addCollection.call( this, collection, true );
127-
let hasShownOnce = false;
135+
this.hasShownOnce = false;
128136

129137
// show dialog the 1st time all collection boxes are filled
130138
collection.allCollectionBoxesFilledProperty.link( filled => {
131139
if ( filled ) {
132-
if ( !hasShownOnce ) {
140+
if ( !this.hasShownOnce ) {
133141
this.allFilledNode.show();
134-
hasShownOnce = true;
142+
this.hasShownOnce = true;
135143
}
136144
}
137145
} );

0 commit comments

Comments
 (0)