Closed AgustinVallejo closed 9 months ago
Usage in KeplersLawsScreenView.ts is correct, see line 292:
const stopwatchNode = new StopwatchNode(
model.stopwatch, {
dragBoundsProperty: this.visibleBoundsProperty,
visibleProperty: model.stopwatchVisibleProperty,
numberDisplayOptions: {
numberFormatter: StopwatchNode.createRichTextNumberFormatter( {
showAsMinutesAndSeconds: false,
numberOfDecimalPlaces: 2,
292 units: KeplersLawsStrings.units.yearsStringProperty
} )
}
}
);
The problem is in StopwatchNode createRichTextNumberFormatter
. It creates a formatter that only updates when the time value changes. When the stopwatch is running, you'll see "years" update properly. For example, running with `stringTest=dynamic" and starting the stopwatch, I see:
I wouldn't worry about this for Kepler's Law. The stopwatch units will update properly when the stopwatch starts running. Not great, but not blocking.
I'll transfer this issue to scenery-phet, and assign to @samreid -- it looks like he added this function in https://github.com/phetsims/scenery-phet/commit/21f6e5a1b20c3e55603acef35711dfbd0d0b1aad.
Also noting that the root of this problem is actually in NumberDisplay, and is related to https://github.com/phetsims/scenery-phet/issues/812. Imo NumberDisplay needs a rewrite. It has gotten too complicated, and it's difficult to support dynamic locale with the current API and implementation.
@matthew-blackman and I reviewed this patch in the context of the Sound simulation.
This experiment demonstrates that the stopwatch can be made to update the text on that string change, even when paused. However, baking this specific stopwatch-related string into NumberDisplay is not practical. I agree with @pixelzoom remarks above and not sure what, if anything, should be done in the meantime.
We realized this means the units wouldn't change when changing English to another language, so we investigated adding another dependency to trigger the update. This is working in the sound sim.
@DianaTavares or @AgustinVallejo or @matthew-blackman can you clarify if this is required for Sound Waves or Kepler's Law?
@samreid Not sure if 'needed' but there's definitely a Stopwatch Node in Kepler's.
I've played around with changing the locale, and the stopwatch definitely feels a little confusing and janky. My opinion in https://github.com/phetsims/scenery-phet/issues/814#issuecomment-1678814420 was that it's not blocking. But it's not my call.
Agree with CM. This is not blocking in Kepler. Unassigning Diana and I.
This was fixed by @samreid in https://github.com/phetsims/scenery-phet/issues/824. Closing.
Looking at keplers-laws/js/common/view/KeplersLawsScreenView.ts:284 the pattern is technically correct but when running the string tests, it still says 'years'. Not sure what to do about it