Skip to content

Commit

Permalink
Add an intermediate Node that contains the body + nozzle, and make it…
Browse files Browse the repository at this point in the history
… public, see #660
  • Loading branch information
samreid committed Jan 31, 2021
1 parent b7c2e3d commit 186e921
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/LaserPointerNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class LaserPointerNode extends Node {
right: 0,
centerY: 0
} );
children.push( nozzleNode );

// the main body of the laser pointer
const bodyNode = new Rectangle( 0, 0, options.bodySize.width, options.bodySize.height, {
Expand All @@ -116,7 +115,8 @@ class LaserPointerNode extends Node {
right: nozzleNode.left + options.cornerRadius, // overlap to hide corner radius
centerY: nozzleNode.centerY
} );
children.push( bodyNode );
const bodyAndNozzleNode = new Node( { children: [ nozzleNode, bodyNode ] } );
children.push( bodyAndNozzleNode );

// the optional button that controls whether the laser is on or off
let onOffButton = null;
Expand Down Expand Up @@ -175,6 +175,9 @@ class LaserPointerNode extends Node {

// support for binder documentation, stripped out in builds and only runs when ?binder is specified
assert && phet.chipper.queryParameters.binder && InstanceRegistry.registerDataURL( 'scenery-phet', 'LaserPointerNode', this );

// @public (read-only) {Node} - in case the client needs to add input listeners to that part
this.bodyAndNozzleNode = bodyAndNozzleNode;
}

get enabled() { return this.isEnabled(); }
Expand Down

0 comments on commit 186e921

Please sign in to comment.