123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { metas as fMetas } from './shape'
- import type { BoardData, BoardShapeData } from 'store'
- import type { Emitter } from 'mitt'
- type Metas = typeof fMetas
- export type ShapeType = keyof Metas
- export interface Pos {
- x: number
- y: number
- }
- // 形状通用对象
- export type BoardShape<T = BoardShapeData, K = keyof T> = IntersectionFromUnion<
- K extends 'type'
- ? { data: { [key in K]: T[K]} }
- : { data: { [key in K]: T[K] } } & { [key in `set${Capitalize<K>}`]: (val: T[K]) => void }
- >
- export type ExtractShape<T extends string, D = BoardShapeData> = BoardShape<
- D extends object
- ? T extends keyof D ? D : never
- : never
- >
- export type Board = {
- el: HTMLCanvasElement
- bus: Emitter<{
- storeChange: undefined
- selectShape: BoardShape | null
- }>
- setImage(url: string): void
- readyAddShape(type: ShapeType, onFinish?: () => void): () => void
- getCurrentStore(): BoardData
- drawStore(store: BoardData): void
- export(): Promise<Blob>
- destroy(): void
- }
- function create (store: BoardData, canvas: HTMLCanvasElement): Board
- export { BoardShapeData }
- export const metas: Metas
- export const images: ShapeType[]
- export const labels: ShapeType[]
- export {
- brokenLine,
- text,
- table,
- rect,
- circular,
- arrow,
- icon,
- cigarette,
- fireoint,
- footPrint,
- shoePrint,
- fingerPrint,
- corpse,
- theBlood,
- } from './shape'
- export default create
|