mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 17:01:20 -08:00
refactor(core): CORE-14 split typed settings and scope tree lifetimes
This commit is contained in:
1 parent
697817eceb
commit
64d1939daa
51 files changed
+28144
-1519
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import type { SettingHost, SettingItem } from './types'
|
||||
import { subscribeSetting } from './resources'
|
||||
|
||||
export default function subtitleOffset(art: SettingHost): SettingItem {
|
||||
const { i18n, icons, constructor } = art
|
||||
|
||||
return {
|
||||
width: constructor.SETTING_ITEM_WIDTH,
|
||||
name: 'subtitle-offset',
|
||||
html: i18n.get('Subtitle Offset'),
|
||||
icon: icons.subtitle,
|
||||
tooltip: '0s',
|
||||
range: [0, -10, 10, 0.1],
|
||||
onChange(item) {
|
||||
art.subtitleOffset = item.range![0]!
|
||||
return `${item.range![0]}s`
|
||||
},
|
||||
mounted: (_, item) => {
|
||||
subscribeSetting(art, item, 'subtitleOffset', (value) => {
|
||||
item.$range!.value = String(value)
|
||||
item.tooltip = `${value}s`
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user