24 lines
537 B
TypeScript
24 lines
537 B
TypeScript
import { computed, ref } from 'vue'
|
|
|
|
export interface KfSelectionKey {
|
|
layerId: string
|
|
kind: 'main' | 'position' | 'rotation'
|
|
keyframeId: string
|
|
}
|
|
|
|
const selectedKfs = ref<KfSelectionKey[]>([])
|
|
|
|
export function kfSelectionKey(k: KfSelectionKey): string {
|
|
return `${k.layerId}:${k.kind}:${k.keyframeId}`
|
|
}
|
|
|
|
const selectedKfSet = computed(() => {
|
|
const s = new Set<string>()
|
|
for (const k of selectedKfs.value) s.add(kfSelectionKey(k))
|
|
return s
|
|
})
|
|
|
|
export function useKfSelection() {
|
|
return { selectedKfs, selectedKfSet }
|
|
}
|