-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinput.go
More file actions
59 lines (53 loc) · 1.62 KB
/
input.go
File metadata and controls
59 lines (53 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package cdp
import (
"context"
)
type DispatchKeyEventOption struct {
Type string `json:"type"`
Key string `json:"key"`
Text string `json:"text"`
UnmodifiedText string `json:"unmodifiedText"`
}
func (obj *WebSock) InputDispatchKeyEvent(ctx context.Context, option DispatchKeyEventOption) (RecvData, error) {
return obj.send(ctx, commend{
Method: "Input.dispatchKeyEvent",
Params: map[string]any{
"type": option.Type,
"key": option.Key,
"text": option.Text,
"unmodifiedText": option.UnmodifiedText,
},
})
}
type DispatchMouseEventOption struct {
Type string `json:"type"`
Button string `json:"button"`
X float64 `json:"x"`
Y float64 `json:"y"`
ClickCount int64 `json:"clickCount"`
DeltaX float64 `json:"deltaX"`
DeltaY float64 `json:"deltaY"`
}
func (obj *WebSock) InputDispatchMouseEvent(ctx context.Context, option DispatchMouseEventOption) (RecvData, error) {
return obj.send(ctx, commend{
Method: "Input.dispatchMouseEvent",
Params: map[string]any{
"type": option.Type,
"button": option.Button,
"clickCount": option.ClickCount,
"x": option.X,
"y": option.Y,
"deltaX": option.DeltaX,
"deltaY": option.DeltaY,
},
})
}
func (obj *WebSock) InputDispatchTouchEvent(ctx context.Context, Type string, TouchPoints []Point) (RecvData, error) {
return obj.send(ctx, commend{
Method: "Input.dispatchTouchEvent",
Params: map[string]any{
"type": Type,
"touchPoints": TouchPoints,
},
})
}