@antv/l7-component 2.9.36-alpha.1 → 2.9.37
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/control/BaseControl.d.ts +27 -0
- package/es/control/BaseControl.js +134 -0
- package/es/control/layer.d.ts +38 -0
- package/es/control/layer.js +340 -0
- package/es/control/logo.d.ts +6 -10
- package/es/control/logo.js +11 -41
- package/es/control/scale.d.ts +10 -20
- package/es/control/scale.js +53 -77
- package/es/control/zoom.d.ts +10 -21
- package/es/control/zoom.js +49 -76
- package/es/css/l7.css +502 -0
- package/es/images/logo.png +0 -0
- package/es/index.d.ts +8 -15
- package/es/index.js +9 -15
- package/es/interface.d.ts +20 -1
- package/es/popup.d.ts +35 -0
- package/es/popup.js +300 -0
- package/lib/control/BaseControl.js +160 -0
- package/lib/control/layer.js +362 -0
- package/lib/control/logo.js +23 -50
- package/lib/control/scale.js +62 -82
- package/lib/control/zoom.js +59 -78
- package/lib/css/l7.css +502 -0
- package/lib/images/logo.png +0 -0
- package/lib/index.js +50 -165
- package/lib/popup.js +317 -0
- package/package.json +5 -8
- package/es/assets/iconfont/iconfont.js +0 -53
- package/es/constants/index.d.ts +0 -60
- package/es/constants/index.js +0 -60
- package/es/control/baseControl/buttonControl.d.ts +0 -59
- package/es/control/baseControl/buttonControl.js +0 -191
- package/es/control/baseControl/control.d.ts +0 -106
- package/es/control/baseControl/control.js +0 -301
- package/es/control/baseControl/index.d.ts +0 -4
- package/es/control/baseControl/index.js +0 -4
- package/es/control/baseControl/popperControl.d.ts +0 -26
- package/es/control/baseControl/popperControl.js +0 -131
- package/es/control/baseControl/selectControl.d.ts +0 -46
- package/es/control/baseControl/selectControl.js +0 -232
- package/es/control/exportImage.d.ts +0 -18
- package/es/control/exportImage.js +0 -163
- package/es/control/fullscreen.d.ts +0 -19
- package/es/control/fullscreen.js +0 -151
- package/es/control/geoLocate.d.ts +0 -16
- package/es/control/geoLocate.js +0 -139
- package/es/control/layerControl.d.ts +0 -21
- package/es/control/layerControl.js +0 -172
- package/es/control/mapTheme.d.ts +0 -10
- package/es/control/mapTheme.js +0 -135
- package/es/control/mouseLocation.d.ts +0 -15
- package/es/control/mouseLocation.js +0 -104
- package/es/css/button.less +0 -70
- package/es/css/control.less +0 -71
- package/es/css/index.css +0 -567
- package/es/css/index.less +0 -12
- package/es/css/l7.less +0 -60
- package/es/css/layerPopup.less +0 -8
- package/es/css/logo.less +0 -18
- package/es/css/mouseLocation.less +0 -9
- package/es/css/popper.less +0 -64
- package/es/css/popup.less +0 -169
- package/es/css/scale.less +0 -34
- package/es/css/select.less +0 -86
- package/es/css/variables.less +0 -28
- package/es/css/zoom.less +0 -21
- package/es/images/quanping.svg +0 -12
- package/es/popup/layerPopup.d.ts +0 -78
- package/es/popup/layerPopup.js +0 -308
- package/es/popup/popup.d.ts +0 -147
- package/es/popup/popup.js +0 -636
- package/es/utils/icon.d.ts +0 -1
- package/es/utils/icon.js +0 -9
- package/es/utils/popper.d.ts +0 -75
- package/es/utils/popper.js +0 -286
- package/es/utils/screenfull.d.ts +0 -2
- package/es/utils/screenfull.js +0 -157
- package/lib/assets/iconfont/iconfont.js +0 -55
- package/lib/constants/index.js +0 -68
- package/lib/control/baseControl/buttonControl.js +0 -207
- package/lib/control/baseControl/control.js +0 -333
- package/lib/control/baseControl/index.js +0 -57
- package/lib/control/baseControl/popperControl.js +0 -142
- package/lib/control/baseControl/selectControl.js +0 -253
- package/lib/control/exportImage.js +0 -177
- package/lib/control/fullscreen.js +0 -164
- package/lib/control/geoLocate.js +0 -154
- package/lib/control/layerControl.js +0 -182
- package/lib/control/mapTheme.js +0 -151
- package/lib/control/mouseLocation.js +0 -120
- package/lib/css/button.less +0 -70
- package/lib/css/control.less +0 -71
- package/lib/css/index.css +0 -567
- package/lib/css/index.less +0 -12
- package/lib/css/l7.less +0 -60
- package/lib/css/layerPopup.less +0 -8
- package/lib/css/logo.less +0 -18
- package/lib/css/mouseLocation.less +0 -9
- package/lib/css/popper.less +0 -64
- package/lib/css/popup.less +0 -169
- package/lib/css/scale.less +0 -34
- package/lib/css/select.less +0 -86
- package/lib/css/variables.less +0 -28
- package/lib/css/zoom.less +0 -21
- package/lib/images/quanping.svg +0 -12
- package/lib/popup/layerPopup.js +0 -317
- package/lib/popup/popup.js +0 -651
- package/lib/utils/icon.js +0 -18
- package/lib/utils/popper.js +0 -297
- package/lib/utils/screenfull.js +0 -167
package/es/control/scale.js
CHANGED
|
@@ -1,73 +1,56 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
3
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _get from "@babel/runtime/helpers/get";
|
|
6
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
7
|
|
|
11
8
|
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); }; }
|
|
12
9
|
|
|
13
10
|
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; } }
|
|
14
11
|
|
|
15
|
-
import { DOM, lnglatDistance } from '@antv/l7-utils';
|
|
16
|
-
import
|
|
17
|
-
export { Scale };
|
|
12
|
+
import { bindAll, DOM, lnglatDistance } from '@antv/l7-utils';
|
|
13
|
+
import Control, { PositionType } from "./BaseControl";
|
|
18
14
|
|
|
19
15
|
var Scale = /*#__PURE__*/function (_Control) {
|
|
20
16
|
_inherits(Scale, _Control);
|
|
21
17
|
|
|
22
18
|
var _super = _createSuper(Scale);
|
|
23
19
|
|
|
24
|
-
function Scale() {
|
|
20
|
+
function Scale(cfg) {
|
|
25
21
|
var _this;
|
|
26
22
|
|
|
27
23
|
_classCallCheck(this, Scale);
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
34
|
-
|
|
35
|
-
_defineProperty(_assertThisInitialized(_this), "update", function () {
|
|
36
|
-
var mapsService = _this.mapsService;
|
|
37
|
-
var maxWidth = _this.controlOption.maxWidth;
|
|
38
|
-
var y = mapsService.getSize()[1] / 2;
|
|
39
|
-
var p1 = mapsService.containerToLngLat([0, y]);
|
|
40
|
-
var p2 = mapsService.containerToLngLat([maxWidth, y]);
|
|
41
|
-
var maxMeters = lnglatDistance([p1.lng, p1.lat], [p2.lng, p2.lat]);
|
|
42
|
-
|
|
43
|
-
_this.updateScales(maxMeters);
|
|
44
|
-
});
|
|
45
|
-
|
|
25
|
+
_this = _super.call(this, cfg);
|
|
26
|
+
bindAll(['update'], _assertThisInitialized(_this));
|
|
46
27
|
return _this;
|
|
47
28
|
}
|
|
48
29
|
|
|
49
30
|
_createClass(Scale, [{
|
|
50
31
|
key: "getDefault",
|
|
51
|
-
value: function getDefault(
|
|
52
|
-
return
|
|
53
|
-
name: 'scale',
|
|
32
|
+
value: function getDefault() {
|
|
33
|
+
return {
|
|
54
34
|
position: PositionType.BOTTOMLEFT,
|
|
55
35
|
maxWidth: 100,
|
|
56
36
|
metric: true,
|
|
57
37
|
updateWhenIdle: false,
|
|
58
38
|
imperial: false,
|
|
59
|
-
|
|
60
|
-
}
|
|
39
|
+
name: 'scale'
|
|
40
|
+
};
|
|
61
41
|
}
|
|
62
42
|
}, {
|
|
63
43
|
key: "onAdd",
|
|
64
44
|
value: function onAdd() {
|
|
65
45
|
var className = 'l7-control-scale';
|
|
66
46
|
var container = DOM.create('div', className);
|
|
67
|
-
this.
|
|
68
|
-
var updateWhenIdle = this.controlOption.updateWhenIdle;
|
|
47
|
+
this.addScales(className + '-line', container);
|
|
48
|
+
var updateWhenIdle = this.controlOption.updateWhenIdle; // TODO: 高德地图和MapBox地图事件不一致问题
|
|
49
|
+
// 高德zoomchange
|
|
50
|
+
|
|
69
51
|
this.mapsService.on(updateWhenIdle ? 'moveend' : 'mapmove', this.update);
|
|
70
52
|
this.mapsService.on(updateWhenIdle ? 'zoomend' : 'zoomchange', this.update);
|
|
53
|
+
this.update();
|
|
71
54
|
return container;
|
|
72
55
|
}
|
|
73
56
|
}, {
|
|
@@ -78,13 +61,15 @@ var Scale = /*#__PURE__*/function (_Control) {
|
|
|
78
61
|
this.mapsService.off(updateWhenIdle ? 'moveend' : 'mapmove', this.update);
|
|
79
62
|
}
|
|
80
63
|
}, {
|
|
81
|
-
key: "
|
|
82
|
-
value: function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
key: "update",
|
|
65
|
+
value: function update() {
|
|
66
|
+
var mapsService = this.mapsService;
|
|
67
|
+
var maxWidth = this.controlOption.maxWidth;
|
|
68
|
+
var y = mapsService.getSize()[1] / 2;
|
|
69
|
+
var p1 = mapsService.containerToLngLat([0, y]);
|
|
70
|
+
var p2 = mapsService.containerToLngLat([maxWidth, y]);
|
|
71
|
+
var maxMeters = lnglatDistance([p1.lng, p1.lat], [p2.lng, p2.lat]);
|
|
72
|
+
this.updateScales(maxMeters);
|
|
88
73
|
}
|
|
89
74
|
}, {
|
|
90
75
|
key: "updateScales",
|
|
@@ -101,45 +86,6 @@ var Scale = /*#__PURE__*/function (_Control) {
|
|
|
101
86
|
this.updateImperial(maxMeters);
|
|
102
87
|
}
|
|
103
88
|
}
|
|
104
|
-
}, {
|
|
105
|
-
key: "resetScaleLines",
|
|
106
|
-
value: function resetScaleLines(container) {
|
|
107
|
-
DOM.clearChildren(container);
|
|
108
|
-
var _this$controlOption2 = this.controlOption,
|
|
109
|
-
metric = _this$controlOption2.metric,
|
|
110
|
-
imperial = _this$controlOption2.imperial,
|
|
111
|
-
maxWidth = _this$controlOption2.maxWidth,
|
|
112
|
-
lockWidth = _this$controlOption2.lockWidth;
|
|
113
|
-
|
|
114
|
-
if (lockWidth) {
|
|
115
|
-
DOM.addStyle(container, "width: ".concat(maxWidth, "px"));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (metric) {
|
|
119
|
-
this.mScale = DOM.create('div', 'l7-control-scale-line', container);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (imperial) {
|
|
123
|
-
this.iScale = DOM.create('div', 'l7-control-scale-line', container);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
this.update();
|
|
127
|
-
}
|
|
128
|
-
}, {
|
|
129
|
-
key: "updateScale",
|
|
130
|
-
value: function updateScale(scale, text, ratio) {
|
|
131
|
-
var maxWidth = this.controlOption.maxWidth;
|
|
132
|
-
scale.style.width = Math.round(maxWidth * ratio) + 'px';
|
|
133
|
-
scale.innerHTML = text;
|
|
134
|
-
}
|
|
135
|
-
}, {
|
|
136
|
-
key: "getRoundNum",
|
|
137
|
-
value: function getRoundNum(num) {
|
|
138
|
-
var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1);
|
|
139
|
-
var d = num / pow10;
|
|
140
|
-
d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;
|
|
141
|
-
return pow10 * d;
|
|
142
|
-
}
|
|
143
89
|
}, {
|
|
144
90
|
key: "updateMetric",
|
|
145
91
|
value: function updateMetric(maxMeters) {
|
|
@@ -164,6 +110,36 @@ var Scale = /*#__PURE__*/function (_Control) {
|
|
|
164
110
|
this.updateScale(this.iScale, feet + ' ft', feet / maxFeet);
|
|
165
111
|
}
|
|
166
112
|
}
|
|
113
|
+
}, {
|
|
114
|
+
key: "updateScale",
|
|
115
|
+
value: function updateScale(scale, text, ratio) {
|
|
116
|
+
var maxWidth = this.controlOption.maxWidth;
|
|
117
|
+
scale.style.width = Math.round(maxWidth * ratio) + 'px';
|
|
118
|
+
scale.innerHTML = text;
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "getRoundNum",
|
|
122
|
+
value: function getRoundNum(num) {
|
|
123
|
+
var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1);
|
|
124
|
+
var d = num / pow10;
|
|
125
|
+
d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;
|
|
126
|
+
return pow10 * d;
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "addScales",
|
|
130
|
+
value: function addScales(className, container) {
|
|
131
|
+
var _this$controlOption2 = this.controlOption,
|
|
132
|
+
metric = _this$controlOption2.metric,
|
|
133
|
+
imperial = _this$controlOption2.imperial;
|
|
134
|
+
|
|
135
|
+
if (metric) {
|
|
136
|
+
this.mScale = DOM.create('div', className, container);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (imperial) {
|
|
140
|
+
this.iScale = DOM.create('div', className, container);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
167
143
|
}]);
|
|
168
144
|
|
|
169
145
|
return Scale;
|
package/es/control/zoom.d.ts
CHANGED
|
@@ -1,35 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface IZoomControlOption extends IControlOption {
|
|
5
|
-
zoomInText: ELType | string;
|
|
6
|
-
zoomInTitle: string;
|
|
7
|
-
zoomOutText: ELType | string;
|
|
8
|
-
zoomOutTitle: string;
|
|
9
|
-
}
|
|
10
|
-
export { Zoom };
|
|
11
|
-
export default class Zoom extends Control<IZoomControlOption> {
|
|
1
|
+
import { IZoomControlOption } from '../interface';
|
|
2
|
+
import Control, { PositionType } from './BaseControl';
|
|
3
|
+
export default class Zoom extends Control {
|
|
12
4
|
private disabled;
|
|
13
5
|
private zoomInButton;
|
|
14
6
|
private zoomOutButton;
|
|
15
|
-
|
|
7
|
+
constructor(cfg?: Partial<IZoomControlOption>);
|
|
8
|
+
getDefault(): {
|
|
16
9
|
position: PositionType;
|
|
17
|
-
|
|
18
|
-
zoomInText: SVGSVGElement;
|
|
10
|
+
zoomInText: string;
|
|
19
11
|
zoomInTitle: string;
|
|
20
|
-
zoomOutText:
|
|
12
|
+
zoomOutText: string;
|
|
21
13
|
zoomOutTitle: string;
|
|
22
|
-
|
|
23
|
-
style?: string | undefined;
|
|
14
|
+
name: string;
|
|
24
15
|
};
|
|
25
|
-
setOptions(newOptions: Partial<IZoomControlOption>): void;
|
|
26
16
|
onAdd(): HTMLElement;
|
|
27
17
|
onRemove(): void;
|
|
28
18
|
disable(): this;
|
|
29
19
|
enable(): this;
|
|
30
|
-
zoomIn
|
|
31
|
-
zoomOut
|
|
32
|
-
private resetButtonGroup;
|
|
20
|
+
private zoomIn;
|
|
21
|
+
private zoomOut;
|
|
33
22
|
private createButton;
|
|
34
23
|
private updateDisabled;
|
|
35
24
|
}
|
package/es/control/zoom.js
CHANGED
|
@@ -1,98 +1,54 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
3
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _get from "@babel/runtime/helpers/get";
|
|
6
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
7
|
|
|
11
8
|
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); }; }
|
|
12
9
|
|
|
13
10
|
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; } }
|
|
14
11
|
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { createL7Icon } from "../utils/icon";
|
|
18
|
-
import { Control } from "./baseControl";
|
|
19
|
-
export { Zoom };
|
|
12
|
+
import { bindAll, DOM } from '@antv/l7-utils';
|
|
13
|
+
import Control, { PositionType } from "./BaseControl";
|
|
20
14
|
|
|
21
15
|
var Zoom = /*#__PURE__*/function (_Control) {
|
|
22
16
|
_inherits(Zoom, _Control);
|
|
23
17
|
|
|
24
18
|
var _super = _createSuper(Zoom);
|
|
25
19
|
|
|
26
|
-
function Zoom() {
|
|
20
|
+
function Zoom(cfg) {
|
|
27
21
|
var _this;
|
|
28
22
|
|
|
29
23
|
_classCallCheck(this, Zoom);
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
36
|
-
|
|
37
|
-
_defineProperty(_assertThisInitialized(_this), "zoomIn", function () {
|
|
38
|
-
if (!_this.disabled && _this.mapsService.getZoom() < _this.mapsService.getMaxZoom()) {
|
|
39
|
-
_this.mapsService.zoomIn();
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
_defineProperty(_assertThisInitialized(_this), "zoomOut", function () {
|
|
44
|
-
if (!_this.disabled && _this.mapsService.getZoom() > _this.mapsService.getMinZoom()) {
|
|
45
|
-
_this.mapsService.zoomOut();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
_defineProperty(_assertThisInitialized(_this), "updateDisabled", function () {
|
|
50
|
-
var mapsService = _this.mapsService;
|
|
51
|
-
|
|
52
|
-
_this.zoomInButton.removeAttribute('disabled');
|
|
53
|
-
|
|
54
|
-
_this.zoomOutButton.removeAttribute('disabled');
|
|
55
|
-
|
|
56
|
-
if (_this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
|
|
57
|
-
_this.zoomOutButton.setAttribute('disabled', 'true');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (_this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
|
|
61
|
-
_this.zoomInButton.setAttribute('disabled', 'true');
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
25
|
+
_this = _super.call(this, cfg);
|
|
26
|
+
bindAll(['updateDisabled', 'zoomIn', 'zoomOut'], _assertThisInitialized(_this));
|
|
65
27
|
return _this;
|
|
66
28
|
}
|
|
67
29
|
|
|
68
30
|
_createClass(Zoom, [{
|
|
69
31
|
key: "getDefault",
|
|
70
|
-
value: function getDefault(
|
|
71
|
-
return
|
|
72
|
-
position: PositionType.
|
|
73
|
-
|
|
74
|
-
zoomInText: createL7Icon('l7-icon-enlarge'),
|
|
32
|
+
value: function getDefault() {
|
|
33
|
+
return {
|
|
34
|
+
position: PositionType.TOPLEFT,
|
|
35
|
+
zoomInText: '+',
|
|
75
36
|
zoomInTitle: 'Zoom in',
|
|
76
|
-
zoomOutText:
|
|
77
|
-
zoomOutTitle: 'Zoom out'
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}, {
|
|
81
|
-
key: "setOptions",
|
|
82
|
-
value: function setOptions(newOptions) {
|
|
83
|
-
_get(_getPrototypeOf(Zoom.prototype), "setOptions", this).call(this, newOptions);
|
|
84
|
-
|
|
85
|
-
if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle'])) {
|
|
86
|
-
this.resetButtonGroup(this.container);
|
|
87
|
-
}
|
|
37
|
+
zoomOutText: '−',
|
|
38
|
+
zoomOutTitle: 'Zoom out',
|
|
39
|
+
name: 'zoom'
|
|
40
|
+
};
|
|
88
41
|
}
|
|
89
42
|
}, {
|
|
90
43
|
key: "onAdd",
|
|
91
44
|
value: function onAdd() {
|
|
92
|
-
var
|
|
93
|
-
|
|
45
|
+
var zoomName = 'l7-control-zoom';
|
|
46
|
+
var container = DOM.create('div', zoomName + ' l7-bar');
|
|
47
|
+
this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, zoomName + '-in', container, this.zoomIn);
|
|
48
|
+
this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, zoomName + '-out', container, this.zoomOut);
|
|
94
49
|
this.mapsService.on('zoomend', this.updateDisabled);
|
|
95
50
|
this.mapsService.on('zoomchange', this.updateDisabled);
|
|
51
|
+
this.updateDisabled();
|
|
96
52
|
return container;
|
|
97
53
|
}
|
|
98
54
|
}, {
|
|
@@ -116,28 +72,45 @@ var Zoom = /*#__PURE__*/function (_Control) {
|
|
|
116
72
|
return this;
|
|
117
73
|
}
|
|
118
74
|
}, {
|
|
119
|
-
key: "
|
|
120
|
-
value: function
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
75
|
+
key: "zoomIn",
|
|
76
|
+
value: function zoomIn() {
|
|
77
|
+
if (!this.disabled && this.mapsService.getZoom() < this.mapsService.getMaxZoom()) {
|
|
78
|
+
this.mapsService.zoomIn();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "zoomOut",
|
|
83
|
+
value: function zoomOut() {
|
|
84
|
+
if (!this.disabled && this.mapsService.getZoom() > this.mapsService.getMinZoom()) {
|
|
85
|
+
this.mapsService.zoomOut();
|
|
86
|
+
}
|
|
125
87
|
}
|
|
126
88
|
}, {
|
|
127
89
|
key: "createButton",
|
|
128
90
|
value: function createButton(html, tile, className, container, fn) {
|
|
129
|
-
var link = DOM.create('
|
|
130
|
-
|
|
131
|
-
if (typeof html === 'string') {
|
|
132
|
-
link.innerHTML = html;
|
|
133
|
-
} else {
|
|
134
|
-
link.append(html);
|
|
135
|
-
}
|
|
136
|
-
|
|
91
|
+
var link = DOM.create('a', className, container);
|
|
92
|
+
link.innerHTML = html;
|
|
137
93
|
link.title = tile;
|
|
94
|
+
link.href = 'javascript:void(0)';
|
|
138
95
|
link.addEventListener('click', fn);
|
|
139
96
|
return link;
|
|
140
97
|
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "updateDisabled",
|
|
100
|
+
value: function updateDisabled() {
|
|
101
|
+
var mapsService = this.mapsService;
|
|
102
|
+
var className = 'l7-disabled';
|
|
103
|
+
DOM.removeClass(this.zoomInButton, className);
|
|
104
|
+
DOM.removeClass(this.zoomOutButton, className);
|
|
105
|
+
|
|
106
|
+
if (this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
|
|
107
|
+
DOM.addClass(this.zoomOutButton, className);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
|
|
111
|
+
DOM.addClass(this.zoomInButton, className);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
141
114
|
}]);
|
|
142
115
|
|
|
143
116
|
return Zoom;
|