@antv/l7-component 2.16.1 → 2.16.2

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 (47) hide show
  1. package/es/assets/iconfont/iconfont.js +10 -17
  2. package/es/control/baseControl/buttonControl.js +9 -42
  3. package/es/control/baseControl/control.js +24 -53
  4. package/es/control/baseControl/popperControl.js +10 -24
  5. package/es/control/baseControl/selectControl.js +6 -45
  6. package/es/control/exportImage.js +76 -116
  7. package/es/control/fullscreen.js +20 -53
  8. package/es/control/geoLocate.js +36 -66
  9. package/es/control/layerSwitch.js +0 -31
  10. package/es/control/logo.js +2 -14
  11. package/es/control/mapTheme.js +7 -32
  12. package/es/control/mouseLocation.js +2 -23
  13. package/es/control/scale.js +6 -29
  14. package/es/control/zoom.js +0 -23
  15. package/es/index.js +2 -12
  16. package/es/marker-layer.js +41 -75
  17. package/es/marker.js +29 -83
  18. package/es/popup/layerPopup.js +31 -82
  19. package/es/popup/popup.js +48 -127
  20. package/es/utils/anchor.js +3 -7
  21. package/es/utils/popper.js +15 -64
  22. package/es/utils/screenfull.js +23 -52
  23. package/lib/assets/iconfont/iconfont.js +10 -17
  24. package/lib/control/baseControl/buttonControl.js +9 -52
  25. package/lib/control/baseControl/control.js +24 -68
  26. package/lib/control/baseControl/index.js +0 -8
  27. package/lib/control/baseControl/popperControl.js +10 -29
  28. package/lib/control/baseControl/selectControl.js +6 -60
  29. package/lib/control/exportImage.js +76 -125
  30. package/lib/control/fullscreen.js +20 -60
  31. package/lib/control/geoLocate.js +36 -75
  32. package/lib/control/layerSwitch.js +0 -36
  33. package/lib/control/logo.js +2 -26
  34. package/lib/control/mapTheme.js +7 -42
  35. package/lib/control/mouseLocation.js +2 -33
  36. package/lib/control/scale.js +6 -40
  37. package/lib/control/zoom.js +0 -33
  38. package/lib/index.js +0 -41
  39. package/lib/marker-layer.js +39 -86
  40. package/lib/marker.js +29 -91
  41. package/lib/popup/layerPopup.js +29 -94
  42. package/lib/popup/popup.js +48 -139
  43. package/lib/utils/anchor.js +4 -9
  44. package/lib/utils/icon.js +0 -2
  45. package/lib/utils/popper.js +14 -71
  46. package/lib/utils/screenfull.js +23 -54
  47. package/package.json +6 -6
package/lib/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -21,15 +20,10 @@ Object.defineProperty(exports, "MarkerLayer", {
21
20
  return _markerLayer.default;
22
21
  }
23
22
  });
24
-
25
23
  var _marker = _interopRequireDefault(require("./marker"));
26
-
27
24
  var _markerLayer = _interopRequireDefault(require("./marker-layer"));
28
-
29
25
  require("./assets/iconfont/iconfont.js");
30
-
31
26
  var _baseControl = require("./control/baseControl");
32
-
33
27
  Object.keys(_baseControl).forEach(function (key) {
34
28
  if (key === "default" || key === "__esModule") return;
35
29
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -41,9 +35,7 @@ Object.keys(_baseControl).forEach(function (key) {
41
35
  }
42
36
  });
43
37
  });
44
-
45
38
  var _exportImage = require("./control/exportImage");
46
-
47
39
  Object.keys(_exportImage).forEach(function (key) {
48
40
  if (key === "default" || key === "__esModule") return;
49
41
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -55,9 +47,7 @@ Object.keys(_exportImage).forEach(function (key) {
55
47
  }
56
48
  });
57
49
  });
58
-
59
50
  var _fullscreen = require("./control/fullscreen");
60
-
61
51
  Object.keys(_fullscreen).forEach(function (key) {
62
52
  if (key === "default" || key === "__esModule") return;
63
53
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -69,9 +59,7 @@ Object.keys(_fullscreen).forEach(function (key) {
69
59
  }
70
60
  });
71
61
  });
72
-
73
62
  var _geoLocate = require("./control/geoLocate");
74
-
75
63
  Object.keys(_geoLocate).forEach(function (key) {
76
64
  if (key === "default" || key === "__esModule") return;
77
65
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -83,9 +71,7 @@ Object.keys(_geoLocate).forEach(function (key) {
83
71
  }
84
72
  });
85
73
  });
86
-
87
74
  var _layerSwitch = require("./control/layerSwitch");
88
-
89
75
  Object.keys(_layerSwitch).forEach(function (key) {
90
76
  if (key === "default" || key === "__esModule") return;
91
77
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -97,9 +83,7 @@ Object.keys(_layerSwitch).forEach(function (key) {
97
83
  }
98
84
  });
99
85
  });
100
-
101
86
  var _logo = require("./control/logo");
102
-
103
87
  Object.keys(_logo).forEach(function (key) {
104
88
  if (key === "default" || key === "__esModule") return;
105
89
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -111,9 +95,7 @@ Object.keys(_logo).forEach(function (key) {
111
95
  }
112
96
  });
113
97
  });
114
-
115
98
  var _mapTheme = require("./control/mapTheme");
116
-
117
99
  Object.keys(_mapTheme).forEach(function (key) {
118
100
  if (key === "default" || key === "__esModule") return;
119
101
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -125,9 +107,7 @@ Object.keys(_mapTheme).forEach(function (key) {
125
107
  }
126
108
  });
127
109
  });
128
-
129
110
  var _mouseLocation = require("./control/mouseLocation");
130
-
131
111
  Object.keys(_mouseLocation).forEach(function (key) {
132
112
  if (key === "default" || key === "__esModule") return;
133
113
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -139,9 +119,7 @@ Object.keys(_mouseLocation).forEach(function (key) {
139
119
  }
140
120
  });
141
121
  });
142
-
143
122
  var _scale = require("./control/scale");
144
-
145
123
  Object.keys(_scale).forEach(function (key) {
146
124
  if (key === "default" || key === "__esModule") return;
147
125
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -153,9 +131,7 @@ Object.keys(_scale).forEach(function (key) {
153
131
  }
154
132
  });
155
133
  });
156
-
157
134
  var _zoom = require("./control/zoom");
158
-
159
135
  Object.keys(_zoom).forEach(function (key) {
160
136
  if (key === "default" || key === "__esModule") return;
161
137
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -167,9 +143,7 @@ Object.keys(_zoom).forEach(function (key) {
167
143
  }
168
144
  });
169
145
  });
170
-
171
146
  var _interface = require("./interface");
172
-
173
147
  Object.keys(_interface).forEach(function (key) {
174
148
  if (key === "default" || key === "__esModule") return;
175
149
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -181,9 +155,7 @@ Object.keys(_interface).forEach(function (key) {
181
155
  }
182
156
  });
183
157
  });
184
-
185
158
  var _layerPopup = require("./popup/layerPopup");
186
-
187
159
  Object.keys(_layerPopup).forEach(function (key) {
188
160
  if (key === "default" || key === "__esModule") return;
189
161
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -195,9 +167,7 @@ Object.keys(_layerPopup).forEach(function (key) {
195
167
  }
196
168
  });
197
169
  });
198
-
199
170
  var _popup = require("./popup/popup");
200
-
201
171
  Object.keys(_popup).forEach(function (key) {
202
172
  if (key === "default" || key === "__esModule") return;
203
173
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -209,46 +179,35 @@ Object.keys(_popup).forEach(function (key) {
209
179
  }
210
180
  });
211
181
  });
212
-
213
182
  // 引入样式
214
183
  function loadStyles(css, doc) {
215
184
  var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
216
185
  var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
217
-
218
186
  if (isMiniAli || isWeChatMiniProgram) {
219
187
  return;
220
188
  }
221
-
222
189
  if (!doc) doc = document;
223
-
224
190
  if (!doc) {
225
191
  return;
226
192
  }
227
-
228
193
  var head = doc.head || doc.getElementsByTagName('head')[0];
229
-
230
194
  if (!head) {
231
195
  head = doc.createElement('head');
232
196
  var body = doc.body || doc.getElementsByTagName('body')[0];
233
-
234
197
  if (body) {
235
198
  body.parentNode.insertBefore(head, body);
236
199
  } else {
237
200
  doc.documentElement.appendChild(head);
238
201
  }
239
202
  }
240
-
241
203
  var style = doc.createElement('style');
242
204
  style.type = 'text/css';
243
-
244
205
  if (style.styleSheet) {
245
206
  style.styleSheet.cssText = css;
246
207
  } else {
247
208
  style.appendChild(doc.createTextNode(css));
248
209
  }
249
-
250
210
  head.appendChild(style);
251
211
  return style;
252
212
  }
253
-
254
213
  loadStyles(".l7-marker-container {\n position: absolute;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n.l7-marker {\n position: absolute !important;\n top: 0;\n left: 0;\n z-index: 5;\n cursor: pointer;\n}\n.l7-marker-cluster {\n width: 40px;\n height: 40px;\n background-color: rgba(181, 226, 140, 0.6);\n background-clip: padding-box;\n border-radius: 20px;\n}\n.l7-marker-cluster div {\n width: 30px;\n height: 30px;\n margin-top: 5px;\n margin-left: 5px;\n font: 12px 'Helvetica Neue', Arial, Helvetica, sans-serif;\n text-align: center;\n background-color: rgba(110, 204, 57, 0.6);\n border-radius: 15px;\n}\n.l7-marker-cluster span {\n line-height: 30px;\n}\n.l7-touch .l7-control-attribution,\n.l7-touch .l7-control-layers,\n.l7-touch .l7-bar {\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n.l7-touch .l7-control-layers,\n.l7-touch .l7-bar {\n background-clip: padding-box;\n border: 2px solid rgba(0, 0, 0, 0.2);\n}\n.mapboxgl-ctrl-logo,\n.amap-logo {\n display: none !important;\n}\n.l7-select-box {\n border: 3px dashed gray;\n border-radius: 2px;\n position: absolute;\n z-index: 1000;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n.l7-control-container {\n font: 12px/1.5 'Helvetica Neue', Arial, Helvetica, sans-serif;\n}\n.l7-control-container .l7-control {\n position: relative;\n z-index: 800;\n float: left;\n clear: both;\n color: #595959;\n font-size: 12px;\n pointer-events: visiblePainted;\n /* IE 9-10 doesn't have auto */\n pointer-events: auto;\n}\n.l7-control-container .l7-control.l7-control--hide {\n display: none;\n}\n.l7-control-container .l7-top {\n top: 0;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n position: absolute;\n z-index: 1000;\n pointer-events: none;\n}\n.l7-control-container .l7-top .l7-control:not(.l7-control--hide) {\n margin-top: 8px;\n}\n.l7-control-container .l7-right {\n right: 0;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n position: absolute;\n z-index: 1000;\n pointer-events: none;\n}\n.l7-control-container .l7-right .l7-control:not(.l7-control--hide) {\n margin-right: 8px;\n}\n.l7-control-container .l7-bottom {\n bottom: 0;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n position: absolute;\n z-index: 1000;\n pointer-events: none;\n}\n.l7-control-container .l7-bottom .l7-control:not(.l7-control--hide) {\n margin-bottom: 8px;\n}\n.l7-control-container .l7-left {\n left: 0;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n position: absolute;\n z-index: 1000;\n pointer-events: none;\n}\n.l7-control-container .l7-left .l7-control:not(.l7-control--hide) {\n margin-left: 8px;\n}\n.l7-control-container .l7-center {\n position: absolute;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.l7-control-container .l7-center.l7-top,\n.l7-control-container .l7-center.l7-bottom {\n width: 100%;\n}\n.l7-control-container .l7-center.l7-left,\n.l7-control-container .l7-center.l7-right {\n height: 100%;\n}\n.l7-control-container .l7-center .l7-control {\n margin-right: 8px;\n margin-bottom: 8px;\n}\n.l7-control-container .l7-row {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.l7-control-container .l7-row.l7-top {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n.l7-control-container .l7-row.l7-bottom {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.l7-control-container .l7-column {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.l7-control-container .l7-column.l7-left {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n.l7-control-container .l7-column.l7-right {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.l7-button-control {\n min-width: 28px;\n height: 28px;\n background-color: #fff;\n border-width: 0;\n border-radius: 2px;\n outline: 0;\n cursor: pointer;\n -webkit-transition: all 0.2s;\n transition: all 0.2s;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n padding: 0 6px;\n -webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n line-height: 16px;\n}\n.l7-button-control .l7-iconfont {\n fill: #595959;\n color: #595959;\n width: 16px;\n height: 16px;\n}\n.l7-button-control.l7-button-control--row {\n padding: 0 16px 0 13px;\n}\n.l7-button-control.l7-button-control--row * + .l7-button-control__text {\n margin-left: 8px;\n}\n.l7-button-control.l7-button-control--column {\n height: 44px;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.l7-button-control.l7-button-control--column .l7-iconfont {\n margin-top: 3px;\n}\n.l7-button-control.l7-button-control--column .l7-button-control__text {\n margin-top: 3px;\n font-size: 10px;\n -webkit-transform: scale(0.83333);\n transform: scale(0.83333);\n}\n.l7-button-control:not(:disabled):hover {\n background-color: #f3f3f3;\n}\n.l7-button-control:not(:disabled):active {\n background-color: #f3f3f3;\n}\n.l7-button-control:disabled {\n background-color: #fafafa;\n color: #bdbdbd;\n cursor: not-allowed;\n}\n.l7-button-control:disabled .l7-iconfont {\n fill: #bdbdbd;\n color: #bdbdbd;\n}\n.l7-button-control:disabled:hover {\n background-color: #fafafa;\n}\n.l7-button-control:disabled:active {\n background-color: #fafafa;\n}\n.l7-popper {\n position: absolute;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n z-index: 5;\n color: #595959;\n}\n.l7-popper.l7-popper-hide {\n display: none;\n}\n.l7-popper .l7-popper-content {\n min-height: 28px;\n background: #fff;\n border-radius: 2px;\n -webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n}\n.l7-popper .l7-popper-arrow {\n width: 0;\n height: 0;\n border-width: 4px;\n border-style: solid;\n border-top-color: transparent;\n border-bottom-color: transparent;\n border-left-color: transparent;\n border-right-color: transparent;\n -webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n}\n.l7-popper.l7-popper-left {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.l7-popper.l7-popper-left .l7-popper-arrow {\n border-left-color: #fff;\n margin: 10px 0;\n}\n.l7-popper.l7-popper-right {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: reverse;\n -ms-flex-direction: row-reverse;\n flex-direction: row-reverse;\n}\n.l7-popper.l7-popper-right .l7-popper-arrow {\n border-right-color: #fff;\n margin: 10px 0;\n}\n.l7-popper.l7-popper-top {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.l7-popper.l7-popper-top .l7-popper-arrow {\n border-top-color: #fff;\n margin: 0 10px;\n}\n.l7-popper.l7-popper-bottom {\n -webkit-box-orient: vertical;\n -webkit-box-direction: reverse;\n -ms-flex-direction: column-reverse;\n flex-direction: column-reverse;\n}\n.l7-popper.l7-popper-bottom .l7-popper-arrow {\n border-bottom-color: #fff;\n margin: 0 10px;\n}\n.l7-popper.l7-popper-start {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n.l7-popper.l7-popper-end {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.l7-select-control--normal {\n padding: 4px 0;\n}\n.l7-select-control--normal .l7-select-control-item {\n height: 24px;\n line-height: 24px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n padding: 0 16px;\n font-size: 12px;\n}\n.l7-select-control--normal .l7-select-control-item > * + * {\n margin-left: 6px;\n}\n.l7-select-control--normal .l7-select-control-item input[type='checkbox'] {\n height: 14px;\n width: 14px;\n}\n.l7-select-control--normal .l7-select-control-item:hover {\n background-color: #f3f3f3;\n}\n.l7-select-control--image {\n padding: 12px 12px 0 12px;\n width: 474px;\n height: 320px;\n overflow: auto;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n.l7-select-control--image .l7-select-control-item {\n margin-right: 12px;\n border-radius: 2px;\n overflow: hidden;\n border: 1px solid #fff;\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n width: calc((100% - 36px) / 3);\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n margin-bottom: 12px;\n position: relative;\n font-size: 12px;\n}\n.l7-select-control--image .l7-select-control-item img {\n width: 142px;\n height: 80px;\n}\n.l7-select-control--image .l7-select-control-item input[type='checkbox'] {\n position: absolute;\n right: 0;\n top: 0;\n}\n.l7-select-control--image .l7-select-control-item .l7-select-control-item-row {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n line-height: 26px;\n}\n.l7-select-control--image .l7-select-control-item .l7-select-control-item-row > * + * {\n margin-left: 8px;\n}\n.l7-select-control--image .l7-select-control-item.l7-select-control-item-active {\n border-color: #0370fe;\n}\n.l7-select-control--image .l7-select-control-item:nth-child(3n) {\n margin-right: 0;\n}\n.l7-select-control-item {\n cursor: pointer;\n}\n.l7-select-control-item input[type='checkbox'] {\n margin: 0;\n cursor: pointer;\n}\n.l7-select-control--multiple .l7-select-control-item:hover {\n background-color: transparent;\n}\n.l7-control-logo {\n width: 89px;\n height: 16px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.l7-control-logo img {\n height: 100%;\n width: 100%;\n}\n.l7-control-logo .l7-control-logo-link {\n display: block;\n cursor: pointer;\n}\n.l7-control-logo .l7-control-logo-link img {\n cursor: pointer;\n}\n.l7-control-mouse-location {\n background-color: #fff;\n border-radius: 2px;\n -webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n padding: 2px 4px;\n min-width: 130px;\n}\n.l7-control-zoom {\n -webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);\n border-radius: 2px;\n overflow: hidden;\n}\n.l7-control-zoom .l7-button-control {\n -webkit-box-shadow: 0 0 0;\n box-shadow: 0 0 0;\n border-radius: 0;\n font-size: 16px;\n}\n.l7-control-zoom .l7-button-control .l7-iconfont {\n width: 14px;\n height: 14px;\n}\n.l7-control-zoom .l7-button-control:first-child {\n border-bottom: 1px solid #f0f0f0;\n}\n.l7-control-scale {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.l7-control-scale .l7-control-scale-line {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: 2px 5px 1px;\n overflow: hidden;\n color: #595959;\n font-size: 10px;\n line-height: 1.1;\n white-space: nowrap;\n background: #fff;\n border: 2px solid #000;\n border-top: 0;\n -webkit-transition: width 0.1s;\n transition: width 0.1s;\n}\n.l7-control-scale .l7-control-scale-line + .l7-control-scale .l7-control-scale-line {\n margin-top: -2px;\n border-top: 2px solid #777;\n border-bottom: none;\n}\n.l7-right .l7-control-scale {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.l7-right .l7-control-scale .l7-control-scale-line {\n text-align: right;\n}\n.l7-popup {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 5;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n will-change: transform;\n pointer-events: none;\n}\n.l7-popup.l7-popup-hide {\n display: none;\n}\n.l7-popup .l7-popup-content {\n position: relative;\n padding: 16px;\n font-size: 14px;\n background: #fff;\n border-radius: 3px;\n -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n}\n.l7-popup .l7-popup-content .l7-popup-content__title {\n margin-bottom: 8px;\n font-weight: bold;\n}\n.l7-popup .l7-popup-content .l7-popup-close-button,\n.l7-popup .l7-popup-content .l7-popup-content__title,\n.l7-popup .l7-popup-content .l7-popup-content__panel {\n white-space: normal;\n -webkit-user-select: text;\n -moz-user-select: text;\n -ms-user-select: text;\n user-select: text;\n pointer-events: initial;\n}\n.l7-popup .l7-popup-content .l7-popup-close-button {\n position: absolute;\n top: 0;\n right: 0;\n width: 18px;\n height: 18px;\n padding: 0;\n font-size: 14px;\n line-height: 18px;\n text-align: center;\n background-color: transparent;\n border: 0;\n border-radius: 0 3px 0 0;\n cursor: pointer;\n}\n.l7-popup .l7-popup-tip {\n position: relative;\n z-index: 1;\n width: 0;\n height: 0;\n border: 10px solid transparent;\n}\n.l7-popup.l7-popup-anchor-bottom,\n.l7-popup.l7-popup-anchor-bottom-left,\n.l7-popup.l7-popup-anchor-bottom-right {\n -webkit-box-orient: vertical;\n -webkit-box-direction: reverse;\n -ms-flex-direction: column-reverse;\n flex-direction: column-reverse;\n}\n.l7-popup.l7-popup-anchor-bottom .l7-popup-tip,\n.l7-popup.l7-popup-anchor-bottom-left .l7-popup-tip,\n.l7-popup.l7-popup-anchor-bottom-right .l7-popup-tip {\n bottom: 1px;\n}\n.l7-popup.l7-popup-anchor-top,\n.l7-popup.l7-popup-anchor-top-left,\n.l7-popup.l7-popup-anchor-top-right {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.l7-popup.l7-popup-anchor-top .l7-popup-tip,\n.l7-popup.l7-popup-anchor-top-left .l7-popup-tip,\n.l7-popup.l7-popup-anchor-top-right .l7-popup-tip {\n top: 1px;\n}\n.l7-popup.l7-popup-anchor-left {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.l7-popup.l7-popup-anchor-right {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: reverse;\n -ms-flex-direction: row-reverse;\n flex-direction: row-reverse;\n}\n.l7-popup-anchor-top .l7-popup-tip {\n position: relative;\n -webkit-align-self: center;\n -ms-flex-item-align: center;\n align-self: center;\n border-top: none;\n border-bottom-color: #fff;\n}\n.l7-popup-anchor-top-left .l7-popup-tip {\n -webkit-align-self: flex-start;\n -ms-flex-item-align: start;\n align-self: flex-start;\n border-top: none;\n border-bottom-color: #fff;\n border-left: none;\n}\n.l7-popup-anchor-top-right .l7-popup-tip {\n -webkit-align-self: flex-end;\n -ms-flex-item-align: end;\n align-self: flex-end;\n border-top: none;\n border-right: none;\n border-bottom-color: #fff;\n}\n.l7-popup-anchor-bottom .l7-popup-tip {\n -webkit-align-self: center;\n -ms-flex-item-align: center;\n align-self: center;\n border-top-color: #fff;\n border-bottom: none;\n}\n.l7-popup-anchor-bottom-left .l7-popup-tip {\n -webkit-align-self: flex-start;\n -ms-flex-item-align: start;\n align-self: flex-start;\n border-top-color: #fff;\n border-bottom: none;\n border-left: none;\n}\n.l7-popup-anchor-bottom-right .l7-popup-tip {\n -webkit-align-self: flex-end;\n -ms-flex-item-align: end;\n align-self: flex-end;\n border-top-color: #fff;\n border-right: none;\n border-bottom: none;\n}\n.l7-popup-anchor-left .l7-popup-tip {\n -webkit-align-self: center;\n -ms-flex-item-align: center;\n align-self: center;\n border-right-color: #fff;\n border-left: none;\n}\n.l7-popup-anchor-right .l7-popup-tip {\n right: 1px;\n -webkit-align-self: center;\n -ms-flex-item-align: center;\n align-self: center;\n border-right: none;\n border-left-color: #fff;\n}\n.l7-popup-anchor-top-left .l7-popup-content {\n border-top-left-radius: 0;\n}\n.l7-popup-anchor-top-right .l7-popup-content {\n border-top-right-radius: 0;\n}\n.l7-popup-anchor-bottom-left .l7-popup-content {\n border-bottom-left-radius: 0;\n}\n.l7-popup-anchor-bottom-right .l7-popup-content {\n border-bottom-right-radius: 0;\n}\n.l7-popup-track-pointer {\n display: none;\n}\n.l7-popup-track-pointer * {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n pointer-events: none;\n}\n.l7-map:hover .l7-popup-track-pointer {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.l7-map:active .l7-popup-track-pointer {\n display: none;\n}\n.l7-layer-popup__row {\n font-size: 12px;\n}\n.l7-layer-popup__row + .l7-layer-popup__row {\n margin-top: 4px;\n}\n");
@@ -1,54 +1,32 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
16
  var _l7Core = require("@antv/l7-core");
27
-
28
17
  var _l7Utils = require("@antv/l7-utils");
29
-
30
18
  var _eventemitter = require("eventemitter3");
31
-
32
19
  var _lodash = require("lodash");
33
-
34
20
  var _supercluster = _interopRequireDefault(require("supercluster/dist/supercluster"));
35
-
36
21
  var _marker = _interopRequireDefault(require("./marker"));
37
-
38
22
  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); }; }
39
-
40
23
  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; } }
41
-
42
24
  var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
43
25
  (0, _inherits2.default)(MarkerLayer, _EventEmitter);
44
-
45
26
  var _super = _createSuper(MarkerLayer);
46
-
47
27
  function MarkerLayer(option) {
48
28
  var _this$markerLayerOpti;
49
-
50
29
  var _this;
51
-
52
30
  (0, _classCallCheck2.default)(this, MarkerLayer);
53
31
  _this = _super.call(this);
54
32
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "markers", []);
@@ -59,7 +37,6 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
59
37
  _this.zoom = ((_this$markerLayerOpti = _this.markerLayerOption.clusterOption) === null || _this$markerLayerOpti === void 0 ? void 0 : _this$markerLayerOpti.zoom) || -99;
60
38
  return _this;
61
39
  }
62
-
63
40
  (0, _createClass2.default)(MarkerLayer, [{
64
41
  key: "getDefault",
65
42
  value: function getDefault() {
@@ -74,63 +51,60 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
74
51
  className: ''
75
52
  }
76
53
  };
77
- } // 执行scene.addMarkerLayer时调用
54
+ }
78
55
 
56
+ // 执行scene.addMarkerLayer时调用
79
57
  }, {
80
58
  key: "addTo",
81
59
  value: function addTo(scene) {
82
60
  // this.remove();
83
61
  this.scene = scene;
84
62
  this.mapsService = scene.get(_l7Core.TYPES.IMapService);
85
-
86
63
  if (this.markerLayerOption.cluster) {
87
64
  this.initCluster();
88
- this.update(); // 地图视野变化时,重新计算视野内的聚合点。
89
-
65
+ this.update();
66
+ // 地图视野变化时,重新计算视野内的聚合点。
90
67
  this.mapsService.on('camerachange', this.update); // amap1.x 更新事件
91
-
92
68
  this.mapsService.on('viewchange', this.update); // amap2.0 更新事件
93
69
  }
94
70
 
95
71
  this.mapsService.on('camerachange', this.setContainerSize.bind(this)); // amap1.x 更新事件
96
-
97
72
  this.mapsService.on('viewchange', this.setContainerSize.bind(this)); // amap2.0 更新事件
98
-
99
73
  this.addMarkers();
100
74
  this.inited = true;
101
75
  return this;
102
- } // 设置容器大小
76
+ }
103
77
 
78
+ // 设置容器大小
104
79
  }, {
105
80
  key: "setContainerSize",
106
81
  value: function setContainerSize() {
107
82
  if (!this.mapsService) {
108
83
  return;
109
84
  }
110
-
111
85
  var container = this.mapsService.getContainer();
112
86
  this.containerSize = {
113
87
  containerWidth: (container === null || container === void 0 ? void 0 : container.scrollWidth) || 0,
114
88
  containerHeight: (container === null || container === void 0 ? void 0 : container.scrollHeight) || 0,
115
89
  bounds: this.mapsService.getBounds()
116
90
  };
117
- } // 获取容器尺寸
91
+ }
118
92
 
93
+ // 获取容器尺寸
119
94
  }, {
120
95
  key: "getContainerSize",
121
96
  value: function getContainerSize() {
122
97
  return this.containerSize;
123
- } // 在图层添加单个marker
98
+ }
124
99
 
100
+ // 在图层添加单个marker
125
101
  }, {
126
102
  key: "addMarker",
127
103
  value: function addMarker(marker) {
128
104
  var cluster = this.markerLayerOption.cluster;
129
105
  marker.getMarkerLayerContainerSize = this.getContainerSize.bind(this);
130
-
131
106
  if (cluster) {
132
107
  this.addPoint(marker, this.markers.length);
133
-
134
108
  if (this.mapsService) {
135
109
  // 在新增 marker 的时候需要更新聚合信息(哪怕此时的 zoom 没有发生变化)
136
110
  var zoom = this.mapsService.getZoom();
@@ -140,8 +114,8 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
140
114
  this.getClusterMarker(this.bbox, this.zoom);
141
115
  }
142
116
  }
143
-
144
- this.markers.push(marker); // if(this.inited) {
117
+ this.markers.push(marker);
118
+ // if(this.inited) {
145
119
  // marker.addTo(this.scene);
146
120
  // }
147
121
  }
@@ -150,15 +124,14 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
150
124
  value: function removeMarker(marker) {
151
125
  this.markers.indexOf(marker);
152
126
  var markerIndex = this.markers.indexOf(marker);
153
-
154
127
  if (markerIndex > -1) {
155
128
  this.markers.splice(markerIndex, 1);
156
129
  }
157
130
  }
131
+
158
132
  /**
159
133
  * 隐藏 marker 在每个 marker 上单独修改属性而不是在 markerContainer 上修改(在 markerContainer 修改会有用户在场景加载完之前调用失败的问题)
160
134
  */
161
-
162
135
  }, {
163
136
  key: "hide",
164
137
  value: function hide() {
@@ -169,10 +142,10 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
169
142
  m.getElement().style.opacity = '0';
170
143
  });
171
144
  }
145
+
172
146
  /**
173
147
  * 显示 marker
174
148
  */
175
-
176
149
  }, {
177
150
  key: "show",
178
151
  value: function show() {
@@ -182,25 +155,27 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
182
155
  this.clusterMarkers.map(function (m) {
183
156
  m.getElement().style.opacity = '1';
184
157
  });
185
- } // 返回当下的markers数据,有聚合图时返回聚合的marker列表,否则返回原始maerker列表
158
+ }
186
159
 
160
+ // 返回当下的markers数据,有聚合图时返回聚合的marker列表,否则返回原始maerker列表
187
161
  }, {
188
162
  key: "getMarkers",
189
163
  value: function getMarkers() {
190
164
  var cluster = this.markerLayerOption.cluster;
191
165
  return cluster ? this.clusterMarkers : this.markers;
192
- } // 批量添加marker到scene
166
+ }
193
167
 
168
+ // 批量添加marker到scene
194
169
  }, {
195
170
  key: "addMarkers",
196
171
  value: function addMarkers() {
197
172
  var _this2 = this;
198
-
199
173
  this.getMarkers().forEach(function (marker) {
200
174
  marker.addTo(_this2.scene);
201
175
  });
202
- } // 清除图层里的marker
176
+ }
203
177
 
178
+ // 清除图层里的marker
204
179
  }, {
205
180
  key: "clear",
206
181
  value: function clear() {
@@ -223,15 +198,15 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
223
198
  this.mapsService.off('viewchange', this.update);
224
199
  this.mapsService.off('camerachange', this.setContainerSize.bind(this));
225
200
  this.mapsService.off('viewchange', this.setContainerSize.bind(this));
226
- } // 将marker数据保存在point中
201
+ }
227
202
 
203
+ // 将marker数据保存在point中
228
204
  }, {
229
205
  key: "addPoint",
230
206
  value: function addPoint(marker, id) {
231
207
  var _marker$getLnglat = marker.getLnglat(),
232
- lng = _marker$getLnglat.lng,
233
- lat = _marker$getLnglat.lat;
234
-
208
+ lng = _marker$getLnglat.lng,
209
+ lat = _marker$getLnglat.lat;
235
210
  var feature = {
236
211
  geometry: {
237
212
  type: 'Point',
@@ -242,7 +217,6 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
242
217
  })
243
218
  };
244
219
  this.points.push(feature);
245
-
246
220
  if (this.clusterIndex) {
247
221
  // 在新增点的时候需要更新 cluster 的数据
248
222
  this.clusterIndex.load(this.points);
@@ -254,25 +228,23 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
254
228
  if (!this.markerLayerOption.cluster) {
255
229
  return;
256
230
  }
257
-
258
231
  var _this$markerLayerOpti2 = this.markerLayerOption.clusterOption,
259
- radius = _this$markerLayerOpti2.radius,
260
- _this$markerLayerOpti3 = _this$markerLayerOpti2.minZoom,
261
- minZoom = _this$markerLayerOpti3 === void 0 ? 0 : _this$markerLayerOpti3,
262
- maxZoom = _this$markerLayerOpti2.maxZoom;
232
+ radius = _this$markerLayerOpti2.radius,
233
+ _this$markerLayerOpti3 = _this$markerLayerOpti2.minZoom,
234
+ minZoom = _this$markerLayerOpti3 === void 0 ? 0 : _this$markerLayerOpti3,
235
+ maxZoom = _this$markerLayerOpti2.maxZoom;
263
236
  this.clusterIndex = new _supercluster.default({
264
237
  radius: radius,
265
238
  minZoom: minZoom,
266
239
  maxZoom: maxZoom
267
- }); // @ts-ignore
268
-
240
+ });
241
+ // @ts-ignore
269
242
  this.clusterIndex.load(this.points);
270
243
  }
271
244
  }, {
272
245
  key: "getClusterMarker",
273
246
  value: function getClusterMarker(viewBounds, zoom) {
274
247
  var _this3 = this;
275
-
276
248
  var viewBBox = viewBounds[0].concat(viewBounds[1]);
277
249
  var clusterPoint = this.clusterIndex.getClusters(viewBBox, zoom);
278
250
  this.clusterMarkers.forEach(function (marker) {
@@ -281,37 +253,27 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
281
253
  this.clusterMarkers = [];
282
254
  clusterPoint.forEach(function (feature) {
283
255
  var _feature$properties;
284
-
285
256
  var _this3$markerLayerOpt = _this3.markerLayerOption.clusterOption,
286
- field = _this3$markerLayerOpt.field,
287
- method = _this3$markerLayerOpt.method; // 处理聚合数据
288
-
257
+ field = _this3$markerLayerOpt.field,
258
+ method = _this3$markerLayerOpt.method;
259
+ // 处理聚合数据
289
260
  if ((_feature$properties = feature.properties) !== null && _feature$properties !== void 0 && _feature$properties.cluster_id) {
290
261
  var _feature$properties2;
291
-
292
262
  var clusterData = _this3.getLeaves((_feature$properties2 = feature.properties) === null || _feature$properties2 === void 0 ? void 0 : _feature$properties2.cluster_id);
293
-
294
263
  feature.properties.clusterData = clusterData;
295
-
296
264
  if (field && method) {
297
265
  var columnData = clusterData === null || clusterData === void 0 ? void 0 : clusterData.map(function (item) {
298
266
  var data = (0, _defineProperty2.default)({}, field, item.properties[field]);
299
267
  return data;
300
268
  });
301
-
302
269
  var column = _l7Utils.Satistics.getColumn(columnData, field);
303
-
304
270
  var stat = _l7Utils.Satistics.getSatByColumn(method, column);
305
-
306
271
  var fieldName = 'point_' + method;
307
272
  feature.properties[fieldName] = stat.toFixed(2);
308
273
  }
309
274
  }
310
-
311
275
  var marker = _this3.clusterMarker(feature);
312
-
313
276
  _this3.clusterMarkers.push(marker);
314
-
315
277
  marker.addTo(_this3.scene);
316
278
  });
317
279
  }
@@ -320,11 +282,9 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
320
282
  value: function getLeaves(clusterId) {
321
283
  var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
322
284
  var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
323
-
324
285
  if (!clusterId) {
325
286
  return null;
326
287
  }
327
-
328
288
  return this.clusterIndex.getLeaves(clusterId, limit, offset);
329
289
  }
330
290
  }, {
@@ -332,8 +292,8 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
332
292
  value: function clusterMarker(feature) {
333
293
  var clusterOption = this.markerLayerOption.clusterOption;
334
294
  var _ref = clusterOption,
335
- _ref$element = _ref.element,
336
- element = _ref$element === void 0 ? this.generateElement.bind(this) : _ref$element;
295
+ _ref$element = _ref.element,
296
+ element = _ref$element === void 0 ? this.generateElement.bind(this) : _ref$element;
337
297
  var marker = new _marker.default({
338
298
  element: element(feature)
339
299
  }).setLnglat({
@@ -353,16 +313,13 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
353
313
  value: function update() {
354
314
  if (!this.mapsService) {
355
315
  return;
356
- } // 当图层中无marker时,无需更新
357
-
358
-
316
+ }
317
+ // 当图层中无marker时,无需更新
359
318
  if (this.markers.length === 0) {
360
319
  return;
361
320
  }
362
-
363
321
  var zoom = this.mapsService.getZoom();
364
322
  var bbox = this.mapsService.getBounds();
365
-
366
323
  if (!this.bbox || Math.abs(zoom - this.zoom) >= 1 || !(0, _l7Utils.boundsContains)(this.bbox, bbox)) {
367
324
  this.bbox = (0, _l7Utils.padBounds)(bbox, 0.5);
368
325
  this.zoom = Math.floor(zoom);
@@ -373,14 +330,11 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
373
330
  key: "generateElement",
374
331
  value: function generateElement(feature) {
375
332
  var el = _l7Utils.DOM.create('div', 'l7-marker-cluster');
376
-
377
333
  var label = _l7Utils.DOM.create('div', '', el);
378
-
379
334
  var span = _l7Utils.DOM.create('span', '', label);
380
-
381
335
  var _this$markerLayerOpti4 = this.markerLayerOption.clusterOption,
382
- field = _this$markerLayerOpti4.field,
383
- method = _this$markerLayerOpti4.method;
336
+ field = _this$markerLayerOpti4.field,
337
+ method = _this$markerLayerOpti4.method;
384
338
  feature.properties.point_count = feature.properties.point_count || 1;
385
339
  var text = field && method ? feature.properties['point_' + method] || feature.properties[field] : feature.properties.point_count;
386
340
  span.textContent = text;
@@ -389,5 +343,4 @@ var MarkerLayer = /*#__PURE__*/function (_EventEmitter) {
389
343
  }]);
390
344
  return MarkerLayer;
391
345
  }(_eventemitter.EventEmitter);
392
-
393
346
  exports.default = MarkerLayer;