From e058dfff5e3b5304ee52b46cfdc18fd8f3b44148 Mon Sep 17 00:00:00 2001 From: denz1994 Date: Wed, 4 Mar 2020 10:59:01 -0500 Subject: [PATCH] Interrupt drag events when collections are swapped. https://github.com/phetsims/build-a-molecule/issues/162 --- js/common/view/BAMScreenView.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/common/view/BAMScreenView.js b/js/common/view/BAMScreenView.js index f0273c54..0a7d9b26 100644 --- a/js/common/view/BAMScreenView.js +++ b/js/common/view/BAMScreenView.js @@ -195,6 +195,13 @@ class BAMScreenView extends ScreenView { // When a collection is changed, update the listeners to the kits and KitPlayAreaNode. kitCollectionList.currentCollectionProperty.link( ( collection, previousCollection ) => { + console.log( 'TEST' ); + this.kitPlayAreaNode.atomLayer.children.forEach( otherAtomNode => { + if ( otherAtomNode ) { + otherAtomNode.interruptSubtreeInput(); + otherAtomNode.atom.userControlledProperty.reset(); + } + } ); if ( previousCollection ) { previousCollection.kits.forEach( kit => {