@@ -22,15 +22,13 @@ import { toButtonsMask, toModifiersMask } from './crProtocolHelper';
22
22
23
23
import type * as types from '../types' ;
24
24
import type { CRSession } from './crConnection' ;
25
- import type { DragManager } from './crDragDrop' ;
26
25
import type { CRPage } from './crPage' ;
27
26
28
27
29
28
export class RawKeyboardImpl implements input . RawKeyboard {
30
29
constructor (
31
30
private _client : CRSession ,
32
31
private _isMac : boolean ,
33
- private _dragManger : DragManager ,
34
32
) { }
35
33
36
34
_commandsForCode ( code : string , modifiers : Set < types . KeyboardModifier > ) {
@@ -54,8 +52,8 @@ export class RawKeyboardImpl implements input.RawKeyboard {
54
52
55
53
async keydown ( modifiers : Set < types . KeyboardModifier > , keyName : string , description : input . KeyDescription , autoRepeat : boolean ) : Promise < void > {
56
54
const { code, key, location, text } = description ;
57
- if ( code === 'Escape' && await this . _dragManger . cancelDrag ( ) )
58
- return ;
55
+ if ( code === 'Escape' )
56
+ await this . _client . send ( 'Input.cancelDragging' , { } ) ;
59
57
const commands = this . _commandsForCode ( code , modifiers ) ;
60
58
await this . _client . send ( 'Input.dispatchKeyEvent' , {
61
59
type : text ? 'keyDown' : 'rawKeyDown' ,
@@ -92,37 +90,25 @@ export class RawKeyboardImpl implements input.RawKeyboard {
92
90
export class RawMouseImpl implements input . RawMouse {
93
91
private _client : CRSession ;
94
92
private _page : CRPage ;
95
- private _dragManager : DragManager ;
96
93
97
- constructor ( page : CRPage , client : CRSession , dragManager : DragManager ) {
94
+ constructor ( page : CRPage , client : CRSession ) {
98
95
this . _page = page ;
99
96
this . _client = client ;
100
- this . _dragManager = dragManager ;
101
97
}
102
98
103
99
async move ( x : number , y : number , button : types . MouseButton | 'none' , buttons : Set < types . MouseButton > , modifiers : Set < types . KeyboardModifier > , forClick : boolean ) : Promise < void > {
104
- const actualMove = async ( ) => {
105
- await this . _client . send ( 'Input.dispatchMouseEvent' , {
106
- type : 'mouseMoved' ,
107
- button,
108
- buttons : toButtonsMask ( buttons ) ,
109
- x,
110
- y,
111
- modifiers : toModifiersMask ( modifiers ) ,
112
- force : buttons . size > 0 ? 0.5 : 0 ,
113
- } ) ;
114
- } ;
115
- if ( forClick ) {
116
- // Avoid extra protocol calls related to drag and drop, because click relies on
117
- // move-down-up protocol commands being sent synchronously.
118
- return actualMove ( ) ;
119
- }
120
- await this . _dragManager . interceptDragCausedByMove ( x , y , button , buttons , modifiers , actualMove ) ;
100
+ await this . _client . send ( 'Input.dispatchMouseEvent' , {
101
+ type : 'mouseMoved' ,
102
+ button,
103
+ buttons : toButtonsMask ( buttons ) ,
104
+ x,
105
+ y,
106
+ modifiers : toModifiersMask ( modifiers ) ,
107
+ force : buttons . size > 0 ? 0.5 : 0 ,
108
+ } ) ;
121
109
}
122
110
123
111
async down ( x : number , y : number , button : types . MouseButton , buttons : Set < types . MouseButton > , modifiers : Set < types . KeyboardModifier > , clickCount : number ) : Promise < void > {
124
- if ( this . _dragManager . isDragging ( ) )
125
- return ;
126
112
await this . _client . send ( 'Input.dispatchMouseEvent' , {
127
113
type : 'mousePressed' ,
128
114
button,
@@ -136,10 +122,6 @@ export class RawMouseImpl implements input.RawMouse {
136
122
}
137
123
138
124
async up ( x : number , y : number , button : types . MouseButton , buttons : Set < types . MouseButton > , modifiers : Set < types . KeyboardModifier > , clickCount : number ) : Promise < void > {
139
- if ( this . _dragManager . isDragging ( ) ) {
140
- await this . _dragManager . drop ( x , y , modifiers ) ;
141
- return ;
142
- }
143
125
await this . _client . send ( 'Input.dispatchMouseEvent' , {
144
126
type : 'mouseReleased' ,
145
127
button,
0 commit comments