(fix)保护手势框架中定义的常量

This commit is contained in:
wangchangqi 2022-10-10 19:39:38 +08:00
parent f0fa7f39e6
commit 1fc4ab827c
1 changed files with 36 additions and 9 deletions

View File

@ -479,29 +479,56 @@ const getTouchFromTouches = (
export default class GestureDetector {
// 进入长按状态的阈值
static HOLD_THRESHOLD = 300
static #HOLD_THRESHOLD = 300
static get HOLD_THRESHOLD() {
return this.#HOLD_THRESHOLD
}
// 进入滑动状态的阈值
static PAN_THRESHOLD = 20
static #PAN_THRESHOLD = 20
static get PAN_THRESHOLD() {
return this.#PAN_THRESHOLD
}
// 判定是swipe事件的速度阈值单位: px/ms
static VELOCITY_THRESHOLD = 0.3
static #VELOCITY_THRESHOLD = 0.3
static get VELOCITY_THRESHOLD() {
return this.#VELOCITY_THRESHOLD
}
static THRESHOLD_SMOOTHING = 0.9
static #THRESHOLD_SMOOTHING = 0.9
static get THRESHOLD_SMOOTHING() {
return this.#THRESHOLD_SMOOTHING
}
static VELOCITY_SMOOTHING = 0.5
static #VELOCITY_SMOOTHING = 0.5
static get VELOCITY_SMOOTHING() {
return this.#VELOCITY_SMOOTHING
}
// 连续两次点触(双击或三击)允许的x和y坐标的最大偏移量
static DOUBLE_TAP_DISTANCE = 50
static #DOUBLE_TAP_DISTANCE = 50
static get DOUBLE_TAP_DISTANCE() {
return this.#DOUBLE_TAP_DISTANCE
}
// 连续两次点触(双击或三击)允许的最大间隔时间
static DOUBLE_TAP_TIME = 300
static #DOUBLE_TAP_TIME = 300
static get DOUBLE_TAP_TIME() {
return this.#DOUBLE_TAP_TIME
}
// scale 触发阈值, 单位: px
static SCALE_THRESHOLD = 20
static #SCALE_THRESHOLD = 20
static get SCALE_THRESHOLD() {
return this.#SCALE_THRESHOLD
}
// rotate 触发阈值, 单位: 度°
static ROTATE_THRESHOLD = 22.5
static #ROTATE_THRESHOLD = 22.5
static get ROTATE_THRESHOLD() {
return this.#ROTATE_THRESHOLD
}
// _options 是 option 的备份,用于重置
_options!: GestureOptions | null