From 673c5fc75fc854afdaff973be099f40dc1b94333 Mon Sep 17 00:00:00 2001 From: zepumph Date: Mon, 29 Jul 2019 13:24:01 -0800 Subject: [PATCH] factor out var, fix arrow min width, https://github.com/phetsims/inverse-square-law-common/issues/76 --- js/view/ISLCForceArrowNode.js | 2 +- js/view/ISLCObjectNode.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/view/ISLCForceArrowNode.js b/js/view/ISLCForceArrowNode.js index 49c9748..5c60078 100644 --- a/js/view/ISLCForceArrowNode.js +++ b/js/view/ISLCForceArrowNode.js @@ -30,7 +30,7 @@ define( function( require ) { // constants var ARROW_LENGTH = 8; // empirically determined - var ARROW_WIDTH_MIN = 1; // empirically determined + var ARROW_WIDTH_MIN = 0; // Some ISLC sims support an object value of zero, this must be zero to support this case. var TEXT_OFFSET = 10; // empirically determined to make sure text does not go out of bounds /** diff --git a/js/view/ISLCObjectNode.js b/js/view/ISLCObjectNode.js index b1e7412..539426e 100644 --- a/js/view/ISLCObjectNode.js +++ b/js/view/ISLCObjectNode.js @@ -137,8 +137,11 @@ define( require => { // @public - which object this instance is (one or two) this.enum = object === model.object1 ? ISLCObjectEnum.OBJECT_ONE : ISLCObjectEnum.OBJECT_TWO; + // Used by arrows and puller + const modelMaxForce = model.getMaxForce(); + // the full range of force for the arrow node (note: this is distinct) - const arrowForceRange = new Range( model.getMinForceMagnitude(), model.getMaxForce() ); + const arrowForceRange = new Range( model.getMinForceMagnitude(), modelMaxForce ); // @protected - arrow node this.arrowNode = new ISLCForceArrowNode( @@ -155,7 +158,7 @@ define( require => { // @private - the puller node this.pullerNode = new ISLCPullerNode( - new Range( model.getMinForce(), model.getMaxForce() ), + new Range( model.getMinForce(), modelMaxForce ), config.tandem.createTandem( 'pullerNode' ), config.pullerNodeOptions );