Skip to content

Commit 6156d2b

Browse files
committed
release: v1.4.4
1 parent 196f304 commit 6156d2b

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.4.4 (20 Dec 2022)
2+
3+
* fix: select element on mobile
4+
15
## 1.4.3 (17 Dec 2022)
26

37
* feat: support DOM.getNode

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chobitsu",
3-
"version": "1.4.3",
3+
"version": "1.4.4",
44
"description": "Chrome devtools protocol JavaScript implementation",
55
"main": "dist/chobitsu.js",
66
"exports": {

src/domains/Overlay.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { getNode, getNodeId, isValidNode } from '../lib/nodeManager'
22
import { pushNodesToFrontend } from './DOM'
33
import $ from 'licia/$'
44
import h from 'licia/h'
5-
import isMobile from 'licia/isMobile'
65
import evalCss from 'licia/evalCss'
76
import defaults from 'licia/defaults'
87
import extend from 'licia/extend'
@@ -21,6 +20,7 @@ const showInfo = cssSupports(
2120
'clip-path',
2221
'polygon(50% 0px, 0px 100%, 100% 100%)'
2322
)
23+
const hasTouchSupport = 'ontouchstart' in root
2424

2525
const css = require('luna-dom-highlighter/luna-dom-highlighter.css').replace(
2626
'/*# sourceMappingURL=luna-dom-highlighter.css.map*/',
@@ -126,9 +126,9 @@ export function setInspectMode(params: any) {
126126
}
127127

128128
function getElementFromPoint(e: any) {
129-
if (isMobile()) {
129+
if (hasTouchSupport) {
130130
const touch = e.touches[0] || e.changedTouches[0]
131-
return document.elementFromPoint(touch.pageX, touch.pageY)
131+
return document.elementFromPoint(touch.clientX, touch.clientY)
132132
}
133133

134134
return document.elementFromPoint(e.clientX, e.clientY)
@@ -185,7 +185,7 @@ function clickListener(e: any) {
185185
function addEvent(type: string, listener: any) {
186186
document.documentElement.addEventListener(type, listener, true)
187187
}
188-
if (isMobile()) {
188+
if (hasTouchSupport) {
189189
addEvent('touchstart', moveListener)
190190
addEvent('touchmove', moveListener)
191191
addEvent('touchend', clickListener)

0 commit comments

Comments
 (0)