Skip to content

Commit

Permalink
Adding PressListener.clearOverPointers to help with complicated "ente…
Browse files Browse the repository at this point in the history
…r" and "exit" mismatch events, see #1021
  • Loading branch information
jonathanolson committed Dec 17, 2019
1 parent 9032474 commit e938783
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions js/listeners/PressListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,19 @@ define( require => {
sceneryLog && sceneryLog.InputListener && sceneryLog.pop();
},

/**
* This should be called when the listened "Node" is effectively removed from the scene graph AND
* expected to be placed back in such that it could potentially get multiple "enter" events, see
* https://github.com/phetsims/scenery/issues/1021
* @public
*
* This will clear the list of pointers considered "over" the Node, so that when it is placed back in, the state
* will be correct, and another "enter" event will not be missing an "exit".
*/
clearOverPointers() {
this.overPointers.clear(); // We have listeners that will trigger the proper refreshes
},

/**
* Recomputes the value for isOverProperty. Separate to reduce anonymous function closures.
* @private
Expand Down

0 comments on commit e938783

Please sign in to comment.