From 769dc9b3594369d441293e9be6c69700ac6a3feb Mon Sep 17 00:00:00 2001 From: Martin Veillette Date: Thu, 29 Jul 2021 10:25:07 -0400 Subject: [PATCH] remove extra spacing --- js/common/GeometricOpticsColors.js | 3 - js/common/GeometricOpticsConstants.js | 3 - js/common/GeometricOpticsQueryParameters.js | 1 - js/common/model/LightRay.js | 2 - js/common/model/Optic.js | 412 +++++++++---------- js/common/model/Ray.js | 1 - js/common/model/Representation.js | 1 - js/common/model/Ruler.js | 1 - js/common/model/SourceObject.js | 1 - js/common/model/Target.js | 1 - js/common/view/CurveControl.js | 1 - js/common/view/FocalPointNode.js | 2 - js/common/view/GeometricOpticsRulersLayer.js | 3 +- js/common/view/GeometricOpticsScreenView.js | 4 - js/common/view/LabelNode.js | 3 +- js/common/view/LightRaysNode.js | 3 +- js/common/view/OpticNode.js | 2 - js/common/view/SourceObjectNode.js | 6 - js/common/view/TargetNode.js | 1 - js/common/view/ToolboxPanel.js | 1 - js/common/view/TrackingDiskNode.js | 1 - js/lens/LensScreen.js | 1 - js/lens/model/LensModel.js | 2 - js/lens/model/Spotlight.js | 2 - js/mirror/model/MirrorModel.js | 1 - 25 files changed, 209 insertions(+), 250 deletions(-) diff --git a/js/common/GeometricOpticsColors.js b/js/common/GeometricOpticsColors.js index 56295e78..a0329408 100644 --- a/js/common/GeometricOpticsColors.js +++ b/js/common/GeometricOpticsColors.js @@ -11,7 +11,6 @@ import geometricOptics from '../geometricOptics.js'; const GeometricOpticsColors = { - //-------------------------------------------------------------------------- // SCREEN @@ -30,7 +29,6 @@ const GeometricOpticsColors = { default: 'rgb(255, 255, 255)' } ), - //-------------------------------------------------------------------------- // FOCAL POINT @@ -92,7 +90,6 @@ const GeometricOpticsColors = { default: 'rgb(27,27,96)' } ), - //-------------------------------------------------------------------------- // GUIDES diff --git a/js/common/GeometricOpticsConstants.js b/js/common/GeometricOpticsConstants.js index b027fbe1..2e742736 100644 --- a/js/common/GeometricOpticsConstants.js +++ b/js/common/GeometricOpticsConstants.js @@ -50,7 +50,6 @@ const GeometricOpticsConstants = { MIRROR_RADIUS_OF_CURVATURE_RANGE: new RangeWithValue( 150, 250, 200 ), // centimeters MIRROR_DIAMETER_RANGE: new RangeWithValue( 30, 150, 80 ), // centimeters - //---------------------------------------------------------------------------------------- // FOCAL POINT FOCAL_POINT_OPTIONS: { @@ -63,7 +62,6 @@ const GeometricOpticsConstants = { SECOND_SOURCE_POINT_OPTIONS: { radius: 5 }, - //---------------------------------------------------------------------------------------- // OPTICAL AXIS @@ -80,7 +78,6 @@ const GeometricOpticsConstants = { OPTICAL_ELEMENT_LINE_WIDTH: 2, - //-------------------------------------------------------------------------------------- // RULER diff --git a/js/common/GeometricOpticsQueryParameters.js b/js/common/GeometricOpticsQueryParameters.js index 78b7a73e..1504348e 100644 --- a/js/common/GeometricOpticsQueryParameters.js +++ b/js/common/GeometricOpticsQueryParameters.js @@ -23,7 +23,6 @@ const GeometricOpticsQueryParameters = QueryStringMachine.getAll( { type: 'flag', public: false } - } ); geometricOptics.register( 'GeometricOpticsQueryParameters', GeometricOpticsQueryParameters ); diff --git a/js/common/model/LightRay.js b/js/common/model/LightRay.js index 18471c83..703f693c 100644 --- a/js/common/model/LightRay.js +++ b/js/common/model/LightRay.js @@ -130,7 +130,6 @@ class LightRay { return this.realRays.length > 1 && distanceTraveled > distance; } - /** * get the first intersection Point * @@ -203,7 +202,6 @@ class LightRay { // {Vector2|null} back shape point intersecting the transmitted ray const backPoint = this.getPoint( backIntersection ); - // add additional rays only if the front lens is hit if ( frontPoint instanceof Vector2 ) { diff --git a/js/common/model/Optic.js b/js/common/model/Optic.js index 9eee2ccd..7de6f3b7 100644 --- a/js/common/model/Optic.js +++ b/js/common/model/Optic.js @@ -104,6 +104,212 @@ class Optic { this.diameterRange = diameterRange; } + /** + * Returns the shape of a parabolic mirror. + * The shape is designed as a "first surface mirror". + * The returned object contains an outline shape, representing the reflecting coating, + * and a fill shape representing the base backing of the mirror. + * The shapes are drawn using quadratic Bezier curves. + * + * @param {number} radius - radius of curvature at the center of the mirror + * @param {number} diameter - vertical height of the mirror + * @param {Optic.Curve} curve + * @param {Object} [options] + * @returns { + fillShape: Shape, + outlineShape: Shape, + frontShape: Shape, + backShape: null, + middleShape: null + } + * @public + */ + static getMirrorShapes( radius, diameter, curve, options ) { + + 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 + }, options ); + + // convenience variable + const halfHeight = diameter / 2; + + // half of the width of the outline shape of the mirror along the x -axis + const halfWidth = radius - Math.sqrt( radius ** 2 - halfHeight ** 2 ); + + // top and bottom surfaces of fill shape must be tilted to generate right angle corners + const angle = Math.atan( halfHeight / radius ); + + // curveSign is +1 for convex and -1 for concave + const curveSign = ( curve === Optic.Curve.CONVEX ) ? 1 : -1; + + // vector offset between the two top corners and bottom corners of the shape + // with a magnitude of option.thickness + const offsetTopVector = Vector2.createPolar( options.thickness, -curveSign * angle ); + const offsetBottomVector = Vector2.createPolar( options.thickness, curveSign * angle ); + + // four corners of the mirror shape + const topLeft = new Vector2( curveSign * halfWidth, halfHeight ); + const topRight = topLeft.plus( offsetTopVector ); + const bottomLeft = new Vector2( curveSign * halfWidth, -halfHeight ); + const bottomRight = bottomLeft.plus( offsetBottomVector ); + + // control points: Note that the curve will not go through the control points. + // rather, it will go through the two following points: (0,0) and ( options.thickness, 0 ) + const midLeft = new Vector2( -curveSign * halfWidth, 0 ); + const midRight = midLeft.plusXY( options.thickness, 0 ); + + // shapes drawn from top to bottom in counterclockwise fashion. + + // front shape of mirror front - with zero area. + const frontShape = new Shape() + .moveToPoint( topLeft ) + .quadraticCurveToPoint( midLeft, bottomLeft ) + .quadraticCurveToPoint( midLeft, topLeft ) + .close(); + + // shape of entire mirror, including mirror backing + const fillShape = new Shape() + .moveToPoint( topLeft ) + .quadraticCurveToPoint( midLeft, bottomLeft ) + .lineToPoint( bottomRight ) + .quadraticCurveToPoint( midRight, topRight ) + .close(); + + return { + fillShape: fillShape, + outlineShape: frontShape, + frontShape: frontShape, + backShape: null, + middleShape: null + }; + } + + /** + * Returns the shapes of a lens. In the case of a lens, the outline and fills shape are identical. + * + * The lens shape is approximated as a parabolic lens. + * The radius of curvature of the lens does necessarily match the value of radius and can be instead "hollywooded". + * This gives the flexibility to draw lenses with radius of curvature that is larger than diameter/2, a physical impossibility. + * The center point of the lens is '0,0' + * + * @param {number} radius - radius of curvature + * @param {number} diameter - height of the lens + * @param {Optic.Curve} curve + * @param {Object} [options] + * @returns { + fillShape: Shape, + outlineShape: Shape, + frontShape: Shape, + backShape: Shape, + middleShape: Shape + } + * @public + */ + static getLensShapes( radius, diameter, curve, options ) { + + options = merge( { + isHollywood: true, // is the radius of curvature parameter matching the shape of the lens + offsetRadius: 100 + }, + options ); + + const halfHeight = diameter / 2; + + // the width of the lens changes with the radius + const halfWidth = options.isHollywood ? + 1 / 2 * halfHeight * halfHeight / ( radius + options.offsetRadius ) : + radius - Math.sqrt( radius ** 2 - halfHeight ** 2 ); + + // {Shape} shape of lens + let outlineShape; // the outline of the lens (including top and bottom) + let frontShape; // the left facing portion of the lens + let backShape; // the right facing portion of the lens + + if ( curve === Optic.Curve.CONVEX ) { + + // two extrema points of the lens + const top = new Vector2( 0, halfHeight ); + const bottom = new Vector2( 0, -halfHeight ); + + // two control points on the optical axis, note that the shape does not go through these points + // The shape will go through the two points: ( -halfWidth, 0 ) and ( halfWidth, 0 ) + const left = new Vector2( -2 * halfWidth, 0 ); + const right = new Vector2( 2 * halfWidth, 0 ); + + // shape of convex lens + outlineShape = new Shape() + .moveToPoint( top ) + .quadraticCurveToPoint( left, bottom ) + .quadraticCurveToPoint( right, top ) + .close(); + + frontShape = new Shape() + .moveToPoint( top ) + .quadraticCurveToPoint( left, bottom ) + .quadraticCurveToPoint( left, top ) + .close(); + + backShape = new Shape() + .moveToPoint( top ) + .quadraticCurveToPoint( right, bottom ) + .quadraticCurveToPoint( right, top ) + .close(); + + } + else { + // implies that curve === Optic.Curve.CONCAVE + + const midWidth = halfWidth; + + // four corners of the concave shape + const topLeft = new Vector2( -halfWidth, halfHeight ); + const topRight = new Vector2( halfWidth, halfHeight ); + const bottomLeft = new Vector2( -halfWidth, -halfHeight ); + const bottomRight = new Vector2( halfWidth, -halfHeight ); + + // control points + const midLeft = new Vector2( midWidth / 2, 0 ); + const midRight = new Vector2( -midWidth / 2, 0 ); + + // shape of concave lens + outlineShape = new Shape() + .moveToPoint( topLeft ) + .lineToPoint( topRight ) + .quadraticCurveToPoint( midRight, bottomRight ) + .lineToPoint( bottomLeft ) + .quadraticCurveToPoint( midLeft, topLeft ) + .close(); + + frontShape = new Shape() + .moveToPoint( topLeft ) + .quadraticCurveToPoint( midLeft, bottomLeft ) + .quadraticCurveToPoint( midLeft, topLeft ) + .close(); + + backShape = new Shape() + .moveToPoint( topRight ) + .quadraticCurveToPoint( midRight, bottomRight ) + .quadraticCurveToPoint( midRight, topRight ) + .close(); + } + + // two extrema points of the lens + const top = new Vector2( 0, halfHeight ); + const bottom = new Vector2( 0, -halfHeight ); + const middleShape = new Shape().moveToPoint( top ).lineToPoint( bottom ); + + // the outline shape is the same as the fill shape for a lens + return { + fillShape: outlineShape, + outlineShape: outlineShape, + frontShape: frontShape, + backShape: backShape, + middleShape: middleShape + }; + } + /** * Resets the model. * @public @@ -282,88 +488,6 @@ class Optic { } } - /** - * Returns the shape of a parabolic mirror. - * The shape is designed as a "first surface mirror". - * The returned object contains an outline shape, representing the reflecting coating, - * and a fill shape representing the base backing of the mirror. - * The shapes are drawn using quadratic Bezier curves. - * - * @param {number} radius - radius of curvature at the center of the mirror - * @param {number} diameter - vertical height of the mirror - * @param {Optic.Curve} curve - * @param {Object} [options] - * @returns { - fillShape: Shape, - outlineShape: Shape, - frontShape: Shape, - backShape: null, - middleShape: null - } - * @public - */ - static getMirrorShapes( radius, diameter, curve, options ) { - - 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 - }, options ); - - // convenience variable - const halfHeight = diameter / 2; - - // half of the width of the outline shape of the mirror along the x -axis - const halfWidth = radius - Math.sqrt( radius ** 2 - halfHeight ** 2 ); - - // top and bottom surfaces of fill shape must be tilted to generate right angle corners - const angle = Math.atan( halfHeight / radius ); - - // curveSign is +1 for convex and -1 for concave - const curveSign = ( curve === Optic.Curve.CONVEX ) ? 1 : -1; - - // vector offset between the two top corners and bottom corners of the shape - // with a magnitude of option.thickness - const offsetTopVector = Vector2.createPolar( options.thickness, -curveSign * angle ); - const offsetBottomVector = Vector2.createPolar( options.thickness, curveSign * angle ); - - // four corners of the mirror shape - const topLeft = new Vector2( curveSign * halfWidth, halfHeight ); - const topRight = topLeft.plus( offsetTopVector ); - const bottomLeft = new Vector2( curveSign * halfWidth, -halfHeight ); - const bottomRight = bottomLeft.plus( offsetBottomVector ); - - // control points: Note that the curve will not go through the control points. - // rather, it will go through the two following points: (0,0) and ( options.thickness, 0 ) - const midLeft = new Vector2( -curveSign * halfWidth, 0 ); - const midRight = midLeft.plusXY( options.thickness, 0 ); - - // shapes drawn from top to bottom in counterclockwise fashion. - - // front shape of mirror front - with zero area. - const frontShape = new Shape() - .moveToPoint( topLeft ) - .quadraticCurveToPoint( midLeft, bottomLeft ) - .quadraticCurveToPoint( midLeft, topLeft ) - .close(); - - // shape of entire mirror, including mirror backing - const fillShape = new Shape() - .moveToPoint( topLeft ) - .quadraticCurveToPoint( midLeft, bottomLeft ) - .lineToPoint( bottomRight ) - .quadraticCurveToPoint( midRight, topRight ) - .close(); - - return { - fillShape: fillShape, - outlineShape: frontShape, - frontShape: frontShape, - backShape: null, - middleShape: null - }; - } - /** * Returns the shape of the vertical line * @public @@ -451,130 +575,6 @@ class Optic { return spotPoint; } - /** - * Returns the shapes of a lens. In the case of a lens, the outline and fills shape are identical. - * - * The lens shape is approximated as a parabolic lens. - * The radius of curvature of the lens does necessarily match the value of radius and can be instead "hollywooded". - * This gives the flexibility to draw lenses with radius of curvature that is larger than diameter/2, a physical impossibility. - * The center point of the lens is '0,0' - * - * @param {number} radius - radius of curvature - * @param {number} diameter - height of the lens - * @param {Optic.Curve} curve - * @param {Object} [options] - * @returns { - fillShape: Shape, - outlineShape: Shape, - frontShape: Shape, - backShape: Shape, - middleShape: Shape - } - * @public - */ - static getLensShapes( radius, diameter, curve, options ) { - - options = merge( { - isHollywood: true, // is the radius of curvature parameter matching the shape of the lens - offsetRadius: 100 - }, - options ); - - const halfHeight = diameter / 2; - - // the width of the lens changes with the radius - const halfWidth = options.isHollywood ? - 1 / 2 * halfHeight * halfHeight / ( radius + options.offsetRadius ) : - radius - Math.sqrt( radius ** 2 - halfHeight ** 2 ); - - // {Shape} shape of lens - let outlineShape; // the outline of the lens (including top and bottom) - let frontShape; // the left facing portion of the lens - let backShape; // the right facing portion of the lens - - if ( curve === Optic.Curve.CONVEX ) { - - // two extrema points of the lens - const top = new Vector2( 0, halfHeight ); - const bottom = new Vector2( 0, -halfHeight ); - - // two control points on the optical axis, note that the shape does not go through these points - // The shape will go through the two points: ( -halfWidth, 0 ) and ( halfWidth, 0 ) - const left = new Vector2( -2 * halfWidth, 0 ); - const right = new Vector2( 2 * halfWidth, 0 ); - - // shape of convex lens - outlineShape = new Shape() - .moveToPoint( top ) - .quadraticCurveToPoint( left, bottom ) - .quadraticCurveToPoint( right, top ) - .close(); - - frontShape = new Shape() - .moveToPoint( top ) - .quadraticCurveToPoint( left, bottom ) - .quadraticCurveToPoint( left, top ) - .close(); - - backShape = new Shape() - .moveToPoint( top ) - .quadraticCurveToPoint( right, bottom ) - .quadraticCurveToPoint( right, top ) - .close(); - - } - else { - // implies that curve === Optic.Curve.CONCAVE - - const midWidth = halfWidth; - - // four corners of the concave shape - const topLeft = new Vector2( -halfWidth, halfHeight ); - const topRight = new Vector2( halfWidth, halfHeight ); - const bottomLeft = new Vector2( -halfWidth, -halfHeight ); - const bottomRight = new Vector2( halfWidth, -halfHeight ); - - // control points - const midLeft = new Vector2( midWidth / 2, 0 ); - const midRight = new Vector2( -midWidth / 2, 0 ); - - // shape of concave lens - outlineShape = new Shape() - .moveToPoint( topLeft ) - .lineToPoint( topRight ) - .quadraticCurveToPoint( midRight, bottomRight ) - .lineToPoint( bottomLeft ) - .quadraticCurveToPoint( midLeft, topLeft ) - .close(); - - frontShape = new Shape() - .moveToPoint( topLeft ) - .quadraticCurveToPoint( midLeft, bottomLeft ) - .quadraticCurveToPoint( midLeft, topLeft ) - .close(); - - backShape = new Shape() - .moveToPoint( topRight ) - .quadraticCurveToPoint( midRight, bottomRight ) - .quadraticCurveToPoint( midRight, topRight ) - .close(); - } - - // two extrema points of the lens - const top = new Vector2( 0, halfHeight ); - const bottom = new Vector2( 0, -halfHeight ); - const middleShape = new Shape().moveToPoint( top ).lineToPoint( bottom ); - - // the outline shape is the same as the fill shape for a lens - return { - fillShape: outlineShape, - outlineShape: outlineShape, - frontShape: frontShape, - backShape: backShape, - middleShape: middleShape - }; - } - /** * Returns the shapes of the optic * The outline shape, represents the reflecting coating of a mirror, or the external surface of the lens diff --git a/js/common/model/Ray.js b/js/common/model/Ray.js index b5fc006f..2cc06eeb 100644 --- a/js/common/model/Ray.js +++ b/js/common/model/Ray.js @@ -83,7 +83,6 @@ class Ray extends Ray2 { const displacementVector = point.minus( this.position ); return this.direction.dot( displacementVector ); } - } geometricOptics.register( 'Ray', Ray ); diff --git a/js/common/model/Representation.js b/js/common/model/Representation.js index 37015127..44206082 100644 --- a/js/common/model/Representation.js +++ b/js/common/model/Representation.js @@ -120,6 +120,5 @@ const Representation = Enumeration.byMap( { { source: lampRedImage } ) } ); - geometricOptics.register( 'Representation', Representation ); export default Representation; diff --git a/js/common/model/Ruler.js b/js/common/model/Ruler.js index 2752cd0f..87213eaa 100644 --- a/js/common/model/Ruler.js +++ b/js/common/model/Ruler.js @@ -37,7 +37,6 @@ class Ruler { this.orientation = options.orientation; } - /** * resets the property of the model * @public diff --git a/js/common/model/SourceObject.js b/js/common/model/SourceObject.js index df8a1506..e7fc4434 100644 --- a/js/common/model/SourceObject.js +++ b/js/common/model/SourceObject.js @@ -80,7 +80,6 @@ class SourceObject { } } ); - representationProperty.link( representation => { const scale = representation.isObject ? OBJECT_SCALE_FACTOR : SOURCE_SCALE_FACTOR; diff --git a/js/common/model/Target.js b/js/common/model/Target.js index dcfd6fd2..351f337e 100644 --- a/js/common/model/Target.js +++ b/js/common/model/Target.js @@ -125,7 +125,6 @@ class Target { return bounds.shifted( position ); } ); - // 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 ) => { diff --git a/js/common/view/CurveControl.js b/js/common/view/CurveControl.js index 0575ac2d..d82109bd 100644 --- a/js/common/view/CurveControl.js +++ b/js/common/view/CurveControl.js @@ -1,6 +1,5 @@ // Copyright 2021, University of Colorado Boulder - /** * Controls the value of the curve property to determine the shape of the optic displayed in play area * diff --git a/js/common/view/FocalPointNode.js b/js/common/view/FocalPointNode.js index 3bcc78e9..eea9e79a 100644 --- a/js/common/view/FocalPointNode.js +++ b/js/common/view/FocalPointNode.js @@ -66,8 +66,6 @@ class FocalPointNode extends PlusNode { return new PlusNode( options ); } - - } geometricOptics.register( 'FocalPointNode', FocalPointNode ); diff --git a/js/common/view/GeometricOpticsRulersLayer.js b/js/common/view/GeometricOpticsRulersLayer.js index 7d6fa210..3a3de54e 100644 --- a/js/common/view/GeometricOpticsRulersLayer.js +++ b/js/common/view/GeometricOpticsRulersLayer.js @@ -17,7 +17,7 @@ import GeometricOpticsRulerNode from './GeometricOpticsRulerNode.js'; class GeometricOpticRulersLayer extends Node { /** - * @param {horizontal: , vertical:} rulers - model of rulers + * @param {horizontal: Ruler, vertical:Ruler} rulers - model of rulers * @param {Property.} visibleBoundsProperty * @param {Property.} absoluteScaleProperty * @param {Property.} modelViewTransformProperty @@ -75,7 +75,6 @@ class GeometricOpticRulersLayer extends Node { return rulerNode; }; - // update rulers when scale changes absoluteScaleProperty.link( absoluteScale => { diff --git a/js/common/view/GeometricOpticsScreenView.js b/js/common/view/GeometricOpticsScreenView.js index 6eba321b..c1713fa6 100644 --- a/js/common/view/GeometricOpticsScreenView.js +++ b/js/common/view/GeometricOpticsScreenView.js @@ -153,7 +153,6 @@ class GeometricOpticsScreenView extends ScreenView { //------------------------------------------------------------------- - // @protected {Property.} playAreaModelBoundsProperty this.playAreaModelBoundsProperty = new DerivedProperty( [ this.visibleBoundsProperty, this.zoomModelViewTransformProperty ], @@ -240,7 +239,6 @@ class GeometricOpticsScreenView extends ScreenView { } ); - Property.multilink( [ model.lightRayModeProperty, this.visibleProperties.visibleRayTracingProperty ], ( lightRayMode, showHide ) => { if ( lightRayMode === LightRayMode.NONE ) { @@ -342,7 +340,6 @@ class GeometricOpticsScreenView extends ScreenView { return scale / oldScale; } - /** * Returns the absolute scaling factor measured from the initial zoom level * The absolute scale returns 1 if the zoom level is the initial zoom level value @@ -372,7 +369,6 @@ class GeometricOpticsScreenView extends ScreenView { return ModelViewTransform2.createOffsetXYScaleMapping( ORIGIN_POINT, viewModelScale, -viewModelScale ); } - } geometricOptics.register( 'GeometricOpticsScreenView', GeometricOpticsScreenView ); diff --git a/js/common/view/LabelNode.js b/js/common/view/LabelNode.js index 493d93c2..a46ebd9b 100644 --- a/js/common/view/LabelNode.js +++ b/js/common/view/LabelNode.js @@ -11,8 +11,8 @@ import Node from '../../../../scenery/js/nodes/Node.js'; import Rectangle from '../../../../scenery/js/nodes/Rectangle.js'; import Text from '../../../../scenery/js/nodes/Text.js'; import geometricOptics from '../../geometricOptics.js'; -import GeometricOpticsConstants from '../GeometricOpticsConstants.js'; import GeometricOpticsColors from '../GeometricOpticsColors.js'; +import GeometricOpticsConstants from '../GeometricOpticsConstants.js'; const BACKGROUND_COLOR = GeometricOpticsColors.labelBackgroundFillProperty; const LABEL_FONT = GeometricOpticsConstants.LABEL_FONT; @@ -82,7 +82,6 @@ class LabelNode extends Node { visibleProperty.linkAttribute( this, 'visible' ); } - /** * Set a string for the label * @public diff --git a/js/common/view/LightRaysNode.js b/js/common/view/LightRaysNode.js index 3294848d..7dda2c46 100644 --- a/js/common/view/LightRaysNode.js +++ b/js/common/view/LightRaysNode.js @@ -4,11 +4,11 @@ * @author Martin Veillette */ +import merge from '../../../../phet-core/js/merge.js'; import Node from '../../../../scenery/js/nodes/Node.js'; import Path from '../../../../scenery/js/nodes/Path.js'; import Tandem from '../../../../tandem/js/Tandem.js'; import geometricOptics from '../../geometricOptics.js'; -import merge from '../../../../phet-core/js/merge.js'; class LightRaysNode extends Node { @@ -54,7 +54,6 @@ class LightRaysNode extends Node { visibleVirtualImageProperty.linkAttribute( virtualRayPath, 'visible' ); } - } geometricOptics.register( 'LightRaysNode', LightRaysNode ); diff --git a/js/common/view/OpticNode.js b/js/common/view/OpticNode.js index 0bd822d8..b6810a53 100644 --- a/js/common/view/OpticNode.js +++ b/js/common/view/OpticNode.js @@ -45,7 +45,6 @@ class OpticNode extends Node { super( options ); - // create a drag listener on the fill of the opticalElement (see #22) let clickOffset; const dragListener = new DragListener( { @@ -97,7 +96,6 @@ class OpticNode extends Node { lineDash: [ 8, 5 ] } ); - /** * clip the center line based on model bounds * @param {Bounds2} modelBounds diff --git a/js/common/view/SourceObjectNode.js b/js/common/view/SourceObjectNode.js index 5d1e1e5a..4748cf1b 100644 --- a/js/common/view/SourceObjectNode.js +++ b/js/common/view/SourceObjectNode.js @@ -99,7 +99,6 @@ class SourceObjectNode extends Node { visibleBounds.maxY ); } ); - // create drag listener for source const sourceObjectDragListener = new DragListener( { positionProperty: sourceObject.leftTopProperty, @@ -115,12 +114,10 @@ class SourceObjectNode extends Node { setImagePosition( sourceObjectImage, position ); } ); - dragBoundsProperty.link( dragBounds => { sourceObject.leftTopProperty.value = dragBounds.closestPointTo( sourceObject.leftTopProperty.value ); } ); - // create a node to hold the second source const secondNode = new Node(); this.addChild( secondNode ); @@ -160,7 +157,6 @@ class SourceObjectNode extends Node { secondNode.addInputListener( secondSourceDragListener ); - /** * set the position of the second node based on the position * @@ -183,7 +179,6 @@ class SourceObjectNode extends Node { scaleFunction( sourceObjectImage, sourceObject.boundsProperty.value ); setImagePosition( sourceObjectImage, sourceObject.leftTopProperty.value ); - // remove all children to the second node secondNode.removeAllChildren(); @@ -204,7 +199,6 @@ class SourceObjectNode extends Node { setSecondSourcePosition( sourceObject.secondPositionProperty.value ); } ); - secondSourcePositionProperty.link( position => { sourceObject.setSecondPoint( representationProperty, position ); } ); diff --git a/js/common/view/TargetNode.js b/js/common/view/TargetNode.js index bf1169b1..cc6361c8 100644 --- a/js/common/view/TargetNode.js +++ b/js/common/view/TargetNode.js @@ -59,7 +59,6 @@ class TargetNode extends Node { targetImage.translation = new Vector2( viewBounds.minX, viewBounds.minY ); }; - /** * update the visibility of the image based on: * is the image virtual? diff --git a/js/common/view/ToolboxPanel.js b/js/common/view/ToolboxPanel.js index 6b5ac058..41abb8ee 100644 --- a/js/common/view/ToolboxPanel.js +++ b/js/common/view/ToolboxPanel.js @@ -55,7 +55,6 @@ class ToolboxPanel extends Panel { super( toolbox, options ); - /** * Add input listener on iconNode to forward events to rulerNode * @param {Node} iconNode diff --git a/js/common/view/TrackingDiskNode.js b/js/common/view/TrackingDiskNode.js index 14a63bfc..1ef8fa6c 100644 --- a/js/common/view/TrackingDiskNode.js +++ b/js/common/view/TrackingDiskNode.js @@ -35,7 +35,6 @@ class TrackingDiskNode extends Circle { super( options.radius, options ); - //update position of disk positionProperty.link( position => { this.center = modelViewTransform.modelToViewPosition( position ); diff --git a/js/lens/LensScreen.js b/js/lens/LensScreen.js index 4e86be76..1c2f8094 100644 --- a/js/lens/LensScreen.js +++ b/js/lens/LensScreen.js @@ -39,7 +39,6 @@ class LensScreen extends Screen { tandem: tandem }; - super( () => new LensModel( tandem.createTandem( 'model' ) ), model => new LensScreenView( model, tandem.createTandem( 'view' ) ), diff --git a/js/lens/model/LensModel.js b/js/lens/model/LensModel.js index ee83a2f6..32b3a5a1 100644 --- a/js/lens/model/LensModel.js +++ b/js/lens/model/LensModel.js @@ -43,9 +43,7 @@ class LensModel extends GeometricOpticsModel { reset() { super.reset(); } - } - geometricOptics.register( 'LensModel', LensModel ); export default LensModel; diff --git a/js/lens/model/Spotlight.js b/js/lens/model/Spotlight.js index 66e2d325..580a0be7 100644 --- a/js/lens/model/Spotlight.js +++ b/js/lens/model/Spotlight.js @@ -67,7 +67,6 @@ class Spotlight { } - /** * get ratio of the distance of the screen/ target measure from the optic. * @private @@ -99,7 +98,6 @@ class Spotlight { */ getDiskParameters( screenPosition, opticPosition, opticDiameter, targetPosition ) { - 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 } ); diff --git a/js/mirror/model/MirrorModel.js b/js/mirror/model/MirrorModel.js index 7f877b8e..6c43e487 100644 --- a/js/mirror/model/MirrorModel.js +++ b/js/mirror/model/MirrorModel.js @@ -36,7 +36,6 @@ class MirrorModel extends GeometricOpticsModel { reset() { super.reset(); } - } geometricOptics.register( 'MirrorModel', MirrorModel );