diff --git a/js/common/model/GeometricOpticsModel.js b/js/common/model/GeometricOpticsModel.js index 86eff1ab..f38439bc 100644 --- a/js/common/model/GeometricOpticsModel.js +++ b/js/common/model/GeometricOpticsModel.js @@ -80,7 +80,8 @@ class GeometricOpticsModel { // @public {Object} rulers for the simulations this.rulers = { horizontal: new Ruler( HORIZONTAL_RULER_INITIAL_POSITION, HORIZONTAL_RULER_LENGTH ), - vertical: new Ruler( VERTICAL_RULER_INITIAL_POSITION, VERTICAL_RULER_LENGTH, { orientation: Ruler.Orientation.VERTICAL } ) + vertical: new Ruler( VERTICAL_RULER_INITIAL_POSITION, VERTICAL_RULER_LENGTH, + { orientation: Ruler.Orientation.VERTICAL } ) }; // @public {Optic} - model of the optic @@ -99,13 +100,16 @@ class GeometricOpticsModel { this.firstFocalPoint = new FocalPoint( this.optic.positionProperty, this.optic.focalLengthProperty, tandem ); // @public {FocalPoint} second principal focal point - this.secondFocalPoint = new FocalPoint( this.optic.positionProperty, this.optic.focalLengthProperty, tandem, { multiplicativeFactor: -1 } ); + this.secondFocalPoint = new FocalPoint( this.optic.positionProperty, + this.optic.focalLengthProperty, tandem, { multiplicativeFactor: -1 } ); // @public {Target} model of the target/image associated with the first source - this.firstTarget = new Target( this.sourceObject.firstPositionProperty, this.optic, this.representationProperty, tandem ); + this.firstTarget = new Target( this.sourceObject.firstPositionProperty, + this.optic, this.representationProperty, tandem ); // @public {Target} target/ image associated with the second source - this.secondTarget = new Target( this.sourceObject.secondPositionProperty, this.optic, this.representationProperty, tandem ); + this.secondTarget = new Target( this.sourceObject.secondPositionProperty, + this.optic, this.representationProperty, tandem ); // @public {ProjectorScreen} model of the projector screen and spotlights this.projectorScreen = new ProjectorScreen( diff --git a/js/common/model/Optic.js b/js/common/model/Optic.js index 65f196fb..703a14b8 100644 --- a/js/common/model/Optic.js +++ b/js/common/model/Optic.js @@ -126,7 +126,8 @@ class Optic { */ static getMirrorShapes( radius, diameter, curve, options ) { - assert && assert( radius > diameter / 2, 'the radius of curvature is too small when compared to the diameter' ); + assert && assert( radius > diameter / 2, + 'the radius of curvature is too small when compared to the diameter' ); options = merge( { thickness: 5 // horizontal separation between the two edges of the surfaces at the middle part diff --git a/js/common/model/SourceObject.js b/js/common/model/SourceObject.js index bd65d294..5d0a28d8 100644 --- a/js/common/model/SourceObject.js +++ b/js/common/model/SourceObject.js @@ -121,7 +121,9 @@ class SourceObject { setSecondPoint( representationProperty, position ) { if ( representationProperty.value.isObject ) { const unconstrainedVerticalOffset = position.y - this.firstPositionProperty.value.y; - this.verticalOffsetProperty.value = Utils.clamp( unconstrainedVerticalOffset, verticalOffsetRange.min, verticalOffsetRange.max ); + this.verticalOffsetProperty.value = Utils.clamp( unconstrainedVerticalOffset, + verticalOffsetRange.min, + verticalOffsetRange.max ); } else { this.unconstrainedSecondSourcePositionProperty.value = position; diff --git a/js/common/model/Target.js b/js/common/model/Target.js index a44a0a48..e578188f 100644 --- a/js/common/model/Target.js +++ b/js/common/model/Target.js @@ -22,7 +22,10 @@ class Target { * @param {Property.} representationProperty * @param {Tandem} tandem */ - constructor( objectPositionProperty, optic, representationProperty, tandem ) { + constructor( objectPositionProperty, + optic, + representationProperty, + tandem ) { assert && assert( tandem instanceof Tandem, 'invalid tandem' ); // @private {Property.} position of the object/source @@ -127,17 +130,18 @@ class Target { // light intensity of the image (Hollywood) - a value between 0 and 1 // @public (read-only) {Property.} - this.lightIntensityProperty = new DerivedProperty( [ this.scaleProperty, optic.diameterProperty ], ( scale, diameter ) => { + this.lightIntensityProperty = new DerivedProperty( [ this.scaleProperty, optic.diameterProperty ], + ( scale, diameter ) => { - // effect of the distance on the opacity, hollywooded as 1/scale for upscaled image - const distanceFactor = Math.min( 1, Math.abs( 1 / scale ) ); + // effect of the distance on the opacity, hollywooded as 1/scale for upscaled image + const distanceFactor = Math.min( 1, Math.abs( 1 / scale ) ); - // effect of the diameter of the optic on the light intensity of the image (also hollywooded) - const diameterFactor = optic.getNormalizedDiameter( diameter ); + // effect of the diameter of the optic on the light intensity of the image (also hollywooded) + const diameterFactor = optic.getNormalizedDiameter( diameter ); - // product of the two factors - return distanceFactor * diameterFactor; - } ); + // product of the two factors + return distanceFactor * diameterFactor; + } ); // @public (read-only) {Property.} // determine the image with appropriate orientation to select for the display diff --git a/js/common/view/CurveControl.js b/js/common/view/CurveControl.js index 52613619..81d4daff 100644 --- a/js/common/view/CurveControl.js +++ b/js/common/view/CurveControl.js @@ -109,8 +109,10 @@ class CurveControl extends RectangularRadioButtonGroup { options.strutLength - 2 * options.buttonContentYMargin ); // make sure the spacer is larger than icon - assert && assert( iconSpacer.width > iconNode.width, 'spacer width is smaller than icon content' ); - assert && assert( iconSpacer.height > iconNode.height, 'spacer height is smaller than icon content' ); + assert && assert( iconSpacer.width > iconNode.width, + 'spacer width is smaller than icon content' ); + assert && assert( iconSpacer.height > iconNode.height, + 'spacer height is smaller than icon content' ); // center the icon in the spacer iconNode.center = iconSpacer.center; diff --git a/js/common/view/FocalPointNode.js b/js/common/view/FocalPointNode.js index eea9e79a..f9807262 100644 --- a/js/common/view/FocalPointNode.js +++ b/js/common/view/FocalPointNode.js @@ -27,7 +27,11 @@ class FocalPointNode extends PlusNode { * @param {Tandem} tandem * @param {Object} [options] */ - constructor( focalPoint, visibleProperty, modelViewTransform, tandem, options ) { + constructor( focalPoint, + visibleProperty, + modelViewTransform, + tandem, + options ) { assert && assert( tandem instanceof Tandem, 'invalid tandem' ); // options for plus Node. Rotated by 45 degrees to create an X shape. diff --git a/js/common/view/GeometricOpticsControlPanel.js b/js/common/view/GeometricOpticsControlPanel.js index 7bea3364..31c85cea 100644 --- a/js/common/view/GeometricOpticsControlPanel.js +++ b/js/common/view/GeometricOpticsControlPanel.js @@ -183,7 +183,7 @@ class GeometricOpticsControlPanel extends Panel { */ const createCheckboxGroupItem = ( string, property, options ) => { options = merge( { - icon: null // {null||Node} + icon: null // {null|Node} }, options ); // text for the checkbox @@ -207,10 +207,12 @@ class GeometricOpticsControlPanel extends Panel { // create checkbox group for visibility settings const checkboxGroupItems = [ - createCheckboxGroupItem( focalPointString, visibleProperties.visibleFocalPointProperty, { icon: focalPointIcon } ), + createCheckboxGroupItem( focalPointString, visibleProperties.visibleFocalPointProperty, + { icon: focalPointIcon } ), createCheckboxGroupItem( virtualImageString, visibleProperties.visibleVirtualImageProperty ), createCheckboxGroupItem( labelsString, visibleProperties.visibleLabelsProperty ), - createCheckboxGroupItem( secondSourceString, visibleProperties.visibleSecondSourceProperty, { icon: secondSourcePointIcon } ), + createCheckboxGroupItem( secondSourceString, visibleProperties.visibleSecondSourceProperty, + { icon: secondSourcePointIcon } ), createCheckboxGroupItem( guidesString, visibleProperties.visibleGuidesProperty ) ]; diff --git a/js/common/view/GeometricOpticsRulerNode.js b/js/common/view/GeometricOpticsRulerNode.js index eee8353f..45bd1f1f 100644 --- a/js/common/view/GeometricOpticsRulerNode.js +++ b/js/common/view/GeometricOpticsRulerNode.js @@ -99,12 +99,18 @@ class GeometricOpticsRulerNode extends RulerNode { // if vertical the left and right bounds of the ruler stay within visible bounds // minimum visible length of the ruler is always showing inside top and bottom visible bounds. - return visibleBounds.withOffsets( 0, -MINIMUM_VISIBLE_LENGTH, -this.width, -MINIMUM_VISIBLE_LENGTH + this.height ); + return visibleBounds.withOffsets( 0, + -MINIMUM_VISIBLE_LENGTH, + -this.width, + -MINIMUM_VISIBLE_LENGTH + this.height ); } else { // if horizontal ruler, the bottom and top bounds of the ruler stay within visible bounds // minimum visible length of the ruler is always showing inside left and right visible bounds. - return visibleBounds.withOffsets( this.width - MINIMUM_VISIBLE_LENGTH, 0, -MINIMUM_VISIBLE_LENGTH, -this.height ); + return visibleBounds.withOffsets( this.width - MINIMUM_VISIBLE_LENGTH, + 0, + -MINIMUM_VISIBLE_LENGTH, + -this.height ); } } ); diff --git a/js/common/view/GeometricOpticsScreenView.js b/js/common/view/GeometricOpticsScreenView.js index 55bdcf02..517e6e5d 100644 --- a/js/common/view/GeometricOpticsScreenView.js +++ b/js/common/view/GeometricOpticsScreenView.js @@ -178,7 +178,11 @@ class GeometricOpticsScreenView extends ScreenView { const opticalAxisLine = new OpticalAxisLine( model.optic.positionProperty, this.playAreaModelBoundsProperty, this.modelViewTransform ); - const opticNode = new OpticNode( model.optic, model.lightRayModeProperty, this.playAreaModelBoundsProperty, this.modelViewTransform, tandem ); + const opticNode = new OpticNode( model.optic, + model.lightRayModeProperty, + this.playAreaModelBoundsProperty, + this.modelViewTransform, + tandem ); // create the light rays associated with the object const lightRaysNode = new LightRaysNode( model.firstLightRays, diff --git a/js/common/view/LabelNode.js b/js/common/view/LabelNode.js index 07938af9..305b79ad 100644 --- a/js/common/view/LabelNode.js +++ b/js/common/view/LabelNode.js @@ -28,7 +28,11 @@ class LabelNode extends Node { * @param {Property.} modelViewTransformProperty * @param {Object} [options] */ - constructor( string, positionProperty, visibleProperty, modelViewTransformProperty, options ) { + constructor( string, + positionProperty, + visibleProperty, + modelViewTransformProperty, + options ) { options = merge( { text: { @@ -99,7 +103,8 @@ class LabelNode extends Node { * @private */ setLabelPosition() { - this.centerTop = this.modelViewTransformProperty.value.modelToViewPosition( this.positionProperty.value ).plusXY( 0, this.options.labelOffset ); + this.centerTop = this.modelViewTransformProperty.value.modelToViewPosition( this.positionProperty.value ) + .plusXY( 0, this.options.labelOffset ); } /** diff --git a/js/common/view/LabelsNode.js b/js/common/view/LabelsNode.js index 28919fc1..3f9ca1ea 100644 --- a/js/common/view/LabelsNode.js +++ b/js/common/view/LabelsNode.js @@ -57,12 +57,17 @@ class LabelsNode extends Node { modelViewTransformProperty ); // define optic label position - const opticLabelPositionProperty = new DerivedProperty( [ model.optic.positionProperty, model.optic.diameterProperty ], ( position, diameter ) => - position.minusXY( 0, diameter / 2 ) + const opticLabelPositionProperty = new DerivedProperty( + [ model.optic.positionProperty, model.optic.diameterProperty ], + ( position, diameter ) => + position.minusXY( 0, diameter / 2 ) ); // create optic label with empty string - const opticLabel = new LabelNode( '', opticLabelPositionProperty, new BooleanProperty( true ), modelViewTransformProperty ); + const opticLabel = new LabelNode( '', + opticLabelPositionProperty, + new BooleanProperty( true ), + modelViewTransformProperty ); // update the label string of the optic model.optic.curveProperty.link( curve => { @@ -86,7 +91,10 @@ class LabelsNode extends Node { bounds => bounds.centerTop ); // create image label - const imageLabel = new LabelNode( imageString, imageLabelPositionProperty, new BooleanProperty( true ), modelViewTransformProperty ); + const imageLabel = new LabelNode( imageString, + imageLabelPositionProperty, + new BooleanProperty( true ), + modelViewTransformProperty ); // define object label position const objectLabelPositionProperty = new DerivedProperty( [ model.sourceObject.boundsProperty ], @@ -94,7 +102,10 @@ class LabelsNode extends Node { bounds => bounds.centerTop ); // create object label - const objectLabel = new LabelNode( objectString, objectLabelPositionProperty, new BooleanProperty( true ), modelViewTransformProperty ); + const objectLabel = new LabelNode( objectString, + objectLabelPositionProperty, + new BooleanProperty( true ), + modelViewTransformProperty ); // update the visibility of the object and image labels Property.multilink( [ diff --git a/js/common/view/LightRaysNode.js b/js/common/view/LightRaysNode.js index 7dda2c46..e4eacf7b 100644 --- a/js/common/view/LightRaysNode.js +++ b/js/common/view/LightRaysNode.js @@ -19,7 +19,11 @@ class LightRaysNode extends Node { * @param {Tandem} tandem * @param {Object} [options] */ - constructor( lightRays, visibleVirtualImageProperty, modelViewTransform, tandem, options ) { + constructor( lightRays, + visibleVirtualImageProperty, + modelViewTransform, + tandem, + options ) { assert && assert( tandem instanceof Tandem, 'invalid tandem' ); options = merge( { diff --git a/js/common/view/OpticNode.js b/js/common/view/OpticNode.js index b6810a53..929580a0 100644 --- a/js/common/view/OpticNode.js +++ b/js/common/view/OpticNode.js @@ -34,7 +34,12 @@ class OpticNode extends Node { * @param {Tandem} tandem * @param {Object} [options] */ - constructor( optic, lightRayModeProperty, playAreaModelBoundsProperty, modelViewTransform, tandem, options ) { + constructor( optic, + lightRayModeProperty, + playAreaModelBoundsProperty, + modelViewTransform, + tandem, + options ) { assert && assert( tandem instanceof Tandem, 'invalid tandem' ); options = merge( { diff --git a/js/common/view/OpticalAxisLine.js b/js/common/view/OpticalAxisLine.js index 309abbd9..39519f97 100644 --- a/js/common/view/OpticalAxisLine.js +++ b/js/common/view/OpticalAxisLine.js @@ -21,7 +21,9 @@ class OpticalAxisLine extends Line { * @param {Property.} visibleModelBoundsProperty * @param {ModelViewTransform2} modelViewTransform */ - constructor( opticPositionProperty, visibleModelBoundsProperty, modelViewTransform ) { + constructor( opticPositionProperty, + visibleModelBoundsProperty, + modelViewTransform ) { // create optical axis line, with arbitrary length values. super( 0, 0, 1, 0, { diff --git a/js/common/view/ToolboxPanel.js b/js/common/view/ToolboxPanel.js index f353c0a9..9643e81d 100644 --- a/js/common/view/ToolboxPanel.js +++ b/js/common/view/ToolboxPanel.js @@ -42,10 +42,14 @@ class ToolboxPanel extends Panel { const verticalRulerIconNode = ToolboxPanel.getRulerIcon( true ); // increase touchArea and mouseArea for both rulers - horizontalRulerIconNode.touchArea = horizontalRulerIconNode.localBounds.dilatedXY( options.touchAreaDilationX, options.touchAreaDilationY ); - horizontalRulerIconNode.mouseArea = horizontalRulerIconNode.localBounds.dilatedXY( options.mouseAreaDilationX, options.mouseAreaDilationY ); - verticalRulerIconNode.touchArea = verticalRulerIconNode.localBounds.dilatedXY( options.touchAreaDilationX, options.touchAreaDilationY ); - verticalRulerIconNode.mouseArea = verticalRulerIconNode.localBounds.dilatedXY( options.mouseAreaDilationX, options.mouseAreaDilationY ); + horizontalRulerIconNode.touchArea = horizontalRulerIconNode.localBounds.dilatedXY( + options.touchAreaDilationX, options.touchAreaDilationY ); + horizontalRulerIconNode.mouseArea = horizontalRulerIconNode.localBounds.dilatedXY( + options.mouseAreaDilationX, options.mouseAreaDilationY ); + verticalRulerIconNode.touchArea = verticalRulerIconNode.localBounds.dilatedXY( + options.touchAreaDilationX, options.touchAreaDilationY ); + verticalRulerIconNode.mouseArea = verticalRulerIconNode.localBounds.dilatedXY( + options.mouseAreaDilationX, options.mouseAreaDilationY ); // create the content for the panel const toolbox = new HBox( { @@ -62,7 +66,9 @@ class ToolboxPanel extends Panel { * @param {GeometricOpticsRulerNode} rulerNode * @param {Property.} visibleRulerProperty - visibility associated with the rulerNode (not icon) */ - const createForwardListener = ( iconNode, rulerNode, visibleRulerProperty ) => { + const createForwardListener = ( iconNode, + rulerNode, + visibleRulerProperty ) => { // ruler node and icon node have opposite visibilities visibleRulerProperty.link( visible => { @@ -87,8 +93,12 @@ class ToolboxPanel extends Panel { }; // attach a create a Forward listener on each icon - createForwardListener( horizontalRulerIconNode, rulersLayer.horizontalRulerNode, rulersLayer.visibleHorizontalProperty ); - createForwardListener( verticalRulerIconNode, rulersLayer.verticalRulerNode, rulersLayer.visibleVerticalProperty ); + createForwardListener( horizontalRulerIconNode, + rulersLayer.horizontalRulerNode, + rulersLayer.visibleHorizontalProperty ); + createForwardListener( verticalRulerIconNode, + rulersLayer.verticalRulerNode, + rulersLayer.visibleVerticalProperty ); } /** diff --git a/js/common/view/TrackingDiskNode.js b/js/common/view/TrackingDiskNode.js index b219b661..c6db62d9 100644 --- a/js/common/view/TrackingDiskNode.js +++ b/js/common/view/TrackingDiskNode.js @@ -20,7 +20,10 @@ class TrackingDiskNode extends Circle { * @param {Tandem} tandem * @param {Object} [options] * */ - constructor( positionProperty, modelViewTransform, tandem, options ) { + constructor( positionProperty, + modelViewTransform, + tandem, + options ) { assert && assert( tandem instanceof Tandem, 'invalid tandem' ); options = merge( { diff --git a/js/lens/model/Guide.js b/js/lens/model/Guide.js index 32f8eae3..fa9c8ab8 100644 --- a/js/lens/model/Guide.js +++ b/js/lens/model/Guide.js @@ -43,7 +43,9 @@ class Guide { // @public (read-only) {Property.} find the angle of the transmitted guide with respect to the positive // x-axis - this.transmittedAngleProperty = new DerivedProperty( [ optic.focalLengthProperty, optic.diameterProperty, this.incidentAngleProperty ], + this.transmittedAngleProperty = new DerivedProperty( [ optic.focalLengthProperty, + optic.diameterProperty, + this.incidentAngleProperty ], ( focalLength, diameter, incidentAngle ) => { // transmitted angle if the optic was a blank. diff --git a/js/lens/model/LensModel.js b/js/lens/model/LensModel.js index d6e7ea70..7488a9b0 100644 --- a/js/lens/model/LensModel.js +++ b/js/lens/model/LensModel.js @@ -32,13 +32,15 @@ class LensModel extends GeometricOpticsModel { this.firstTopGuide = new Guide( this.sourceObject.firstPositionProperty, this.optic ); // @public {Guide} model for bottom guide associated with the first source/object - this.firstBottomGuide = new Guide( this.sourceObject.firstPositionProperty, this.optic, { location: Guide.Location.BOTTOM } ); + this.firstBottomGuide = new Guide( this.sourceObject.firstPositionProperty, this.optic, + { location: Guide.Location.BOTTOM } ); // @public {Guide} model for top guide associated with the second source/object this.secondTopGuide = new Guide( this.sourceObject.secondPositionProperty, this.optic ); // @public {Guide} model for bottom guide associated with the second source/object - this.secondBottomGuide = new Guide( this.sourceObject.secondPositionProperty, this.optic, { location: Guide.Location.BOTTOM } ); + this.secondBottomGuide = new Guide( this.sourceObject.secondPositionProperty, this.optic, + { location: Guide.Location.BOTTOM } ); } diff --git a/js/lens/model/Spotlight.js b/js/lens/model/Spotlight.js index fc36f677..ee73e840 100644 --- a/js/lens/model/Spotlight.js +++ b/js/lens/model/Spotlight.js @@ -103,8 +103,10 @@ class Spotlight { getDiskParameters( screenPosition, opticPosition, opticDiameter, targetPosition ) { // get the extremum points on the optic - const extremumTopOpticPoint = this.optic.getExtremumPoint( this.sourcePositionProperty.value, targetPosition, { location: Optic.Location.TOP } ); - const extremumBottomOpticPoint = this.optic.getExtremumPoint( this.sourcePositionProperty.value, targetPosition, { location: Optic.Location.BOTTOM } ); + const extremumTopOpticPoint = this.optic.getExtremumPoint( this.sourcePositionProperty.value, targetPosition, + { location: Optic.Location.TOP } ); + const extremumBottomOpticPoint = this.optic.getExtremumPoint( this.sourcePositionProperty.value, targetPosition, + { location: Optic.Location.BOTTOM } ); // determine the top and bottom position of the unclipped disk const diskTopPosition = this.getIntersectPosition( screenPosition, extremumTopOpticPoint, targetPosition );