1
0
mirror of synced 2025-12-08 22:58:46 +08:00

fix: mouse event on touch device

This commit is contained in:
redhoodsu
2023-07-18 19:52:22 +08:00
parent 8a200d45e6
commit 97122c86db
4 changed files with 14 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin
const BundleAnalyzerPlugin =
require('webpack-bundle-analyzer').BundleAnalyzerPlugin
exports = require('./webpack.prod')

View File

@@ -65,7 +65,7 @@
"licia": "^1.38.2",
"luna-box-model": "^0.1.0",
"luna-console": "^1.3.3",
"luna-data-grid": "^0.4.3",
"luna-data-grid": "^0.5.1",
"luna-dom-viewer": "^1.2.3",
"luna-modal": "^1.0.0",
"luna-notification": "^0.1.4",

View File

@@ -17,6 +17,7 @@
.resizer {
position: absolute;
width: 100%;
touch-action: none;
left: 0;
top: -8px;
cursor: row-resize;

View File

@@ -151,6 +151,7 @@ function processClass(str) {
}
const hasTouchSupport = 'ontouchstart' in root
const hasPointerSupport = 'PointerEvent' in root
const touchEvents = {
start: 'touchstart',
move: 'touchmove',
@@ -161,8 +162,17 @@ const mouseEvents = {
move: 'mousemove',
end: 'mouseup',
}
const pointerEvents = {
start: 'pointerdown',
move: 'pointermove',
end: 'pointerup',
}
export function drag(name) {
if (hasPointerSupport) {
return pointerEvents[name]
}
return hasTouchSupport ? touchEvents[name] : mouseEvents[name]
}