diff --git a/js/common/view/CompassNeedleNode.ts b/js/common/view/CompassNeedleNode.ts index 0ace2988..acf4c82b 100644 --- a/js/common/view/CompassNeedleNode.ts +++ b/js/common/view/CompassNeedleNode.ts @@ -11,8 +11,9 @@ import faradaysElectromagneticLab from '../../faradaysElectromagneticLab.js'; import { Shape } from '../../../../kite/js/imports.js'; import FELColors from '../FELColors.js'; -import { Node, Path, TColor } from '../../../../scenery/js/imports.js'; +import { Node, NodeOptions, Path, TColor } from '../../../../scenery/js/imports.js'; import optionize from '../../../../phet-core/js/optionize.js'; +import PickOptional from '../../../../phet-core/js/types/PickOptional.js'; const NEEDLE_ASPECT_RATIO = 25 / 7; // length:waist @@ -26,13 +27,13 @@ type SelfOptions = { southFill?: TColor; }; -type CompassNeedleNodeOptions = SelfOptions; +type CompassNeedleNodeOptions = SelfOptions & PickOptional; export default class CompassNeedleNode extends Node { public constructor( providedOptions?: CompassNeedleNodeOptions ) { - const options = optionize()( { + const options = optionize()( { // SelfOptions length: 25, @@ -65,9 +66,9 @@ export default class CompassNeedleNode extends Node { lineWidth: 0.5 } ); - super( { - children: [ southPath, northPath, unionPath ] - } ); + options.children = [ southPath, northPath, unionPath ]; + + super( options ); } } diff --git a/js/common/view/FieldNode.ts b/js/common/view/FieldNode.ts index c3c68b38..0c70fcb6 100644 --- a/js/common/view/FieldNode.ts +++ b/js/common/view/FieldNode.ts @@ -86,11 +86,11 @@ export default class FieldNode extends Sprites { // Convert a CompassNeedleNode to a Sprite. const compassNeedleNode = new CompassNeedleNode( { northFill: compassNeedleNorthColor, - southFill: compassNeedleSouthColor - } ); + southFill: compassNeedleSouthColor, - // Apply a scale to increase resolution (we'll apply the inverse scale when rendering). - compassNeedleNode.scale( COMPASS_NEEDLE_RESOLUTION_MULTIPLIER ); + // Apply a scale to increase resolution (we'll apply the inverse scale when rendering). + scale: COMPASS_NEEDLE_RESOLUTION_MULTIPLIER + } ); let spriteImage!: SpriteImage;