-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add support for dynamic locale #140
Comments
In the above commits, I converted the easy stuff to StringProperty. Still to be done:
|
@kathy-phet asked me to finish this off, in preparation for publishing with character sets for the Region and Culture feature. ..."looking at early Feb for when this would need to be ready." |
In a Slack#DM with @amanda-phet, we determined that #142 is behind schedule, and it's unclear when this needs to be ready for QA. So I'm going to defer this issue to work on other higher-priority things. @amanda-phet Please assign this back to me when I should start working on it. I'll need a minimum of 2 weeks notice to get this ready for QA. |
In the above commits, I added a guard to prevent reentry of // to prevent stack overflow, see https://github.com/phetsims/graphing-lines/issues/140#issuecomment-1904968755
let isUpdatingLayout = false; This works in PointSlopeEquationNode, but not in SlopeInterceptEquationNode, where I've added this TODO: const dynamicStringMultilink = Multilink.lazyMultilink(
//TODO https://github.com/phetsims/graphing-lines/issues/140 Adding xText.boundsProperty to dependencies fails with 'stack size exceeded', despite isUpdatingLayout guards
[ yText.boundsProperty, GraphingLinesStrings.slopeUndefinedStringProperty ], |
PointSlopeEquationNode was failing CT with 'stack size exceeded'. So in 793ff35, I remove the |
I was asked to resume this work, see #142 (comment). |
I'll need @jonathanolson's assistance debugging the "stack size exceeded" problems. We're meeting on 2/6/2024. @jonathanolson If you'd like to take a look ahead of time, here are the 2 cases that are failing, with the failing dependencies commented out. Both of these cases will fail on startup. SlopeInterceptEquationNode.ts: // If dynamic strings change, update the layout. xNode.boundsProperty and yNode.boundsProperty are RichText that
// are observing a StringProperty. slopeUndefinedStringProperty is used in this.updateLayout.
const dynamicStringMultilink = Multilink.lazyMultilink(
//TODO https://github.com/phetsims/graphing-lines/issues/140 Adding xText.boundsProperty to dependencies fails with 'stack size exceeded'.
// [ xText.boundsProperty, yText.boundsProperty, GraphingLinesStrings.slopeUndefinedStringProperty ],
[ yText.boundsProperty, GraphingLinesStrings.slopeUndefinedStringProperty ],
() => updateLayout( lineProperty.value )
); PointSlopeEquationNode.ts: // If dynamic strings change, update the layout. xNode.boundsProperty and yNode.boundsProperty are RichText that
// are observing a StringProperty. slopeUndefinedStringProperty is used in this.updateLayout.
const dynamicStringMultilink = Multilink.lazyMultilink(
//TODO https://github.com/phetsims/graphing-lines/issues/140 Adding xText.boundsProperty and yText.boundsProperty to dependencies fails with 'stack size exceeded'.
// [ xText.boundsProperty, yText.boundsProperty, GraphingLinesStrings.slopeUndefinedStringProperty ],
[ GraphingLinesStrings.slopeUndefinedStringProperty ],
() => updateLayout( lineProperty.value )
); |
Checked into SlopeInterceptEquationNode. xText's x-translation value seems to be ping-ponging. There's a lot of logic, so I didn't trace down the exact pattern (if that's helpful to do, let me know). However we're very clearly listening to (and modifying) xText's bounds (because we are positioning it), so we've created a lot of infinite-loop potential. I didn't check PointSlopeEquationNode, but it seems likely something similar is happening there. For the dynamic locale support, we're presumably caring about xText's localBounds (that change with the GLSymbols.xStringProperty). Listening directly to the localBounds kills both of the infinite loops (since updating xText's position won't trigger another loop). Committed the localBounds change above. Let me know if that looks good (and available at the planned 10am for discussion). |
I always forget about observing |
@amanda-phet This is ready for review. The easiest way to review is with |
Thanks for reminding me of that query parameter. All is looking good to me. |
No description provided.
The text was updated successfully, but these errors were encountered: