Skip to content

Commit

Permalink
Completing main move of content from Accessibility.js => AccessibleDi…
Browse files Browse the repository at this point in the history
…splaysInfo.js, see #746
  • Loading branch information
jonathanolson committed May 15, 2018
1 parent 0e9104f commit 259a5bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 84 deletions.
81 changes: 1 addition & 80 deletions js/accessibility/Accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ define( function( require ) {
var Emitter = require( 'AXON/Emitter' );
var extend = require( 'PHET_CORE/extend' );
var invalidateAccessibleContent = require( 'SCENERY/accessibility/invalidateAccessibleContent' );
var Renderer = require( 'SCENERY/display/Renderer' );
var scenery = require( 'SCENERY/scenery' );

var INPUT_TAG = AccessibilityUtil.TAGS.INPUT;
Expand Down Expand Up @@ -1467,7 +1466,7 @@ define( function( require ) {
if ( this._accessibleVisible !== visible ) {
this._accessibleVisible = visible;

this.onAccessibleAccessibleVisibilityChange( visible );
this._accessibleDisplaysInfo.onAccessibleVisibilityChange( visible );
}
},
set accessibleVisible( visible ) { this.setAccessibleVisible( visible ); },
Expand Down Expand Up @@ -1844,84 +1843,6 @@ define( function( require ) {
sceneryLog && sceneryLog.Accessibility && sceneryLog.pop();
},

/**
* Called when our summary bitmask changes
* @public (scenery-internal)
*
* @param {number} oldBitmask
* @param {number} newBitmask
*/
onAccessibleSummaryChange: function( oldBitmask, newBitmask ) {
sceneryLog && sceneryLog.Accessibility && sceneryLog.Accessibility( 'onAccessibleSummaryChange n#' + this.id + ' wasA11y:' + !( Renderer.bitmaskNotAccessible & oldBitmask ) + ', isA11y:' + !( Renderer.bitmaskNotAccessible & newBitmask ) );
sceneryLog && sceneryLog.Accessibility && sceneryLog.push();

this._accessibleDisplaysInfo.onSummaryChange( oldBitmask, newBitmask );

sceneryLog && sceneryLog.Accessibility && sceneryLog.pop();
},

/**
* Called when our visibility changes.
* @public (scenery-internal)
*
* @param {boolean} visible
*/
onAccessibleVisibilityChange: function( visible ) {
sceneryLog && sceneryLog.Accessibility && sceneryLog.Accessibility( 'onAccessibleVisibilityChange n#' + this.id + ' visible:' + visible );
sceneryLog && sceneryLog.Accessibility && sceneryLog.push();

this._accessibleDisplaysInfo.onVisibilityChange( visible );

sceneryLog && sceneryLog.Accessibility && sceneryLog.pop();
},

/**
* Called when our accessibleVisibility changes.
* @public (scenery-internal)
*
* TODO: figure out a good renaming, we were following a pattern earlier.
*
* @param {boolean} visible
*/
onAccessibleAccessibleVisibilityChange: function( visible ) {
sceneryLog && sceneryLog.Accessibility && sceneryLog.Accessibility( 'onAccessibleAccessibleVisibilityChange n#' + this.id + ' accessibleVisible:' + visible );
sceneryLog && sceneryLog.Accessibility && sceneryLog.push();

this._accessibleDisplaysInfo.onAccessibleVisibilityChange( visible );

sceneryLog && sceneryLog.Accessibility && sceneryLog.pop();
},

/**
* Called when we have a rooted display added to this node.
* @public (scenery-internal)
*
* @param {Display} display
*/
onAccessibleAddedRootedDisplay: function( display ) {
sceneryLog && sceneryLog.Accessibility && sceneryLog.Accessibility( 'onAccessibleAddedRootedDisplay n#' + this.id );
sceneryLog && sceneryLog.Accessibility && sceneryLog.push();

this._accessibleDisplaysInfo.onAddedRootedDisplay( display );

sceneryLog && sceneryLog.Accessibility && sceneryLog.pop();
},

/**
* Called when we have a rooted display removed from this node.
* @public (scenery-internal)
*
* @param {Display} display
*/
onAccessibleRemovedRootedDisplay: function( display ) {
sceneryLog && sceneryLog.Accessibility && sceneryLog.Accessibility( 'onAccessibleRemovedRootedDisplay n#' + this.id );
sceneryLog && sceneryLog.Accessibility && sceneryLog.push();

this._accessibleDisplaysInfo.onRemovedRootedDisplay( display );

sceneryLog && sceneryLog.Accessibility && sceneryLog.pop();
},

/*---------------------------------------------------------------------------*/
// Accessible Instance handling

Expand Down
12 changes: 8 additions & 4 deletions js/nodes/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2210,7 +2210,8 @@ define( function( require ) {
* @param {number} newBitmask
*/
onSummaryChange: function( oldBitmask, newBitmask ) {
this.onAccessibleSummaryChange( oldBitmask, newBitmask );
// Defined in Accessibility.js
this._accessibleDisplaysInfo.onSummaryChange( oldBitmask, newBitmask );
},

/**
Expand Down Expand Up @@ -2848,7 +2849,8 @@ define( function( require ) {
this._picker.onVisibilityChange();
if ( assertSlow ) { this._picker.audit(); }

this.onAccessibleVisibilityChange( visible );
// Defined in Accessibility.js
this._accessibleDisplaysInfo.onVisibilityChange( visible );

this.trigger0( 'visibility' );
}
Expand Down Expand Up @@ -4356,7 +4358,8 @@ define( function( require ) {
assert && assert( display instanceof scenery.Display );
this._rootedDisplays.push( display );

this.onAccessibleAddedRootedDisplay( display );
// Defined in Accessibility.js
this._accessibleDisplaysInfo.onAddedRootedDisplay( display );
},

/**
Expand All @@ -4371,7 +4374,8 @@ define( function( require ) {
assert && assert( index !== -1, 'Cannot remove a Display from a Node if it was not there' );
this._rootedDisplays.splice( index, 1 );

this.onAccessibleRemovedRootedDisplay( display );
// Defined in Accessibility.js
this._accessibleDisplaysInfo.onRemovedRootedDisplay( display );
},

/*---------------------------------------------------------------------------*
Expand Down

0 comments on commit 259a5bb

Please sign in to comment.