Skip to content
This repository was archived by the owner on Jun 16, 2022. It is now read-only.

Commit d519d0b

Browse files
committed
Merge branch 'master' into 34-sync-touch
2 parents b10da26 + 03099ca commit d519d0b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/device.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ function createWindow(url, width, height) {
3737
chrome.windows.update(newWindow.id, {
3838
width: newWidth,
3939
height: newHeight + INFOBAR_HEIGHT + FRAME_HEIGHT
40-
}, () => {
40+
}, (updatedWindow) => {
41+
newWindow.width = updatedWindow.width;
42+
newWindow.height = updatedWindow.height;
43+
4144
resolve(newWindow);
4245
});
4346

@@ -114,6 +117,8 @@ class Device {
114117
url: winCtrl._url
115118
}));
116119

120+
//requested screen size VS actual window size
121+
this._windowScale = newWindow.width / this._width;
117122
this._window = newWindow;
118123
this._debugger = tabDebugger;
119124
}
@@ -168,15 +173,16 @@ class Device {
168173
button: 'left',
169174
y: y,
170175
x: x,
171-
timestamp: Date.now()
176+
timestamp: Date.now(),
177+
clickCount: 1
172178
};
173179

174180
if(this._touch) {
175181
command = 'Input.emulateTouchFromMouseEvent';
176-
data.timestamp = Date.now();
182+
data.x = Math.round(data.x * this._windowScale);
183+
data.y = Math.round(data.y * this._windowScale);
177184
} else {
178185
command = 'Input.dispatchMouseEvent';
179-
data.clickCount = 1;
180186
}
181187

182188
return (this._debugger)

0 commit comments

Comments
 (0)