ym.modules.provider.Path
Overview
An abstract class containing options and constants shared between vector overlays (polygon, polyline, circle). Do not use the class directly.
Features
Property: Options
| Name of the Option Sub-property | Description | Data Type | Default Value |
|---|---|---|---|
| className | Custom class name of an element. | string | '' |
| clickable | If false, the vector will not output mouse events and will act as part of the underlying map. | bool | true |
| color | Line color. | string | '#03f' |
| dashArray | A string that defines the stroke pattern. Does not work on canvas-equipped layers (e.g. Android 2) | string | null |
| fill | Specifies whether the path should be filled with color. Set it to false to disable the filling of polygons or circles. | bool | |
| fillColor | Fill color. | string | |
| fillOpacity | The opacity of the filling. | int | 0.2 |
| fillRule | A string that defines how the inside of a shape is determined. | string | 'evenodd' |
| lineCap | A string that defines the shape to be used at the end of the stroke. | string | null |
| lineJoin | A string that defines the shape to be used at the corners of the stroke. | string | null |
| opacity | Opacity of the stroke. | int | 0.5 |
| pointerEvents | Sets the pointer-event attribute to the path if the SVG backend is used. | string | null |
| stroke | Specifies whether a line should be drawn along the path. Set it to false to disable borders on polygons or circles. | bool | true |
| weight | Line width in pixels. | int | 5 |
Methods
| Name | Return | Description |
|---|---|---|
| addTo(Map map) | this | Adds the layer to the map. |
| bindPopup(string html | HTMLElement element | Popup popup, PopupOptions options?) | this | Binds a popup with a specific HTML content to a click on this path. |
| bindPopup(Popup popup, PopupOptions options?) | this | Binds a specific popup object to the path. |
| unbindPopup() | this | Removes the popup previously bound to the path with bindPopup. |
| openPopup(LatLng latlng?) | this | Opens the popup that was previously bound to the specified point or to one of the points of the path by the bindPopup method. |
| closePopup() | this | Closes the popup bound to the path if it was open. |
| setStyle(PathOptions object) | this | Changes the appearance of a path based on the options in the PathOptions object. |
| getBounds() | LatLngBounds | Returns the LatLngBounds of the path. |
| bringToFront() | this | Brings the layer to the top of all path layers. |
| bringToBack() | this | Brings the layer to the bottom of all path layers. |
| redraw() | this | Redraws the layer. Sometimes useful after you have changed the coordinates the path uses. |
Events
| Event | Event Type | Description |
|---|---|---|
| click | MouseEvent | Is triggered when the user clicks (or taps) the object. |
| dblclick | MouseEvent | Is triggered when the user double-clicks (or double-taps) on the object. |
| mousedown | MouseEvent | Is triggered when the user presses the mouse button over the object. |
| mouseover | MouseEvent | Is triggered when the mouse is moved over the object. |
| mouseout | MouseEvent | Is triggered when the mouse leaves the object. |
| contextmenu | MouseEvent | Is triggered when the user presses the right mouse button over the object. Prevents the browser's default context menu from being displayed when the listener is on this event. |
| add | Event | Is triggered when the path is added to the map. |
| remove | Event | Is triggered when the path is removed from the map. |
| popupopen | PopupEvent | Is triggered when a popup bound to the path is opened. |
| popupclose | PopupEvent | Is triggered when a popup bound to the path is closed. |