mirror of
https://github.com/liriliri/eruda.git
synced 2026-02-02 09:49:00 +08:00
fix: mouse event on touch device
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
|
const BundleAnalyzerPlugin =
|
||||||
.BundleAnalyzerPlugin
|
require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||||
|
|
||||||
exports = require('./webpack.prod')
|
exports = require('./webpack.prod')
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
"licia": "^1.38.2",
|
"licia": "^1.38.2",
|
||||||
"luna-box-model": "^0.1.0",
|
"luna-box-model": "^0.1.0",
|
||||||
"luna-console": "^1.3.3",
|
"luna-console": "^1.3.3",
|
||||||
"luna-data-grid": "^0.4.3",
|
"luna-data-grid": "^0.5.1",
|
||||||
"luna-dom-viewer": "^1.2.3",
|
"luna-dom-viewer": "^1.2.3",
|
||||||
"luna-modal": "^1.0.0",
|
"luna-modal": "^1.0.0",
|
||||||
"luna-notification": "^0.1.4",
|
"luna-notification": "^0.1.4",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
.resizer {
|
.resizer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
touch-action: none;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
cursor: row-resize;
|
cursor: row-resize;
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ function processClass(str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const hasTouchSupport = 'ontouchstart' in root
|
const hasTouchSupport = 'ontouchstart' in root
|
||||||
|
const hasPointerSupport = 'PointerEvent' in root
|
||||||
const touchEvents = {
|
const touchEvents = {
|
||||||
start: 'touchstart',
|
start: 'touchstart',
|
||||||
move: 'touchmove',
|
move: 'touchmove',
|
||||||
@@ -161,8 +162,17 @@ const mouseEvents = {
|
|||||||
move: 'mousemove',
|
move: 'mousemove',
|
||||||
end: 'mouseup',
|
end: 'mouseup',
|
||||||
}
|
}
|
||||||
|
const pointerEvents = {
|
||||||
|
start: 'pointerdown',
|
||||||
|
move: 'pointermove',
|
||||||
|
end: 'pointerup',
|
||||||
|
}
|
||||||
|
|
||||||
export function drag(name) {
|
export function drag(name) {
|
||||||
|
if (hasPointerSupport) {
|
||||||
|
return pointerEvents[name]
|
||||||
|
}
|
||||||
|
|
||||||
return hasTouchSupport ? touchEvents[name] : mouseEvents[name]
|
return hasTouchSupport ? touchEvents[name] : mouseEvents[name]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user