Constructor
(abstract) new Tool(map, ctrl, toolName)
Constructs a Tool object
Parameters:
Name | Type | Description |
---|---|---|
map |
Map | The Map instance which handles the tool |
ctrl |
String | Element | The selector or the element itself which controls the tool when clicking over it, set to null to have the default controller |
toolName |
String | The drawing tool name |
Methods
activate() → {Tool}
Activates the tool
Returns:
instance
- Type
- Tool
addItem(item)
Adds an item to the items
Parameters:
Name | Type | Description |
---|---|---|
item |
Object | a map shape |
Returns:
void
deactivate(removeCtrlopt) → {Tool}
Removes the tool
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
removeCtrl |
Boolean |
<optional> |
false | Whether or not to remove the tool control if the default one |
Returns:
instance
- Type
- Tool
getToolName() → {String}
Returns the tool name
Returns:
The tool name
- Type
- String
prepareTool() → {Tool}
Prepares the current drawing tool
Empty because at the moment has to do nothing, but it's a place where some things
can be done in the future, I suppose.
Returns:
instance
- Type
- Tool
setDrawing() → {Tool}
Sets the current drawing tool
Returns:
instance
- Type
- Tool
setMaxItemsAllowed(max)
Sets the maximum number of items that the tool may draw
Parameters:
Name | Type | Description |
---|---|---|
max |
The maximum number of drawable items |
Returns:
void
setNextShape(enable)
Sets the value of the next shape property (a new click starts a new shape if true)
Parameters:
Name | Type | Description |
---|---|---|
enable |
Whether or not next click has to start a new shape |
Returns:
void
setSelected()
Sets the css selected class
Returns:
void
setUnselected() → {Tool}
Removes the css selected class
Returns:
instance
- Type
- Tool