Drawing Style
The drawing style defines the visual appearance of entities created by the user when using the draw tool. It is applied at draw time — only the style properties relevant to the drawn shape are used; extra properties are silently ignored.
setDrawingStyle()
Updates the drawing style. This call does a shallow merge with the existing style, so you only need to pass the properties you want to override.
setDrawingStyle(style: Partial<IDrawingStyleProperties>): void;
The style is persisted in the controller scene and applied whenever the user commits a draw gesture.
var ctrl = Visu.page0.display1.getController();
// Set a red stroke for new rectangles
ctrl.setDrawingStyle({
lineColor: "#FF0000",
lineWidth: 2,
filled: false,
});
// Make newly drawn shapes filled with semi-transparent blue
ctrl.setDrawingStyle({
filled: true,
fillColor: "#0000FF",
fillOpacity: 0.3,
});
IDrawingStyleProperties reference
Stroke
Applies to: Rect2d, Segment2d, Line2d, Path2d, Shape2d, Ellipse2d, Circle2d
| Property | Type | Description |
|---|---|---|
lineWidth | number | Stroke width in pixels |
lineColor | string | CSS color string (e.g. "#FF0000", "red") |
lineOpacity | number | Stroke opacity from 0 to 1 |
lineStyle | Ve.ELineStyle | Solid, dashed, dotted, etc. |
Fill
Applies to: Rect2d, Path2d, Shape2d, Ellipse2d, Circle2d
| Property | Type | Description |
|---|---|---|
filled | boolean | Whether the shape has a filled interior |
fillColor | string | CSS color string |
fillOpacity | number | Fill opacity from 0 to 1 |
Point
Applies to: Point2d
| Property | Type | Description |
|---|---|---|
color | string | CSS color string |
opacity | number | Opacity from 0 to 1 |
marker | Ve.EMarkerType | Marker shape (cross, circle, square, etc.) |
markerSize | number | Marker size in pixels |
Segment caps
Applies to: Segment2d
| Property | Type | Description |
|---|---|---|
cap1 | Ve.ECapType | Cap style at the first endpoint |
capSize1 | number | Cap size at the first endpoint |
cap2 | Ve.ECapType | Cap style at the second endpoint |
capSize2 | number | Cap size at the second endpoint |
String entities
Applies to: AnchorString, FrameString
| Property | Type | Description |
|---|---|---|
color | string | CSS color string |
opacity | number | Opacity from 0 to 1 |
fontSize | number | Font size |
hAlignment | TStringHAlignment | Horizontal text alignment |
vAlignment | TStringVAlignment | Vertical text alignment |