Fix a problem with effects not stopping. #13
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With a multiple display setup, some effects would not stop when the mouse existed the notch. If a display is oriented above the notched display, the mouse cursor can move out the 'top' of the notch.
Many of our effects stop rendering when the mouse has moved outside the notch or some distance from the notch. This works because the mouse tracking area extends beyond the the bounds of the notch to the sides and below the notch. In these scenarios we generate
mouseMoved()
calls when the cursor leaves the notch, but is still in that tracking area. In this case though, the mouse can exit the notch at the top, which means it leaves the notch and the tracking area in one update of mouse position. This results in nomousedMoved()
call, but an immediatemouseExited()
call.Effects that expect to end their rendering on a
mouseMove()
that happens withunderNotch == false
would then fail to stop. We could make sure that each effect also stops rendering onmouseExited()
, but that leaves the door open to repeat this problem because it is not enforced.This fix adds an explicit call to
mouseMoved(at:underNotch:)
before the call tomouseExited(at:point:)
. This ensures that any code in mouseMoved that switches on under the notch or not still gets a chance to run in the exit case.