Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holding down the add pair button is interrupted seemingly randomly #31

Closed
KatieWoe opened this issue Jun 9, 2022 · 4 comments
Closed
Assignees
Labels
type:bug Something isn't working

Comments

@KatieWoe
Copy link
Contributor

KatieWoe commented Jun 9, 2022

Test device
Dell
Operating System
Win 11
Browser
Chrome
Problem description
For phetsims/qa#809.
When holding down the buttons to add a proton and a neutron, the press is interrupted for seemingly no reason. If you start from empty and hold down the add pair button it stops at Tc-86, then again at Ru-88. This does not seem to be connected to a nuclide that doesn't form from what I can tell. This may also happen with other buttons, but this was the easiest for me to see.
Steps to reproduce

  1. Start from an empty nuclide
  2. Press down the add both button and don't let go
  3. Repeat

Visuals
holddownbutton

Troubleshooting information:

!!!!! DO NOT EDIT !!!!!
Name: ‪Build a Nucleus‬
URL: https://phet-dev.colorado.edu/html/build-a-nucleus/1.0.0-betaDecay.11/phet/build-a-nucleus_all_phet.html
Version: 1.0.0-betaDecay.11 2022-06-04 01:06:50 UTC
Features missing: applicationcache, applicationcache, touch
Flags: pixelRatioScaling
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36
Language: en-US
Window: 1280x649
Pixel Ratio: 1.5/1
WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium)
GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)
Vendor: WebKit (WebKit WebGL)
Vertex: attribs: 16 varying: 30 uniform: 4096
Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32)
Max viewport: 32767x32767
OES_texture_float: true
Dependencies JSON: {}

@KatieWoe KatieWoe added the type:bug Something isn't working label Jun 9, 2022
@Luisav1
Copy link
Contributor

Luisav1 commented Jun 23, 2022

Meeting June 22, 2022

@ariel-phet it's okay to not fix this for the prototype but personally wouldn't let this go out for true publication with this bug because we don't want to have to answer the question "why" when there is no why - such as here where the random interruptions have no pattern/trend.

@ariel-phet could it be a memory issue? @chrisklus doubts it because it's the same on every platform we tried and it follows the same random pattern 0 -> 86 nucleons, then one more click, then keeps going.

@ariel-phet if you change the animation speed would it stop at a different number?

@chrisklus
Copy link
Contributor

@Luisav1 and I figured out the why! It is because the double arrow button does not actually work how it appears to work. When a proton and neutron are emitted at the same time, they cannot be received by the atom atomically (both at the same time) - they have to be added individually because shred/ParticleAtom tracks each type of particle in its own array. So, whenever the double arrow is pressed, the model is not immediately jumping up by two nucleons - it's changing by one and then the other. The reason this "pause" first happens is because 44,43 is the first set of nucleons that is one away from matching proton/neutron counts that does not form. This means that the enabledProperty of the double up button blips to off, and cancels the press before it's re-enabled.

We briefly talked about some ideas to fix this, but it does not seem doable without significant changes in BAN code and shred code, and it will be complicated.

Here are the logs:

protons: 1, neutrons: 0, doesExist: true
protons: 1, neutrons: 1, doesExist: true
protons: 2, neutrons: 1, doesExist: true
protons: 2, neutrons: 2, doesExist: true
protons: 3, neutrons: 2, doesExist: true
protons: 3, neutrons: 3, doesExist: true
protons: 4, neutrons: 3, doesExist: true
protons: 4, neutrons: 4, doesExist: true
protons: 5, neutrons: 4, doesExist: true
protons: 5, neutrons: 5, doesExist: true
protons: 6, neutrons: 5, doesExist: true
protons: 6, neutrons: 6, doesExist: true
protons: 7, neutrons: 6, doesExist: true
protons: 7, neutrons: 7, doesExist: true
protons: 8, neutrons: 7, doesExist: true
protons: 8, neutrons: 8, doesExist: true
protons: 9, neutrons: 8, doesExist: true
protons: 9, neutrons: 9, doesExist: true
protons: 10, neutrons: 9, doesExist: true
protons: 10, neutrons: 10, doesExist: true
protons: 11, neutrons: 10, doesExist: true
protons: 11, neutrons: 11, doesExist: true
protons: 12, neutrons: 11, doesExist: true
protons: 12, neutrons: 12, doesExist: true
protons: 13, neutrons: 12, doesExist: true
protons: 13, neutrons: 13, doesExist: true
protons: 14, neutrons: 13, doesExist: true
protons: 14, neutrons: 14, doesExist: true
protons: 15, neutrons: 14, doesExist: true
protons: 14, neutrons: 14, doesExist: true
protons: 14, neutrons: 15, doesExist: true
protons: 14, neutrons: 14, doesExist: true
protons: 15, neutrons: 14, doesExist: true
protons: 15, neutrons: 15, doesExist: true
protons: 16, neutrons: 15, doesExist: true
protons: 15, neutrons: 15, doesExist: true
protons: 15, neutrons: 16, doesExist: true
protons: 15, neutrons: 15, doesExist: true
protons: 16, neutrons: 15, doesExist: true
protons: 16, neutrons: 16, doesExist: true
protons: 17, neutrons: 16, doesExist: true
protons: 16, neutrons: 16, doesExist: true
protons: 16, neutrons: 17, doesExist: true
protons: 16, neutrons: 16, doesExist: true
protons: 17, neutrons: 16, doesExist: true
protons: 17, neutrons: 17, doesExist: true
protons: 18, neutrons: 17, doesExist: true
protons: 17, neutrons: 17, doesExist: true
protons: 17, neutrons: 18, doesExist: true
protons: 17, neutrons: 17, doesExist: true
protons: 18, neutrons: 17, doesExist: true
protons: 18, neutrons: 18, doesExist: true
protons: 19, neutrons: 18, doesExist: true
protons: 18, neutrons: 18, doesExist: true
protons: 18, neutrons: 19, doesExist: true
protons: 18, neutrons: 18, doesExist: true
protons: 19, neutrons: 18, doesExist: true
protons: 19, neutrons: 19, doesExist: true
protons: 20, neutrons: 19, doesExist: true
protons: 19, neutrons: 19, doesExist: true
protons: 19, neutrons: 20, doesExist: true
protons: 19, neutrons: 19, doesExist: true
protons: 20, neutrons: 19, doesExist: true
protons: 20, neutrons: 20, doesExist: true
protons: 21, neutrons: 20, doesExist: true
protons: 20, neutrons: 20, doesExist: true
protons: 20, neutrons: 21, doesExist: true
protons: 20, neutrons: 20, doesExist: true
protons: 21, neutrons: 20, doesExist: true
protons: 21, neutrons: 21, doesExist: true
protons: 22, neutrons: 21, doesExist: true
protons: 21, neutrons: 21, doesExist: true
protons: 21, neutrons: 22, doesExist: true
protons: 21, neutrons: 21, doesExist: true
protons: 22, neutrons: 21, doesExist: true
protons: 22, neutrons: 22, doesExist: true
protons: 23, neutrons: 22, doesExist: true
protons: 22, neutrons: 22, doesExist: true
protons: 22, neutrons: 23, doesExist: true
protons: 22, neutrons: 22, doesExist: true
protons: 23, neutrons: 22, doesExist: true
protons: 23, neutrons: 23, doesExist: true
protons: 24, neutrons: 23, doesExist: true
protons: 23, neutrons: 23, doesExist: true
protons: 23, neutrons: 24, doesExist: true
protons: 23, neutrons: 23, doesExist: true
protons: 24, neutrons: 23, doesExist: true
protons: 24, neutrons: 24, doesExist: true
protons: 25, neutrons: 24, doesExist: true
protons: 24, neutrons: 24, doesExist: true
protons: 24, neutrons: 25, doesExist: true
protons: 24, neutrons: 24, doesExist: true
protons: 25, neutrons: 24, doesExist: true
protons: 25, neutrons: 25, doesExist: true
protons: 26, neutrons: 25, doesExist: true
protons: 25, neutrons: 25, doesExist: true
protons: 25, neutrons: 26, doesExist: true
protons: 25, neutrons: 25, doesExist: true
protons: 26, neutrons: 25, doesExist: true
protons: 26, neutrons: 26, doesExist: true
protons: 27, neutrons: 26, doesExist: true
protons: 26, neutrons: 26, doesExist: true
protons: 26, neutrons: 27, doesExist: true
protons: 26, neutrons: 26, doesExist: true
protons: 27, neutrons: 26, doesExist: true
protons: 27, neutrons: 27, doesExist: true
protons: 28, neutrons: 27, doesExist: true
protons: 27, neutrons: 27, doesExist: true
protons: 27, neutrons: 28, doesExist: true
protons: 27, neutrons: 27, doesExist: true
protons: 28, neutrons: 27, doesExist: true
protons: 28, neutrons: 28, doesExist: true
protons: 29, neutrons: 28, doesExist: true
protons: 28, neutrons: 28, doesExist: true
protons: 28, neutrons: 29, doesExist: true
protons: 28, neutrons: 28, doesExist: true
protons: 29, neutrons: 28, doesExist: true
protons: 29, neutrons: 29, doesExist: true
protons: 30, neutrons: 29, doesExist: true
protons: 29, neutrons: 29, doesExist: true
protons: 29, neutrons: 30, doesExist: true
protons: 29, neutrons: 29, doesExist: true
protons: 30, neutrons: 29, doesExist: true
protons: 30, neutrons: 30, doesExist: true
protons: 31, neutrons: 30, doesExist: true
protons: 30, neutrons: 30, doesExist: true
protons: 30, neutrons: 31, doesExist: true
protons: 30, neutrons: 30, doesExist: true
protons: 31, neutrons: 30, doesExist: true
protons: 31, neutrons: 31, doesExist: true
protons: 32, neutrons: 31, doesExist: true
protons: 32, neutrons: 32, doesExist: true
protons: 33, neutrons: 32, doesExist: true
protons: 32, neutrons: 32, doesExist: true
protons: 32, neutrons: 33, doesExist: true
protons: 32, neutrons: 32, doesExist: true
protons: 33, neutrons: 32, doesExist: true
protons: 33, neutrons: 33, doesExist: true
protons: 34, neutrons: 33, doesExist: true
protons: 33, neutrons: 33, doesExist: true
protons: 33, neutrons: 34, doesExist: true
protons: 33, neutrons: 33, doesExist: true
protons: 34, neutrons: 33, doesExist: true
protons: 33, neutrons: 33, doesExist: true
protons: 33, neutrons: 34, doesExist: true
protons: 33, neutrons: 33, doesExist: true
protons: 34, neutrons: 33, doesExist: true
protons: 34, neutrons: 34, doesExist: true
protons: 35, neutrons: 34, doesExist: true
protons: 35, neutrons: 35, doesExist: true
protons: 36, neutrons: 35, doesExist: true
protons: 35, neutrons: 35, doesExist: true
protons: 35, neutrons: 36, doesExist: true
protons: 35, neutrons: 35, doesExist: true
protons: 36, neutrons: 35, doesExist: true
protons: 35, neutrons: 35, doesExist: true
protons: 35, neutrons: 36, doesExist: true
protons: 35, neutrons: 35, doesExist: true
protons: 36, neutrons: 35, doesExist: true
protons: 36, neutrons: 36, doesExist: true
protons: 37, neutrons: 36, doesExist: true
protons: 36, neutrons: 36, doesExist: true
protons: 36, neutrons: 37, doesExist: true
protons: 36, neutrons: 36, doesExist: true
protons: 37, neutrons: 36, doesExist: true
protons: 37, neutrons: 37, doesExist: true
protons: 38, neutrons: 37, doesExist: true
protons: 37, neutrons: 37, doesExist: true
protons: 37, neutrons: 38, doesExist: true
protons: 37, neutrons: 37, doesExist: true
protons: 38, neutrons: 37, doesExist: true
protons: 38, neutrons: 38, doesExist: true
protons: 39, neutrons: 38, doesExist: true
protons: 38, neutrons: 38, doesExist: true
protons: 38, neutrons: 39, doesExist: true
protons: 38, neutrons: 38, doesExist: true
protons: 39, neutrons: 38, doesExist: true
protons: 39, neutrons: 39, doesExist: true
protons: 40, neutrons: 39, doesExist: true
protons: 39, neutrons: 39, doesExist: true
protons: 39, neutrons: 40, doesExist: true
protons: 39, neutrons: 39, doesExist: true
protons: 40, neutrons: 39, doesExist: true
protons: 40, neutrons: 40, doesExist: true
protons: 41, neutrons: 40, doesExist: true
protons: 40, neutrons: 40, doesExist: true
protons: 40, neutrons: 41, doesExist: true
protons: 40, neutrons: 40, doesExist: true
protons: 41, neutrons: 40, doesExist: true
protons: 41, neutrons: 41, doesExist: true
protons: 42, neutrons: 41, doesExist: true
protons: 42, neutrons: 42, doesExist: true
protons: 43, neutrons: 42, doesExist: true
protons: 42, neutrons: 42, doesExist: true
protons: 42, neutrons: 43, doesExist: true
protons: 42, neutrons: 42, doesExist: true
protons: 43, neutrons: 42, doesExist: true
protons: 42, neutrons: 42, doesExist: true
protons: 42, neutrons: 43, doesExist: true
protons: 42, neutrons: 42, doesExist: true
protons: 43, neutrons: 42, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 43, neutrons: 43, doesExist: true
doubleUpArrow: true
protons: 43, neutrons: 44, doesExist: true
protons: 43, neutrons: 43, doesExist: true
protons: 44, neutrons: 43, doesExist: false
doubleUpArrow: false
protons: 44, neutrons: 44, doesExist: true
doubleUpArrow: true
protons: 45, neutrons: 44, doesExist: true
protons: 44, neutrons: 44, doesExist: true
protons: 44, neutrons: 45, doesExist: true
protons: 44, neutrons: 44, doesExist: true

Here is a patch for our logging:

Index: js/common/view/BANScreenView.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/view/BANScreenView.ts b/js/common/view/BANScreenView.ts
--- a/js/common/view/BANScreenView.ts	(revision df2040e62cbc2e5456e9ecd467db4deaa26f0fbd)
+++ b/js/common/view/BANScreenView.ts	(date 1658875114215)
@@ -177,6 +177,9 @@
           if ( !AtomIdentifier.doesExist( protonCount, neutronCount ) && ( model.particleAtom.massNumberProperty.value !== 0 || userControlledNucleonCount !== 0 ) ) {
             creatorNodeEnabled( this.protonsCreatorNode, false );
             creatorNodeEnabled( this.neutronsCreatorNode, false );
+
+            console.log( 'protons: ' + protonCount + ', neutrons: ' + neutronCount + ', doesExist: ' + AtomIdentifier.doesExist( protonCount, neutronCount ) );
+
             return false;
           }
 
@@ -196,6 +199,8 @@
                                              !AtomIdentifier.doesPreviousNuclideExist( protonCount, neutronCount ) :
                                              nextOrPreviousIsoExists;
 
+            console.log( 'protons: ' + protonCount + ', neutrons: ' + neutronCount + ', doesExist: ' + doesNuclideExist );
+
             if ( nuclideExistsBoolean && doesPreviousNuclideExist ) {
               return false;
             }
@@ -208,12 +213,23 @@
     };
 
     // create the arrow enabled properties
-    const protonUpArrowEnabledProperty = createArrowEnabledProperty( 'up', ParticleType.PROTON );
-    const neutronUpArrowEnabledProperty = createArrowEnabledProperty( 'up', ParticleType.NEUTRON );
+    // const protonUpArrowEnabledProperty = createArrowEnabledProperty( 'up', ParticleType.PROTON );
+    // const neutronUpArrowEnabledProperty = createArrowEnabledProperty( 'up', ParticleType.NEUTRON );
     const doubleUpArrowEnabledProperty = createArrowEnabledProperty( 'up', ParticleType.PROTON, ParticleType.NEUTRON );
-    const protonDownArrowEnabledProperty = createArrowEnabledProperty( 'down', ParticleType.PROTON );
-    const neutronDownArrowEnabledProperty = createArrowEnabledProperty( 'down', ParticleType.NEUTRON );
-    const doubleDownArrowEnabledProperty = createArrowEnabledProperty( 'down', ParticleType.PROTON, ParticleType.NEUTRON );
+    // const protonDownArrowEnabledProperty = createArrowEnabledProperty( 'down', ParticleType.PROTON );
+    // const neutronDownArrowEnabledProperty = createArrowEnabledProperty( 'down', ParticleType.NEUTRON );
+    // const doubleDownArrowEnabledProperty = createArrowEnabledProperty( 'down', ParticleType.PROTON, ParticleType.NEUTRON );
+
+    // Multilink.multilink( [ this.model.particleAtom.protonCountProperty, this.model.particleAtom.neutronCountProperty ], ( pCount, nCount ) => {
+    //   console.log( 'protons: ' + pCount + ', neutrons: ' + nCount );
+    // }  )
+
+    // protonUpArrowEnabledProperty.link( enabled => console.log( 'protonUpArrow: ' + enabled ) );
+    // neutronUpArrowEnabledProperty.link( enabled => console.log( 'neutronUpArrow: ' + enabled ) );
+    doubleUpArrowEnabledProperty.link( enabled => console.log( 'doubleUpArrow: ' + enabled ) );
+    // protonDownArrowEnabledProperty.link( enabled => console.log( 'protonDownArrow: ' + enabled ) );
+    // neutronDownArrowEnabledProperty.link( enabled => console.log( 'neutronDownArrow: ' + enabled ) );
+    // doubleDownArrowEnabledProperty.link( enabled => console.log( 'doubleDownArrow: ' + enabled ) );
 
     // function to create the double arrow buttons
     const createDoubleArrowButtons = ( direction: DoubleArrowButtonDirection ): Node => {
@@ -224,7 +240,7 @@
         merge( {
           leftArrowFill: BANColors.protonColorProperty,
           rightArrowFill: BANColors.neutronColorProperty,
-          enabledProperty: direction === 'up' ? doubleUpArrowEnabledProperty : doubleDownArrowEnabledProperty,
+          enabledProperty: direction === 'up' ? doubleUpArrowEnabledProperty : 'doubleDownArrowEnabledProperty',
           touchAreaYDilation: TOUCH_AREA_Y_DILATION
         }, arrowButtonOptions )
       );
@@ -232,7 +248,7 @@
 
     // create the double arrow buttons
     const doubleArrowButtons = new VBox( {
-      children: [ createDoubleArrowButtons( 'up' ), createDoubleArrowButtons( 'down' ) ],
+      children: [ createDoubleArrowButtons( 'up' ) ],
       spacing: arrowButtonSpacing
     } );
     doubleArrowButtons.bottom = this.layoutBounds.maxY - BANConstants.SCREEN_VIEW_Y_MARGIN;
@@ -254,37 +270,37 @@
     };
 
     // function to create the single arrow buttons
-    const createSingleArrowButtons = ( nucleonType: ParticleType, nucleonColorProperty: ProfileColorProperty ): Node => {
-      const singleArrowButtonOptions = merge( { arrowFill: nucleonColorProperty }, arrowButtonOptions );
-      const upArrowButton = new ArrowButton( 'up', () => increaseNucleonCountListener( nucleonType ),
-        merge( {
-            enabledProperty: nucleonType === ParticleType.PROTON ? protonUpArrowEnabledProperty : neutronUpArrowEnabledProperty,
-            touchAreaYDilation: TOUCH_AREA_Y_DILATION
-          },
-          singleArrowButtonOptions )
-      );
-      const downArrowButton = new ArrowButton( 'down', () => decreaseNucleonCountListener( nucleonType ),
-        merge( {
-            enabledProperty: nucleonType === ParticleType.PROTON ? protonDownArrowEnabledProperty : neutronDownArrowEnabledProperty,
-            touchAreaYDilation: TOUCH_AREA_Y_DILATION
-          },
-          singleArrowButtonOptions )
-      );
-      return new VBox( {
-        children: [ upArrowButton, downArrowButton ],
-        spacing: arrowButtonSpacing
-      } );
-    };
+    // const createSingleArrowButtons = ( nucleonType: ParticleType, nucleonColorProperty: ProfileColorProperty ): Node => {
+    //   const singleArrowButtonOptions = merge( { arrowFill: nucleonColorProperty }, arrowButtonOptions );
+    //   const upArrowButton = new ArrowButton( 'up', () => increaseNucleonCountListener( nucleonType ),
+    //     merge( {
+    //         enabledProperty: nucleonType === ParticleType.PROTON ? protonUpArrowEnabledProperty : neutronUpArrowEnabledProperty,
+    //         touchAreaYDilation: TOUCH_AREA_Y_DILATION
+    //       },
+    //       singleArrowButtonOptions )
+    //   );
+    //   const downArrowButton = new ArrowButton( 'down', () => decreaseNucleonCountListener( nucleonType ),
+    //     merge( {
+    //         enabledProperty: nucleonType === ParticleType.PROTON ? protonDownArrowEnabledProperty : neutronDownArrowEnabledProperty,
+    //         touchAreaYDilation: TOUCH_AREA_Y_DILATION
+    //       },
+    //       singleArrowButtonOptions )
+    //   );
+    //   return new VBox( {
+    //     children: [ upArrowButton, downArrowButton ],
+    //     spacing: arrowButtonSpacing
+    //   } );
+    // };
 
     // create the single arrow buttons
-    const protonArrowButtons = createSingleArrowButtons( ParticleType.PROTON, BANColors.protonColorProperty );
-    protonArrowButtons.bottom = this.layoutBounds.maxY - BANConstants.SCREEN_VIEW_Y_MARGIN;
-    protonArrowButtons.right = doubleArrowButtons.left - HORIZONTAL_DISTANCE_BETWEEN_ARROW_BUTTONS;
-    this.addChild( protonArrowButtons );
-    const neutronArrowButtons = createSingleArrowButtons( ParticleType.NEUTRON, BANColors.neutronColorProperty );
-    neutronArrowButtons.bottom = this.layoutBounds.maxY - BANConstants.SCREEN_VIEW_Y_MARGIN;
-    neutronArrowButtons.left = doubleArrowButtons.right + HORIZONTAL_DISTANCE_BETWEEN_ARROW_BUTTONS;
-    this.addChild( neutronArrowButtons );
+    // const protonArrowButtons = createSingleArrowButtons( ParticleType.PROTON, BANColors.protonColorProperty );
+    // protonArrowButtons.bottom = this.layoutBounds.maxY - BANConstants.SCREEN_VIEW_Y_MARGIN;
+    // protonArrowButtons.right = doubleArrowButtons.left - HORIZONTAL_DISTANCE_BETWEEN_ARROW_BUTTONS;
+    // this.addChild( protonArrowButtons );
+    // const neutronArrowButtons = createSingleArrowButtons( ParticleType.NEUTRON, BANColors.neutronColorProperty );
+    // neutronArrowButtons.bottom = this.layoutBounds.maxY - BANConstants.SCREEN_VIEW_Y_MARGIN;
+    // neutronArrowButtons.left = doubleArrowButtons.right + HORIZONTAL_DISTANCE_BETWEEN_ARROW_BUTTONS;
+    // this.addChild( neutronArrowButtons );
 
     // function to keep track of when a double arrow button was clicked
     const createSingleOrDoubleArrowButtonClickedListener = ( isDoubleArrowButton: boolean, arrowButtons: Node ) => {
@@ -297,8 +313,8 @@
     };
 
     createSingleOrDoubleArrowButtonClickedListener( true, doubleArrowButtons );
-    createSingleOrDoubleArrowButtonClickedListener( false, protonArrowButtons );
-    createSingleOrDoubleArrowButtonClickedListener( false, neutronArrowButtons );
+    // createSingleOrDoubleArrowButtonClickedListener( false, protonArrowButtons );
+    // createSingleOrDoubleArrowButtonClickedListener( false, neutronArrowButtons );
 
     // create and add the electron cloud
     this.electronCloud = new Circle( {
@@ -312,27 +328,27 @@
 
     const nucleonLabelTextOptions = { font: new PhetFont( 20 ), maxWidth: 150 };
 
-    // create and add the Protons and Neutrons label
-    const protonsLabel = new Text( buildANucleusStrings.protons, nucleonLabelTextOptions );
-    protonsLabel.bottom = doubleArrowButtons.bottom;
-    protonsLabel.centerX = ( doubleArrowButtons.left - protonArrowButtons.right ) / 2 + protonArrowButtons.right;
-    this.addChild( protonsLabel );
-
-    const neutronsLabel = new Text( buildANucleusStrings.neutronsUppercase, nucleonLabelTextOptions );
-    neutronsLabel.bottom = doubleArrowButtons.bottom;
-    neutronsLabel.centerX = ( neutronArrowButtons.left - doubleArrowButtons.right ) / 2 + doubleArrowButtons.right;
-    this.addChild( neutronsLabel );
+    // // create and add the Protons and Neutrons label
+    // const protonsLabel = new Text( buildANucleusStrings.protons, nucleonLabelTextOptions );
+    // protonsLabel.bottom = doubleArrowButtons.bottom;
+    // protonsLabel.centerX = ( doubleArrowButtons.left - protonArrowButtons.right ) / 2 + protonArrowButtons.right;
+    // this.addChild( protonsLabel );
+    //
+    // const neutronsLabel = new Text( buildANucleusStrings.neutronsUppercase, nucleonLabelTextOptions );
+    // neutronsLabel.bottom = doubleArrowButtons.bottom;
+    // neutronsLabel.centerX = ( neutronArrowButtons.left - doubleArrowButtons.right ) / 2 + doubleArrowButtons.right;
+    // this.addChild( neutronsLabel );
 
     // create and add the NucleonCreatorNode for the protons
     this.protonsCreatorNode = new NucleonCreatorNode( ParticleType.PROTON, this );
     this.protonsCreatorNode.top = doubleArrowButtons.top;
-    this.protonsCreatorNode.centerX = protonsLabel.centerX;
+    // this.protonsCreatorNode.centerX = protonsLabel.centerX;
     this.addChild( this.protonsCreatorNode );
 
     // create and add the NucleonCreatorNode for the neutrons
     this.neutronsCreatorNode = new NucleonCreatorNode( ParticleType.NEUTRON, this );
     this.neutronsCreatorNode.top = doubleArrowButtons.top;
-    this.neutronsCreatorNode.centerX = neutronsLabel.centerX;
+    // this.neutronsCreatorNode.centerX = neutronsLabel.centerX;
     this.addChild( this.neutronsCreatorNode );
 
     BANScreenView.protonsCreatorNodeModelCenter = this.modelViewTransform.viewToModelPosition( this.protonsCreatorNode.center );

@Luisav1
Copy link
Contributor

Luisav1 commented Jul 27, 2022

Meeting 2022-07-27 ideas around this:

  • make it obvious that you are adding the nucleons (proton and neutron) at different times
    • but issue with this: because the way it works now is if you have another incoming nucleon that will cause does not exist it disabled it all -> "freezes" sim
  • disable "fire on hold" annoying sure but oh well if want to get prototype
  • @Luisav1 will ask advisor about this and decide which path to take

@Luisav1
Copy link
Contributor

Luisav1 commented Aug 2, 2022

Disabled the "fire on hold" feature since it's the easiest way to not have this interruption while still being able to get up to the larger nuclei just fine. While this doesn't fix the interruptions, it does avoid them from occurring. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants