Skip to content

Commit

Permalink
no need for EnabledNode to change cursor, scenery handles this when p…
Browse files Browse the repository at this point in the history
…ickable:false, #643
  • Loading branch information
pixelzoom committed Oct 23, 2020
1 parent 961b980 commit add7c94
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
4 changes: 0 additions & 4 deletions js/EnabledNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,13 @@ const EnabledNode = {
// this call defines enabledProperty
this.initializeEnabledPhetioObject( options );

const cursor = this.cursor;
const enabledListener = enabled => {
this.interruptSubtreeInput();
this.pickable = enabled;
this.opacity = enabled ? 1.0 : options.disabledOpacity;

// Mark this Node as disabled in the ParallelDOM
this.setAccessibleAttribute( 'aria-disabled', !enabled );

// handle cursor by supporting setting back to what the cursor was when component was made disabled.
this.cursor = enabled ? cursor : 'default';
};
this.enabledProperty.link( enabledListener );

Expand Down
6 changes: 1 addition & 5 deletions js/EnabledNodeTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,12 @@ QUnit.test( 'EnabledNode', assert => {
testEnabledNode( assert, node, 'For Node' );

const disabledOpacity = .2;
const customCursor = 'hi';
node = new EnabledNodeClass( {
disabledOpacity: disabledOpacity,
cursor: customCursor
disabledOpacity: disabledOpacity
} );

assert.ok( node.cursor === customCursor, 'cursor should be set' );
assert.ok( node.opacity === new Node().opacity, 'opacity should default to Node default' );
node.enabled = false;
assert.ok( node.cursor !== customCursor, 'enabled listener should have changed cursor' );
assert.ok( node.opacity === disabledOpacity, 'test disabled opacity' );

node.disposeEnabledNode();
Expand Down
3 changes: 0 additions & 3 deletions js/buttons/ButtonNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ class ButtonNode extends Node {

super();

//TODO https://github.com/phetsims/sun/issues/643 delete this when options are passed to super
this.cursor = options.cursor;

// @protected
this.buttonModel = buttonModel;

Expand Down

1 comment on commit add7c94

@zepumph
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tagging #257 also as base work in EnabledNode.

Please sign in to comment.