@daign/2d-graphics
Version:
Two dimensional graphics library that implements the daign-2d-pipeline.
48 lines (47 loc) • 1.8 kB
TypeScript
import { Vector2, Matrix3 } from '@daign/math';
import { Application } from '../application';
import { Group } from '../basic-elements';
import { StyledGraphicNode } from '../styledGraphicNode';
import { ControlObject } from './controlObject';
/**
* Interactive control point for control objects.
*/
export declare class ControlPoint extends Group {
readonly targetPoint: Vector2;
private readonly targetTransformation;
readonly application: Application;
readonly controlObject: ControlObject;
private controlIndex;
private offset;
/**
* Getter for the center position.
*/
get center(): Vector2;
/**
* Setter for the center position.
*/
set center(position: Vector2);
/**
* Constructor.
* @param targetPoint - The point coordinates to display and modify.
* @param targetTransformation - The transformation matrix of the control object.
* @param application - The corresponding application.
* @param controlObject - The corresponding control object.
* @param controlIndex - The index of the point in the points array of the control object.
* @param controlShape - The shape to display for a control point. Optional.
*/
constructor(targetPoint: Vector2, targetTransformation: Matrix3, application: Application, controlObject: ControlObject, controlIndex: number, controlShape?: StyledGraphicNode | null);
/**
* Calculate the offset transformation resulting from the center point position.
*/
private calculateOffset;
/**
* Save a snapshot copy of the current center position.
*/
snap(): void;
/**
* Apply a translation delta to the last snapshot of the center.
* @param delta - The translation delta.
*/
drag(delta: Vector2): void;
}