From cd734bbfe094a294df8fb822045acdd40cfbcd6c Mon Sep 17 00:00:00 2001 From: Jonathan Olson Date: Tue, 2 Jun 2020 10:41:27 -0600 Subject: [PATCH] REVIEW changes for https://github.com/phetsims/scenery/issues/490 (and removing getChildrenWithinBounds) --- js/nodes/Node.js | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/js/nodes/Node.js b/js/nodes/Node.js index d92866b75..27c52fb27 100644 --- a/js/nodes/Node.js +++ b/js/nodes/Node.js @@ -382,9 +382,8 @@ function Node( options ) { // @private {Array.} - For user input handling (mouse/touch). this._inputListeners = []; - // For now, custom-add listener count change notifications into these Properties, since we need to know when their - // number of listeners changes dynamically. - // TODO: We'll want an improved way of doing this, that is still performant. + // Add listener count change notifications into these Properties, since we need to know when their number of listeners + // changes dynamically. const boundsListenersAddedOrRemovedListener = this.onBoundsListenersAddedOrRemoved.bind( this ); const boundsInvalidationListener = this.validateBounds.bind( this ); @@ -1944,26 +1943,6 @@ inherit( PhetioObject, Node, { } }, - /** - * Returns a list of child nodes that intersect the passed in bounds. - * @public - * - * @param {Bounds2} bounds - In the local coordinate frame - * @returns {Array.} - */ - getChildrenWithinBounds: function( bounds ) { - const result = []; - const length = this._children.length; - for ( let i = 0; i < length; i++ ) { - const child = this._children[ i ]; - // TODO: Is this safe, we're directly accessing? - if ( !child.boundsProperty.value.intersection( bounds ).isEmpty() ) { - result.push( child ); - } - } - return result; - }, - /** * Adds an input listener. * @public @@ -3587,7 +3566,8 @@ inherit( PhetioObject, Node, { *----------------------------------------------------------------------------*/ /** - * When a hint changes in general, we default to refresh everything for safety. + * When ANY hint changes, we refresh everything currently (for safety, this may be possible to make more specific + * in the future, but hint changes are not particularly common performance bottleneck). * @private */ invalidateHint: function() {