@inweb/markup
Version:
JavaScript 2D markups
78 lines (77 loc) • 1.83 kB
TypeScript
import { IMarkupObject } from "./IMarkupObject";
import { IMarkupColorable } from "./IMarkupColorable";
/**
* Defines the type of the markup line.
*/
export type MarkupLineType = "solid" | "dot" | "dash";
/**
* 2D markup Line object interface.
*/
export interface IMarkupLine extends IMarkupObject, IMarkupColorable {
/**
* Returns the screen coordinates of the line points as a flat array [x1, y1, x2, y2, ...].
*/
getPoints(): number[];
/**
* Returns the line width.
*/
getLineWidth(): number;
/**
* Sets the line width.
*/
setLineWidth(size: number): any;
/**
* Returns the line type. Can be `solid`, `dot` or `dash`.
*/
getLineType(): string;
/**
* Sets the line type.
*
* @param type - Line type. Can be `solid`, `dot` or `dash`.
*/
setLineType(type: string): any;
/**
* Adds the specified points to the end of the line.
*
* @param points - Array of 2D points.
*/
addPoints(points: [{
x: number;
y: number;
}]): any;
}
/**
* Defines the parameters for creating a {@link IMarkupLine | markup line}.
*/
export interface IMarkupLineParams {
/**
* Array of screen points of the line.
*/
points?: {
x: number;
y: number;
}[];
/**
* Line type. Can be `solid`, `dot` or `dash`.
*
* @default "solid"
*/
type?: MarkupLineType;
/**
* Line width.
*
* @default 4
*/
width?: number;
/**
* Line color as a string in hexadecimal color syntax `#RGB` color using its primary color components
* (red, green, blue) written as hexadecimal numbers.
*
* @default "#ff0000"
*/
color?: string;
/**
* Internal markup object identifier.
*/
id?: string;
}