add art.isRotate

This commit is contained in:
Harvey committed 2022-09-26 18:28:22 +08:00
1 parent 1cbef4c6f4
commit af6e936854
4 files changed
+5 -4

No files matched your search

+1 -2
View File
@@ -21,11 +21,10 @@ export default function gestureInit(art, events) {
const onTouchMove = (event) => {
if (event.touches.length === 1 && isDroging && art.duration) {
const autoOrientation = art.plugins.autoOrientation && art.plugins.autoOrientation.state;
const { clientX, clientY } = event.touches[0];
const ratioX = clamp((clientX - startX) / art.width, -1, 1);
const ratioY = clamp((clientY - startY) / art.height, -1, 1);
const ratio = autoOrientation ? ratioY : ratioX;
const ratio = art.isRotate ? ratioY : ratioX;
const currentTime = clamp(
startTime + art.duration * ratio * art.constructor.TOUCH_MOVE_RATIO,
0,