emulateTouchFromMouseEvent method
Future<void>
emulateTouchFromMouseEvent(
- @Enum.new(['mousePressed', 'mouseReleased', 'mouseMoved', 'mouseWheel']) String type,
- int x,
- int y,
- MouseButton button, {
- TimeSinceEpoch? timestamp,
- num? deltaX,
- num? deltaY,
- int? modifiers,
- int? clickCount,
Emulates touch event from the mouse event parameters.
type Type of the mouse event.
x X coordinate of the mouse pointer in DIP.
y Y coordinate of the mouse pointer in DIP.
button Mouse button. Only "none", "left", "right" are supported.
timestamp Time at which the event occurred (default: current time).
deltaX X delta in DIP for mouse wheel event (default: 0).
deltaY Y delta in DIP for mouse wheel event (default: 0).
modifiers Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
(default: 0).
clickCount Number of times the mouse button was clicked (default: 0).
Implementation
Future<void> emulateTouchFromMouseEvent(
@Enum(['mousePressed', 'mouseReleased', 'mouseMoved', 'mouseWheel'])
String type,
int x,
int y,
MouseButton button, {
TimeSinceEpoch? timestamp,
num? deltaX,
num? deltaY,
int? modifiers,
int? clickCount,
}) async {
assert(
const [
'mousePressed',
'mouseReleased',
'mouseMoved',
'mouseWheel',
].contains(type),
);
await _client.send('Input.emulateTouchFromMouseEvent', {
'type': type,
'x': x,
'y': y,
'button': button,
'timestamp': ?timestamp,
'deltaX': ?deltaX,
'deltaY': ?deltaY,
'modifiers': ?modifiers,
'clickCount': ?clickCount,
});
}