@2gis/mapgl
Advanced tools
Comparing version 1.13.0 to 1.14.0
{ | ||
"name": "@2gis/mapgl", | ||
"version": "1.13.0", | ||
"version": "1.14.0", | ||
"description": "MapGL API script loader with typings", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -16,3 +16,3 @@ import { Map } from './map'; | ||
export { AnimationOptions, RotationAnimationOptions, Easing } from './types/animations'; | ||
export { MapOptions, MarkerOptions, LabelOptions, ControlOptions, ControlPosition, Padding, HtmlMarkerOptions, CircleMarkerOptions, CircleOptions, PolygonOptions, PolylineOptions, MapSupportOptions, } from './types'; | ||
export { MapOptions, MarkerOptions, MarkerIconOptions, LabelOptions, ControlOptions, ControlPosition, Padding, HtmlMarkerOptions, CircleMarkerOptions, CircleOptions, PolygonOptions, PolylineOptions, MapSupportOptions, } from './types'; | ||
export { MapEventTable, DynamicObjectEventTable, MapEvent, MapPointerEvent, EventTarget, } from './types/events'; | ||
@@ -19,0 +19,0 @@ export { isSupported, notSupportedReason } from './isSuported'; |
import { Map } from '../map'; | ||
import { MarkerOptions } from '../types'; | ||
import { MarkerIconOptions, MarkerLabelOptions, MarkerOptions } from '../types'; | ||
import { DynamicObjectEventTable } from '../types/events'; | ||
@@ -21,2 +21,17 @@ import { Evented } from '../utils/evented'; | ||
/** | ||
* Sets the icon of the marker. | ||
* @param iconOptions Options include icon URL, optional anchor and size. | ||
*/ | ||
setIcon(iconOptions: MarkerIconOptions): this; | ||
/** | ||
* Sets the hover icon of the marker. If you pass empty options, the current hover just will be deleted. | ||
* @param iconOptions Options include icon URL, optional anchor and size. | ||
*/ | ||
setHoverIcon(iconOptions?: MarkerIconOptions): this; | ||
/** | ||
* Sets the label of the marker. If you pass an empty label, the current one just will be deleted. | ||
* @param labelOptions Options of a new marker label. | ||
*/ | ||
setLabel(labelOptions?: MarkerLabelOptions): this; | ||
/** | ||
* Sets the geographical center of the marker. | ||
@@ -23,0 +38,0 @@ * @param coordinates Coordinates `[longitude, latitude]` where the center of the marker should be set. |
@@ -39,3 +39,3 @@ import { LngLatBounds } from '../objects/lngLatBounds'; | ||
/** | ||
* Map rotation threshold with multitouch in degrees. 20 by default. | ||
* Map rotation threshold with multitouch in degrees. 10 by default. | ||
*/ | ||
@@ -191,5 +191,89 @@ touchRotationThreshold?: number; | ||
*/ | ||
label?: Omit<LabelOptions, 'coordinates'>; | ||
label?: MarkerLabelOptions; | ||
} | ||
export interface MarkerLabelOptions { | ||
/** | ||
* Label's text. | ||
*/ | ||
text: string; | ||
/** | ||
* Background image for the label. | ||
*/ | ||
image?: LabelImage; | ||
/** | ||
* Minimum display zoom level of the label. | ||
*/ | ||
minZoom?: number; | ||
/** | ||
* Maximum display zoom level of the label. | ||
*/ | ||
maxZoom?: number; | ||
/** | ||
* Text color in hexadecimal RGB (`#ff0000`) or RGBA (`#ff0000ff`) format. | ||
*/ | ||
color?: string; | ||
/** | ||
* Text size. | ||
*/ | ||
fontSize?: number; | ||
/** | ||
* Use `haloRadius` to add background behind each letter. | ||
*/ | ||
haloRadius?: number; | ||
/** | ||
* Background color of letters (when `haloRadius` is specified). The same format as for `color`. | ||
*/ | ||
haloColor?: string; | ||
/** | ||
* Space between each letter. | ||
*/ | ||
letterSpacing?: number; | ||
/** | ||
* For multiline label `lineHeight` specify how far lines between each other. | ||
*/ | ||
lineHeight?: number; | ||
/** | ||
* The offset distance of text box from its `relativeAnchor`. | ||
* Positive values indicate left and up, while negative values indicate right and down. | ||
* | ||
* **[DEPRECATED]** Will be removed in the next major release, use the `offset` option instead. | ||
* @deprecated | ||
*/ | ||
anchor?: number[]; | ||
/** | ||
* The offset distance of text box from its `relativeAnchor`. | ||
* Positive values indicate right and down, while negative values indicate left and up. | ||
*/ | ||
offset?: number[]; | ||
/** | ||
* Coordinates (from 0 to 1 in each dimension) of the text box "tip" relative to its top left corner, for example: | ||
* [0, 0] value is the top left corner, [0.5, 0.5] — center point, and [1, 1] is the bottom right corner of the box. | ||
* The label will be placed so that this point is at geographical `coordinates` respects the absolute `offset`. | ||
*/ | ||
relativeAnchor?: number[]; | ||
/** | ||
* Draw order. | ||
*/ | ||
zIndex?: number; | ||
} | ||
/** | ||
* Options for marker setIcon and setHoverIcon methods. | ||
*/ | ||
export interface MarkerIconOptions { | ||
/** | ||
* Marker icon URL. | ||
*/ | ||
icon: string; | ||
/** | ||
* The position in pixels of the "tip" of the icon (relative to its top left corner). | ||
* The icon will be aligned so that this point is at the marker's geographical location. | ||
* Centered by default if size is specified. | ||
*/ | ||
anchor?: number[]; | ||
/** | ||
* Marker icon size `[width, height]` in pixels. | ||
*/ | ||
size?: number[]; | ||
} | ||
/** | ||
* Label initialization options. | ||
@@ -207,3 +291,3 @@ */ | ||
/** | ||
* Image background for the label | ||
* Background image for the label. | ||
*/ | ||
@@ -232,3 +316,3 @@ image?: LabelImage; | ||
/** | ||
* Color of letters background (when `haloRadius` is specified). Same format as for `color`. | ||
* Background color of letters (when `haloRadius` is specified). The same format as for `color`. | ||
*/ | ||
@@ -258,3 +342,3 @@ haloColor?: string; | ||
/** | ||
* The relative, from 0 to 1 in each dimension, coordinates of the text box "tip". relative to its top left corner, for example: | ||
* Coordinates (from 0 to 1 in each dimension) of the text box "tip" relative to its top left corner, for example: | ||
* [0, 0] value is the top left corner, [0.5, 0.5] — center point, and [1, 1] is the bottom right corner of the box. | ||
@@ -297,2 +381,6 @@ * The label will be placed so that this point is at geographical `coordinates` respects the absolute `offset`. | ||
zIndex?: number; | ||
/** | ||
* Capture events if set. Otherwise events will passed to the map. | ||
*/ | ||
preventMapInteractions?: boolean; | ||
} | ||
@@ -299,0 +387,0 @@ /** |
57445
1818