1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- import { metas as fMetas } from './shape'
- import type { BoardData, BoardShapeData } from 'api'
- import type { Emitter } from 'mitt'
- import {
- brokenLine,
- text,
- table,
- rect,
- circular,
- arrow,
- icon,
- cigarette,
- fireoint,
- footPrint,
- shoePrint,
- fingerPrint,
- corpse,
- theBlood,
- compass,
- title,
- bgImage
- } from './shape'
- type Metas = typeof fMetas
- export type ShapeType = brokenLine | text | table | rect | circular | arrow | icon | cigarette |
- fireoint | footPrint | shoePrint | fingerPrint | corpse | theBlood | compass | title | bgImage
- export type MetaShapeType = 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 }
- > & { delete: () => 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
- backDisabled: boolean
- forwardDisabled: boolean
- }>
- unSelectShape(): void,
- readyAddShape(type: ShapeType, onFinish?: () => void): () => void
- back(): void
- forward(): void
- setImage(url: string): void
- getCurrentStore(): BoardData
- drawStore(store: BoardData): void
- getStore(): BoardData
- 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,
- compass,
- title,
- bgImage
- } from './shape'
- export default create
|