Skip to content

Commit

Permalink
doc and TODOs, #217
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jan 31, 2022
1 parent 129e6cc commit d4279ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/common/model/Representation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import starRightFacingUpright_png from '../../../images/starRightFacingUpright_p
import geometricOptics from '../../geometricOptics.js';
import geometricOpticsStrings from '../../geometricOpticsStrings.js';

// constants
// View-to-model scale for associated HTMLImageElement
const FRAMED_OBJECT_SCALE_FACTOR = 0.25;
const LIGHT_SOURCE_SCALE_FACTOR = 0.5;

Expand Down
10 changes: 6 additions & 4 deletions js/common/model/SourceObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class SourceObject {
representationProperty.value.scaleFactor
);

//TODO should this be derived from representationProperty? or from positionProperty?
//TODO this should be derived from representationProperty and positionProperty
//TODO left-top is unfortunate to have in the model, can this be avoided?
this.leftTopProperty = new Vector2Property( initialPosition.plus( offset ) );

//TODO should this be derived from representationProperty instead?
//TODO this should be the Property that we set
this.positionProperty = new DerivedProperty(
[ this.leftTopProperty ],
( leftTop: Vector2 ) => leftTop.minus( offset )
Expand All @@ -53,8 +53,10 @@ class SourceObject {
this.boundsProperty = new DerivedProperty(
[ this.leftTopProperty, representationProperty ],
( leftTop: Vector2, representation: Representation ) => {
const size = new Dimension2( representation.scaleFactor * representation.rightFacingUpright.width,
representation.scaleFactor * representation.rightFacingUpright.height );
const size = new Dimension2(
representation.scaleFactor * representation.rightFacingUpright.width,
representation.scaleFactor * representation.rightFacingUpright.height
);
return size.toBounds( leftTop.x, leftTop.y - size.height );
} );

Expand Down

0 comments on commit d4279ee

Please sign in to comment.