UNPKG

@daign/2d-graphics

Version:

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

46 lines (45 loc) 1.95 kB
import { Vector2 } from '@daign/math'; import { StyledGraphicNode } from '../styledGraphicNode'; import { Application } from '../application'; import { Group } from '../basic-elements'; import { IControlModifier } from '../control-modifiers'; import { ButtonObject } from './buttonObject'; import { IControlGuide } from './iControlGuide'; /** * Abstract class for drawing elements that are defined by interactive control points. */ export declare abstract class ControlObject extends Group { controlModifier: IControlModifier | null; controlGuides: IControlGuide[]; controlPointShapes: (StyledGraphicNode | null | undefined)[]; buttons: ButtonObject[]; /** * Constructor. */ constructor(); /** * The redraw method to extend which should create the shape of the element. */ redraw(): void; /** * Construct the shapes to be displayed on the control layer. * @param activePoint - The selected point of the active object. * @param application - The corresponding application. * @returns A node containing the content for the control layer. */ redrawControlObjects(activePoint: Vector2 | null, application: Application): StyledGraphicNode; /** * Get a deep copy of the control points. * The ControlPoint uses this method for the ControlModifiers. The method will be overwritten by * ControlObjects that extend the Vector2 class with additional properties. * @returns A deep copy of the control points. */ getDeepCopyOfPoints(): Vector2[]; /** * Copy updated coordinates back to the control points of this control. * The ControlPoint uses this method for the ControlModifiers. The method will be overwritten by * ControlObjects that extend the Vector2 class with additional properties. * @param updatedPoints - The new coordinates to apply. */ writeUpdatesToPoints(updatedPoints: Vector2[]): void; }