[]
        
(Showing Draft Content)

ToolsOptions

Type Alias: ToolsOptions

type ToolsOptions = object;

Default visual properties applied to each paint and object tool when the toolbar opens.

All values are optional, omitted properties fall back to the built-in defaults. User interactions during a session override these values and are persisted in localStorage.

Shape properties (lineWidth, lineColor, fillColor) define the initial style for newly created Rectangle, Line, Arrow, Ellipse, and Brackets objects.

See

PaintToolsPluginOptions.toolsOptions

Example

viewer.addPlugin(new PaintToolsPlugin({
  tools: {
    penSize: 2,
    penColor: '#e03030',
    brushSize: 20,
    brushHardness: 50,
    eraserSize: 30,
    lineWidth: 2,
    lineColor: '#0055cc',
    objects: {
      text: { fontSize: 16, fontColor: '#222222', fontName: 'Arial', fontBold: true },
      rectangle: { fillColor: 'transparent', borderRadius: 4 },
      line: { endCapStyle: 'closedArrow', capSize: 12 },
    },
  }
}));

Properties

penSize

penSize: number;

Pencil stroke width in pixels.

Default

1

penColor

penColor: string;

Pencil stroke color.

Default

'#000000'

penOpacity

penOpacity: number;

Pencil stroke opacity as a percentage (0–100).

Default

100

brushSize

brushSize: number;

Brush stroke width in pixels.

Default

12

brushColor

brushColor: string;

Brush stroke color.

Default

'#000000'

brushHardness

brushHardness: number;

Brush edge hardness as a percentage (0–100). Lower values produce a soft airbrush effect; higher values produce hard edges.

Default

70

brushOpacity

brushOpacity: number;

Brush stroke opacity as a percentage (0–100).

Default

100

cloneStampSize

cloneStampSize: number;

Clone Stamp brush width in pixels.

Default

60

cloneStampOpacity

cloneStampOpacity: number;

Clone Stamp opacity as a percentage (0–100).

Default

100

cloneStampHardness

cloneStampHardness: number;

Clone Stamp edge hardness as a percentage (0–100).

Default

70

eraserSize

eraserSize: number;

Eraser brush width in pixels.

Default

12

eraserOpacity

eraserOpacity: number;

Eraser opacity as a percentage (0–100).

Default

100

eraserHardness

eraserHardness: number;

Eraser edge hardness as a percentage (0–100).

Default

70

lineWidth

lineWidth: number;

Default stroke width in pixels for shape objects (Rectangle, Line, Arrow, Ellipse, Brackets).

Default

1

lineColor

lineColor: string;

Default stroke color for shape objects.

Default

'#000000'

fillColor

fillColor: string;

Default fill color for shape objects. Use 'transparent' or a color with zero alpha to draw unfilled (outline-only) shapes.

Default

'transparent'

objects?

optional objects: ToolsObjectsOptions;

Default style overrides for all paint objects. Allows control over the initial appearance of each object type. Values specified here override lineWidth, lineColor, and fillColor for that specific type.