Constructor
new SelectTool(paperScope)
This tool provides the ability to select and manipulate GeoJSON feature items on the canvas. Users can select items by clicking
on them or by performing area-based selection through click-and-drag. It also emits selection-related events for interaction and provides
functions to retrieve selected items and check for the existence of GeoJSON feature items.
Parameters:
Name | Type | Description |
---|---|---|
paperScope |
Object | The Paper.js paper scope object. |
Properties:
Name | Type | Description |
---|---|---|
ps |
Object | Reference to the Paper.js project scope. |
toolbarControl |
SelectToolbar | Sets the toolbar control for the SelectTool. |
selectionRectangle |
paper.Path.Rectangle | The selection rectangle used for area-based selection. |
sr2 |
paper.Path.Rectangle | A second selection rectangle with a dashed border. |
- Source:
Methods
doAnnotationItemsExist() → {boolean}
Checks if there are any GeoJSON feature items in the project.
This method searches through all the items in the Paper.js project and determines if there are any GeoJSON feature items.
- Source:
Returns:
Returns true if there are GeoJSON feature items, false otherwise.
- Type
- boolean
hitTestArea(ev, onlyFullyContainedopt) → {Array.<HitResult>}
Performs a hit test within an area and returns hit results for GeoJSON feature items.
This method performs a hit test within the provided area and returns hit results that include only GeoJSON feature items.
It supports options for testing against fully contained or overlapping items.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ev |
Object | The mouse event object containing the area for hit testing. | ||
onlyFullyContained |
boolean |
<optional> |
false | Flag to indicate if hit test should be performed only on fully contained items. |
- Source:
Returns:
An array of hit results containing GeoJSON feature items within the specified area.
- Type
- Array.<HitResult>
hitTestPoint(ev) → {HitResult}
Performs a hit test on a specific point and returns hit results for GeoJSON feature items.
This method performs a hit test on the provided point and filters the results to include only GeoJSON feature items.
It also adjusts the hit result if the initial hit is not on the GeoJSON feature itself, but on a child item.
Parameters:
Name | Type | Description |
---|---|---|
ev |
Object | The mouse event object containing the point to perform the hit test on. |
- Source:
Returns:
The hit result object containing information about the hit test.
- Type
- HitResult
onMouseMove(ev)
Handles mouse movement events and emits selection-related events for items under the cursor.
When the mouse moves within the Paper.js project area, this method detects if it is over any item and triggers related selection events.
It updates the currently hovered item and layer, and applies a CSS class to the project's overlay for highlighting selectable layers.
Parameters:
Name | Type | Description |
---|---|---|
ev |
Object | The mouse move event object containing information about the cursor position. |
- Source: