-
Notifications
You must be signed in to change notification settings - Fork 8
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
dropper.soluteProperty is missing valid values #271
Comments
Thanks @Nancy-Salpepi. I think a better user experience in Studio would be to select between the possible solutes using radio buttons. The get/setValue interface works, but it's a bit quirky. If the phetioID has a typo or there is a syntax error, Studio will catch the error and a dialog will pop up. The pH field, however, is ignored. This is true when using Set Value interface in Studio as well as when you use
I am pretty sure we asked @pixelzoom to display the pH as part of the solute value so clients have easy access to the stock pH. My guess is that the inclusion of the pH may be to blame for the strange get/setValue behavior highlighted in the example above. |
Below is a patch that sets the I didn't commit the patch because there's a lot of overhead involved, including:
Testing migration is problematic because common code is not in a stable state (as I understand it). So I'm going to wait until RC testing has been completed, and common-code changes for migration have been completed. PatchSubject: [PATCH] set validValues for dropper.soluteProperty, https://github.com/phetsims/ph-scale/issues/271
---
Index: js/micro/view/MicroScreenView.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/micro/view/MicroScreenView.ts b/js/micro/view/MicroScreenView.ts
--- a/js/micro/view/MicroScreenView.ts (revision e48561d459954db133ed343cc018963f2b8b2834)
+++ b/js/micro/view/MicroScreenView.ts (date 1674098047957)
@@ -133,7 +133,7 @@
// solutes combo box
const soluteListParent = new Node();
- const soluteComboBox = new SoluteComboBox( model.dropper.soluteProperty, model.solutes, soluteListParent, {
+ const soluteComboBox = new SoluteComboBox( model.dropper.soluteProperty, soluteListParent, {
maxWidth: 400,
tandem: options.tandem.createTandem( 'soluteComboBox' )
} );
Index: js/macro/view/MacroScreenView.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/macro/view/MacroScreenView.ts b/js/macro/view/MacroScreenView.ts
--- a/js/macro/view/MacroScreenView.ts (revision e48561d459954db133ed343cc018963f2b8b2834)
+++ b/js/macro/view/MacroScreenView.ts (date 1674097981159)
@@ -105,7 +105,7 @@
// solutes combo box
const soluteListParent = new Node();
- const soluteComboBox = new SoluteComboBox( model.dropper.soluteProperty, model.solutes, soluteListParent, {
+ const soluteComboBox = new SoluteComboBox( model.dropper.soluteProperty, soluteListParent, {
maxWidth: 400,
tandem: options.tandem.createTandem( 'soluteComboBox' )
} );
Index: js/common/model/PHModel.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/model/PHModel.ts b/js/common/model/PHModel.ts
--- a/js/common/model/PHModel.ts (revision e48561d459954db133ed343cc018963f2b8b2834)
+++ b/js/common/model/PHModel.ts (date 1674097981171)
@@ -100,7 +100,7 @@
this.beaker = new Beaker( PHScaleConstants.BEAKER_POSITION );
const yDropper = this.beaker.position.y - this.beaker.size.height - 15;
- this.dropper = new Dropper( Solute.WATER,
+ this.dropper = new Dropper( Solute.WATER, this.solutes,
new Vector2( this.beaker.position.x - 50, yDropper ),
new Bounds2( this.beaker.left + 40, yDropper, this.beaker.right - 200, yDropper ), {
tandem: options.tandem.createTandem( 'dropper' )
Index: js/common/model/Dropper.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/model/Dropper.ts b/js/common/model/Dropper.ts
--- a/js/common/model/Dropper.ts (revision e48561d459954db133ed343cc018963f2b8b2834)
+++ b/js/common/model/Dropper.ts (date 1674097981164)
@@ -38,7 +38,7 @@
// See https://github.com/phetsims/ph-scale/issues/178
public readonly visibleProperty: Property<boolean>;
- public constructor( solute: Solute, position: Vector2, dragBounds: Bounds2, providedOptions: DropperOptions ) {
+ public constructor( solute: Solute, solutes: Solute[], position: Vector2, dragBounds: Bounds2, providedOptions: DropperOptions ) {
const options = optionize<DropperOptions, SelfOptions, PHMovableOptions>()( {
@@ -59,6 +59,7 @@
super( position, dragBounds, options );
this.soluteProperty = new Property( solute, {
+ validValues: solutes,
tandem: options.tandem.createTandem( 'soluteProperty' ),
phetioValueType: Solute.SoluteIO,
phetioDocumentation: 'the solute dispensed by the dropper'
Index: js/common/view/SoluteComboBox.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/view/SoluteComboBox.ts b/js/common/view/SoluteComboBox.ts
--- a/js/common/view/SoluteComboBox.ts (revision e48561d459954db133ed343cc018963f2b8b2834)
+++ b/js/common/view/SoluteComboBox.ts (date 1674097981150)
@@ -25,7 +25,7 @@
export default class SoluteComboBox extends ComboBox<Solute> {
public constructor( selectedSoluteProperty: Property<Solute>,
- solutes: Solute[], soluteListParent: Node,
+ soluteListParent: Node,
providedOptions: SoluteComboBoxOptions ) {
const options = optionize<SoluteComboBoxOptions, SelfOptions, ComboBoxOptions>()( {
@@ -41,6 +41,9 @@
const items: ComboBoxItem<Solute>[] = [];
+ const solutes = selectedSoluteProperty.validValues!;
+ assert && assert( solutes );
+
// Create items for the listbox
solutes.forEach( solute => { |
Common migration work shouldn't block this. Please feel free to add rules and test this with 1.5. |
I agree, this seems safe to commit to master. |
In the above commits, this issue was addressed in master for ph-scale and ph-scale-basics. |
(cherry picked from commit 235e65e)
In the above commits, this issue was patched in ph-scale 1.6 and its dependencies. |
In the above commits, this issue was patched in ph-scale-basics 1.6 and its dependencies. |
So much for "safe to proceed". Migration from ph-scale 1.5 => 1.6 works OK. But migration from ph-scale-basics 1.5. => 1.6 fails (in master!) with:
|
This is issue #268. On hold until that issue is addressed. |
Assertion was resolved by adding missing rules to ph-scale-basics-migration-rules.ts, see phetsims/ph-scale-basics#56. This is ready for testing in the next RC. |
This is not ready for RC. Need to cherry-pick changes from phetsims/ph-scale-basics#56. |
@samreid and I will not cherry pick anything into branches for this issue, but will make sure that once other, blocking issues have their content cherry picked, that this is working correctly. |
Just to clarify... Changes to ph-scale and API files have already been cherry-picked. What has not been cherry-picked is changes to migration rules. I think that's what @zepumph is saying that they "will not cherry pick" in the preceding comment. |
@zepumph and I cherry-picked the related changes, and regenerated the API files. It is working correctly locally. Would be good for @Nancy-Salpepi to confirm in RC.2. |
I confirmed in ph-scale and basics 1.6.0-rc.2. Over to QA. |
This looks good in rc.3 for pH Scale and pH Scale Basics. Closing! |
Test device
Macbook air (m1 chip)
Operating System
13.1
Browser
safari
Problem description
For phetsims/qa#872 and phetsims/qa#873, the solutes should have set values (radio buttons instead of get/set value buttons).
The text was updated successfully, but these errors were encountered: