Skip to content

Commit

Permalink
implemented some suggested improvements to leveraged code that locate…
Browse files Browse the repository at this point in the history
…s the parent screen view in creator nodes, see phetsims/scenery-phet#214 and #83.
  • Loading branch information
jbphet committed Jan 8, 2016
1 parent a7e6ad6 commit a33127a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/common/view/ShapeCreatorNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,15 @@ define( function( require ) {
var thisDragHandler = this;

if ( !this.parentScreenView ) {
// Find the parent screen view by moving up the scene graph.

// find the parent screen view by moving up the scene graph
var testNode = self;
while ( testNode !== null ) {
if ( testNode instanceof ScreenView ) {
this.parentScreenView = testNode;
break;
}
testNode = testNode.parents[ 0 ]; // Move up the scene graph by one level
testNode = testNode.parents[ 0 ]; // move up the scene graph by one level
}
assert && assert( this.parentScreenView, 'unable to find parent screen view' );
}
Expand Down

0 comments on commit a33127a

Please sign in to comment.