-
Notifications
You must be signed in to change notification settings - Fork 5
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
Comments
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? |
@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:
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 );
|
Meeting 2022-07-27 ideas around this:
|
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. |
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
Visuals
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: {}
The text was updated successfully, but these errors were encountered: