@antv/l7-component 2.9.32-alpha.4 → 2.9.32-alpha.5

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.
Files changed (34) hide show
  1. package/es/control/baseControl/buttonControl.d.ts +1 -1
  2. package/es/control/baseControl/control.d.ts +4 -5
  3. package/es/control/baseControl/control.js +18 -5
  4. package/es/control/baseControl/popperControl.d.ts +1 -1
  5. package/es/control/baseControl/selectControl.d.ts +2 -2
  6. package/es/control/baseControl/selectControl.js +5 -0
  7. package/es/control/zoom.d.ts +3 -2
  8. package/lib/assets/iconfont/iconfont.js +46 -30
  9. package/lib/constants/index.js +34 -56
  10. package/lib/control/baseControl/buttonControl.js +194 -105
  11. package/lib/control/baseControl/control.js +317 -156
  12. package/lib/control/baseControl/index.js +57 -22
  13. package/lib/control/baseControl/popperControl.js +136 -102
  14. package/lib/control/baseControl/selectControl.js +230 -130
  15. package/lib/control/exportImage.js +175 -81
  16. package/lib/control/fullscreen.js +157 -102
  17. package/lib/control/geoLocate.js +143 -67
  18. package/lib/control/layerControl.js +162 -116
  19. package/lib/control/logo.js +101 -70
  20. package/lib/control/mapTheme.js +144 -85
  21. package/lib/control/mouseLocation.js +112 -71
  22. package/lib/control/scale.js +180 -127
  23. package/lib/control/zoom.js +154 -111
  24. package/lib/index.js +251 -48
  25. package/lib/interface.js +4 -16
  26. package/lib/marker-layer.js +367 -249
  27. package/lib/marker.js +419 -277
  28. package/lib/popup/layerPopup.js +305 -188
  29. package/lib/popup/popup.js +602 -339
  30. package/lib/utils/anchor.js +37 -55
  31. package/lib/utils/icon.js +13 -32
  32. package/lib/utils/popper.js +268 -180
  33. package/lib/utils/screenfull.js +110 -103
  34. package/package.json +5 -5
@@ -1,136 +1,189 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/control/scale.ts
20
- var scale_exports = {};
21
- __export(scale_exports, {
22
- Scale: () => Scale,
23
- default: () => Scale
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
24
7
  });
25
- module.exports = __toCommonJS(scale_exports);
26
- var import_l7_utils = require("@antv/l7-utils");
27
- var import_baseControl = require("./baseControl");
28
- var Scale = class extends import_baseControl.Control {
29
- constructor() {
30
- super(...arguments);
31
- this.update = () => {
32
- const mapsService = this.mapsService;
33
- const { maxWidth } = this.controlOption;
34
- const y = mapsService.getSize()[1] / 2;
35
- const p1 = mapsService.containerToLngLat([0, y]);
36
- const p2 = mapsService.containerToLngLat([maxWidth, y]);
37
- const maxMeters = (0, import_l7_utils.lnglatDistance)([p1.lng, p1.lat], [p2.lng, p2.lat]);
38
- this.updateScales(maxMeters);
39
- };
40
- }
41
- getDefault(option) {
42
- return {
43
- ...super.getDefault(option),
44
- name: "scale",
45
- position: import_baseControl.PositionType.BOTTOMLEFT,
46
- maxWidth: 100,
47
- metric: true,
48
- updateWhenIdle: false,
49
- imperial: false,
50
- lockWidth: true
51
- };
52
- }
53
- onAdd() {
54
- const className = "l7-control-scale";
55
- const container = import_l7_utils.DOM.create("div", className);
56
- this.resetScaleLines(container);
57
- const { updateWhenIdle } = this.controlOption;
58
- this.mapsService.on(updateWhenIdle ? "moveend" : "mapmove", this.update);
59
- this.mapsService.on(updateWhenIdle ? "zoomend" : "zoomchange", this.update);
60
- return container;
61
- }
62
- onRemove() {
63
- const { updateWhenIdle } = this.controlOption;
64
- this.mapsService.off(updateWhenIdle ? "zoomend" : "zoomchange", this.update);
65
- this.mapsService.off(updateWhenIdle ? "moveend" : "mapmove", this.update);
66
- }
67
- setOptions(newOption) {
68
- super.setOptions(newOption);
69
- if (this.checkUpdateOption(newOption, [
70
- "lockWidth",
71
- "maxWidth",
72
- "metric",
73
- "updateWhenIdle",
74
- "imperial"
75
- ])) {
76
- this.resetScaleLines(this.container);
8
+ exports.default = exports.Scale = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
+
18
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
19
+
20
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
+
22
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
+
24
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
+
26
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
+
28
+ var _l7Utils = require("@antv/l7-utils");
29
+
30
+ var _baseControl = require("./baseControl");
31
+
32
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
+
34
+ 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; } }
35
+
36
+ var Scale = /*#__PURE__*/function (_Control) {
37
+ (0, _inherits2.default)(Scale, _Control);
38
+
39
+ var _super = _createSuper(Scale);
40
+
41
+ function Scale() {
42
+ var _this;
43
+
44
+ (0, _classCallCheck2.default)(this, Scale);
45
+
46
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
+ args[_key] = arguments[_key];
77
48
  }
49
+
50
+ _this = _super.call.apply(_super, [this].concat(args));
51
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "update", function () {
52
+ var mapsService = _this.mapsService;
53
+ var maxWidth = _this.controlOption.maxWidth;
54
+ var y = mapsService.getSize()[1] / 2;
55
+ var p1 = mapsService.containerToLngLat([0, y]);
56
+ var p2 = mapsService.containerToLngLat([maxWidth, y]);
57
+ var maxMeters = (0, _l7Utils.lnglatDistance)([p1.lng, p1.lat], [p2.lng, p2.lat]);
58
+
59
+ _this.updateScales(maxMeters);
60
+ });
61
+ return _this;
78
62
  }
79
- updateScales(maxMeters) {
80
- const { metric, imperial } = this.controlOption;
81
- if (metric && maxMeters) {
82
- this.updateMetric(maxMeters);
63
+
64
+ (0, _createClass2.default)(Scale, [{
65
+ key: "getDefault",
66
+ value: function getDefault(option) {
67
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(Scale.prototype), "getDefault", this).call(this, option)), {}, {
68
+ name: 'scale',
69
+ position: _baseControl.PositionType.BOTTOMLEFT,
70
+ maxWidth: 100,
71
+ metric: true,
72
+ updateWhenIdle: false,
73
+ imperial: false,
74
+ lockWidth: true
75
+ });
83
76
  }
84
- if (imperial && maxMeters) {
85
- this.updateImperial(maxMeters);
77
+ }, {
78
+ key: "onAdd",
79
+ value: function onAdd() {
80
+ var className = 'l7-control-scale';
81
+
82
+ var container = _l7Utils.DOM.create('div', className);
83
+
84
+ this.resetScaleLines(container);
85
+ var updateWhenIdle = this.controlOption.updateWhenIdle;
86
+ this.mapsService.on(updateWhenIdle ? 'moveend' : 'mapmove', this.update);
87
+ this.mapsService.on(updateWhenIdle ? 'zoomend' : 'zoomchange', this.update);
88
+ return container;
86
89
  }
87
- }
88
- resetScaleLines(container) {
89
- import_l7_utils.DOM.clearChildren(container);
90
- const { metric, imperial, maxWidth, lockWidth } = this.controlOption;
91
- if (lockWidth) {
92
- import_l7_utils.DOM.addStyle(container, `width: ${maxWidth}px`);
90
+ }, {
91
+ key: "onRemove",
92
+ value: function onRemove() {
93
+ var updateWhenIdle = this.controlOption.updateWhenIdle;
94
+ this.mapsService.off(updateWhenIdle ? 'zoomend' : 'zoomchange', this.update);
95
+ this.mapsService.off(updateWhenIdle ? 'moveend' : 'mapmove', this.update);
93
96
  }
94
- if (metric) {
95
- this.mScale = import_l7_utils.DOM.create("div", "l7-control-scale-line", container);
97
+ }, {
98
+ key: "setOptions",
99
+ value: function setOptions(newOption) {
100
+ (0, _get2.default)((0, _getPrototypeOf2.default)(Scale.prototype), "setOptions", this).call(this, newOption);
101
+
102
+ if (this.checkUpdateOption(newOption, ['lockWidth', 'maxWidth', 'metric', 'updateWhenIdle', 'imperial'])) {
103
+ this.resetScaleLines(this.container);
104
+ }
96
105
  }
97
- if (imperial) {
98
- this.iScale = import_l7_utils.DOM.create("div", "l7-control-scale-line", container);
106
+ }, {
107
+ key: "updateScales",
108
+ value: function updateScales(maxMeters) {
109
+ var _this$controlOption = this.controlOption,
110
+ metric = _this$controlOption.metric,
111
+ imperial = _this$controlOption.imperial;
112
+
113
+ if (metric && maxMeters) {
114
+ this.updateMetric(maxMeters);
115
+ }
116
+
117
+ if (imperial && maxMeters) {
118
+ this.updateImperial(maxMeters);
119
+ }
99
120
  }
100
- this.update();
101
- }
102
- updateScale(scale, text, ratio) {
103
- const { maxWidth } = this.controlOption;
104
- scale.style.width = Math.round(maxWidth * ratio) + "px";
105
- scale.innerHTML = text;
106
- }
107
- getRoundNum(num) {
108
- const pow10 = Math.pow(10, (Math.floor(num) + "").length - 1);
109
- let d = num / pow10;
110
- d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;
111
- return pow10 * d;
112
- }
113
- updateMetric(maxMeters) {
114
- const meters = this.getRoundNum(maxMeters);
115
- const label = meters < 1e3 ? meters + " m" : meters / 1e3 + " km";
116
- this.updateScale(this.mScale, label, meters / maxMeters);
117
- }
118
- updateImperial(maxMeters) {
119
- const maxFeet = maxMeters * 3.2808399;
120
- let maxMiles;
121
- let miles;
122
- let feet;
123
- if (maxFeet > 5280) {
124
- maxMiles = maxFeet / 5280;
125
- miles = this.getRoundNum(maxMiles);
126
- this.updateScale(this.iScale, miles + " mi", miles / maxMiles);
127
- } else {
128
- feet = this.getRoundNum(maxFeet);
129
- this.updateScale(this.iScale, feet + " ft", feet / maxFeet);
121
+ }, {
122
+ key: "resetScaleLines",
123
+ value: function resetScaleLines(container) {
124
+ _l7Utils.DOM.clearChildren(container);
125
+
126
+ var _this$controlOption2 = this.controlOption,
127
+ metric = _this$controlOption2.metric,
128
+ imperial = _this$controlOption2.imperial,
129
+ maxWidth = _this$controlOption2.maxWidth,
130
+ lockWidth = _this$controlOption2.lockWidth;
131
+
132
+ if (lockWidth) {
133
+ _l7Utils.DOM.addStyle(container, "width: ".concat(maxWidth, "px"));
134
+ }
135
+
136
+ if (metric) {
137
+ this.mScale = _l7Utils.DOM.create('div', 'l7-control-scale-line', container);
138
+ }
139
+
140
+ if (imperial) {
141
+ this.iScale = _l7Utils.DOM.create('div', 'l7-control-scale-line', container);
142
+ }
143
+
144
+ this.update();
130
145
  }
131
- }
132
- };
133
- // Annotate the CommonJS export names for ESM import in node:
134
- 0 && (module.exports = {
135
- Scale
136
- });
146
+ }, {
147
+ key: "updateScale",
148
+ value: function updateScale(scale, text, ratio) {
149
+ var maxWidth = this.controlOption.maxWidth;
150
+ scale.style.width = Math.round(maxWidth * ratio) + 'px';
151
+ scale.innerHTML = text;
152
+ }
153
+ }, {
154
+ key: "getRoundNum",
155
+ value: function getRoundNum(num) {
156
+ var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1);
157
+ var d = num / pow10;
158
+ d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;
159
+ return pow10 * d;
160
+ }
161
+ }, {
162
+ key: "updateMetric",
163
+ value: function updateMetric(maxMeters) {
164
+ var meters = this.getRoundNum(maxMeters);
165
+ var label = meters < 1000 ? meters + ' m' : meters / 1000 + ' km';
166
+ this.updateScale(this.mScale, label, meters / maxMeters);
167
+ }
168
+ }, {
169
+ key: "updateImperial",
170
+ value: function updateImperial(maxMeters) {
171
+ var maxFeet = maxMeters * 3.2808399;
172
+ var maxMiles;
173
+ var miles;
174
+ var feet;
175
+
176
+ if (maxFeet > 5280) {
177
+ maxMiles = maxFeet / 5280;
178
+ miles = this.getRoundNum(maxMiles);
179
+ this.updateScale(this.iScale, miles + ' mi', miles / maxMiles);
180
+ } else {
181
+ feet = this.getRoundNum(maxFeet);
182
+ this.updateScale(this.iScale, feet + ' ft', feet / maxFeet);
183
+ }
184
+ }
185
+ }]);
186
+ return Scale;
187
+ }(_baseControl.Control);
188
+
189
+ exports.default = exports.Scale = Scale;
@@ -1,119 +1,162 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/control/zoom.ts
20
- var zoom_exports = {};
21
- __export(zoom_exports, {
22
- Zoom: () => Zoom,
23
- default: () => Zoom
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
24
7
  });
25
- module.exports = __toCommonJS(zoom_exports);
26
- var import_l7_core = require("@antv/l7-core");
27
- var import_l7_utils = require("@antv/l7-utils");
28
- var import_icon = require("../utils/icon");
29
- var import_baseControl = require("./baseControl");
30
- var Zoom = class extends import_baseControl.Control {
31
- constructor() {
32
- super(...arguments);
33
- this.zoomIn = () => {
34
- if (!this.disabled && this.mapsService.getZoom() < this.mapsService.getMaxZoom()) {
35
- this.mapsService.zoomIn();
8
+ exports.default = exports.Zoom = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
+
18
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
19
+
20
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
+
22
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
+
24
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
+
26
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
+
28
+ var _l7Core = require("@antv/l7-core");
29
+
30
+ var _l7Utils = require("@antv/l7-utils");
31
+
32
+ var _icon = require("../utils/icon");
33
+
34
+ var _baseControl = require("./baseControl");
35
+
36
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
37
+
38
+ 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; } }
39
+
40
+ var Zoom = /*#__PURE__*/function (_Control) {
41
+ (0, _inherits2.default)(Zoom, _Control);
42
+
43
+ var _super = _createSuper(Zoom);
44
+
45
+ function Zoom() {
46
+ var _this;
47
+
48
+ (0, _classCallCheck2.default)(this, Zoom);
49
+
50
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
51
+ args[_key] = arguments[_key];
52
+ }
53
+
54
+ _this = _super.call.apply(_super, [this].concat(args));
55
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoomIn", function () {
56
+ if (!_this.disabled && _this.mapsService.getZoom() < _this.mapsService.getMaxZoom()) {
57
+ _this.mapsService.zoomIn();
36
58
  }
37
- };
38
- this.zoomOut = () => {
39
- if (!this.disabled && this.mapsService.getZoom() > this.mapsService.getMinZoom()) {
40
- this.mapsService.zoomOut();
59
+ });
60
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoomOut", function () {
61
+ if (!_this.disabled && _this.mapsService.getZoom() > _this.mapsService.getMinZoom()) {
62
+ _this.mapsService.zoomOut();
41
63
  }
42
- };
43
- this.updateDisabled = () => {
44
- const mapsService = this.mapsService;
45
- this.zoomInButton.removeAttribute("disabled");
46
- this.zoomOutButton.removeAttribute("disabled");
47
- if (this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
48
- this.zoomOutButton.setAttribute("disabled", "true");
64
+ });
65
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateDisabled", function () {
66
+ var mapsService = _this.mapsService;
67
+
68
+ _this.zoomInButton.removeAttribute('disabled');
69
+
70
+ _this.zoomOutButton.removeAttribute('disabled');
71
+
72
+ if (_this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
73
+ _this.zoomOutButton.setAttribute('disabled', 'true');
49
74
  }
50
- if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
51
- this.zoomInButton.setAttribute("disabled", "true");
75
+
76
+ if (_this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
77
+ _this.zoomInButton.setAttribute('disabled', 'true');
52
78
  }
53
- };
79
+ });
80
+ return _this;
54
81
  }
55
- getDefault(option) {
56
- return {
57
- ...super.getDefault(option),
58
- position: import_l7_core.PositionType.BOTTOMRIGHT,
59
- name: "zoom",
60
- zoomInText: (0, import_icon.createL7Icon)("l7-icon-enlarge"),
61
- zoomInTitle: "Zoom in",
62
- zoomOutText: (0, import_icon.createL7Icon)("l7-icon-narrow"),
63
- zoomOutTitle: "Zoom out"
64
- };
65
- }
66
- setOptions(newOptions) {
67
- super.setOptions(newOptions);
68
- if (this.checkUpdateOption(newOptions, [
69
- "zoomInText",
70
- "zoomInTitle",
71
- "zoomOutText",
72
- "zoomOutTitle"
73
- ])) {
74
- this.resetButtonGroup(this.container);
82
+
83
+ (0, _createClass2.default)(Zoom, [{
84
+ key: "getDefault",
85
+ value: function getDefault(option) {
86
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(Zoom.prototype), "getDefault", this).call(this, option)), {}, {
87
+ position: _l7Core.PositionType.BOTTOMRIGHT,
88
+ name: 'zoom',
89
+ zoomInText: (0, _icon.createL7Icon)('l7-icon-enlarge'),
90
+ zoomInTitle: 'Zoom in',
91
+ zoomOutText: (0, _icon.createL7Icon)('l7-icon-narrow'),
92
+ zoomOutTitle: 'Zoom out'
93
+ });
75
94
  }
76
- }
77
- onAdd() {
78
- const container = import_l7_utils.DOM.create("div", "l7-control-zoom");
79
- this.resetButtonGroup(container);
80
- this.mapsService.on("zoomend", this.updateDisabled);
81
- this.mapsService.on("zoomchange", this.updateDisabled);
82
- return container;
83
- }
84
- onRemove() {
85
- this.mapsService.off("zoomend", this.updateDisabled);
86
- this.mapsService.off("zoomchange", this.updateDisabled);
87
- }
88
- disable() {
89
- this.disabled = true;
90
- this.updateDisabled();
91
- return this;
92
- }
93
- enable() {
94
- this.disabled = false;
95
- this.updateDisabled();
96
- return this;
97
- }
98
- resetButtonGroup(container) {
99
- import_l7_utils.DOM.clearChildren(container);
100
- this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, "l7-button-control", container, this.zoomIn);
101
- this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, "l7-button-control", container, this.zoomOut);
102
- this.updateDisabled();
103
- }
104
- createButton(html, tile, className, container, fn) {
105
- const link = import_l7_utils.DOM.create("button", className, container);
106
- if (typeof html === "string") {
107
- link.innerHTML = html;
108
- } else {
109
- link.append(html);
95
+ }, {
96
+ key: "setOptions",
97
+ value: function setOptions(newOptions) {
98
+ (0, _get2.default)((0, _getPrototypeOf2.default)(Zoom.prototype), "setOptions", this).call(this, newOptions);
99
+
100
+ if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle'])) {
101
+ this.resetButtonGroup(this.container);
102
+ }
110
103
  }
111
- link.title = tile;
112
- link.addEventListener("click", fn);
113
- return link;
114
- }
115
- };
116
- // Annotate the CommonJS export names for ESM import in node:
117
- 0 && (module.exports = {
118
- Zoom
119
- });
104
+ }, {
105
+ key: "onAdd",
106
+ value: function onAdd() {
107
+ var container = _l7Utils.DOM.create('div', 'l7-control-zoom');
108
+
109
+ this.resetButtonGroup(container);
110
+ this.mapsService.on('zoomend', this.updateDisabled);
111
+ this.mapsService.on('zoomchange', this.updateDisabled);
112
+ return container;
113
+ }
114
+ }, {
115
+ key: "onRemove",
116
+ value: function onRemove() {
117
+ this.mapsService.off('zoomend', this.updateDisabled);
118
+ this.mapsService.off('zoomchange', this.updateDisabled);
119
+ }
120
+ }, {
121
+ key: "disable",
122
+ value: function disable() {
123
+ this.disabled = true;
124
+ this.updateDisabled();
125
+ return this;
126
+ }
127
+ }, {
128
+ key: "enable",
129
+ value: function enable() {
130
+ this.disabled = false;
131
+ this.updateDisabled();
132
+ return this;
133
+ }
134
+ }, {
135
+ key: "resetButtonGroup",
136
+ value: function resetButtonGroup(container) {
137
+ _l7Utils.DOM.clearChildren(container);
138
+
139
+ this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, 'l7-button-control', container, this.zoomIn);
140
+ this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, 'l7-button-control', container, this.zoomOut);
141
+ this.updateDisabled();
142
+ }
143
+ }, {
144
+ key: "createButton",
145
+ value: function createButton(html, tile, className, container, fn) {
146
+ var link = _l7Utils.DOM.create('button', className, container);
147
+
148
+ if (typeof html === 'string') {
149
+ link.innerHTML = html;
150
+ } else {
151
+ link.append(html);
152
+ }
153
+
154
+ link.title = tile;
155
+ link.addEventListener('click', fn);
156
+ return link;
157
+ }
158
+ }]);
159
+ return Zoom;
160
+ }(_baseControl.Control);
161
+
162
+ exports.default = exports.Zoom = Zoom;