���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/video/layout/js/node_modules/artplayer/src/control/ |
import { setStyle } from '../utils'; import { getPosFromEvent } from './progress'; export default function thumbnails(options) { return (art) => ({ ...options, mounted: ($control) => { const { option, template: { $progress, $video }, events: { proxy, loadImg }, } = art; let image = null; let loading = false; let isLoad = false; function showThumbnails(event) { const { width: posWidth } = getPosFromEvent(art, event); const { url, number, column, width, height } = option.thumbnails; const width2 = width || image.naturalWidth / column; const height2 = height || width2 / ($video.videoWidth / $video.videoHeight); const perWidth = $progress.clientWidth / number; const perIndex = Math.floor(posWidth / perWidth); const yIndex = Math.ceil(perIndex / column) - 1; const xIndex = perIndex % column || column - 1; setStyle($control, 'backgroundImage', `url(${url})`); setStyle($control, 'height', `${height2}px`); setStyle($control, 'width', `${width2}px`); setStyle($control, 'backgroundPosition', `-${xIndex * width2}px -${yIndex * height2}px`); if (posWidth <= width2 / 2) { setStyle($control, 'left', 0); } else if (posWidth > $progress.clientWidth - width2 / 2) { setStyle($control, 'left', `${$progress.clientWidth - width2}px`); } else { setStyle($control, 'left', `${posWidth - width2 / 2}px`); } } proxy($progress, 'mousemove', async (event) => { if (!loading) { loading = true; const img = await loadImg(option.thumbnails.url); image = img; isLoad = true; } if (isLoad) { setStyle($control, 'display', 'flex'); showThumbnails(event); } }); proxy($progress, 'mouseleave', () => { setStyle($control, 'display', 'none'); }); art.on('hover', (state) => { if (!state) { setStyle($control, 'display', 'none'); } }); }, }); }