Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Oct 10, 2017
2 parents 5362d16 + 23aa0e6 commit 1d44afc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 22 deletions.
65 changes: 44 additions & 21 deletions js/accessibility/FocusHighlightPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ define( function( require ) {
this.innerHighlightPath && this.innerHighlightPath.setShape( shape );
},

/**
* Get a scalar based on the node's transform excluding position.
* @private
* @param {Node} [node] - optional node to be used instead of "this"
* @returns {number}
*/
getWidthMagnitudeFromTransform: function( node ) {
node = node || this;
return node.transform.transformDelta2( Vector2.X_UNIT ).magnitude();
},

/**
* @public
* Update the line width of both Paths based on transform. Can be overwritten (ridden?) by the options
Expand All @@ -101,29 +90,63 @@ define( function( require ) {
},

/**
* Given a node, return the lineWidth of the focusHighlight that would be supplied.
* @param {Node} [node] - optional node to base the line width off of, otherwise use "this"
* Given a node, return the lineWidth of this focus highlight.
* @public
* @returns {number}
*/
getOuterLineWidth: function( node ) {
getOuterLineWidth: function() {
if ( this.options.outerLineWidth ) {
return this.options.outerLineWidth;
}
node = node || this;
return OUTER_LINE_WIDTH_BASE / this.getWidthMagnitudeFromTransform( node );
return FocusHighlightPath.getOuterLineWidthFromNode( this );
},

/**
* Given a node, return the lineWidth of the inner focusHighlight that would be supplied.
* @param {Node} [node] - optional node to base the line width off of, otherwise use "this"
* Given a node, return the lineWidth of this focus highlight.
* @returns {number}
*/
getInnerLineWidth: function( node ) {
getInnerLineWidth: function() {
if ( this.options.innerLineWidth ) {
return this.options.innerLineWidth;
}
node = node || this;
return INNER_LINE_WIDTH_BASE / this.getWidthMagnitudeFromTransform( node );
return FocusHighlightPath.getInnerLineWidthFromNode( this );
}
}, {

/**
* Get the outer line width of a focus highlight based on the node's scale and rotation transform information.
* @public
* @static
*
* @param {Node} node
* @return {number}
*/
getInnerLineWidthFromNode: function( node ) {
return INNER_LINE_WIDTH_BASE / FocusHighlightPath.getWidthMagnitudeFromTransform( node );
},

/**
* Get the outer line width of a node, based on its scale and rotation transformation.
* @public
* @static
*
* @param {Node} node
* @return {number}
*/
getOuterLineWidthFromNode: function( node ) {
return OUTER_LINE_WIDTH_BASE / FocusHighlightPath.getWidthMagnitudeFromTransform( node );
},

/**
* Get a scalar width based on the node's transform excluding position.
* @private
* @static
*
* @param {Node} node
* @returns {number}
*/
getWidthMagnitudeFromTransform: function( node ) {
return node.transform.transformDelta2( Vector2.X_UNIT ).magnitude();
}
} );
} );
2 changes: 1 addition & 1 deletion js/overlays/FocusOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ define( function( require ) {
else if ( this.mode === 'node' ) {

// If focusHighlightLayerable, then the focusHighlight is just a node in the scene graph, so set it invisible
if ( this.node.accessibleContent.focusHighlightLayerable ) {
if ( this.node.accessibleContent && this.node.accessibleContent.focusHighlightLayerable ) {
this.node.accessibleContent.focusHighlight.visible = false;
}
else {
Expand Down

0 comments on commit 1d44afc

Please sign in to comment.