From 536023ffafa609a0528d05590eb9192fe807f5e7 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Wed, 1 Mar 2023 13:49:42 -0700 Subject: [PATCH] fix centering of NumberNode, https://github.com/phetsims/reactants-products-and-leftovers/issues/80 --- js/common/view/NumberNode.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/common/view/NumberNode.ts b/js/common/view/NumberNode.ts index 1957d62..7e94aae 100644 --- a/js/common/view/NumberNode.ts +++ b/js/common/view/NumberNode.ts @@ -31,13 +31,15 @@ export default class NumberNode extends Text { decimalPlaces: 0 }, providedOptions ); - super( '', options ); + super( '' ); const numberPropertyObserver = ( value: number ) => { this.text = Utils.toFixed( value, options.decimalPlaces ); }; numberProperty.link( numberPropertyObserver ); // must be unlinked in dispose + this.mutate( options ); + this.disposeNumberNode = () => { if ( numberProperty.hasListener( numberPropertyObserver ) ) { numberProperty.unlink( numberPropertyObserver );