UNPKG

@daign/2d-graphics

Version:

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

58 lines (57 loc) 1.79 kB
import { Box2, Matrix3, Vector2, Vector2Array } from '@daign/math'; import { GraphicNode } from '@daign/2d-pipeline'; import { StyleSelector } from '@daign/style-sheets'; import { GraphicStyle } from './graphicStyle'; /** * Abstract class for graphic nodes that are defined by points and to which styles apply. */ export declare abstract class StyledGraphicNode extends GraphicNode { points: Vector2Array; private classNames; styleSelector: StyleSelector; elementStyle: GraphicStyle | null; onclick: (() => void) | null; id: string | null; mask: string | null; clipPath: string | null; /** * Setter for the base class. * @param baseClass - The name of the base class. */ protected set baseClass(baseClass: string); /** * Constructor. */ protected constructor(); /** * Get points after transformation. * @param transformation - The transformation to apply. * @returns The array of transformed points. */ getPointsTransformed(transformation: Matrix3): Vector2[]; /** * Get the transformed bounding box of all points of the element. * @returns The transformed bounding box. */ getBoxTransformed(): Box2; /** * Get the bounding box of all points of the element. * @returns The bounding box. */ getBox(): Box2; /** * Add a class name. * @param className - The class name. */ addClass(className: string): void; /** * Add or overwrite a class name by identifier. * @param identifier - The identifier. * @param className - The class name. */ setVariableClass(identifier: string, className: string): void; /** * Construct the style selector object. */ private buildStyleSelector; }