Spaces:
Paused
Paused
fix: 핀치줌 복구 + 중앙 더블탭 제거
Browse files핀치줌 안 됐던 원인:
- .hold-overlay의 touch-action:manipulation이 핀치 자체를 차단.
- 오버레이가 video를 덮어 video의 기존 핀치 핸들러까지 이벤트 안 감.
해결:
- touch-action: manipulation → none (모든 native gesture 끄고 JS로 직접 처리)
- 핀치 처리를 wrap touchstart/move/end로 옮김 (pinchStart 변수는 같은 IIFE 스코프 재사용)
- 두 손가락 닿는 순간 hold/더블탭 상태 정리
중앙 더블탭:
- 사용자 요청으로 줌 토글 제거. 이제 좌측 1/3 = -5초, 우측 1/3 = +5초, 중앙은 무동작.
- 확대는 핀치줌으로만.
- index.html +38 -23
index.html
CHANGED
|
@@ -157,7 +157,9 @@
|
|
| 157 |
-webkit-touch-callout: none;
|
| 158 |
-webkit-user-select: none;
|
| 159 |
user-select: none;
|
| 160 |
-
touch-action:
|
|
|
|
|
|
|
| 161 |
.video-wrap.locked .hold-overlay { display: none; }
|
| 162 |
.video-wrap.locked .fs-zoom-btn,
|
| 163 |
.video-wrap.locked .side-toggle-btn,
|
|
@@ -2466,43 +2468,56 @@ function closeAddModal() { $('#addModal').classList.remove('show'); }
|
|
| 2466 |
} else if (lx > w * 2 / 3) {
|
| 2467 |
v.currentTime = Math.min(v.duration, v.currentTime + 5);
|
| 2468 |
if (typeof showToast === 'function') showToast('+5초 ⏩');
|
| 2469 |
-
} else {
|
| 2470 |
-
// 중앙: 줌 토글 (기존 click 핸들러 로직과 동일)
|
| 2471 |
-
if (typeof setZoom === 'function') setZoom(zoom > 1 ? 1 : 1.75);
|
| 2472 |
}
|
|
|
|
| 2473 |
}
|
| 2474 |
wrap.addEventListener('touchstart', (e) => {
|
| 2475 |
const t = e.touches[0];
|
| 2476 |
if (!t) return;
|
| 2477 |
// 우리 UI 위에서 시작된 터치는 제외
|
| 2478 |
if (e.target.closest('#zoomCtrl, #moreMenu, #btnFsZoom, #btnSideToggle, #pauseOverlay, .skip-btn, .lock-btn, .hls-quality, .hls-audio, .hls-sub')) return;
|
| 2479 |
-
//
|
| 2480 |
-
//
|
| 2481 |
-
|
| 2482 |
-
|
| 2483 |
-
|
| 2484 |
-
|
| 2485 |
-
|
| 2486 |
-
|
| 2487 |
-
Math.abs(t.clientX - _lastTapX) < DBL_TAP_TOL &&
|
| 2488 |
-
Math.abs(t.clientY - _lastTapY) < DBL_TAP_TOL) {
|
| 2489 |
-
_handleDoubleTap(t.clientX, t.clientY);
|
| 2490 |
-
_lastTapAt = 0; // 트리플탭 방지
|
| 2491 |
-
return; // hold 타이머 시작 안 함
|
| 2492 |
-
}
|
| 2493 |
-
_lastTapAt = now;
|
| 2494 |
-
_lastTapX = t.clientX;
|
| 2495 |
-
_lastTapY = t.clientY;
|
| 2496 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2497 |
_holdStart(t.clientX, t.clientY);
|
| 2498 |
}, { passive: false, capture: true });
|
| 2499 |
wrap.addEventListener('touchmove', (e) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2500 |
const t = e.touches[0];
|
| 2501 |
if (!t) return;
|
| 2502 |
_holdMove(t.clientX, t.clientY);
|
| 2503 |
}, { passive: true, capture: true });
|
| 2504 |
-
wrap.addEventListener('touchend',
|
| 2505 |
-
|
|
|
|
|
|
|
|
|
|
| 2506 |
// 마우스(데스크탑)용 — pointerdown만, leave는 등록 안 함
|
| 2507 |
wrap.addEventListener('pointerdown', (e) => {
|
| 2508 |
if (e.pointerType !== 'mouse') return; // 터치는 위에서 처리
|
|
|
|
| 157 |
-webkit-touch-callout: none;
|
| 158 |
-webkit-user-select: none;
|
| 159 |
user-select: none;
|
| 160 |
+
/* touch-action: none — 브라우저 native gesture(핀치/더블탭줌/팬) 전부 끄고
|
| 161 |
+
우리 JS에서 직접 처리. 'manipulation'은 핀치 자체를 막아버려 NG. */
|
| 162 |
+
touch-action: none; }
|
| 163 |
.video-wrap.locked .hold-overlay { display: none; }
|
| 164 |
.video-wrap.locked .fs-zoom-btn,
|
| 165 |
.video-wrap.locked .side-toggle-btn,
|
|
|
|
| 2468 |
} else if (lx > w * 2 / 3) {
|
| 2469 |
v.currentTime = Math.min(v.duration, v.currentTime + 5);
|
| 2470 |
if (typeof showToast === 'function') showToast('+5초 ⏩');
|
|
|
|
|
|
|
|
|
|
| 2471 |
}
|
| 2472 |
+
// 중앙: 아무 일도 안 함 (확대는 핀치줌으로만)
|
| 2473 |
}
|
| 2474 |
wrap.addEventListener('touchstart', (e) => {
|
| 2475 |
const t = e.touches[0];
|
| 2476 |
if (!t) return;
|
| 2477 |
// 우리 UI 위에서 시작된 터치는 제외
|
| 2478 |
if (e.target.closest('#zoomCtrl, #moreMenu, #btnFsZoom, #btnSideToggle, #pauseOverlay, .skip-btn, .lock-btn, .hls-quality, .hls-audio, .hls-sub')) return;
|
| 2479 |
+
// 두 번째 손가락이 닿는 순간 — 핀치 시작. hold/더블탭 상태 정리하고 우리가 직접 처리.
|
| 2480 |
+
// (오버레이가 video를 덮고 있어 video의 native 핀치 핸들러까지 이벤트가 안 감)
|
| 2481 |
+
if (e.touches.length >= 2) {
|
| 2482 |
+
_cancelHoldTimer();
|
| 2483 |
+
_exitHoldFast();
|
| 2484 |
+
_lastTapAt = 0;
|
| 2485 |
+
pinchStart = { dist: tdist(e.touches[0], e.touches[1]), zoom };
|
| 2486 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2487 |
}
|
| 2488 |
+
// 단일 터치: 삼성인터넷·일부 안드 브라우저가 touchstart 직후 long-press gesture로
|
| 2489 |
+
// 가로채며 즉시 touchend를 발화 → preventDefault로 차단.
|
| 2490 |
+
try { e.preventDefault(); } catch {}
|
| 2491 |
+
// 더블탭 감지 — preventDefault로 인해 native dblclick이 안 오므로 여기서 직접.
|
| 2492 |
+
const now = Date.now();
|
| 2493 |
+
if (now - _lastTapAt < DBL_TAP_MS &&
|
| 2494 |
+
Math.abs(t.clientX - _lastTapX) < DBL_TAP_TOL &&
|
| 2495 |
+
Math.abs(t.clientY - _lastTapY) < DBL_TAP_TOL) {
|
| 2496 |
+
_handleDoubleTap(t.clientX, t.clientY);
|
| 2497 |
+
_lastTapAt = 0; // 트리플탭 방지
|
| 2498 |
+
return; // hold 타이머 시작 안 함
|
| 2499 |
+
}
|
| 2500 |
+
_lastTapAt = now;
|
| 2501 |
+
_lastTapX = t.clientX;
|
| 2502 |
+
_lastTapY = t.clientY;
|
| 2503 |
_holdStart(t.clientX, t.clientY);
|
| 2504 |
}, { passive: false, capture: true });
|
| 2505 |
wrap.addEventListener('touchmove', (e) => {
|
| 2506 |
+
// 핀치 — 두 손가락 거리 변화로 줌 조절
|
| 2507 |
+
if (e.touches.length >= 2 && pinchStart) {
|
| 2508 |
+
const d = tdist(e.touches[0], e.touches[1]);
|
| 2509 |
+
setZoom(pinchStart.zoom * (d / pinchStart.dist));
|
| 2510 |
+
return;
|
| 2511 |
+
}
|
| 2512 |
const t = e.touches[0];
|
| 2513 |
if (!t) return;
|
| 2514 |
_holdMove(t.clientX, t.clientY);
|
| 2515 |
}, { passive: true, capture: true });
|
| 2516 |
+
wrap.addEventListener('touchend', (e) => {
|
| 2517 |
+
if (e.touches.length < 2) pinchStart = null;
|
| 2518 |
+
_holdEnd();
|
| 2519 |
+
}, true);
|
| 2520 |
+
wrap.addEventListener('touchcancel', () => { pinchStart = null; _holdEnd(); }, true);
|
| 2521 |
// 마우스(데스크탑)용 — pointerdown만, leave는 등록 안 함
|
| 2522 |
wrap.addEventListener('pointerdown', (e) => {
|
| 2523 |
if (e.pointerType !== 'mouse') return; // 터치는 위에서 처리
|