|
432 | 432 |
|
433 | 433 | if (currentZoom === 1) { |
434 | 434 | playerWrap.style.width = '100%'; |
435 | | - playerWrap.style.maxWidth = '1400px'; |
| 435 | + playerWrap.style.maxWidth = '1400px'; |
| 436 | + v.style.maxHeight = '80vh'; // Restore height constraint |
436 | 437 | } else { |
437 | | - // Calculate Native Dimensions |
438 | | - const nativeW = v.videoWidth || 1920; |
439 | | - const watchContainer = document.querySelector('.watch'); |
440 | | - const containerW = watchContainer ? watchContainer.clientWidth : window.innerWidth; |
441 | | - |
442 | | - // Target width based on container width * zoom factor |
443 | | - let targetW = containerW * currentZoom; |
444 | | - |
445 | | - // Cap at native video width to prevent upscaling blurriness, |
446 | | - // unless native is smaller than container, then allow up to native. |
447 | | - // Actually user wants x1.5 / x2 of "origin size" AND "window size". |
448 | | - // Let's interpret: expand player to 1.5x or 2x of current view, limited by Native. |
449 | | - |
450 | | - // Simply: apply width % on player-wrap. |
451 | | - // But player-wrap has max-width 1400px. |
452 | | - // We override max-width to allow expansion. |
| 438 | + // Zoom logic: Scale relative to viewport width |
| 439 | + // We remove constraints to allow "true" zoom (upscaling) |
| 440 | + const viewportW = window.innerWidth; |
| 441 | + let targetW = viewportW * currentZoom; |
453 | 442 |
|
454 | 443 | playerWrap.style.maxWidth = 'none'; |
455 | | - |
456 | | - // If we strictly follow "according to native size", we should cap. |
457 | | - if (targetW > nativeW) { |
458 | | - targetW = nativeW; |
459 | | - } |
460 | | - |
461 | | - // If targetW is still smaller than containerW (small video), we just set it to targetW. |
462 | | - // But if it's larger, it will overflow. |
463 | | - |
464 | 444 | playerWrap.style.width = targetW + 'px'; |
| 445 | + v.style.maxHeight = 'none'; // Uncap height to allow proportional growth |
465 | 446 | } |
466 | 447 | } |
467 | 448 |
|
|
0 commit comments