[web] Notify engine of handled PointerScrollEvents. (#145500)
Notifies the engine when `PointerSignalEvents` have been ignored by the framework, through the `ui.PointerData.respond` method. This allows the web to "preventDefault" (or not) on `wheel` events. ## Issues * Fixes (partially): https://github.com/flutter/flutter/issues/139263 ## Tests * Added tests to ensure `respond` is called at the right time, with the right value. ## Demo * https://dit-multiview-scroll.web.app <details> <summary> ## Previous versions </summary> 1. Modified `PointerScrollEvent`, not shippable. 2. Modified when events were handled, instead of the opposite. </details>
This commit is contained in:
@@ -288,6 +288,7 @@ class TestPointer {
|
||||
PointerScrollEvent scroll(
|
||||
Offset scrollDelta, {
|
||||
Duration timeStamp = Duration.zero,
|
||||
RespondPointerEventCallback? onRespond,
|
||||
}) {
|
||||
assert(kind != PointerDeviceKind.touch, "Touch pointers can't generate pointer signal events");
|
||||
assert(location != null);
|
||||
@@ -297,6 +298,7 @@ class TestPointer {
|
||||
device: _device,
|
||||
position: location!,
|
||||
scrollDelta: scrollDelta,
|
||||
onRespond: onRespond,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user