1
0
mirror of synced 2025-12-07 14:08:06 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
redhoodsu
600ea6213a fix: quirks mode table rendering 2024-09-20 18:52:09 +08:00
redhoodsu
27b85b4834 chore: use licia pointerEvent 2024-09-20 16:12:03 +08:00
5 changed files with 22 additions and 40 deletions

View File

@@ -61,7 +61,7 @@
"karma-jquery": "^0.2.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^5.0.0",
"licia": "^1.41.0",
"licia": "^1.42.0",
"luna-box-model": "^1.0.0",
"luna-console": "^1.3.4",
"luna-data-grid": "^0.6.0",

View File

@@ -15,6 +15,7 @@ import extend from 'licia/extend'
import isStr from 'licia/isStr'
import startWith from 'licia/startWith'
import ready from 'licia/ready'
import pointerEvent from 'licia/pointerEvent'
import evalCss from '../lib/evalCss'
import emitter from '../lib/emitter'
import { isDarkTheme } from '../lib/themes'
@@ -23,7 +24,6 @@ import LunaModal from 'luna-modal'
import LunaTab from 'luna-tab'
import {
classPrefix as c,
drag,
eventClient,
hasSafeArea,
safeStorage,
@@ -358,8 +358,8 @@ export default class DevTools extends Emitter {
$resizer.css('height', '100%')
$document.on(drag('move'), moveListener)
$document.on(drag('end'), endListener)
$document.on(pointerEvent('move'), moveListener)
$document.on(pointerEvent('up'), endListener)
}
const moveListener = (e) => {
if (!this._isResizing) {
@@ -385,11 +385,11 @@ export default class DevTools extends Emitter {
$resizer.css('height', 10)
$document.off(drag('move'), moveListener)
$document.off(drag('end'), endListener)
$document.off(pointerEvent('move'), moveListener)
$document.off(pointerEvent('up'), endListener)
}
$resizer.css('height', 10)
$resizer.on(drag('start'), startListener)
$resizer.on(pointerEvent('down'), startListener)
$navBar.on('contextmenu', (e) => e.preventDefault())
this.$container.on('click', (e) => e.stopPropagation())

View File

@@ -4,7 +4,8 @@ import Emitter from 'licia/Emitter'
import $ from 'licia/$'
import nextTick from 'licia/nextTick'
import orientation from 'licia/orientation'
import { pxToNum, classPrefix as c, drag, eventClient } from '../lib/util'
import pointerEvent from 'licia/pointerEvent'
import { pxToNum, classPrefix as c, eventClient } from '../lib/util'
import evalCss from '../lib/evalCss'
const $document = $(document)
@@ -93,8 +94,8 @@ export default class EntryBtn extends Emitter {
this._oldX = pxToNum($el.css('left'))
this._oldY = pxToNum($el.css('top'))
this._startY = eventClient('y', e)
$document.on(drag('move'), this._onDragMove)
$document.on(drag('end'), this._onDragEnd)
$document.on(pointerEvent('move'), this._onDragMove)
$document.on(pointerEvent('up'), this._onDragEnd)
}
_onDragMove = (e) => {
const btnSize = this._$el.get(0).offsetWidth
@@ -132,8 +133,8 @@ export default class EntryBtn extends Emitter {
}
this._onDragMove(e)
$document.off(drag('move'), this._onDragMove)
$document.off(drag('end'), this._onDragEnd)
$document.off(pointerEvent('move'), this._onDragMove)
$document.off(pointerEvent('up'), this._onDragEnd)
const cfg = this.config
@@ -149,7 +150,7 @@ export default class EntryBtn extends Emitter {
_bindEvent() {
const $el = this._$el
$el.on(drag('start'), this._onDragStart)
$el.on(pointerEvent('down'), this._onDragStart)
orientation.on('change', () => this._resetPos(true))
window.addEventListener('resize', () => this._resetPos())

View File

@@ -5,7 +5,6 @@ import isUndef from 'licia/isUndef'
import last from 'licia/last'
import map from 'licia/map'
import memStorage from 'licia/memStorage'
import root from 'licia/root'
import toNum from 'licia/toNum'
import trim from 'licia/trim'
import html from 'licia/html'
@@ -147,32 +146,6 @@ function processClass(str) {
}).join(' ')
}
const hasTouchSupport = 'ontouchstart' in root
const hasPointerSupport = 'PointerEvent' in root
const touchEvents = {
start: 'touchstart',
move: 'touchmove',
end: 'touchend',
}
const mouseEvents = {
start: 'mousedown',
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]
}
export function eventClient(type, e) {
const name = type === 'x' ? 'clientX' : 'clientY'

View File

@@ -116,5 +116,13 @@
table {
border-collapse: collapse;
border-spacing: 0;
color: inherit;
font-size: 1em;
font-style: inherit;
font-variant: inherit;
font-weight: inherit;
line-height: inherit;
text-decoration: inherit;
white-space: inherit;
}
}