mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 13:51:20 -08:00
fix thumbnails option
This commit is contained in:
1 parent
592ae58f05
commit
8ef45f2452
11 files changed
+21
-55
No files matched your search
@@ -7,16 +7,19 @@ export default function thumbnails(options) {
|
||||
mounted: ($control) => {
|
||||
const {
|
||||
option,
|
||||
template: { $progress },
|
||||
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, height, width, number, column } = option.thumbnails;
|
||||
const { url, number, column } = option.thumbnails;
|
||||
const width = image.naturalWidth / column;
|
||||
const height = width / ($video.videoWidth / $video.videoHeight);
|
||||
const perWidth = $progress.clientWidth / number;
|
||||
const perIndex = Math.floor(posWidth / perWidth);
|
||||
const yIndex = Math.ceil(perIndex / column) - 1;
|
||||
@@ -37,7 +40,8 @@ export default function thumbnails(options) {
|
||||
proxy($progress, 'mousemove', (event) => {
|
||||
if (!loading) {
|
||||
loading = true;
|
||||
loadImg(option.thumbnails.url).then(() => {
|
||||
loadImg(option.thumbnails.url).then((img) => {
|
||||
image = img;
|
||||
isLoad = true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -156,8 +156,6 @@ export default class Artplayer extends Emitter {
|
||||
thumbnails: {
|
||||
url: '',
|
||||
number: 60,
|
||||
width: 160,
|
||||
height: 90,
|
||||
column: 10,
|
||||
},
|
||||
subtitle: {
|
||||
|
||||
@@ -95,8 +95,6 @@ export default {
|
||||
thumbnails: {
|
||||
url: s,
|
||||
number: n,
|
||||
width: n,
|
||||
height: n,
|
||||
column: n,
|
||||
},
|
||||
subtitle: {
|
||||
|
||||
Reference in new issue
Block a user