Skip to content

Commit

Permalink
force string was not being centered initially
Browse files Browse the repository at this point in the history
  • Loading branch information
aadish committed Feb 15, 2017
1 parent 0ddf3aa commit b13cbbd
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions js/gravity-force-lab/view/MassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,13 @@ define( function( require ) {

var setArrowTextPosition = function(){
// making sure arrow text does not goes out of dev bounds
var arrowAtBoundary = false;
arrowText.centerX = 0;
if ( Math.floor( self.localToParentPoint( arrowText.center ).x - arrowText.width / 2 ) <= layoutBounds.left + TEXT_OFFSET ) {
arrowText.left = self.parentToLocalBounds( layoutBounds ).left + TEXT_OFFSET;
arrowAtBoundary = true;
}

if ( Math.ceil( self.localToParentPoint( arrowText.center ).x + arrowText.width / 2 ) >= layoutBounds.right - TEXT_OFFSET ) {
arrowText.right = self.parentToLocalBounds( layoutBounds ).right - TEXT_OFFSET;
arrowAtBoundary = true;
}

if ( !arrowAtBoundary ) {
arrowText.centerX = 0;
}
};
// redraw view without shift
Expand Down Expand Up @@ -226,7 +220,7 @@ define( function( require ) {

massModel.positionProperty.link( function( prop ) {
self.x = modelViewTransform.modelToViewX( prop );
setArrowTextPosition();
//setArrowTextPosition();
} );

model.showValuesProperty.lazyLink( redrawForce );
Expand Down

0 comments on commit b13cbbd

Please sign in to comment.