maplair 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +118 -0
- package/dist/esm/Maplair.js +14 -14
- package/dist/esm/control/AttributionControl.js +24 -14
- package/dist/esm/control/AttributionControl.js.map +1 -1
- package/dist/esm/control/ButtonControl.js +9 -11
- package/dist/esm/control/ButtonControl.js.map +1 -1
- package/dist/esm/control/ContextMenu.js +1 -3
- package/dist/esm/control/ContextMenu.js.map +1 -1
- package/dist/esm/control/Control.js +9 -16
- package/dist/esm/control/Control.js.map +1 -1
- package/dist/esm/control/FullscreenControl.js +5 -7
- package/dist/esm/control/FullscreenControl.js.map +1 -1
- package/dist/esm/control/LayersControl.js +144 -35
- package/dist/esm/control/LayersControl.js.map +1 -1
- package/dist/esm/control/LegendControl.js +7 -9
- package/dist/esm/control/LegendControl.js.map +1 -1
- package/dist/esm/control/MiniMapControl.js +14 -16
- package/dist/esm/control/MiniMapControl.js.map +1 -1
- package/dist/esm/control/RotateControl.js +1 -3
- package/dist/esm/control/RotateControl.js.map +1 -1
- package/dist/esm/control/ScaleControl.js +7 -9
- package/dist/esm/control/ScaleControl.js.map +1 -1
- package/dist/esm/control/SearchControl.js +99 -17
- package/dist/esm/control/SearchControl.js.map +1 -1
- package/dist/esm/control/SideBySideControl.js +1 -3
- package/dist/esm/control/SideBySideControl.js.map +1 -1
- package/dist/esm/control/TextControl.js +5 -7
- package/dist/esm/control/TextControl.js.map +1 -1
- package/dist/esm/control/TimeControl.js +408 -0
- package/dist/esm/control/TimeControl.js.map +1 -0
- package/dist/esm/control/ZoomControl.js +5 -7
- package/dist/esm/control/ZoomControl.js.map +1 -1
- package/dist/esm/core/Class.js +28 -37
- package/dist/esm/core/Class.js.map +1 -1
- package/dist/esm/core/Events.js +21 -8
- package/dist/esm/core/Events.js.map +1 -1
- package/dist/esm/core/Handler.js +13 -11
- package/dist/esm/core/Handler.js.map +1 -1
- package/dist/esm/core/Util.js +13 -1
- package/dist/esm/core/Util.js.map +1 -1
- package/dist/esm/dom/DomEvent.DoubleTap.js +25 -22
- package/dist/esm/dom/DomEvent.DoubleTap.js.map +1 -1
- package/dist/esm/dom/DomEvent.PointerEvents.js +2 -16
- package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -1
- package/dist/esm/dom/DomEvent.js +8 -42
- package/dist/esm/dom/DomEvent.js.map +1 -1
- package/dist/esm/dom/DomUtil.js +14 -68
- package/dist/esm/dom/DomUtil.js.map +1 -1
- package/dist/esm/dom/Draggable.js +17 -18
- package/dist/esm/dom/Draggable.js.map +1 -1
- package/dist/esm/dom/PosAnimation.js +3 -25
- package/dist/esm/dom/PosAnimation.js.map +1 -1
- package/dist/esm/geo/LatLng.js +15 -5
- package/dist/esm/geo/LatLng.js.map +1 -1
- package/dist/esm/geo/crs/EPSG3395.js +1 -1
- package/dist/esm/geo/crs/EPSG3395.js.map +1 -1
- package/dist/esm/geo/crs/EPSG3857.js +1 -1
- package/dist/esm/geo/crs/EPSG3857.js.map +1 -1
- package/dist/esm/geo/crs/EPSG4326.js +1 -1
- package/dist/esm/geo/crs/EPSG4326.js.map +1 -1
- package/dist/esm/geo/crs/EarthCRS.js +2 -2
- package/dist/esm/geo/crs/EarthCRS.js.map +1 -1
- package/dist/esm/geo/crs/SimpleCRS.js +1 -1
- package/dist/esm/geo/crs/SimpleCRS.js.map +1 -1
- package/dist/esm/geo/projection/Projection.LonLat.js +1 -1
- package/dist/esm/geo/projection/Projection.LonLat.js.map +1 -1
- package/dist/esm/geo/projection/Projection.Mercator.js +1 -1
- package/dist/esm/geo/projection/Projection.Mercator.js.map +1 -1
- package/dist/esm/geo/projection/Projection.SphericalMercator.js +1 -1
- package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +1 -1
- package/dist/esm/geometry/LineUtil.js +36 -30
- package/dist/esm/geometry/LineUtil.js.map +1 -1
- package/dist/esm/geometry/PolyUtil.js +8 -27
- package/dist/esm/geometry/PolyUtil.js.map +1 -1
- package/dist/esm/layer/BlanketOverlay.js +6 -8
- package/dist/esm/layer/BlanketOverlay.js.map +1 -1
- package/dist/esm/layer/DivOverlay.js +15 -20
- package/dist/esm/layer/DivOverlay.js.map +1 -1
- package/dist/esm/layer/GeoJSON.js +9 -145
- package/dist/esm/layer/GeoJSON.js.map +1 -1
- package/dist/esm/layer/GeoJSONUtil.js +75 -0
- package/dist/esm/layer/GeoJSONUtil.js.map +1 -0
- package/dist/esm/layer/HeatLayer.js +15 -17
- package/dist/esm/layer/HeatLayer.js.map +1 -1
- package/dist/esm/layer/ImageOverlay.js +20 -26
- package/dist/esm/layer/ImageOverlay.js.map +1 -1
- package/dist/esm/layer/Layer.js +8 -10
- package/dist/esm/layer/Layer.js.map +1 -1
- package/dist/esm/layer/LayerGroup.js +51 -0
- package/dist/esm/layer/LayerGroup.js.map +1 -1
- package/dist/esm/layer/Popup.js +26 -42
- package/dist/esm/layer/Popup.js.map +1 -1
- package/dist/esm/layer/SVGOverlay.js +2 -5
- package/dist/esm/layer/SVGOverlay.js.map +1 -1
- package/dist/esm/layer/Tooltip.js +15 -17
- package/dist/esm/layer/Tooltip.js.map +1 -1
- package/dist/esm/layer/VideoOverlay.js +12 -15
- package/dist/esm/layer/VideoOverlay.js.map +1 -1
- package/dist/esm/layer/marker/DefaultIcon.js +15 -48
- package/dist/esm/layer/marker/DefaultIcon.js.map +1 -1
- package/dist/esm/layer/marker/DivIcon.js +7 -9
- package/dist/esm/layer/marker/DivIcon.js.map +1 -1
- package/dist/esm/layer/marker/Icon.js +7 -10
- package/dist/esm/layer/marker/Icon.js.map +1 -1
- package/dist/esm/layer/marker/Marker.Drag.js +1 -1
- package/dist/esm/layer/marker/Marker.Drag.js.map +1 -1
- package/dist/esm/layer/marker/Marker.Move.js +1 -2
- package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
- package/dist/esm/layer/marker/Marker.js +61 -33
- package/dist/esm/layer/marker/Marker.js.map +1 -1
- package/dist/esm/layer/marker/MarkerClusterGroup.js +302 -0
- package/dist/esm/layer/marker/MarkerClusterGroup.js.map +1 -0
- package/dist/esm/layer/marker/SvgIcon.js +6 -8
- package/dist/esm/layer/marker/SvgIcon.js.map +1 -1
- package/dist/esm/layer/tile/GridLayer.js +85 -97
- package/dist/esm/layer/tile/GridLayer.js.map +1 -1
- package/dist/esm/layer/tile/TileLayer.js +28 -36
- package/dist/esm/layer/tile/TileLayer.js.map +1 -1
- package/dist/esm/layer/tile/WMSTileLayer.js +28 -23
- package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -1
- package/dist/esm/layer/vector/Canvas.js +1 -3
- package/dist/esm/layer/vector/Canvas.js.map +1 -1
- package/dist/esm/layer/vector/Circle.js +2 -2
- package/dist/esm/layer/vector/Circle.js.map +1 -1
- package/dist/esm/layer/vector/CircleMarker.js +17 -7
- package/dist/esm/layer/vector/CircleMarker.js.map +1 -1
- package/dist/esm/layer/vector/Path.DashAnimation.js +2 -3
- package/dist/esm/layer/vector/Path.DashAnimation.js.map +1 -1
- package/dist/esm/layer/vector/Path.js +27 -20
- package/dist/esm/layer/vector/Path.js.map +1 -1
- package/dist/esm/layer/vector/Polygon.js +20 -4
- package/dist/esm/layer/vector/Polygon.js.map +1 -1
- package/dist/esm/layer/vector/Polyline.Decorations.js +2 -2
- package/dist/esm/layer/vector/Polyline.js +23 -7
- package/dist/esm/layer/vector/Polyline.js.map +1 -1
- package/dist/esm/layer/vector/Renderer.getRenderer.js +14 -13
- package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -1
- package/dist/esm/layer/vector/SVG.js +5 -5
- package/dist/esm/layer/vector/SVG.js.map +1 -1
- package/dist/esm/map/Map.Rotation.js +10 -6
- package/dist/esm/map/Map.Rotation.js.map +1 -1
- package/dist/esm/map/Map.js +116 -110
- package/dist/esm/map/Map.js.map +1 -1
- package/dist/esm/map/handler/BoxZoomHandler.js +5 -7
- package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -1
- package/dist/esm/map/handler/DisplaceHandler.js +6 -8
- package/dist/esm/map/handler/DisplaceHandler.js.map +1 -1
- package/dist/esm/map/handler/DragHandler.js +19 -19
- package/dist/esm/map/handler/DragHandler.js.map +1 -1
- package/dist/esm/map/handler/KeyboardHandler.js +35 -35
- package/dist/esm/map/handler/KeyboardHandler.js.map +1 -1
- package/dist/esm/map/handler/PinchZoomHandler.js +12 -3
- package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -1
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js +3 -4
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -1
- package/dist/esm/map/handler/TapHoldHandler.js +12 -5
- package/dist/esm/map/handler/TapHoldHandler.js.map +1 -1
- package/dist/esm/package.js +1 -1
- package/dist/maplair-global-src.js +8009 -7369
- package/dist/maplair-global-src.js.map +1 -1
- package/dist/maplair-global.js +2 -2
- package/dist/maplair-global.js.map +1 -1
- package/dist/maplair-src.js +10040 -9381
- package/dist/maplair-src.js.map +1 -1
- package/dist/maplair.css +148 -98
- package/dist/maplair.js +2 -2
- package/dist/maplair.js.map +1 -1
- package/i18n/cs.json +6 -0
- package/i18n/de.json +6 -0
- package/i18n/en.json +6 -0
- package/i18n/es.json +6 -0
- package/i18n/fr.json +6 -0
- package/i18n/hu.json +6 -0
- package/i18n/it.json +6 -0
- package/i18n/rm.json +6 -0
- package/i18n/sk.json +6 -0
- package/i18n/sl.json +6 -0
- package/package.json +9 -11
- package/src/control/AttributionControl.js +25 -18
- package/src/control/ButtonControl.js +9 -11
- package/src/control/ContextMenu.js +3 -5
- package/src/control/Control.js +9 -19
- package/src/control/FullscreenControl.js +5 -7
- package/src/control/LayersControl.js +159 -36
- package/src/control/LegendControl.js +7 -9
- package/src/control/MiniMapControl.js +9 -11
- package/src/control/RotateControl.js +3 -5
- package/src/control/ScaleControl.js +7 -9
- package/src/control/SearchControl.js +102 -19
- package/src/control/SideBySideControl.js +3 -5
- package/src/control/TextControl.js +5 -7
- package/src/control/TimeControl.js +471 -0
- package/src/control/ZoomControl.js +5 -7
- package/src/control/index.js +1 -0
- package/src/core/Class.js +35 -34
- package/src/core/Events.js +22 -3
- package/src/core/Handler.js +14 -12
- package/src/core/Util.js +19 -1
- package/src/core/index.js +0 -1
- package/src/dom/DomEvent.DoubleTap.js +18 -10
- package/src/dom/DomEvent.PointerEvents.js +3 -26
- package/src/dom/DomEvent.js +8 -66
- package/src/dom/DomUtil.js +22 -78
- package/src/dom/Draggable.js +27 -22
- package/src/dom/PosAnimation.js +3 -25
- package/src/dom/index.js +0 -1
- package/src/geo/LatLng.js +20 -3
- package/src/geo/crs/EPSG3395.js +1 -1
- package/src/geo/crs/EPSG3857.js +1 -1
- package/src/geo/crs/EPSG4326.js +1 -1
- package/src/geo/crs/EarthCRS.js +2 -8
- package/src/geo/crs/SimpleCRS.js +1 -1
- package/src/geo/projection/Projection.LonLat.js +1 -1
- package/src/geo/projection/Projection.Mercator.js +1 -1
- package/src/geo/projection/Projection.SphericalMercator.js +1 -1
- package/src/geometry/LineUtil.js +47 -48
- package/src/geometry/PolyUtil.js +14 -43
- package/src/layer/BlanketOverlay.js +6 -10
- package/src/layer/DivOverlay.js +15 -26
- package/src/layer/GeoJSON.js +7 -205
- package/src/layer/GeoJSONUtil.js +85 -0
- package/src/layer/HeatLayer.js +9 -11
- package/src/layer/ImageOverlay.js +19 -30
- package/src/layer/Layer.js +8 -10
- package/src/layer/LayerGroup.js +71 -0
- package/src/layer/Popup.js +28 -43
- package/src/layer/SVGOverlay.js +1 -5
- package/src/layer/Tooltip.js +15 -19
- package/src/layer/VideoOverlay.js +12 -15
- package/src/layer/marker/DefaultIcon.js +15 -61
- package/src/layer/marker/DivIcon.js +9 -11
- package/src/layer/marker/Icon.js +7 -10
- package/src/layer/marker/Marker.Drag.js +1 -1
- package/src/layer/marker/Marker.Move.js +1 -2
- package/src/layer/marker/Marker.js +81 -39
- package/src/layer/marker/MarkerClusterGroup.js +370 -0
- package/src/layer/marker/SvgIcon.js +7 -9
- package/src/layer/marker/index.js +1 -0
- package/src/layer/tile/GridLayer.js +103 -133
- package/src/layer/tile/TileLayer.js +35 -43
- package/src/layer/tile/WMSTileLayer.js +26 -24
- package/src/layer/vector/Canvas.js +3 -5
- package/src/layer/vector/Circle.js +5 -2
- package/src/layer/vector/CircleMarker.js +17 -6
- package/src/layer/vector/Path.DashAnimation.js +1 -2
- package/src/layer/vector/Path.js +30 -21
- package/src/layer/vector/Polygon.js +28 -5
- package/src/layer/vector/Polyline.js +25 -6
- package/src/layer/vector/Renderer.getRenderer.js +17 -17
- package/src/layer/vector/SVG.js +5 -5
- package/src/map/Map.Rotation.js +12 -4
- package/src/map/Map.js +142 -133
- package/src/map/handler/BoxZoomHandler.js +9 -8
- package/src/map/handler/DisplaceHandler.js +6 -8
- package/src/map/handler/DragHandler.js +25 -28
- package/src/map/handler/KeyboardHandler.js +42 -48
- package/src/map/handler/PinchZoomHandler.js +16 -5
- package/src/map/handler/ScrollWheelZoomHandler.js +6 -4
- package/src/map/handler/TapHoldHandler.js +15 -4
- package/src/map/index.js +1 -1
- package/src/maplair.css +148 -98
- package/dist/esm/core/Browser.js +0 -100
- package/dist/esm/core/Browser.js.map +0 -1
- package/dist/images/layers.svg +0 -1
- package/dist/images/marker-icon.svg +0 -1
- package/dist/images/marker-shadow.svg +0 -1
- package/src/core/Browser.js +0 -110
- package/src/images/layers.svg +0 -1
- package/src/images/marker-icon.svg +0 -1
- package/src/images/marker-shadow.svg +0 -1
|
@@ -9,11 +9,43 @@ import {I18n} from '../core/I18n.js';
|
|
|
9
9
|
/** @import {Layer} from '../layer/Layer.js' */
|
|
10
10
|
/** @import {LayersControlEvent} from '../core/Events.js' */
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* An entry of `LayersControl`, as returned by `getLayers()`.
|
|
14
|
+
* @typedef {object} LayersControlEntry
|
|
15
|
+
* @property {Layer} layer The layer.
|
|
16
|
+
* @property {string} name The name of the layer, as given to the control.
|
|
17
|
+
* @property {boolean} overlay Whether the layer is an overlay (checkbox) or a base layer
|
|
18
|
+
* (radio button).
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The group of an entry of `LayersControl`, as returned by the option `groupBy`.
|
|
23
|
+
* @typedef {object} LayersControlGroup
|
|
24
|
+
* @property {string} group The name of the group, rendered as text.
|
|
25
|
+
* @property {string} label The label of the entry within the group, may contain HTML
|
|
26
|
+
* (like layer names).
|
|
27
|
+
*/
|
|
28
|
+
|
|
12
29
|
/**
|
|
13
30
|
* Options of `LayersControl`.
|
|
14
31
|
* @typedef {object} LayersControlOptions
|
|
15
32
|
* @property {boolean} [collapsed=true] If `true`, the control will be collapsed into an
|
|
16
|
-
* icon and expanded on pointer hover, touch, or keyboard activation.
|
|
33
|
+
* icon and expanded on pointer hover, touch, or keyboard activation. Ignored if `inline`
|
|
34
|
+
* is `true`.
|
|
35
|
+
* @property {boolean} [inline=false] If `true`, the control is laid out like the
|
|
36
|
+
* attribution control: it is always expanded (without toggle button) and all entries are
|
|
37
|
+
* placed next to each other, wrapping onto multiple lines if necessary.
|
|
38
|
+
* @property {(name: string, layer: Layer, overlay: boolean) => LayersControlGroup | undefined} [groupBy]
|
|
39
|
+
* A function to group the entries. For each entry, it returns the name of its group and
|
|
40
|
+
* its label within the group, or `undefined` for an ungrouped entry. Consecutive entries
|
|
41
|
+
* of the same group (base layers and overlays separately) are rendered within one
|
|
42
|
+
* `maplair-control-layers-group` container, starting with the group name in a
|
|
43
|
+
* `maplair-control-layers-group-name` element, and each entry shows only its label.
|
|
44
|
+
* Events like `baselayerchange` still carry the full `name`. When combined with
|
|
45
|
+
* `sortLayers`, the entries are sorted first and grouped afterwards.
|
|
46
|
+
* @property {string|HTMLElement} [toggleContent] The content of the toggle button of a
|
|
47
|
+
* collapsed control instead of the layers icon: HTML (e.g. an icon or a character) or an
|
|
48
|
+
* element. String content is rendered as HTML; do not pass untrusted input.
|
|
17
49
|
* @property {number} [collapseDelay=0] Collapse delay in milliseconds. If greater than 0,
|
|
18
50
|
* the control will remain open longer, making it easier to scroll through long layer
|
|
19
51
|
* lists.
|
|
@@ -71,6 +103,19 @@ import {I18n} from '../core/I18n.js';
|
|
|
71
103
|
* {"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer}
|
|
72
104
|
* ```
|
|
73
105
|
*
|
|
106
|
+
* Layers can be grouped using the option `groupBy`, for example layer names of the form
|
|
107
|
+
* `"Group (label)"`:
|
|
108
|
+
*
|
|
109
|
+
* ```js
|
|
110
|
+
* new LayersControl(baseLayers, overlays, {
|
|
111
|
+
* inline: true,
|
|
112
|
+
* groupBy(name) {
|
|
113
|
+
* const [, group, label] = /^([^<>()]+) \((.+)\)$/.exec(name) ?? [];
|
|
114
|
+
* return group ? {group: `${group}:`, label} : undefined;
|
|
115
|
+
* }
|
|
116
|
+
* }).addTo(map);
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
74
119
|
* @fires MaplairMap#baselayerchange {LayersControlEvent} Fired when the base layer is
|
|
75
120
|
* changed through the [layers control](#control-layers).
|
|
76
121
|
* @fires MaplairMap#overlayadd {LayersControlEvent} Fired when an overlay is selected
|
|
@@ -80,19 +125,20 @@ import {I18n} from '../core/I18n.js';
|
|
|
80
125
|
*/
|
|
81
126
|
export class LayersControl extends Control {
|
|
82
127
|
|
|
83
|
-
static {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
128
|
+
static defaultOptions = {
|
|
129
|
+
collapsed: true,
|
|
130
|
+
inline: false,
|
|
131
|
+
groupBy: undefined,
|
|
132
|
+
toggleContent: undefined,
|
|
133
|
+
collapseDelay: 0,
|
|
134
|
+
position: 'topright',
|
|
135
|
+
autoZIndex: true,
|
|
136
|
+
hideSingleBase: false,
|
|
137
|
+
sortLayers: false,
|
|
138
|
+
sortFunction(layerA, layerB, nameA, nameB) {
|
|
139
|
+
return nameA < nameB ? -1 : (nameB < nameA ? 1 : 0);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
96
142
|
|
|
97
143
|
/**
|
|
98
144
|
* Creates a layers control with the given layers. Base layers will be switched with
|
|
@@ -139,7 +185,7 @@ export class LayersControl extends Control {
|
|
|
139
185
|
layer.layer.on('add remove', this._onLayerChange, this);
|
|
140
186
|
}
|
|
141
187
|
|
|
142
|
-
if (!this.
|
|
188
|
+
if (!this._isCollapsible()) {
|
|
143
189
|
// update the height of the container after resizing the window
|
|
144
190
|
map.on('resize', this._expandIfNotCollapsed, this);
|
|
145
191
|
}
|
|
@@ -206,6 +252,32 @@ export class LayersControl extends Control {
|
|
|
206
252
|
return (this._map) ? this._update() : this;
|
|
207
253
|
}
|
|
208
254
|
|
|
255
|
+
/**
|
|
256
|
+
* Returns the entries of the control in the order they are displayed.
|
|
257
|
+
* @returns {LayersControlEntry[]}
|
|
258
|
+
*/
|
|
259
|
+
getLayers() {
|
|
260
|
+
return this._layers.map(({layer, name, overlay}) => ({layer, name, overlay}));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Selects the given layer of the control like a click on its entry: a base layer
|
|
265
|
+
* replaces the current base layer, an overlay is added to the map. The events
|
|
266
|
+
* `baselayerchange` and `overlayadd` are fired as for a click, but without
|
|
267
|
+
* `originalEvent`. Has no effect if the control is not on a map or does not contain
|
|
268
|
+
* the layer.
|
|
269
|
+
* @param {Layer} layer
|
|
270
|
+
* @returns {this}
|
|
271
|
+
*/
|
|
272
|
+
selectLayer(layer) {
|
|
273
|
+
const input = this._layerControlInputs.find(input => input.layerId === Util.stamp(layer));
|
|
274
|
+
if (input && !input.checked) {
|
|
275
|
+
input.checked = true;
|
|
276
|
+
this._onInputClick();
|
|
277
|
+
}
|
|
278
|
+
return this;
|
|
279
|
+
}
|
|
280
|
+
|
|
209
281
|
/**
|
|
210
282
|
* Expand the control container if collapsed.
|
|
211
283
|
* @returns {this}
|
|
@@ -214,7 +286,7 @@ export class LayersControl extends Control {
|
|
|
214
286
|
clearTimeout(this._collapseDelayTimeout);
|
|
215
287
|
|
|
216
288
|
this._container.classList.add('maplair-control-layers-expanded');
|
|
217
|
-
this._section.style.height =
|
|
289
|
+
this._section.style.height = '';
|
|
218
290
|
const acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);
|
|
219
291
|
if (acceptableHeight < this._section.clientHeight) {
|
|
220
292
|
this._section.classList.add('maplair-control-layers-scrollbar');
|
|
@@ -233,6 +305,9 @@ export class LayersControl extends Control {
|
|
|
233
305
|
* @returns {this}
|
|
234
306
|
*/
|
|
235
307
|
collapse(ev) {
|
|
308
|
+
if (this.options.inline) {
|
|
309
|
+
return this;
|
|
310
|
+
}
|
|
236
311
|
// On touch devices `pointerleave` & `pointerout` is fired while clicking on a checkbox.
|
|
237
312
|
// The control was collapsed instead of adding the layer to the map.
|
|
238
313
|
// So we allow collapse only if it is not touch.
|
|
@@ -254,12 +329,17 @@ export class LayersControl extends Control {
|
|
|
254
329
|
_initLayout() {
|
|
255
330
|
const className = 'maplair-control-layers',
|
|
256
331
|
container = this._container = DomUtil.create('div', className),
|
|
257
|
-
collapsed = this.
|
|
332
|
+
collapsed = this._isCollapsible();
|
|
333
|
+
|
|
334
|
+
if (this.options.inline) {
|
|
335
|
+
container.classList.add(`${className}-inline`);
|
|
336
|
+
}
|
|
258
337
|
|
|
259
338
|
DomEvent.disableClickPropagation(container);
|
|
260
339
|
DomEvent.disableScrollPropagation(container);
|
|
261
340
|
|
|
262
341
|
const section = this._section = DomUtil.create('fieldset', `${className}-list`);
|
|
342
|
+
section.setAttribute('aria-label', I18n.translate('Layers'));
|
|
263
343
|
|
|
264
344
|
if (collapsed) {
|
|
265
345
|
this._map.on('click', this.collapse, this);
|
|
@@ -270,23 +350,32 @@ export class LayersControl extends Control {
|
|
|
270
350
|
}, this);
|
|
271
351
|
}
|
|
272
352
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
353
|
+
if (!this.options.inline) {
|
|
354
|
+
const link = this._layersLink = DomUtil.create('button', `${className}-toggle`, container);
|
|
355
|
+
link.type = 'button';
|
|
356
|
+
link.title = I18n.translate('Layers');
|
|
357
|
+
link.setAttribute('aria-label', I18n.translate('Layers'));
|
|
358
|
+
|
|
359
|
+
const {toggleContent} = this.options;
|
|
360
|
+
if (typeof toggleContent === 'string') {
|
|
361
|
+
link.innerHTML = toggleContent;
|
|
362
|
+
} else if (toggleContent) {
|
|
363
|
+
link.replaceChildren(toggleContent);
|
|
364
|
+
}
|
|
277
365
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
366
|
+
DomEvent.on(link, {
|
|
367
|
+
keydown(e) {
|
|
368
|
+
if (e.code === 'Enter') {
|
|
369
|
+
this._expandSafely();
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
// Certain screen readers intercept the key event and instead send a click event
|
|
373
|
+
click(e) {
|
|
374
|
+
e.preventDefault();
|
|
281
375
|
this._expandSafely();
|
|
282
376
|
}
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
click(e) {
|
|
286
|
-
e.preventDefault();
|
|
287
|
-
this._expandSafely();
|
|
288
|
-
}
|
|
289
|
-
}, this);
|
|
377
|
+
}, this);
|
|
378
|
+
}
|
|
290
379
|
|
|
291
380
|
if (!collapsed) {
|
|
292
381
|
this.expand();
|
|
@@ -315,7 +404,7 @@ export class LayersControl extends Control {
|
|
|
315
404
|
this._layers.push({
|
|
316
405
|
layer,
|
|
317
406
|
name,
|
|
318
|
-
overlay
|
|
407
|
+
overlay: !!overlay
|
|
319
408
|
});
|
|
320
409
|
|
|
321
410
|
if (this.options.sortLayers) {
|
|
@@ -337,6 +426,7 @@ export class LayersControl extends Control {
|
|
|
337
426
|
this._overlaysList.replaceChildren();
|
|
338
427
|
|
|
339
428
|
this._layerControlInputs = [];
|
|
429
|
+
this._groupCount = 0;
|
|
340
430
|
let baseLayersPresent, overlaysPresent, baseLayersCount = 0;
|
|
341
431
|
|
|
342
432
|
for (const obj of this._layers) {
|
|
@@ -369,7 +459,7 @@ export class LayersControl extends Control {
|
|
|
369
459
|
(e.type === 'add' ? 'baselayerchange' : null);
|
|
370
460
|
|
|
371
461
|
if (type) {
|
|
372
|
-
this._map.fire(type, obj);
|
|
462
|
+
this._map.fire(type, this._clickEvent ? {...obj, originalEvent: this._clickEvent} : obj);
|
|
373
463
|
}
|
|
374
464
|
}
|
|
375
465
|
|
|
@@ -390,8 +480,10 @@ export class LayersControl extends Control {
|
|
|
390
480
|
|
|
391
481
|
DomEvent.on(input, 'click', this._onInputClick, this);
|
|
392
482
|
|
|
483
|
+
const group = this.options.groupBy?.(obj.name, obj.layer, obj.overlay);
|
|
484
|
+
|
|
393
485
|
const name = document.createElement('span');
|
|
394
|
-
name.innerHTML = ` ${obj.name}`;
|
|
486
|
+
name.innerHTML = ` ${group ? group.label : obj.name}`;
|
|
395
487
|
|
|
396
488
|
// Helps from preventing layer control flicker when checkboxes are disabled
|
|
397
489
|
// https://github.com/Leaflet/Leaflet/issues/2771
|
|
@@ -401,13 +493,38 @@ export class LayersControl extends Control {
|
|
|
401
493
|
holder.appendChild(input);
|
|
402
494
|
holder.appendChild(name);
|
|
403
495
|
|
|
404
|
-
const
|
|
496
|
+
const list = obj.overlay ? this._overlaysList : this._baseLayersList;
|
|
497
|
+
const container = group ? this._getGroupContainer(list, group.group) : list;
|
|
405
498
|
container.appendChild(label);
|
|
406
499
|
|
|
407
500
|
this._checkDisabledLayers();
|
|
408
501
|
return label;
|
|
409
502
|
}
|
|
410
503
|
|
|
504
|
+
/**
|
|
505
|
+
* Returns the container of the given group if it is the last element in `list`
|
|
506
|
+
* (continuing the group), otherwise appends a new group container to `list`.
|
|
507
|
+
* @param {HTMLElement} list
|
|
508
|
+
* @param {string} group
|
|
509
|
+
* @returns {HTMLElement}
|
|
510
|
+
*/
|
|
511
|
+
_getGroupContainer(list, group) {
|
|
512
|
+
const last = list.lastElementChild;
|
|
513
|
+
if (last?._maplairGroup === group) {
|
|
514
|
+
return last;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
const className = 'maplair-control-layers-group',
|
|
518
|
+
container = DomUtil.create('div', className, list),
|
|
519
|
+
name = DomUtil.create('span', `${className}-name`, container);
|
|
520
|
+
name.id = `${className}_${Util.stamp(this)}_${++this._groupCount}`;
|
|
521
|
+
name.textContent = group;
|
|
522
|
+
container.setAttribute('role', 'group');
|
|
523
|
+
container.setAttribute('aria-labelledby', name.id);
|
|
524
|
+
container._maplairGroup = group;
|
|
525
|
+
return container;
|
|
526
|
+
}
|
|
527
|
+
|
|
411
528
|
_onInputClick(e) {
|
|
412
529
|
// expanding the control on mobile with a click can cause adding a layer - we don't want this
|
|
413
530
|
if (this._preventClick) {
|
|
@@ -419,6 +536,7 @@ export class LayersControl extends Control {
|
|
|
419
536
|
removedLayers = [];
|
|
420
537
|
|
|
421
538
|
this._handlingClick = true;
|
|
539
|
+
this._clickEvent = e;
|
|
422
540
|
|
|
423
541
|
for (const input of inputs) {
|
|
424
542
|
const layer = this._getLayer(input.layerId).layer;
|
|
@@ -443,6 +561,7 @@ export class LayersControl extends Control {
|
|
|
443
561
|
}
|
|
444
562
|
|
|
445
563
|
this._handlingClick = false;
|
|
564
|
+
this._clickEvent = undefined;
|
|
446
565
|
|
|
447
566
|
this._refocusOnMap(e);
|
|
448
567
|
}
|
|
@@ -459,8 +578,12 @@ export class LayersControl extends Control {
|
|
|
459
578
|
}
|
|
460
579
|
}
|
|
461
580
|
|
|
581
|
+
_isCollapsible() {
|
|
582
|
+
return this.options.collapsed && !this.options.inline;
|
|
583
|
+
}
|
|
584
|
+
|
|
462
585
|
_expandIfNotCollapsed() {
|
|
463
|
-
if (this._map && !this.
|
|
586
|
+
if (this._map && !this._isCollapsible()) {
|
|
464
587
|
this.expand();
|
|
465
588
|
}
|
|
466
589
|
return this;
|
|
@@ -47,14 +47,12 @@ const svgNS = 'http://www.w3.org/2000/svg';
|
|
|
47
47
|
|
|
48
48
|
export class LegendControl extends Control {
|
|
49
49
|
|
|
50
|
-
static {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
}
|
|
50
|
+
static defaultOptions = {
|
|
51
|
+
position: 'bottomright',
|
|
52
|
+
collapsed: false,
|
|
53
|
+
featureCount: false,
|
|
54
|
+
bar: false
|
|
55
|
+
};
|
|
58
56
|
|
|
59
57
|
/**
|
|
60
58
|
* Creates a legend control.
|
|
@@ -236,7 +234,7 @@ function formatCount({count, share}) {
|
|
|
236
234
|
function createPatch(layer, symbol, styled) {
|
|
237
235
|
while (layer?.getLayers) { layer = layer.getLayers()[0]; }
|
|
238
236
|
if (!layer?.setStyle) { layer = undefined; }
|
|
239
|
-
const base = layer?.options ?? CircleMarker.
|
|
237
|
+
const base = layer?.options ?? new CircleMarker([0, 0]).options,
|
|
240
238
|
options = Object.assign(Object.create(base), layer && styled ? {} : symbol),
|
|
241
239
|
svg = document.createElementNS(svgNS, 'svg');
|
|
242
240
|
svg.setAttribute('class', 'maplair-control-legend-patch');
|
|
@@ -43,17 +43,15 @@ import {Polygon} from '../layer/vector/Polygon.js';
|
|
|
43
43
|
*/
|
|
44
44
|
export class MiniMapControl extends Control {
|
|
45
45
|
|
|
46
|
-
static {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
}
|
|
46
|
+
static defaultOptions = {
|
|
47
|
+
position: 'bottomright',
|
|
48
|
+
width: 150,
|
|
49
|
+
height: 150,
|
|
50
|
+
zoomOffset: -5,
|
|
51
|
+
collapsed: false,
|
|
52
|
+
rectangleOptions: {color: '#ff7800', weight: 1, fillOpacity: 0.2},
|
|
53
|
+
mapOptions: {}
|
|
54
|
+
};
|
|
57
55
|
|
|
58
56
|
/**
|
|
59
57
|
* Creates an overview map control showing `layer` (which must not be on another map).
|
|
@@ -44,11 +44,9 @@ const compass = '<svg aria-hidden="true" width="16" height="16" viewBox="0 0 16
|
|
|
44
44
|
*/
|
|
45
45
|
export class RotateControl extends Control {
|
|
46
46
|
|
|
47
|
-
static {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
}
|
|
47
|
+
static defaultOptions = {
|
|
48
|
+
position: 'topleft'
|
|
49
|
+
};
|
|
52
50
|
|
|
53
51
|
/**
|
|
54
52
|
* Creates a rotate control.
|
|
@@ -33,15 +33,13 @@ import {I18n} from '../core/I18n.js';
|
|
|
33
33
|
*/
|
|
34
34
|
export class ScaleControl extends Control {
|
|
35
35
|
|
|
36
|
-
static {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
44
|
-
}
|
|
36
|
+
static defaultOptions = {
|
|
37
|
+
position: 'bottomleft',
|
|
38
|
+
maxWidth: 100,
|
|
39
|
+
metric: true,
|
|
40
|
+
imperial: true,
|
|
41
|
+
updateWhenIdle: false
|
|
42
|
+
};
|
|
45
43
|
|
|
46
44
|
/**
|
|
47
45
|
* Creates a scale control with the given options.
|
|
@@ -11,6 +11,8 @@ import {Marker} from '../layer/marker/Marker.js';
|
|
|
11
11
|
/** @import {MaplairEvent} from '../core/Events.js' */
|
|
12
12
|
/** @import {LatLngExpression} from '../geo/LatLng.js' */
|
|
13
13
|
/** @import {LatLngBoundsExpression} from '../geo/LatLngBounds.js' */
|
|
14
|
+
/** @import {Layer} from '../layer/Layer.js' */
|
|
15
|
+
/** @import {LayerGroup} from '../layer/LayerGroup.js' */
|
|
14
16
|
|
|
15
17
|
const searchIcon = '<svg aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><circle cx="6.5" cy="6.5" r="4.5"/><path d="M10 10l4.5 4.5"/></svg>';
|
|
16
18
|
|
|
@@ -36,6 +38,8 @@ function delay(ms, signal) {
|
|
|
36
38
|
* @property {LatLngBoundsExpression} [bounds] The extent of the result, e.g. of a city,
|
|
37
39
|
* which the map fits to instead of zooming to the position.
|
|
38
40
|
* @property {any} [raw] The original result of the service, for use in event listeners.
|
|
41
|
+
* @property {Layer} [layer] The found layer, by [`SearchControl.layers()`](#searchcontrol-layers),
|
|
42
|
+
* e.g. to open its tooltip in a `searchresult` listener.
|
|
39
43
|
*/
|
|
40
44
|
|
|
41
45
|
/**
|
|
@@ -69,9 +73,17 @@ function delay(ms, signal) {
|
|
|
69
73
|
* [`autoComplete`](#searchcontrol-autocomplete).
|
|
70
74
|
* @property {number} [zoom=16] The zoom level for results without bounds, and the
|
|
71
75
|
* maximum zoom level for fitting the bounds of results.
|
|
72
|
-
* @property {boolean} [marker=true] Whether
|
|
76
|
+
* @property {boolean|((result: SearchResult) => Layer|null|undefined)} [marker=true] Whether
|
|
77
|
+
* to show a marker at the selected result, or a function returning the layer to show
|
|
78
|
+
* instead, e.g. a `CircleMarker` highlighting the result (or nothing for none). The
|
|
79
|
+
* layer is removed when the search is cleared or another result is selected.
|
|
80
|
+
* @property {boolean} [clearOnMapClick=false] If `true`, a click on the map clears the
|
|
81
|
+
* search (the field, the results and the marker) and collapses the control. By
|
|
82
|
+
* default, the click only hides the results and the marker stays.
|
|
73
83
|
* @property {string} [placeholder] The placeholder of the search field, by default
|
|
74
84
|
* the translation of "Search".
|
|
85
|
+
* @property {string} [noResultsText] The message shown if nothing is found, by
|
|
86
|
+
* default the translation of "No results".
|
|
75
87
|
* @extends ControlOptions
|
|
76
88
|
*/
|
|
77
89
|
|
|
@@ -126,19 +138,19 @@ function delay(ms, signal) {
|
|
|
126
138
|
*/
|
|
127
139
|
export class SearchControl extends Control {
|
|
128
140
|
|
|
129
|
-
static {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
141
|
+
static defaultOptions = {
|
|
142
|
+
position: 'topleft',
|
|
143
|
+
geocoder: undefined,
|
|
144
|
+
collapsed: true,
|
|
145
|
+
autoComplete: false,
|
|
146
|
+
autoCompleteDelay: 250,
|
|
147
|
+
minLength: 3,
|
|
148
|
+
zoom: 16,
|
|
149
|
+
marker: true,
|
|
150
|
+
clearOnMapClick: false,
|
|
151
|
+
placeholder: undefined,
|
|
152
|
+
noResultsText: undefined
|
|
153
|
+
};
|
|
142
154
|
|
|
143
155
|
/**
|
|
144
156
|
* Returns a [geocoder](#searchcontrol-geocoder) searching with
|
|
@@ -218,6 +230,73 @@ export class SearchControl extends Control {
|
|
|
218
230
|
});
|
|
219
231
|
}
|
|
220
232
|
|
|
233
|
+
/**
|
|
234
|
+
* Returns a [geocoder](#searchcontrol-geocoder) searching the layers of a layer group,
|
|
235
|
+
* e.g. the markers of a `FeatureGroup` or the features of a `GeoJSON` layer, by their
|
|
236
|
+
* label: a property of their GeoJSON feature (`layer.feature.properties`) or the
|
|
237
|
+
* result of a function. The group is searched at the time of the search, so layers
|
|
238
|
+
* added later are found as well, and nested groups without a label are searched
|
|
239
|
+
* recursively. The search ignores the case and finds the query anywhere in the
|
|
240
|
+
* label; labels starting with it come first, then in alphabetical order. The results
|
|
241
|
+
* contain the found `layer` and its GeoJSON feature as `raw`; layers without a
|
|
242
|
+
* single position (e.g. polygons) have the `bounds` and their center as `latlng`.
|
|
243
|
+
* Combine it with [`autoComplete`](#searchcontrol-autocomplete) to search while
|
|
244
|
+
* typing, and with [`marker`](#searchcontrol-marker) `false` or a function to not
|
|
245
|
+
* cover the found marker with another one.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```js
|
|
249
|
+
* const stations = new GeoJSON(data, {
|
|
250
|
+
* onEachFeature: (feature, layer) => layer.bindTooltip(feature.properties.name)
|
|
251
|
+
* }).addTo(map);
|
|
252
|
+
* new SearchControl({
|
|
253
|
+
* geocoder: SearchControl.layers(stations, {property: 'name'}),
|
|
254
|
+
* autoComplete: true,
|
|
255
|
+
* minLength: 1,
|
|
256
|
+
* marker: false
|
|
257
|
+
* }).addTo(map);
|
|
258
|
+
* map.on('searchresult', ({result}) => result.layer.openTooltip());
|
|
259
|
+
* ```
|
|
260
|
+
* @param {LayerGroup} group The layer group to search.
|
|
261
|
+
* @param {object} [options]
|
|
262
|
+
* @param {string} [options.property='name'] The property of the GeoJSON features to
|
|
263
|
+
* search.
|
|
264
|
+
* @param {(layer: Layer) => string|number|null|undefined} [options.label] A function
|
|
265
|
+
* returning the label of a layer instead of the `property`, nothing to skip the
|
|
266
|
+
* layer (or to search its layers, if it is a group).
|
|
267
|
+
* @param {number} [options.limit=10] The maximum number of results.
|
|
268
|
+
* @returns {Geocoder}
|
|
269
|
+
*/
|
|
270
|
+
static layers(group, {property = 'name', label = layer => layer.feature?.properties?.[property], limit = 10} = {}) {
|
|
271
|
+
return (query) => {
|
|
272
|
+
query = query.toLocaleLowerCase();
|
|
273
|
+
const found = [];
|
|
274
|
+
group.eachLayer(function search(layer) {
|
|
275
|
+
const text = label(layer);
|
|
276
|
+
if (text === undefined || text === null || text === '') {
|
|
277
|
+
layer.eachLayer?.(search);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const result = {label: String(text), layer, raw: layer.feature},
|
|
281
|
+
index = result.label.toLocaleLowerCase().indexOf(query);
|
|
282
|
+
if (index < 0) { return; }
|
|
283
|
+
if (layer.getLatLng) {
|
|
284
|
+
result.latlng = layer.getLatLng();
|
|
285
|
+
} else if (layer.getBounds?.().isValid()) {
|
|
286
|
+
result.bounds = layer.getBounds();
|
|
287
|
+
result.latlng = result.bounds.getCenter();
|
|
288
|
+
} else {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
found.push({result, prefix: index === 0});
|
|
292
|
+
});
|
|
293
|
+
return Promise.resolve(found
|
|
294
|
+
.sort((a, b) => b.prefix - a.prefix || a.result.label.localeCompare(b.result.label))
|
|
295
|
+
.slice(0, limit)
|
|
296
|
+
.map(({result}) => result));
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
221
300
|
/**
|
|
222
301
|
* Creates a search control.
|
|
223
302
|
* @param {...SearchControlOptions} args The options.
|
|
@@ -349,7 +428,7 @@ export class SearchControl extends Control {
|
|
|
349
428
|
try {
|
|
350
429
|
const results = await this.options.geocoder(query, {signal: controller.signal});
|
|
351
430
|
if (!controller.signal.aborted) {
|
|
352
|
-
this._showResults(results, I18n.translate('No results'));
|
|
431
|
+
this._showResults(results, this.options.noResultsText ?? I18n.translate('No results'));
|
|
353
432
|
}
|
|
354
433
|
return results;
|
|
355
434
|
} catch (error) {
|
|
@@ -385,9 +464,10 @@ export class SearchControl extends Control {
|
|
|
385
464
|
}
|
|
386
465
|
|
|
387
466
|
this._marker?.remove();
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
467
|
+
const {marker} = this.options;
|
|
468
|
+
this._marker = typeof marker === 'function' ?
|
|
469
|
+
marker(result)?.addTo(map) ?? null :
|
|
470
|
+
marker ? new Marker(latlng, {title: result.label}).addTo(map) : null;
|
|
391
471
|
|
|
392
472
|
map.fire('searchresult', {result, latlng, bounds});
|
|
393
473
|
return this;
|
|
@@ -521,7 +601,10 @@ export class SearchControl extends Control {
|
|
|
521
601
|
}
|
|
522
602
|
|
|
523
603
|
_onMapClick() {
|
|
524
|
-
if (this.
|
|
604
|
+
if (this.options.clearOnMapClick) {
|
|
605
|
+
this.clear();
|
|
606
|
+
this.collapse();
|
|
607
|
+
} else if (this._input.value) {
|
|
525
608
|
this._showResults([]);
|
|
526
609
|
} else {
|
|
527
610
|
this.collapse();
|
|
@@ -43,11 +43,9 @@ import {I18n} from '../core/I18n.js';
|
|
|
43
43
|
*/
|
|
44
44
|
export class SideBySideControl extends Control {
|
|
45
45
|
|
|
46
|
-
static {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
}
|
|
46
|
+
static defaultOptions = {
|
|
47
|
+
ratio: 0.5
|
|
48
|
+
};
|
|
51
49
|
|
|
52
50
|
/**
|
|
53
51
|
* Creates a side-by-side control for the given layers (which have to be added to the
|
|
@@ -27,13 +27,11 @@ import * as DomEvent from '../dom/DomEvent.js';
|
|
|
27
27
|
*/
|
|
28
28
|
export class TextControl extends Control {
|
|
29
29
|
|
|
30
|
-
static {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
}
|
|
30
|
+
static defaultOptions = {
|
|
31
|
+
position: 'topright',
|
|
32
|
+
content: '',
|
|
33
|
+
className: ''
|
|
34
|
+
};
|
|
37
35
|
|
|
38
36
|
/**
|
|
39
37
|
* Creates a text control.
|