veplayer-mp-wechat
Advanced tools
Comparing version
@@ -223,3 +223,6 @@ "use strict"; | ||
this._touch = { | ||
moving: false | ||
moving: false, | ||
count: 0, | ||
startY: -1, | ||
startX: -1 | ||
}; | ||
@@ -510,8 +513,20 @@ if (!this.properties.interactiveConfig) { | ||
const { _touch } = this; | ||
const _t = (0, index_2.getTouch)(e); | ||
const { enableProgressGesture } = this.properties; | ||
if (!_touch.moving) { | ||
_touch.moving = true; | ||
// 手势在播放器区域滑动,说明在做seek,聚焦控制栏状态 | ||
enableProgressGesture && this.switchControls("focus" /* InteractStates.FOCUS */, false, false); | ||
if (_touch.count === 0) { | ||
_touch.startX = _t.clientX; | ||
_touch.startY = _t.clientY; | ||
} | ||
_touch.count++; | ||
_touch.endX = _t.clientX; | ||
_touch.endY = _t.clientY; | ||
if (this.data.firstPlay && _touch.count > 5 && !_touch.moving) { | ||
const { startX, startY, endX, endY } = _touch; | ||
const isSeeking = endY - startY === 0 || Math.abs((endX - startX) / (endY - startY)) > 1; | ||
if (isSeeking) { | ||
// 手势在播放器区域滑动,说明在做seek,聚焦控制栏状态 | ||
_touch.moving = isSeeking; | ||
enableProgressGesture && this.switchControls("focus" /* InteractStates.FOCUS */, false, false); | ||
} | ||
} | ||
}, | ||
@@ -521,7 +536,15 @@ onTouchEnd(e) { | ||
const { enableProgressGesture } = this.properties; | ||
console.log(`onTouchEnd: moving:${_touch.moving}`); | ||
if (_touch.moving) { | ||
_touch.moving = false; | ||
// 拖动结束,恢复正常状态 | ||
enableProgressGesture && this.switchControls("focus" /* InteractStates.FOCUS */, true, false); | ||
} | ||
this._touch = { | ||
moving: false, | ||
count: 0, | ||
startY: -1, | ||
startX: -1, | ||
endX: -1, | ||
endY: -1, | ||
}; | ||
}, | ||
@@ -528,0 +551,0 @@ onTap(e) { |
@@ -100,3 +100,2 @@ "use strict"; | ||
default: | ||
_ret = 'xg-play-center'; | ||
} | ||
@@ -103,0 +102,0 @@ if (mode === "bg" /* PLAY_BTN_MODE.BG */) { |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.classNames = exports.format = exports.padStart = void 0; | ||
exports.getTouch = exports.classNames = exports.format = exports.padStart = void 0; | ||
/** | ||
@@ -84,1 +84,7 @@ * Util | ||
exports.classNames = classNames; | ||
function getTouch(e) { | ||
if (e && e.touches && e.touches.length > 0) { | ||
return e.touches[0]; | ||
} | ||
} | ||
exports.getTouch = getTouch; |
{ | ||
"name": "veplayer-mp-wechat", | ||
"version": "1.2.2-alpha.7", | ||
"version": "1.2.2-alpha.8", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "miniprogram": "dist", |
146897
0.69%2468
1.15%