UNPKG

@daign/2d-graphics

Version:

Two dimensional graphics library that implements the daign-2d-pipeline.

55 lines (54 loc) 1.63 kB
import { Box2, Matrix3, Vector2 } from '@daign/math'; import { StyledGraphicNode } from '../styledGraphicNode'; /** * Class for a scalable text element at an anchor position. * There is a second point whose distance to the anchor defines the font size. Therefore, the font * size scales proportionally. Unproportional scaling, rotation and perspective transformations are * not supported. */ export declare class ScalableText extends StyledGraphicNode { content: string; textAnchor: string; /** * Getter for the anchor position. */ get anchor(): Vector2; /** * Setter for the anchor position. */ set anchor(position: Vector2); /** * Getter for the point representing the font size. */ get heightPoint(): Vector2; private _fontSize; /** * Setter for the font size. */ set fontSize(size: number); /** * Getter for the font size. */ get fontSize(): number; /** * Constructor. */ constructor(); /** * Calculate the fontSize after a given transformation. * @param transformation - The transformation to apply. * @returns The transformed fontSize. */ getFontSizeTransformed(transformation: Matrix3): number; /** * Calculate the anchor after a given transformation. * @param transformation - The transformation to apply. * @returns The transformed anchor position. */ getAnchorTransformed(transformation: Matrix3): Vector2; /** * Get an approximated bounding box of the scalable text. * @returns The bounding box. */ getBox(): Box2; }