This PR replaces queueMicrotask with requestAnimationFrame. Turns out that introducing useLayoutEffect (which was introduced in #2925) ended up in gestures being attached in wrong order in some cases.
This can be observed in #2963 (it is highly recommended to look into repro structure):
3 handlers from ZoomView where attached - they have correct tags
Re-render happens, handlers' tags are now -1
Pan from SVGMask is attached - all handlers marked as simultaneous have tag-1, therefore relations are not set up
Handlers from 1. are attached again, so they get back their original tags
In this scenario, simultaneous handlers array in Pan in SVGMask was empty, effectively disabling this relation. Switching to requestAnimationFrame solves this problem.
Test plan
Verify that examples work as they used to (draggable, multitap, transformations)
Description
This PR replaces
queueMicrotask
withrequestAnimationFrame
. Turns out that introducinguseLayoutEffect
(which was introduced in #2925) ended up in gestures being attached in wrong order in some cases.This can be observed in #2963 (it is highly recommended to look into repro structure):
ZoomView
where attached - they have correcttags
tags
are now-1
Pan
fromSVGMask
is attached - all handlers marked assimultaneous
havetag
-1
, therefore relations are not set uptags
In this scenario,
simultaneous handlers
array inPan
inSVGMask
was empty, effectively disabling this relation. Switching torequestAnimationFrame
solves this problem.Test plan
Verify that examples work as they used to (
draggable
,multitap
,transformations
)Also tested on code from #2963 .