@antv/l7-component 2.15.2 → 2.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -5,11 +5,8 @@ import _get from "@babel/runtime/helpers/esm/get";
5
5
  import _inherits from "@babel/runtime/helpers/esm/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
-
9
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); }; }
10
-
11
9
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
-
13
10
  import { Popper } from "../../utils/popper";
14
11
  import ButtonControl from "./buttonControl";
15
12
  export { PopperControl };
@@ -27,18 +24,13 @@ var PopperPlacementMap = {
27
24
  rightcenter: 'left',
28
25
  rightbottom: 'top-end'
29
26
  };
30
-
31
27
  var PopperControl = /*#__PURE__*/function (_ButtonControl) {
32
28
  _inherits(PopperControl, _ButtonControl);
33
-
34
29
  var _super = _createSuper(PopperControl);
35
-
36
30
  function PopperControl() {
37
31
  _classCallCheck(this, PopperControl);
38
-
39
32
  return _super.apply(this, arguments);
40
33
  }
41
-
42
34
  _createClass(PopperControl, [{
43
35
  key: "getPopper",
44
36
  value:
@@ -46,6 +38,7 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
46
38
  * 气泡实例
47
39
  * @protected
48
40
  */
41
+
49
42
  function getPopper() {
50
43
  return this.popper;
51
44
  }
@@ -53,22 +46,19 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
53
46
  key: "hide",
54
47
  value: function hide() {
55
48
  this.popper.hide();
56
-
57
49
  _get(_getPrototypeOf(PopperControl.prototype), "hide", this).call(this);
58
50
  }
51
+
59
52
  /**
60
53
  * 获取默认配置
61
54
  * @param option
62
55
  */
63
-
64
56
  }, {
65
57
  key: "getDefault",
66
58
  value: function getDefault(option) {
67
59
  var _option$position;
68
-
69
- var defaultOption = _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
70
-
71
-
60
+ var defaultOption = _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option);
61
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
72
62
  var position = (_option$position = option === null || option === void 0 ? void 0 : option.position) !== null && _option$position !== void 0 ? _option$position : defaultOption.position;
73
63
  return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(PopperControl.prototype), "getDefault", this).call(this, option)), {}, {
74
64
  popperPlacement: position instanceof Element ? 'bottom' : PopperPlacementMap[position],
@@ -79,7 +69,6 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
79
69
  key: "onAdd",
80
70
  value: function onAdd() {
81
71
  var button = _get(_getPrototypeOf(PopperControl.prototype), "onAdd", this).call(this);
82
-
83
72
  this.initPopper();
84
73
  return button;
85
74
  }
@@ -92,14 +81,14 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
92
81
  key: "initPopper",
93
82
  value: function initPopper() {
94
83
  var _this = this;
95
-
96
84
  var _this$controlOption = this.controlOption,
97
- popperClassName = _this$controlOption.popperClassName,
98
- popperPlacement = _this$controlOption.popperPlacement,
99
- popperTrigger = _this$controlOption.popperTrigger; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
100
-
101
- var popperContainer = this.mapsService.getMapContainer(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
85
+ popperClassName = _this$controlOption.popperClassName,
86
+ popperPlacement = _this$controlOption.popperPlacement,
87
+ popperTrigger = _this$controlOption.popperTrigger;
88
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
89
+ var popperContainer = this.mapsService.getMapContainer();
102
90
 
91
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
103
92
  this.popper = new Popper(this.button, {
104
93
  className: popperClassName,
105
94
  placement: popperPlacement,
@@ -118,7 +107,6 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
118
107
  key: "setOptions",
119
108
  value: function setOptions(option) {
120
109
  _get(_getPrototypeOf(PopperControl.prototype), "setOptions", this).call(this, option);
121
-
122
110
  if (this.checkUpdateOption(option, ['popperPlacement', 'popperTrigger', 'popperClassName'])) {
123
111
  var content = this.popper.getContent();
124
112
  this.popper.destroy();
@@ -127,8 +115,6 @@ var PopperControl = /*#__PURE__*/function (_ButtonControl) {
127
115
  }
128
116
  }
129
117
  }]);
130
-
131
118
  return PopperControl;
132
119
  }(ButtonControl);
133
-
134
120
  export { PopperControl as default };
@@ -7,65 +7,47 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
7
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
-
11
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
-
13
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
-
15
12
  import { DOM } from '@antv/l7-utils';
16
13
  import { PopperControl } from "./popperControl";
17
14
  export { SelectControl };
18
- var SelectControlConstant;
19
-
20
- (function (SelectControlConstant) {
15
+ var SelectControlConstant = /*#__PURE__*/function (SelectControlConstant) {
21
16
  SelectControlConstant["ActiveOptionClassName"] = "l7-select-control-item-active";
22
17
  SelectControlConstant["OptionValueAttrKey"] = "data-option-value";
23
18
  SelectControlConstant["OptionIndexAttrKey"] = "data-option-index";
24
- })(SelectControlConstant || (SelectControlConstant = {}));
25
-
19
+ return SelectControlConstant;
20
+ }(SelectControlConstant || {});
26
21
  var SelectControl = /*#__PURE__*/function (_PopperControl) {
27
22
  _inherits(SelectControl, _PopperControl);
28
-
29
23
  var _super = _createSuper(SelectControl);
30
-
31
24
  function SelectControl() {
32
25
  var _this;
33
-
34
26
  _classCallCheck(this, SelectControl);
35
-
36
27
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
37
28
  args[_key] = arguments[_key];
38
29
  }
39
-
40
30
  _this = _super.call.apply(_super, [this].concat(args));
41
-
42
31
  _defineProperty(_assertThisInitialized(_this), "selectValue", []);
43
-
44
32
  _defineProperty(_assertThisInitialized(_this), "createNormalOption", function (option) {
45
33
  var isSelect = _this.selectValue.includes(option.value);
46
-
47
34
  var optionDOM = DOM.create('div', "l7-select-control-item ".concat(isSelect ? SelectControlConstant.ActiveOptionClassName : ''));
48
-
49
35
  if (_this.getIsMultiple()) {
50
36
  optionDOM.appendChild(_this.createCheckbox(isSelect));
51
37
  }
52
-
53
38
  if (option.icon) {
54
39
  optionDOM.appendChild(option.icon);
55
40
  }
56
-
57
41
  var textDOM = DOM.create('span');
58
42
  textDOM.innerText = option.text;
59
43
  optionDOM.appendChild(textDOM);
60
44
  return optionDOM;
61
45
  });
62
-
63
46
  _defineProperty(_assertThisInitialized(_this), "onItemClick", function (item) {
64
47
  if (_this.getIsMultiple()) {
65
48
  var targetIndex = _this.selectValue.findIndex(function (value) {
66
49
  return value === item.value;
67
50
  });
68
-
69
51
  if (targetIndex > -1) {
70
52
  _this.selectValue.splice(targetIndex, 1);
71
53
  } else {
@@ -74,20 +56,15 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
74
56
  } else {
75
57
  _this.selectValue = [item.value];
76
58
  }
77
-
78
59
  _this.setSelectValue(_this.selectValue);
79
60
  });
80
-
81
61
  return _this;
82
62
  }
83
-
84
63
  _createClass(SelectControl, [{
85
64
  key: "setOptions",
86
65
  value: function setOptions(option) {
87
66
  _get(_getPrototypeOf(SelectControl.prototype), "setOptions", this).call(this, option);
88
-
89
67
  var options = option.options;
90
-
91
68
  if (options) {
92
69
  this.popper.setContent(this.getPopperContent(options));
93
70
  }
@@ -96,13 +73,10 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
96
73
  key: "onAdd",
97
74
  value: function onAdd() {
98
75
  var button = _get(_getPrototypeOf(SelectControl.prototype), "onAdd", this).call(this);
99
-
100
76
  var defaultValue = this.controlOption.defaultValue;
101
-
102
77
  if (defaultValue) {
103
78
  this.selectValue = this.transSelectValue(defaultValue);
104
79
  }
105
-
106
80
  this.popper.setContent(this.getPopperContent(this.controlOption.options));
107
81
  return button;
108
82
  }
@@ -115,24 +89,20 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
115
89
  key: "setSelectValue",
116
90
  value: function setSelectValue(value) {
117
91
  var _this2 = this;
118
-
119
92
  var emitEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
120
93
  var finalValue = this.transSelectValue(value);
121
94
  this.optionDOMList.forEach(function (optionDOM) {
122
95
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
123
96
  var optionValue = optionDOM.getAttribute(SelectControlConstant.OptionValueAttrKey);
124
97
  var checkboxDOM = _this2.getIsMultiple() ? optionDOM.querySelector('input[type=checkbox]') : undefined;
125
-
126
98
  if (finalValue.includes(optionValue)) {
127
99
  DOM.addClass(optionDOM, SelectControlConstant.ActiveOptionClassName);
128
-
129
100
  if (checkboxDOM) {
130
101
  // @ts-ignore
131
102
  DOM.setChecked(checkboxDOM, true);
132
103
  }
133
104
  } else {
134
105
  DOM.removeClass(optionDOM, SelectControlConstant.ActiveOptionClassName);
135
-
136
106
  if (checkboxDOM) {
137
107
  // @ts-ignore
138
108
  DOM.setChecked(checkboxDOM, false);
@@ -140,16 +110,15 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
140
110
  }
141
111
  });
142
112
  this.selectValue = finalValue;
143
-
144
113
  if (emitEvent) {
145
114
  this.emit('selectChange', this.getIsMultiple() ? finalValue : finalValue[0]);
146
115
  }
147
116
  }
117
+
148
118
  /**
149
119
  * 是否为多选
150
120
  * @protected
151
121
  */
152
-
153
122
  }, {
154
123
  key: "getIsMultiple",
155
124
  value: function getIsMultiple() {
@@ -159,16 +128,14 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
159
128
  key: "getPopperContent",
160
129
  value: function getPopperContent(options) {
161
130
  var _this3 = this;
162
-
163
131
  var isImageOptions = this.isImageOptions();
164
132
  var content = DOM.create('div', isImageOptions ? 'l7-select-control--image' : 'l7-select-control--normal');
165
-
166
133
  if (this.getIsMultiple()) {
167
134
  DOM.addClass(content, 'l7-select-control--multiple');
168
135
  }
169
-
170
136
  var optionsDOMList = options.map(function (option, optionIndex) {
171
- var optionDOM = isImageOptions ? // @ts-ignore
137
+ var optionDOM = isImageOptions ?
138
+ // @ts-ignore
172
139
  _this3.createImageOption(option) : _this3.createNormalOption(option);
173
140
  optionDOM.setAttribute(SelectControlConstant.OptionValueAttrKey, option.value);
174
141
  optionDOM.setAttribute(SelectControlConstant.OptionIndexAttrKey, window.String(optionIndex));
@@ -189,11 +156,9 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
189
156
  DOM.setUnDraggable(imgDOM);
190
157
  optionDOM.appendChild(imgDOM);
191
158
  var rowDOM = DOM.create('div', 'l7-select-control-item-row');
192
-
193
159
  if (this.getIsMultiple()) {
194
160
  optionDOM.appendChild(this.createCheckbox(isSelect));
195
161
  }
196
-
197
162
  var textDOM = DOM.create('span');
198
163
  textDOM.innerText = option.text;
199
164
  rowDOM.appendChild(textDOM);
@@ -205,11 +170,9 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
205
170
  value: function createCheckbox(isSelect) {
206
171
  var checkboxDOM = DOM.create('input');
207
172
  checkboxDOM.setAttribute('type', 'checkbox');
208
-
209
173
  if (isSelect) {
210
174
  DOM.setChecked(checkboxDOM, true);
211
175
  }
212
-
213
176
  return checkboxDOM;
214
177
  }
215
178
  }, {
@@ -226,8 +189,6 @@ var SelectControl = /*#__PURE__*/function (_PopperControl) {
226
189
  return Array.isArray(value) ? value : [value];
227
190
  }
228
191
  }]);
229
-
230
192
  return SelectControl;
231
193
  }(PopperControl);
232
-
233
194
  export { SelectControl as default };
@@ -10,133 +10,102 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
10
10
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
11
11
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
12
12
  import _regeneratorRuntime from "@babel/runtime/regenerator";
13
-
14
13
  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); }; }
15
-
16
14
  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; } }
17
-
18
15
  import { createL7Icon } from "../utils/icon";
19
16
  import ButtonControl from "./baseControl/buttonControl";
20
17
  export { ExportImage };
21
-
22
18
  var ExportImage = /*#__PURE__*/function (_ButtonControl) {
23
19
  _inherits(ExportImage, _ButtonControl);
24
-
25
20
  var _super = _createSuper(ExportImage);
26
-
27
21
  function ExportImage() {
28
22
  var _this;
29
-
30
23
  _classCallCheck(this, ExportImage);
31
-
32
24
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
25
  args[_key] = arguments[_key];
34
26
  }
35
-
36
27
  _this = _super.call.apply(_super, [this].concat(args));
37
-
38
28
  _defineProperty(_assertThisInitialized(_this), "onClick", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
39
29
  var onExport;
40
30
  return _regeneratorRuntime.wrap(function _callee$(_context) {
41
- while (1) {
42
- switch (_context.prev = _context.next) {
43
- case 0:
44
- onExport = _this.controlOption.onExport;
45
-
46
- if (!(onExport === null || onExport === void 0)) {
47
- _context.next = 5;
48
- break;
49
- }
50
-
51
- void 0;
52
- _context.next = 10;
31
+ while (1) switch (_context.prev = _context.next) {
32
+ case 0:
33
+ onExport = _this.controlOption.onExport;
34
+ if (!(onExport === null || onExport === void 0)) {
35
+ _context.next = 5;
53
36
  break;
54
-
55
- case 5:
56
- _context.t0 = onExport;
57
- _context.next = 8;
58
- return _this.getImage();
59
-
60
- case 8:
61
- _context.t1 = _context.sent;
62
- (0, _context.t0)(_context.t1);
63
-
64
- case 10:
65
- case "end":
66
- return _context.stop();
67
- }
37
+ }
38
+ void 0;
39
+ _context.next = 10;
40
+ break;
41
+ case 5:
42
+ _context.t0 = onExport;
43
+ _context.next = 8;
44
+ return _this.getImage();
45
+ case 8:
46
+ _context.t1 = _context.sent;
47
+ (0, _context.t0)(_context.t1);
48
+ case 10:
49
+ case "end":
50
+ return _context.stop();
68
51
  }
69
52
  }, _callee);
70
53
  })));
71
-
72
54
  _defineProperty(_assertThisInitialized(_this), "mergeImage", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
73
55
  var _this$mapsService$get, _this$mapsService$get2;
74
-
75
56
  var imageType,
76
- _ref3,
77
- _ref3$width,
78
- width,
79
- _ref3$height,
80
- height,
81
- canvas,
82
- context,
83
- _len2,
84
- base64List,
85
- _key2,
86
- imgList,
87
- _args2 = arguments;
88
-
57
+ _ref3,
58
+ _ref3$width,
59
+ width,
60
+ _ref3$height,
61
+ height,
62
+ canvas,
63
+ context,
64
+ _len2,
65
+ base64List,
66
+ _key2,
67
+ imgList,
68
+ _args2 = arguments;
89
69
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
90
- while (1) {
91
- switch (_context2.prev = _context2.next) {
92
- case 0:
93
- imageType = _this.controlOption.imageType;
94
- _ref3 = (_this$mapsService$get = (_this$mapsService$get2 = _this.mapsService.getContainer()) === null || _this$mapsService$get2 === void 0 ? void 0 : _this$mapsService$get2.getBoundingClientRect()) !== null && _this$mapsService$get !== void 0 ? _this$mapsService$get : {}, _ref3$width = _ref3.width, width = _ref3$width === void 0 ? 0 : _ref3$width, _ref3$height = _ref3.height, height = _ref3$height === void 0 ? 0 : _ref3$height;
95
- canvas = document.createElement('canvas');
96
- canvas.width = width;
97
- canvas.height = height;
98
- context = canvas.getContext('2d');
99
-
100
- for (_len2 = _args2.length, base64List = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
101
- base64List[_key2] = _args2[_key2];
102
- }
103
-
104
- _context2.next = 9;
105
- return Promise.all(base64List.map(function (base64) {
106
- return new Promise(function (resolve) {
107
- var img = new Image();
108
-
109
- img.onload = function () {
110
- resolve(img);
111
- };
112
-
113
- img.src = base64;
114
- });
115
- }));
116
-
117
- case 9:
118
- imgList = _context2.sent;
119
- imgList.forEach(function (img) {
120
- context === null || context === void 0 ? void 0 : context.drawImage(img, 0, 0, width, height);
70
+ while (1) switch (_context2.prev = _context2.next) {
71
+ case 0:
72
+ imageType = _this.controlOption.imageType;
73
+ _ref3 = (_this$mapsService$get = (_this$mapsService$get2 = _this.mapsService.getContainer()) === null || _this$mapsService$get2 === void 0 ? void 0 : _this$mapsService$get2.getBoundingClientRect()) !== null && _this$mapsService$get !== void 0 ? _this$mapsService$get : {}, _ref3$width = _ref3.width, width = _ref3$width === void 0 ? 0 : _ref3$width, _ref3$height = _ref3.height, height = _ref3$height === void 0 ? 0 : _ref3$height;
74
+ canvas = document.createElement('canvas');
75
+ canvas.width = width;
76
+ canvas.height = height;
77
+ context = canvas.getContext('2d');
78
+ for (_len2 = _args2.length, base64List = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
79
+ base64List[_key2] = _args2[_key2];
80
+ }
81
+ _context2.next = 9;
82
+ return Promise.all(base64List.map(function (base64) {
83
+ return new Promise(function (resolve) {
84
+ var img = new Image();
85
+ img.onload = function () {
86
+ resolve(img);
87
+ };
88
+ img.src = base64;
121
89
  });
122
- return _context2.abrupt("return", canvas.toDataURL("image/".concat(imageType)));
123
-
124
- case 12:
125
- case "end":
126
- return _context2.stop();
127
- }
90
+ }));
91
+ case 9:
92
+ imgList = _context2.sent;
93
+ imgList.forEach(function (img) {
94
+ context === null || context === void 0 ? void 0 : context.drawImage(img, 0, 0, width, height);
95
+ });
96
+ return _context2.abrupt("return", canvas.toDataURL("image/".concat(imageType)));
97
+ case 12:
98
+ case "end":
99
+ return _context2.stop();
128
100
  }
129
101
  }, _callee2);
130
102
  })));
131
-
132
103
  return _this;
133
104
  }
134
-
135
105
  _createClass(ExportImage, [{
136
106
  key: "onAdd",
137
107
  value: function onAdd() {
138
108
  var button = _get(_getPrototypeOf(ExportImage.prototype), "onAdd", this).call(this);
139
-
140
109
  button.addEventListener('click', this.onClick);
141
110
  return button;
142
111
  }
@@ -155,40 +124,31 @@ var ExportImage = /*#__PURE__*/function (_ButtonControl) {
155
124
  var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
156
125
  var mapImage, layerImage;
157
126
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
158
- while (1) {
159
- switch (_context3.prev = _context3.next) {
160
- case 0:
161
- _context3.next = 2;
162
- return this.mapsService.exportMap('png');
163
-
164
- case 2:
165
- mapImage = _context3.sent;
166
- _context3.next = 5;
167
- return this.scene.exportPng('png');
168
-
169
- case 5:
170
- layerImage = _context3.sent;
171
- return _context3.abrupt("return", this.mergeImage.apply(this, _toConsumableArray([mapImage, layerImage].filter(function (base64) {
172
- return base64;
173
- }))));
174
-
175
- case 7:
176
- case "end":
177
- return _context3.stop();
178
- }
127
+ while (1) switch (_context3.prev = _context3.next) {
128
+ case 0:
129
+ _context3.next = 2;
130
+ return this.mapsService.exportMap('png');
131
+ case 2:
132
+ mapImage = _context3.sent;
133
+ _context3.next = 5;
134
+ return this.scene.exportPng('png');
135
+ case 5:
136
+ layerImage = _context3.sent;
137
+ return _context3.abrupt("return", this.mergeImage.apply(this, _toConsumableArray([mapImage, layerImage].filter(function (base64) {
138
+ return base64;
139
+ }))));
140
+ case 7:
141
+ case "end":
142
+ return _context3.stop();
179
143
  }
180
144
  }, _callee3, this);
181
145
  }));
182
-
183
146
  function getImage() {
184
147
  return _getImage.apply(this, arguments);
185
148
  }
186
-
187
149
  return getImage;
188
150
  }()
189
151
  }]);
190
-
191
152
  return ExportImage;
192
153
  }(ButtonControl);
193
-
194
154
  export { ExportImage as default };