Documentation menu

Type

PluginCommand

A drawing command of a JS plugin. Coordinates and sizes are CSS px from the canvas' top-left corner; colors are CSS colors.

export type PluginCommand = {
    type: 'rect';
    x: number;
    y: number;
    width: number;
    height: number;
    color: string;
} | {
    type: 'line';
    x1: number;
    y1: number;
    x2: number;
    y2: number;
    color: string;
    width?: number;
    dash?: LineStyle;
} | {
    type: 'polyline';
    points: ({
        x: number;
        y: number;
    } | [
        number,
        number
    ])[];
    color: string;
    width?: number;
    dash?: LineStyle;
} | {
    type: 'polygon';
    points: ({
        x: number;
        y: number;
    } | [
        number,
        number
    ])[];
    color: string;
} | {
    type: 'text';
    x: number;
    y: number;
    text: string;
    color: string;
    size?: number;
    align?: 'left' | 'center' | 'right';
    background?: string;
    padding?: number;
} | {
    type: 'icon';
    x: number;
    y: number;
    shape?: 'circle' | 'square' | 'arrowUp' | 'arrowDown';
    size?: number;
    color: string;
};

Used by

LayerPluginJs, DrawingToolJs