@antv/l7-component 2.9.21 → 2.9.22-alpha.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/es/control/BaseControl.js +5 -26
- package/es/control/layer.js +13 -28
- package/es/control/logo.js +3 -4
- package/es/control/scale.js +6 -11
- package/es/control/zoom.js +3 -12
- package/es/css/l7.css +502 -0
- package/es/images/layers.png +0 -0
- package/es/images/layers.svg +1 -0
- package/es/images/logo.png +0 -0
- package/es/index.js +10 -10
- package/es/interface.js +1 -2
- package/es/marker-layer.js +27 -27
- package/es/marker.js +21 -27
- package/es/popup.js +16 -34
- package/es/utils/anchor.js +1 -2
- package/lib/control/BaseControl.js +100 -163
- package/lib/control/layer.js +248 -347
- package/lib/control/logo.js +52 -77
- package/lib/control/scale.js +112 -165
- package/lib/control/zoom.js +95 -143
- package/lib/css/l7.css +502 -0
- package/lib/images/layers.png +0 -0
- package/lib/images/layers.svg +1 -0
- package/lib/images/logo.png +0 -0
- package/lib/index.js +53 -135
- package/lib/interface.js +17 -2
- package/lib/marker-layer.js +224 -330
- package/lib/marker.js +271 -404
- package/lib/popup.js +201 -309
- package/lib/utils/anchor.js +54 -37
- package/package.json +9 -9
- package/es/control/BaseControl.js.map +0 -1
- package/es/control/layer.js.map +0 -1
- package/es/control/logo.js.map +0 -1
- package/es/control/scale.js.map +0 -1
- package/es/control/zoom.js.map +0 -1
- package/es/index.js.map +0 -1
- package/es/interface.js.map +0 -1
- package/es/marker-layer.js.map +0 -1
- package/es/marker.js.map +0 -1
- package/es/popup.js.map +0 -1
- package/es/utils/anchor.js.map +0 -1
- package/lib/control/BaseControl.js.map +0 -1
- package/lib/control/layer.js.map +0 -1
- package/lib/control/logo.js.map +0 -1
- package/lib/control/scale.js.map +0 -1
- package/lib/control/zoom.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/interface.js.map +0 -1
- package/lib/marker-layer.js.map +0 -1
- package/lib/marker.js.map +0 -1
- package/lib/popup.js.map +0 -1
- package/lib/utils/anchor.js.map +0 -1
package/lib/control/zoom.js
CHANGED
|
@@ -1,149 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/control/zoom.ts
|
|
23
|
+
var zoom_exports = {};
|
|
24
|
+
__export(zoom_exports, {
|
|
25
|
+
default: () => Zoom
|
|
9
26
|
});
|
|
10
|
-
exports
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
27
|
-
|
|
28
|
-
var _BaseControl = _interopRequireWildcard(require("./BaseControl"));
|
|
29
|
-
|
|
30
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
34
|
-
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); }; }
|
|
35
|
-
|
|
36
|
-
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; } }
|
|
37
|
-
|
|
38
|
-
var Zoom = function (_Control) {
|
|
39
|
-
(0, _inherits2.default)(Zoom, _Control);
|
|
40
|
-
|
|
41
|
-
var _super = _createSuper(Zoom);
|
|
42
|
-
|
|
43
|
-
function Zoom(cfg) {
|
|
44
|
-
var _this;
|
|
45
|
-
|
|
46
|
-
(0, _classCallCheck2.default)(this, Zoom);
|
|
47
|
-
_this = _super.call(this, cfg);
|
|
48
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "disabled", void 0);
|
|
49
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoomInButton", void 0);
|
|
50
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoomOutButton", void 0);
|
|
51
|
-
(0, _l7Utils.bindAll)(['updateDisabled', 'zoomIn', 'zoomOut'], (0, _assertThisInitialized2.default)(_this));
|
|
52
|
-
return _this;
|
|
27
|
+
module.exports = __toCommonJS(zoom_exports);
|
|
28
|
+
var import_l7_utils = require("@antv/l7-utils");
|
|
29
|
+
var import_BaseControl = __toESM(require("./BaseControl"));
|
|
30
|
+
var Zoom = class extends import_BaseControl.default {
|
|
31
|
+
constructor(cfg) {
|
|
32
|
+
super(cfg);
|
|
33
|
+
(0, import_l7_utils.bindAll)(["updateDisabled", "zoomIn", "zoomOut"], this);
|
|
53
34
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
this.
|
|
91
|
-
this.updateDisabled();
|
|
92
|
-
return this;
|
|
93
|
-
}
|
|
94
|
-
}, {
|
|
95
|
-
key: "enable",
|
|
96
|
-
value: function enable() {
|
|
97
|
-
this.disabled = false;
|
|
98
|
-
this.updateDisabled();
|
|
99
|
-
return this;
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
key: "zoomIn",
|
|
103
|
-
value: function zoomIn() {
|
|
104
|
-
if (!this.disabled && this.mapsService.getZoom() < this.mapsService.getMaxZoom()) {
|
|
105
|
-
this.mapsService.zoomIn();
|
|
106
|
-
}
|
|
35
|
+
getDefault() {
|
|
36
|
+
return {
|
|
37
|
+
position: import_BaseControl.PositionType.TOPLEFT,
|
|
38
|
+
zoomInText: "+",
|
|
39
|
+
zoomInTitle: "Zoom in",
|
|
40
|
+
zoomOutText: "−",
|
|
41
|
+
zoomOutTitle: "Zoom out",
|
|
42
|
+
name: "zoom"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
onAdd() {
|
|
46
|
+
const zoomName = "l7-control-zoom";
|
|
47
|
+
const container = import_l7_utils.DOM.create("div", zoomName + " l7-bar");
|
|
48
|
+
this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, zoomName + "-in", container, this.zoomIn);
|
|
49
|
+
this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, zoomName + "-out", container, this.zoomOut);
|
|
50
|
+
this.mapsService.on("zoomend", this.updateDisabled);
|
|
51
|
+
this.mapsService.on("zoomchange", this.updateDisabled);
|
|
52
|
+
this.updateDisabled();
|
|
53
|
+
return container;
|
|
54
|
+
}
|
|
55
|
+
onRemove() {
|
|
56
|
+
this.mapsService.off("zoomend", this.updateDisabled);
|
|
57
|
+
this.mapsService.off("zoomchange", this.updateDisabled);
|
|
58
|
+
}
|
|
59
|
+
disable() {
|
|
60
|
+
this.disabled = true;
|
|
61
|
+
this.updateDisabled();
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
enable() {
|
|
65
|
+
this.disabled = false;
|
|
66
|
+
this.updateDisabled();
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
zoomIn() {
|
|
70
|
+
if (!this.disabled && this.mapsService.getZoom() < this.mapsService.getMaxZoom()) {
|
|
71
|
+
this.mapsService.zoomIn();
|
|
107
72
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.mapsService.zoomOut();
|
|
113
|
-
}
|
|
73
|
+
}
|
|
74
|
+
zoomOut() {
|
|
75
|
+
if (!this.disabled && this.mapsService.getZoom() > this.mapsService.getMinZoom()) {
|
|
76
|
+
this.mapsService.zoomOut();
|
|
114
77
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
78
|
+
}
|
|
79
|
+
createButton(html, tile, className, container, fn) {
|
|
80
|
+
const link = import_l7_utils.DOM.create("a", className, container);
|
|
81
|
+
link.innerHTML = html;
|
|
82
|
+
link.title = tile;
|
|
83
|
+
link.href = "javascript:void(0)";
|
|
84
|
+
link.addEventListener("click", fn);
|
|
85
|
+
return link;
|
|
86
|
+
}
|
|
87
|
+
updateDisabled() {
|
|
88
|
+
const mapsService = this.mapsService;
|
|
89
|
+
const className = "l7-disabled";
|
|
90
|
+
import_l7_utils.DOM.removeClass(this.zoomInButton, className);
|
|
91
|
+
import_l7_utils.DOM.removeClass(this.zoomOutButton, className);
|
|
92
|
+
if (this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
|
|
93
|
+
import_l7_utils.DOM.addClass(this.zoomOutButton, className);
|
|
125
94
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
value: function updateDisabled() {
|
|
129
|
-
var mapsService = this.mapsService;
|
|
130
|
-
var className = 'l7-disabled';
|
|
131
|
-
|
|
132
|
-
_l7Utils.DOM.removeClass(this.zoomInButton, className);
|
|
133
|
-
|
|
134
|
-
_l7Utils.DOM.removeClass(this.zoomOutButton, className);
|
|
135
|
-
|
|
136
|
-
if (this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
|
|
137
|
-
_l7Utils.DOM.addClass(this.zoomOutButton, className);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
|
|
141
|
-
_l7Utils.DOM.addClass(this.zoomInButton, className);
|
|
142
|
-
}
|
|
95
|
+
if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
|
|
96
|
+
import_l7_utils.DOM.addClass(this.zoomInButton, className);
|
|
143
97
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
exports.default = Zoom;
|
|
149
|
-
//# sourceMappingURL=zoom.js.map
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
+
0 && (module.exports = {});
|