@visactor/vrender-core
Version:
## Description
29 lines (28 loc) • 1.12 kB
TypeScript
import type { IContext2d, IRichTextIcon } from '../../interface';
import { RichTextIcon } from './icon';
import Paragraph from './paragraph';
export default class Line {
left: number;
top: number;
width: number;
height: number;
baseline: number;
ascent: number;
descent: number;
paragraphs: (Paragraph | RichTextIcon)[];
actualWidth: number;
blankWidth: number;
textAlign: string;
direction: 'horizontal' | 'vertical';
directionKey: {
width: string;
height: string;
left: string;
x: string;
y: string;
};
constructor(left: number, width: number, baseline: number, ascent: number, descent: number, lineBuffer: (Paragraph | RichTextIcon)[], direction: 'horizontal' | 'vertical', isWidthMax: boolean);
calcOffset(width: number, isWidthMax: boolean): void;
draw(ctx: IContext2d, lastLine: boolean, x: number, y: number, drawEllipsis: boolean | string, drawIcon: (icon: IRichTextIcon, context: IContext2d, x: number, y: number, baseline: number) => void): void;
getWidthWithEllips(ellipsis: string): number;
}