mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
refactor(core): CORE-17 type input events and own interaction lifetimes
This commit is contained in:
1 parent
88aef830df
commit
a842058136
72 files changed
+31156
-1219
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import type { HoverHost, PointerRegistry } from '../input/pointer-types'
|
||||
import { isClosing } from '../lifecycle/instance'
|
||||
import { addClass, removeClass } from '../utils/dom'
|
||||
|
||||
export default function hoverInit(art: HoverHost, events: Pick<PointerRegistry, 'hover'>): void {
|
||||
const { $player } = art.template
|
||||
events.hover(
|
||||
$player,
|
||||
(event) => {
|
||||
if (isClosing(art))
|
||||
return
|
||||
addClass($player, 'art-hover')
|
||||
art.emit('hover', true, event)
|
||||
},
|
||||
(event) => {
|
||||
if (isClosing(art))
|
||||
return
|
||||
removeClass($player, 'art-hover')
|
||||
art.emit('hover', false, event)
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user