diff --git a/js/common/GeometricOpticsConstants.ts b/js/common/GeometricOpticsConstants.ts index e0920621..ed33a3c3 100644 --- a/js/common/GeometricOpticsConstants.ts +++ b/js/common/GeometricOpticsConstants.ts @@ -7,7 +7,6 @@ * @author Chris Malley (PixelZoom, Inc.) */ -import Vector2 from '../../../dot/js/Vector2.js'; import PhetFont from '../../../scenery-phet/js/PhetFont.js'; import geometricOptics from '../geometricOptics.js'; import NumberControl from '../../../scenery-phet/js/NumberControl.js'; @@ -32,8 +31,6 @@ const GeometricOpticsConstants = { // model HORIZONTAL_RULER_LENGTH: 260, // cm VERTICAL_RULER_LENGTH: 160, // cm - HORIZONTAL_RULER_INITIAL_POSITION: new Vector2( 200, 100 ), // cm - VERTICAL_RULER_INITIAL_POSITION: new Vector2( 100, 300 ), // cm // view RULER_HEIGHT: 40, // in view coordinates diff --git a/js/common/model/GeometricOpticsModel.ts b/js/common/model/GeometricOpticsModel.ts index 3940de71..2311e130 100644 --- a/js/common/model/GeometricOpticsModel.ts +++ b/js/common/model/GeometricOpticsModel.ts @@ -128,13 +128,11 @@ class GeometricOpticsModel { this.horizontalRuler = new GeometricOpticsRuler( { orientation: 'horizontal', - position: GeometricOpticsConstants.HORIZONTAL_RULER_INITIAL_POSITION, length: GeometricOpticsConstants.HORIZONTAL_RULER_LENGTH } ); this.verticalRuler = new GeometricOpticsRuler( { orientation: 'vertical', - position: GeometricOpticsConstants.VERTICAL_RULER_INITIAL_POSITION, length: GeometricOpticsConstants.VERTICAL_RULER_LENGTH } ); } diff --git a/js/common/model/GeometricOpticsRuler.ts b/js/common/model/GeometricOpticsRuler.ts index c5a82a8e..3fc57627 100644 --- a/js/common/model/GeometricOpticsRuler.ts +++ b/js/common/model/GeometricOpticsRuler.ts @@ -22,8 +22,7 @@ class GeometricOpticsRuler { private readonly orientation: RulerOrientation; readonly isVertical: boolean; - // position of the ruler, in view coordinates - //TODO change this to model coordinates + // position of the ruler, in view coordinates! readonly positionProperty: Property; // length of the ruler, in cm @@ -41,7 +40,6 @@ class GeometricOpticsRuler { options = merge( { orientation: 'horizontal', - position: Vector2.ZERO, length: 100 }, options ); @@ -50,7 +48,9 @@ class GeometricOpticsRuler { this.orientation = options.orientation; this.isVertical = ( this.orientation === 'vertical' ); - this.positionProperty = new Vector2Property( options.position ); + // The initial value of position really does not matter, because position will be set when the ruler is + // removed from the toolbox. + this.positionProperty = new Vector2Property( Vector2.ZERO ); this.length = options.length; this.nominalLength = options.length; diff --git a/js/common/view/GeometricOpticsRulerNode.ts b/js/common/view/GeometricOpticsRulerNode.ts index 8b60c266..ece0b773 100644 --- a/js/common/view/GeometricOpticsRulerNode.ts +++ b/js/common/view/GeometricOpticsRulerNode.ts @@ -90,6 +90,7 @@ class GeometricOpticsRulerNode extends Node { } ); // Drag bounds for the ruler, to keep some part of the ruler inside the visible bounds of the ScreenView. + // rulerDragBoundsProperty can be in view coordinates because ruler.positionProperty is in view coordinates. const rulerDragBoundsProperty = new DerivedProperty( [ visibleBoundsProperty ], ( visibleBounds: Bounds2 ) => {