You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this. The bounding itself looks right, and I checked that the loop still drains properly: visible starts true, and idleAt gets pushed forward while the queue is non-empty, so the frame loop stays alive until it empties.
Three things before this goes in:
1. It changes the public API behaviour.enqueueSplat/enqueueMelt bail out on !visible, and that path also covers the public splat() and melt() methods, not just the internal pointer handlers. Anyone driving those programmatically against an off-screen instance now gets a silent no-op. Could we keep dropping pointer input while off-screen, but let explicit API calls through (or at least queue them)? Either way it should be called out, since it's beyond "bound the queue".
2. Fast drags will lag. Liquid went from pop() (LIFO, drain-all) to shift() (FIFO, capped at 8/frame). The ordering is more correct, but a quick swipe that queues ~30 splats now takes 4 frames to apply, so the trail visibly trails the cursor. Could you check the feel on a fast drag in the Liquid demo, rather than just the frame timings?
3. One clause in Frost has no timeout.queuedMelts.length > 0 is now part of animating, but the queue only drains inside renderPointer(), which early-returns when pointer is null. That can't currently happen (createDoubleTarget never returns null, and rebuildTargets always assigns it), so it isn't a live bug. But it's the only condition in animating that can't expire on its own, so if that ever changes the rAF loop would spin forever. Clearing the queue or skipping the clause when pointer is null would make it safe.
Also, the Before/After in the description looks like it was meant to have profiles attached, but they didn't come through.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Summary
Fixes #42.
This PR prevents Liquid and Frost from accumulating and draining an unbounded number of pending inputs in a single animation frame.
Changes
Before:
After: