Skip to content

Commit

Permalink
delete initial positions for rulers, they are not relevant, #263
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Dec 7, 2021
1 parent cdd7376 commit 9cfaa0a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions js/common/GeometricOpticsConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions js/common/model/GeometricOpticsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
} );
}
Expand Down
8 changes: 4 additions & 4 deletions js/common/model/GeometricOpticsRuler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vector2>;

// length of the ruler, in cm
Expand All @@ -41,7 +40,6 @@ class GeometricOpticsRuler {

options = merge( {
orientation: 'horizontal',
position: Vector2.ZERO,
length: 100
}, options );

Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions js/common/view/GeometricOpticsRulerNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Bounds2>(
[ visibleBoundsProperty ],
( visibleBounds: Bounds2 ) => {
Expand Down

0 comments on commit 9cfaa0a

Please sign in to comment.