Class: LinestringTool

OSDPaperjsAnnotation.LinestringTool(paperScope)

The LinestringTool class extends the PolygonTool and provides functionality for creating and modifying linestrings.

Constructor

new LinestringTool(paperScope)

The constructor initializes the LinestringTool by calling the base class (PolygonTool) constructor and sets up the necessary toolbar control (LinestringToolbar).
Parameters:
Name Type Description
paperScope paper.PaperScope The Paper.js scope for the tool.
Properties:
Name Type Description
cursor paper.Shape.Circle The cursor representing the pen for drawing linestrings. It is a Paper.js Circle shape.
radius number The brush radius for drawing linestrings. This property controls the width of the linestring paths.
draggingSegment paper.Path The segment that is being dragged during the mouse drag event. It is a Paper.js Path representing the segment.
Source:

Extends

  • PolygonTool

Classes

LinestringToolbar

Methods

finishCurrentPath()

Finish the current linestring path when the user releases the mouse. This function finalizes the current linestring path by adding it to the main item and clears the drawing group.
Source:

setRadius(r)

Set the brush radius for the linestring tool. This function updates the brush radius used for drawing linestrings. The new radius is adjusted according to the current zoom level.
Parameters:
Name Type Description
r number The new brush radius value to set.
Source:

startNewPath(ev)

Start a new linestring path when the user clicks the mouse. This function initializes the creation of a new linestring path, sets up a drawing group to hold the path, and listens for user mouse events to add new points to the path.
Parameters:
Name Type Description
ev paper.MouseEvent The mouse event containing the click information.
Source: