improve some drawing
This commit is contained in:
25
src/richtext.ts
Normal file
25
src/richtext.ts
Normal file
@ -0,0 +1,25 @@
|
||||
// type RichnessNodeDefinition<N extends {type: string}> = {
|
||||
// type: N["type"]
|
||||
// measure(context: CanvasRenderingContext2D, node: N): Promise<TextMetrics>;
|
||||
// render(
|
||||
// context: CanvasRenderingContext2D,
|
||||
// node: N,
|
||||
// x: number,
|
||||
// y: number
|
||||
// ): Promise<void>;
|
||||
// };
|
||||
|
||||
// type Richness<N extends {type: string}> = {[K in N["type"]]: RichnessNodeDefinition<N & {type: K}>}
|
||||
|
||||
// const drawRichText = <N extends {type: string}>(
|
||||
// context: CanvasRenderingContext2D,
|
||||
// richness: Richness<N>,
|
||||
// richText: N[],
|
||||
// x: number,
|
||||
// y: number,
|
||||
// maxWidth: number,
|
||||
// ) => {
|
||||
// context.save();
|
||||
// const
|
||||
// context.restore();
|
||||
// };
|
Reference in New Issue
Block a user