diff --git a/js/common/view/GuideNode.ts b/js/common/view/GuideNode.ts index bf0c3ae8..985f7bdb 100644 --- a/js/common/view/GuideNode.ts +++ b/js/common/view/GuideNode.ts @@ -45,12 +45,8 @@ class GuideNode extends Node { const fulcrumNode = new Circle( FULCRUM_RADIUS, FULCRUM_OPTIONS ); // The arms are two rectangles, with left center side laying on fulcrum initially. - const armOptions = { - stroke: ARM_STROKE, - fill: armColor - }; - const incidentArmNode = new Rectangle( fulcrumNode.x, fulcrumNode.y - ARM_HEIGHT / 2, ARM_WIDTH, ARM_HEIGHT, armOptions ); - const transmittedArmNode = new Rectangle( fulcrumNode.x, fulcrumNode.y - ARM_HEIGHT / 2, ARM_WIDTH, ARM_HEIGHT, armOptions ); + const incidentArmNode = createArmNode( armColor ); + const transmittedArmNode = createArmNode( armColor ); const options = optionize( { @@ -147,6 +143,17 @@ class GuideNode extends Node { } } +/** + * Creates one of the guide arms. + * @param armColor + */ +function createArmNode( armColor: IColor ) { + return new Rectangle( 0, 0, ARM_WIDTH, ARM_HEIGHT, { + stroke: ARM_STROKE, + fill: armColor + } ); +} + /** * Sets the position of an arm such that its left center is on the fulcrum point. * @param armNode