refactor: simplify thumbnail display logic and improve hover effects

- Removed unnecessary hover event handling for thumbnails.
- Updated thumbnail visibility logic to always show when loading.
- Enhanced CSS for progress tip and thumbnails with scaling and opacity transitions.
- Added hover class to manage thumbnail visibility on progress hover.
This commit is contained in:
Harvey Zhao committed 2025-12-13 23:05:28 +08:00
1 parent 911c88d95f
commit 8cb9cd480c
4 files changed
+22 -45

No files matched your search

+1 -26
View File
@@ -2,7 +2,6 @@ import { def, isMobile, loadImg, setStyle } from '../utils'
export default function thumbnailsMix(art) {
const {
events,
option,
template: { $progress, $video },
} = art
@@ -11,7 +10,6 @@ export default function thumbnailsMix(art) {
let image = null
let loading = false
let isLoad = false
let isHover = false
function reset() {
clearTimeout(timer)
@@ -48,16 +46,6 @@ export default function thumbnailsMix(art) {
}
}
events.hover(
$progress,
() => {
isHover = true
},
() => {
isHover = false
},
)
art.on('setBar', async (type, percentage, event) => {
const $thumbnails = art.controls?.thumbnails
const { url, scale } = option.thumbnails
@@ -73,27 +61,14 @@ export default function thumbnailsMix(art) {
isLoad = true
}
if (!isLoad || !isHover)
if (!isLoad)
return
const width = $progress.clientWidth * percentage
setStyle($thumbnails, 'display', 'flex')
if (width > 0 && width < $progress.clientWidth) {
showThumbnails(width)
}
else {
if (!isMobile) {
setStyle($thumbnails, 'display', 'none')
}
}
if (isMobileDragging) {
clearTimeout(timer)
timer = setTimeout(() => {
setStyle($thumbnails, 'display', 'none')
}, 500)
}
}
})