Skip to content

Commit

Permalink
fix centering of NumberNode, #80
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Mar 1, 2023
1 parent 39abb60 commit 536023f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/common/view/NumberNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 536023f

Please sign in to comment.