Skip to content

Commit

Permalink
add showRulerRegions query parameter, #185
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 5, 2019
1 parent 58fa463 commit 74f4db6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions js/gravity-force-lab/view/GravityForceLabScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ define( require => {
const ISLCA11yStrings = require( 'INVERSE_SQUARE_LAW_COMMON/ISLCA11yStrings' );
const ISLCCheckboxPanel = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCCheckboxPanel' );
const ISLCGridNode = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCGridNode' );
const ISLCRulerRegionsNode = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCRulerRegionsNode' );
const ISLCObjectEnum = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCObjectEnum' );
const ISLCQueryParameters = require( 'INVERSE_SQUARE_LAW_COMMON/ISLCQueryParameters' );
const ISLCRulerNode = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCRulerNode' );
Expand Down Expand Up @@ -65,6 +66,7 @@ define( require => {
// constants
const CONTROL_SCALE = 0.72;
const SHOW_GRID = ISLCQueryParameters.showGrid;
const SHOW_RULER_REGIONS = ISLCQueryParameters.showRulerRegions;
const OBJECT_ONE = ISLCObjectEnum.OBJECT_ONE;
const OBJECT_TWO = ISLCObjectEnum.OBJECT_TWO;
const CHECKBOX_TEXT_SIZE = 15;
Expand Down Expand Up @@ -237,15 +239,17 @@ define( require => {
} );

// create down here because it needs locations of other items in the screen view
const rulerDescriber = new GravityForceLabRulerDescriber( model.rulerPositionProperty, modelViewTransform, [
const rulerRegionPositions = [
mass2Node.top,
mass1Node.top,
mass1Node.localToGlobalPoint( new Vector2( 0, mass1Node.dragNode.top ) ).y,
mass1Node.center.x,
mass1Node.localToGlobalPoint( new Vector2( 0, mass1Node.dragNode.bottom ) ).y,
massControl1.top,
this.layoutBounds.bottom
], positionDescriber );
];
const rulerDescriber = new GravityForceLabRulerDescriber( model.rulerPositionProperty, modelViewTransform,
rulerRegionPositions, positionDescriber );

// @private - added to object for animation stepping
const gravityForceLabRuler = new ISLCRulerNode(
Expand Down Expand Up @@ -314,6 +318,10 @@ define( require => {
{ stroke: 'rgba( 250, 100, 100, 0.6 )' } );
this.addChild( gridNode );
}
if ( SHOW_RULER_REGIONS ) {
const gridNode = new ISLCRulerRegionsNode( rulerRegionPositions, this.layoutBounds );
this.addChild( gridNode );
}

mass1Node.addInputListener( {
focus: function() {
Expand Down

0 comments on commit 74f4db6

Please sign in to comment.