@antv/l7-component 2.21.1 → 2.21.3
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/es/assets/iconfont/iconfont.js +6 -6
- package/es/constants/index.js +2 -2
- package/es/control/baseControl/buttonControl.js +109 -144
- package/es/control/baseControl/control.js +212 -258
- package/es/control/baseControl/popperControl.js +67 -95
- package/es/control/baseControl/selectControl.js +132 -178
- package/es/control/exportImage.js +59 -142
- package/es/control/fullscreen.js +69 -100
- package/es/control/geoLocate.js +37 -84
- package/es/control/layerSwitch.js +111 -154
- package/es/control/logo.js +43 -69
- package/es/control/mapTheme.js +57 -98
- package/es/control/mouseLocation.js +37 -69
- package/es/control/scale.js +107 -135
- package/es/control/swipe.js +297 -389
- package/es/control/zoom.js +80 -112
- package/es/css/index.css +10 -7
- package/es/index.js +675 -1
- package/es/marker-layer.js +275 -326
- package/es/marker.js +394 -446
- package/es/popup/layerPopup.js +277 -321
- package/es/popup/popup.js +422 -482
- package/es/utils/anchor.js +6 -6
- package/es/utils/icon.js +4 -4
- package/es/utils/popper.js +180 -196
- package/es/utils/screenfull.js +29 -51
- package/lib/assets/iconfont/iconfont.js +6 -6
- package/lib/constants/index.d.ts +60 -0
- package/lib/constants/index.js +2 -2
- package/lib/control/baseControl/buttonControl.d.ts +60 -0
- package/lib/control/baseControl/buttonControl.js +110 -143
- package/lib/control/baseControl/control.d.ts +112 -0
- package/lib/control/baseControl/control.js +213 -257
- package/lib/control/baseControl/index.d.ts +4 -0
- package/lib/control/baseControl/index.js +5 -5
- package/lib/control/baseControl/popperControl.d.ts +28 -0
- package/lib/control/baseControl/popperControl.js +68 -94
- package/lib/control/baseControl/selectControl.d.ts +53 -0
- package/lib/control/baseControl/selectControl.js +133 -177
- package/lib/control/exportImage.d.ts +19 -0
- package/lib/control/exportImage.js +60 -141
- package/lib/control/fullscreen.d.ts +20 -0
- package/lib/control/fullscreen.js +70 -99
- package/lib/control/geoLocate.d.ts +17 -0
- package/lib/control/geoLocate.js +38 -83
- package/lib/control/layerSwitch.d.ts +27 -0
- package/lib/control/layerSwitch.js +112 -153
- package/lib/control/logo.d.ts +14 -0
- package/lib/control/logo.js +44 -69
- package/lib/control/mapTheme.d.ts +11 -0
- package/lib/control/mapTheme.js +58 -97
- package/lib/control/mouseLocation.d.ts +16 -0
- package/lib/control/mouseLocation.js +38 -68
- package/lib/control/scale.d.ts +35 -0
- package/lib/control/scale.js +108 -134
- package/lib/control/swipe.d.ts +66 -0
- package/lib/control/swipe.js +298 -388
- package/lib/control/zoom.d.ts +39 -0
- package/lib/control/zoom.js +81 -111
- package/lib/css/index.css +10 -7
- package/lib/index.d.ts +19 -0
- package/lib/index.js +691 -17
- package/lib/interface.d.ts +18 -0
- package/lib/marker-layer.d.ts +55 -0
- package/lib/marker-layer.js +277 -324
- package/lib/marker.d.ts +58 -0
- package/lib/marker.js +395 -445
- package/lib/popup/layerPopup.d.ts +99 -0
- package/lib/popup/layerPopup.js +278 -320
- package/lib/popup/popup.d.ts +142 -0
- package/lib/popup/popup.js +423 -481
- package/lib/utils/anchor.d.ts +22 -0
- package/lib/utils/anchor.js +6 -6
- package/lib/utils/icon.d.ts +1 -0
- package/lib/utils/icon.js +6 -5
- package/lib/utils/popper.d.ts +76 -0
- package/lib/utils/popper.js +184 -196
- package/lib/utils/screenfull.d.ts +2 -0
- package/lib/utils/screenfull.js +29 -52
- package/package.json +16 -20
package/es/control/zoom.js
CHANGED
|
@@ -1,132 +1,100 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
-
import _get from "@babel/runtime/helpers/esm/get";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
8
|
-
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
3
|
import { PositionType } from '@antv/l7-core';
|
|
13
4
|
import { DOM } from '@antv/l7-utils';
|
|
14
5
|
import { createL7Icon } from "../utils/icon";
|
|
15
6
|
import { Control } from "./baseControl";
|
|
16
7
|
export { Zoom };
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_defineProperty(_assertThisInitialized(_this), "zoomIn", function () {
|
|
28
|
-
if (!_this.disabled && _this.mapsService.getZoom() < _this.mapsService.getMaxZoom()) {
|
|
29
|
-
_this.mapsService.zoomIn();
|
|
8
|
+
export default class Zoom extends Control {
|
|
9
|
+
constructor(...args) {
|
|
10
|
+
super(...args);
|
|
11
|
+
_defineProperty(this, "disabled", void 0);
|
|
12
|
+
_defineProperty(this, "zoomInButton", void 0);
|
|
13
|
+
_defineProperty(this, "zoomOutButton", void 0);
|
|
14
|
+
_defineProperty(this, "zoomNumDiv", void 0);
|
|
15
|
+
_defineProperty(this, "zoomIn", () => {
|
|
16
|
+
if (!this.disabled && this.mapsService.getZoom() < this.mapsService.getMaxZoom()) {
|
|
17
|
+
this.mapsService.zoomIn();
|
|
30
18
|
}
|
|
31
19
|
});
|
|
32
|
-
_defineProperty(
|
|
33
|
-
if (!
|
|
34
|
-
|
|
20
|
+
_defineProperty(this, "zoomOut", () => {
|
|
21
|
+
if (!this.disabled && this.mapsService.getZoom() > this.mapsService.getMinZoom()) {
|
|
22
|
+
this.mapsService.zoomOut();
|
|
35
23
|
}
|
|
36
24
|
});
|
|
37
|
-
_defineProperty(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
25
|
+
_defineProperty(this, "updateDisabled", () => {
|
|
26
|
+
const mapsService = this.mapsService;
|
|
27
|
+
this.zoomInButton.removeAttribute('disabled');
|
|
28
|
+
this.zoomOutButton.removeAttribute('disabled');
|
|
29
|
+
if (this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
|
|
30
|
+
this.zoomOutButton.setAttribute('disabled', 'true');
|
|
43
31
|
}
|
|
44
|
-
if (
|
|
45
|
-
|
|
32
|
+
if (this.controlOption.showZoom && this.zoomNumDiv) {
|
|
33
|
+
this.zoomNumDiv.innerText = String(Math.floor(mapsService.getZoom()));
|
|
46
34
|
}
|
|
47
|
-
if (
|
|
48
|
-
|
|
35
|
+
if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
|
|
36
|
+
this.zoomInButton.setAttribute('disabled', 'true');
|
|
49
37
|
}
|
|
50
38
|
});
|
|
51
|
-
return _this;
|
|
52
39
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
value: function setOptions(newOptions) {
|
|
69
|
-
_get(_getPrototypeOf(Zoom.prototype), "setOptions", this).call(this, newOptions);
|
|
70
|
-
if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle', 'showZoom'])) {
|
|
71
|
-
this.resetButtonGroup(this.container);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}, {
|
|
75
|
-
key: "onAdd",
|
|
76
|
-
value: function onAdd() {
|
|
77
|
-
var container = DOM.create('div', 'l7-control-zoom');
|
|
78
|
-
this.resetButtonGroup(container);
|
|
79
|
-
this.mapsService.on('zoomend', this.updateDisabled);
|
|
80
|
-
this.mapsService.on('zoomchange', this.updateDisabled);
|
|
81
|
-
return container;
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "onRemove",
|
|
85
|
-
value: function onRemove() {
|
|
86
|
-
this.mapsService.off('zoomend', this.updateDisabled);
|
|
87
|
-
this.mapsService.off('zoomchange', this.updateDisabled);
|
|
88
|
-
}
|
|
89
|
-
}, {
|
|
90
|
-
key: "disable",
|
|
91
|
-
value: function disable() {
|
|
92
|
-
this.disabled = true;
|
|
93
|
-
this.updateDisabled();
|
|
94
|
-
return this;
|
|
40
|
+
getDefault(option) {
|
|
41
|
+
return _objectSpread(_objectSpread({}, super.getDefault(option)), {}, {
|
|
42
|
+
position: PositionType.BOTTOMRIGHT,
|
|
43
|
+
name: 'zoom',
|
|
44
|
+
zoomInText: createL7Icon('l7-icon-enlarge'),
|
|
45
|
+
zoomInTitle: 'Zoom in',
|
|
46
|
+
zoomOutText: createL7Icon('l7-icon-narrow'),
|
|
47
|
+
zoomOutTitle: 'Zoom out',
|
|
48
|
+
showZoom: false
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
setOptions(newOptions) {
|
|
52
|
+
super.setOptions(newOptions);
|
|
53
|
+
if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle', 'showZoom'])) {
|
|
54
|
+
this.resetButtonGroup(this.container);
|
|
95
55
|
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
56
|
+
}
|
|
57
|
+
onAdd() {
|
|
58
|
+
const container = DOM.create('div', 'l7-control-zoom');
|
|
59
|
+
this.resetButtonGroup(container);
|
|
60
|
+
this.mapsService.on('zoomend', this.updateDisabled);
|
|
61
|
+
this.mapsService.on('zoomchange', this.updateDisabled);
|
|
62
|
+
return container;
|
|
63
|
+
}
|
|
64
|
+
onRemove() {
|
|
65
|
+
this.mapsService.off('zoomend', this.updateDisabled);
|
|
66
|
+
this.mapsService.off('zoomchange', this.updateDisabled);
|
|
67
|
+
}
|
|
68
|
+
disable() {
|
|
69
|
+
this.disabled = true;
|
|
70
|
+
this.updateDisabled();
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
enable() {
|
|
74
|
+
this.disabled = false;
|
|
75
|
+
this.updateDisabled();
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
resetButtonGroup(container) {
|
|
79
|
+
DOM.clearChildren(container);
|
|
80
|
+
this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, 'l7-button-control', container, this.zoomIn);
|
|
81
|
+
if (this.controlOption.showZoom) {
|
|
82
|
+
this.zoomNumDiv = this.createButton('0', '', 'l7-button-control l7-control-zoom__number', container);
|
|
102
83
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.updateDisabled();
|
|
84
|
+
this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, 'l7-button-control', container, this.zoomOut);
|
|
85
|
+
this.updateDisabled();
|
|
86
|
+
}
|
|
87
|
+
createButton(html, tile, className, container, fn) {
|
|
88
|
+
const link = DOM.create('button', className, container);
|
|
89
|
+
if (typeof html === 'string') {
|
|
90
|
+
link.innerHTML = html;
|
|
91
|
+
} else {
|
|
92
|
+
link.append(html);
|
|
113
93
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
var link = DOM.create('button', className, container);
|
|
118
|
-
if (typeof html === 'string') {
|
|
119
|
-
link.innerHTML = html;
|
|
120
|
-
} else {
|
|
121
|
-
link.append(html);
|
|
122
|
-
}
|
|
123
|
-
link.title = tile;
|
|
124
|
-
if (fn) {
|
|
125
|
-
link.addEventListener('click', fn);
|
|
126
|
-
}
|
|
127
|
-
return link;
|
|
94
|
+
link.title = tile;
|
|
95
|
+
if (fn) {
|
|
96
|
+
link.addEventListener('click', fn);
|
|
128
97
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
export { Zoom as default };
|
|
98
|
+
return link;
|
|
99
|
+
}
|
|
100
|
+
}
|
package/es/css/index.css
CHANGED
|
@@ -23,7 +23,11 @@
|
|
|
23
23
|
height: 30px;
|
|
24
24
|
margin-top: 5px;
|
|
25
25
|
margin-left: 5px;
|
|
26
|
-
font:
|
|
26
|
+
font:
|
|
27
|
+
12px 'Helvetica Neue',
|
|
28
|
+
Arial,
|
|
29
|
+
Helvetica,
|
|
30
|
+
sans-serif;
|
|
27
31
|
text-align: center;
|
|
28
32
|
background-color: rgba(110, 204, 57, 0.6);
|
|
29
33
|
border-radius: 15px;
|
|
@@ -53,7 +57,11 @@
|
|
|
53
57
|
box-sizing: border-box;
|
|
54
58
|
}
|
|
55
59
|
.l7-control-container {
|
|
56
|
-
font:
|
|
60
|
+
font:
|
|
61
|
+
12px/1.5 'Helvetica Neue',
|
|
62
|
+
Arial,
|
|
63
|
+
Helvetica,
|
|
64
|
+
sans-serif;
|
|
57
65
|
}
|
|
58
66
|
.l7-control-container .l7-control {
|
|
59
67
|
position: relative;
|
|
@@ -322,11 +330,6 @@
|
|
|
322
330
|
top: 0;
|
|
323
331
|
right: 0;
|
|
324
332
|
}
|
|
325
|
-
.l7-select-control--image .l7-select-control-item input[type='radio'] {
|
|
326
|
-
position: absolute;
|
|
327
|
-
top: 0;
|
|
328
|
-
right: 0;
|
|
329
|
-
}
|
|
330
333
|
.l7-select-control--image .l7-select-control-item .l7-select-control-item-row {
|
|
331
334
|
display: flex;
|
|
332
335
|
align-items: center;
|