dongsik22 commited on
Commit
18b84d7
·
1 Parent(s): af86644

feat: 줌 상태에서 1손가락 드래그로 영상 위치 패닝 + 손바닥 커서

Browse files

- zoom > 1일 때 wrap 단일터치 touchstart에서 dragStart 설정,
touchmove에서 tx/ty 갱신, touchend에서 정리.
- hold(2배속)·더블탭(±5초) 분기는 zoom=1일 때만 동작.
- wrap에 .zoomed 클래스 추가/제거하여 PC에선 grab/grabbing 커서 표시.

Files changed (1) hide show
  1. index.html +20 -1
index.html CHANGED
@@ -160,6 +160,9 @@
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,
@@ -2302,6 +2305,7 @@ function closeAddModal() { $('#addModal').classList.remove('show'); }
2302
  zoom = newZoom;
2303
  clampPan();
2304
  apply();
 
2305
  // 풀스크린 안에서 사용자가 직접 줌 조작한 경우만 fav에 저장 (자동 복원 시는 저장 안 함)
2306
  if (!opts.silent && isFullscreen() && currentFavId) {
2307
  const fav = favs.find(f => f.id === currentFavId && (f.source || 'tvchak') === (currentFavSource || 'tvchak'));
@@ -2488,6 +2492,12 @@ function closeAddModal() { $('#addModal').classList.remove('show'); }
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 &&
@@ -2511,13 +2521,22 @@ function closeAddModal() { $('#addModal').classList.remove('show'); }
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; // 터치는 위에서 처리
 
160
  /* touch-action: none — 브라우저 native gesture(핀치/더블탭줌/팬) 전부 끄고
161
  우리 JS에서 직접 처리. 'manipulation'은 핀치 자체를 막아버려 NG. */
162
  touch-action: none; }
163
+ /* 줌이 들어가있을 때(.zoomed)는 손바닥 커서 — 영상 위치 드래그 가능 힌트 */
164
+ .video-wrap.zoomed .hold-overlay { cursor: grab; }
165
+ .video-wrap.zoomed .hold-overlay:active { cursor: grabbing; }
166
  .video-wrap.locked .hold-overlay { display: none; }
167
  .video-wrap.locked .fs-zoom-btn,
168
  .video-wrap.locked .side-toggle-btn,
 
2305
  zoom = newZoom;
2306
  clampPan();
2307
  apply();
2308
+ wrap.classList.toggle('zoomed', newZoom > 1);
2309
  // 풀스크린 안에서 사용자가 직접 줌 조작한 경우만 fav에 저장 (자동 복원 시는 저장 안 함)
2310
  if (!opts.silent && isFullscreen() && currentFavId) {
2311
  const fav = favs.find(f => f.id === currentFavId && (f.source || 'tvchak') === (currentFavSource || 'tvchak'));
 
2492
  // 단일 터치: 삼성인터넷·일부 안드 브라우저가 touchstart 직후 long-press gesture로
2493
  // 가로채며 즉시 touchend를 발화 → preventDefault로 차단.
2494
  try { e.preventDefault(); } catch {}
2495
+ // 줌이 들어가 있으면 1손가락 드래그 = 패닝. hold/더블탭 로직 건너뜀.
2496
+ if (zoom > 1) {
2497
+ dragStart = { x: t.clientX - tx, y: t.clientY - ty };
2498
+ _lastTapAt = 0;
2499
+ return;
2500
+ }
2501
  // 더블탭 감지 — preventDefault로 인해 native dblclick이 안 오므로 여기서 직접.
2502
  const now = Date.now();
2503
  if (now - _lastTapAt < DBL_TAP_MS &&
 
2521
  }
2522
  const t = e.touches[0];
2523
  if (!t) return;
2524
+ // 1손가락 드래그 패닝 (zoom>1)
2525
+ if (dragStart && zoom > 1) {
2526
+ tx = t.clientX - dragStart.x;
2527
+ ty = t.clientY - dragStart.y;
2528
+ clampPan();
2529
+ apply();
2530
+ return;
2531
+ }
2532
  _holdMove(t.clientX, t.clientY);
2533
  }, { passive: true, capture: true });
2534
  wrap.addEventListener('touchend', (e) => {
2535
  if (e.touches.length < 2) pinchStart = null;
2536
+ if (e.touches.length === 0) dragStart = null;
2537
  _holdEnd();
2538
  }, true);
2539
+ wrap.addEventListener('touchcancel', () => { pinchStart = null; dragStart = null; _holdEnd(); }, true);
2540
  // 마우스(데스크탑)용 — pointerdown만, leave는 등록 안 함
2541
  wrap.addEventListener('pointerdown', (e) => {
2542
  if (e.pointerType !== 'mouse') return; // 터치는 위에서 처리