@antv/l7-component 2.9.36-alpha.1 → 2.9.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/control/BaseControl.d.ts +27 -0
- package/es/control/BaseControl.js +134 -0
- package/es/control/layer.d.ts +38 -0
- package/es/control/layer.js +340 -0
- package/es/control/logo.d.ts +6 -10
- package/es/control/logo.js +11 -41
- package/es/control/scale.d.ts +10 -20
- package/es/control/scale.js +53 -77
- package/es/control/zoom.d.ts +10 -21
- package/es/control/zoom.js +49 -76
- package/es/css/l7.css +502 -0
- package/es/images/logo.png +0 -0
- package/es/index.d.ts +8 -15
- package/es/index.js +9 -15
- package/es/interface.d.ts +20 -1
- package/es/popup.d.ts +35 -0
- package/es/popup.js +300 -0
- package/lib/control/BaseControl.js +160 -0
- package/lib/control/layer.js +362 -0
- package/lib/control/logo.js +23 -50
- package/lib/control/scale.js +62 -82
- package/lib/control/zoom.js +59 -78
- package/lib/css/l7.css +502 -0
- package/lib/images/logo.png +0 -0
- package/lib/index.js +50 -165
- package/lib/popup.js +317 -0
- package/package.json +5 -8
- package/es/assets/iconfont/iconfont.js +0 -53
- package/es/constants/index.d.ts +0 -60
- package/es/constants/index.js +0 -60
- package/es/control/baseControl/buttonControl.d.ts +0 -59
- package/es/control/baseControl/buttonControl.js +0 -191
- package/es/control/baseControl/control.d.ts +0 -106
- package/es/control/baseControl/control.js +0 -301
- package/es/control/baseControl/index.d.ts +0 -4
- package/es/control/baseControl/index.js +0 -4
- package/es/control/baseControl/popperControl.d.ts +0 -26
- package/es/control/baseControl/popperControl.js +0 -131
- package/es/control/baseControl/selectControl.d.ts +0 -46
- package/es/control/baseControl/selectControl.js +0 -232
- package/es/control/exportImage.d.ts +0 -18
- package/es/control/exportImage.js +0 -163
- package/es/control/fullscreen.d.ts +0 -19
- package/es/control/fullscreen.js +0 -151
- package/es/control/geoLocate.d.ts +0 -16
- package/es/control/geoLocate.js +0 -139
- package/es/control/layerControl.d.ts +0 -21
- package/es/control/layerControl.js +0 -172
- package/es/control/mapTheme.d.ts +0 -10
- package/es/control/mapTheme.js +0 -135
- package/es/control/mouseLocation.d.ts +0 -15
- package/es/control/mouseLocation.js +0 -104
- package/es/css/button.less +0 -70
- package/es/css/control.less +0 -71
- package/es/css/index.css +0 -567
- package/es/css/index.less +0 -12
- package/es/css/l7.less +0 -60
- package/es/css/layerPopup.less +0 -8
- package/es/css/logo.less +0 -18
- package/es/css/mouseLocation.less +0 -9
- package/es/css/popper.less +0 -64
- package/es/css/popup.less +0 -169
- package/es/css/scale.less +0 -34
- package/es/css/select.less +0 -86
- package/es/css/variables.less +0 -28
- package/es/css/zoom.less +0 -21
- package/es/images/quanping.svg +0 -12
- package/es/popup/layerPopup.d.ts +0 -78
- package/es/popup/layerPopup.js +0 -308
- package/es/popup/popup.d.ts +0 -147
- package/es/popup/popup.js +0 -636
- package/es/utils/icon.d.ts +0 -1
- package/es/utils/icon.js +0 -9
- package/es/utils/popper.d.ts +0 -75
- package/es/utils/popper.js +0 -286
- package/es/utils/screenfull.d.ts +0 -2
- package/es/utils/screenfull.js +0 -157
- package/lib/assets/iconfont/iconfont.js +0 -55
- package/lib/constants/index.js +0 -68
- package/lib/control/baseControl/buttonControl.js +0 -207
- package/lib/control/baseControl/control.js +0 -333
- package/lib/control/baseControl/index.js +0 -57
- package/lib/control/baseControl/popperControl.js +0 -142
- package/lib/control/baseControl/selectControl.js +0 -253
- package/lib/control/exportImage.js +0 -177
- package/lib/control/fullscreen.js +0 -164
- package/lib/control/geoLocate.js +0 -154
- package/lib/control/layerControl.js +0 -182
- package/lib/control/mapTheme.js +0 -151
- package/lib/control/mouseLocation.js +0 -120
- package/lib/css/button.less +0 -70
- package/lib/css/control.less +0 -71
- package/lib/css/index.css +0 -567
- package/lib/css/index.less +0 -12
- package/lib/css/l7.less +0 -60
- package/lib/css/layerPopup.less +0 -8
- package/lib/css/logo.less +0 -18
- package/lib/css/mouseLocation.less +0 -9
- package/lib/css/popper.less +0 -64
- package/lib/css/popup.less +0 -169
- package/lib/css/scale.less +0 -34
- package/lib/css/select.less +0 -86
- package/lib/css/variables.less +0 -28
- package/lib/css/zoom.less +0 -21
- package/lib/images/quanping.svg +0 -12
- package/lib/popup/layerPopup.js +0 -317
- package/lib/popup/popup.js +0 -651
- package/lib/utils/icon.js +0 -18
- package/lib/utils/popper.js +0 -297
- package/lib/utils/screenfull.js +0 -167
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _get from "@babel/runtime/helpers/get";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
|
|
11
|
-
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
|
-
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
|
-
import { DOM } from '@antv/l7-utils';
|
|
16
|
-
import { PopperControl } from "./popperControl";
|
|
17
|
-
export { SelectControl };
|
|
18
|
-
var SelectControlConstant;
|
|
19
|
-
|
|
20
|
-
(function (SelectControlConstant) {
|
|
21
|
-
SelectControlConstant["ActiveOptionClassName"] = "l7-select-control-item-active";
|
|
22
|
-
SelectControlConstant["OptionValueAttrKey"] = "data-option-value";
|
|
23
|
-
SelectControlConstant["OptionIndexAttrKey"] = "data-option-index";
|
|
24
|
-
})(SelectControlConstant || (SelectControlConstant = {}));
|
|
25
|
-
|
|
26
|
-
var SelectControl = /*#__PURE__*/function (_PopperControl) {
|
|
27
|
-
_inherits(SelectControl, _PopperControl);
|
|
28
|
-
|
|
29
|
-
var _super = _createSuper(SelectControl);
|
|
30
|
-
|
|
31
|
-
function SelectControl() {
|
|
32
|
-
var _this;
|
|
33
|
-
|
|
34
|
-
_classCallCheck(this, SelectControl);
|
|
35
|
-
|
|
36
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
37
|
-
args[_key] = arguments[_key];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
-
|
|
42
|
-
_defineProperty(_assertThisInitialized(_this), "selectValue", []);
|
|
43
|
-
|
|
44
|
-
_defineProperty(_assertThisInitialized(_this), "createNormalOption", function (option) {
|
|
45
|
-
var isSelect = _this.selectValue.includes(option.value);
|
|
46
|
-
|
|
47
|
-
var optionDOM = DOM.create('div', "l7-select-control-item ".concat(isSelect ? SelectControlConstant.ActiveOptionClassName : ''));
|
|
48
|
-
|
|
49
|
-
if (_this.getIsMultiple()) {
|
|
50
|
-
optionDOM.appendChild(_this.createCheckbox(isSelect));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (option.icon) {
|
|
54
|
-
optionDOM.appendChild(option.icon);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var textDOM = DOM.create('span');
|
|
58
|
-
textDOM.innerText = option.text;
|
|
59
|
-
optionDOM.appendChild(textDOM);
|
|
60
|
-
return optionDOM;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
_defineProperty(_assertThisInitialized(_this), "onItemClick", function (item) {
|
|
64
|
-
if (_this.getIsMultiple()) {
|
|
65
|
-
var targetIndex = _this.selectValue.findIndex(function (value) {
|
|
66
|
-
return value === item.value;
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
if (targetIndex > -1) {
|
|
70
|
-
_this.selectValue.splice(targetIndex, 1);
|
|
71
|
-
} else {
|
|
72
|
-
_this.selectValue = [].concat(_toConsumableArray(_this.selectValue), [item.value]);
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
_this.selectValue = [item.value];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
_this.setSelectValue(_this.selectValue);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return _this;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
_createClass(SelectControl, [{
|
|
85
|
-
key: "setOptions",
|
|
86
|
-
value: function setOptions(option) {
|
|
87
|
-
_get(_getPrototypeOf(SelectControl.prototype), "setOptions", this).call(this, option);
|
|
88
|
-
|
|
89
|
-
var options = option.options;
|
|
90
|
-
|
|
91
|
-
if (options) {
|
|
92
|
-
this.popper.setContent(this.getPopperContent(options));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, {
|
|
96
|
-
key: "onAdd",
|
|
97
|
-
value: function onAdd() {
|
|
98
|
-
var button = _get(_getPrototypeOf(SelectControl.prototype), "onAdd", this).call(this);
|
|
99
|
-
|
|
100
|
-
var defaultValue = this.controlOption.defaultValue;
|
|
101
|
-
|
|
102
|
-
if (defaultValue) {
|
|
103
|
-
this.selectValue = this.transSelectValue(defaultValue);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
this.popper.setContent(this.getPopperContent(this.controlOption.options));
|
|
107
|
-
return button;
|
|
108
|
-
}
|
|
109
|
-
}, {
|
|
110
|
-
key: "getSelectValue",
|
|
111
|
-
value: function getSelectValue() {
|
|
112
|
-
return this.getIsMultiple() ? this.selectValue : this.selectValue[0];
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
key: "setSelectValue",
|
|
116
|
-
value: function setSelectValue(value) {
|
|
117
|
-
var _this2 = this;
|
|
118
|
-
|
|
119
|
-
var emitEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
120
|
-
var finalValue = this.transSelectValue(value);
|
|
121
|
-
this.optionDOMList.forEach(function (optionDOM) {
|
|
122
|
-
var optionValue = optionDOM.getAttribute(SelectControlConstant.OptionValueAttrKey);
|
|
123
|
-
var checkboxDOM = _this2.getIsMultiple() ? optionDOM.querySelector('input[type=checkbox]') : undefined;
|
|
124
|
-
|
|
125
|
-
if (finalValue.includes(optionValue)) {
|
|
126
|
-
DOM.addClass(optionDOM, SelectControlConstant.ActiveOptionClassName);
|
|
127
|
-
|
|
128
|
-
if (checkboxDOM) {
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
DOM.setChecked(checkboxDOM, true);
|
|
131
|
-
}
|
|
132
|
-
} else {
|
|
133
|
-
DOM.removeClass(optionDOM, SelectControlConstant.ActiveOptionClassName);
|
|
134
|
-
|
|
135
|
-
if (checkboxDOM) {
|
|
136
|
-
// @ts-ignore
|
|
137
|
-
DOM.setChecked(checkboxDOM, false);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
this.selectValue = finalValue;
|
|
142
|
-
|
|
143
|
-
if (emitEvent) {
|
|
144
|
-
this.emit('selectChange', this.getIsMultiple() ? finalValue : finalValue[0]);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* 是否为多选
|
|
149
|
-
* @protected
|
|
150
|
-
*/
|
|
151
|
-
|
|
152
|
-
}, {
|
|
153
|
-
key: "getIsMultiple",
|
|
154
|
-
value: function getIsMultiple() {
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
}, {
|
|
158
|
-
key: "getPopperContent",
|
|
159
|
-
value: function getPopperContent(options) {
|
|
160
|
-
var _this3 = this;
|
|
161
|
-
|
|
162
|
-
var isImageOptions = this.isImageOptions();
|
|
163
|
-
var content = DOM.create('div', isImageOptions ? 'l7-select-control--image' : 'l7-select-control--normal');
|
|
164
|
-
|
|
165
|
-
if (this.getIsMultiple()) {
|
|
166
|
-
DOM.addClass(content, 'l7-select-control--multiple');
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
var optionsDOMList = options.map(function (option, optionIndex) {
|
|
170
|
-
var optionDOM = isImageOptions ? // @ts-ignore
|
|
171
|
-
_this3.createImageOption(option) : _this3.createNormalOption(option);
|
|
172
|
-
optionDOM.setAttribute(SelectControlConstant.OptionValueAttrKey, option.value);
|
|
173
|
-
optionDOM.setAttribute(SelectControlConstant.OptionIndexAttrKey, window.String(optionIndex));
|
|
174
|
-
optionDOM.addEventListener('click', _this3.onItemClick.bind(_this3, option));
|
|
175
|
-
return optionDOM;
|
|
176
|
-
});
|
|
177
|
-
content.append.apply(content, _toConsumableArray(optionsDOMList));
|
|
178
|
-
this.optionDOMList = optionsDOMList;
|
|
179
|
-
return content;
|
|
180
|
-
}
|
|
181
|
-
}, {
|
|
182
|
-
key: "createImageOption",
|
|
183
|
-
value: function createImageOption(option) {
|
|
184
|
-
var isSelect = this.selectValue.includes(option.value);
|
|
185
|
-
var optionDOM = DOM.create('div', "l7-select-control-item ".concat(isSelect ? SelectControlConstant.ActiveOptionClassName : ''));
|
|
186
|
-
var imgDOM = DOM.create('img');
|
|
187
|
-
imgDOM.setAttribute('src', option.img);
|
|
188
|
-
DOM.setUnDraggable(imgDOM);
|
|
189
|
-
optionDOM.appendChild(imgDOM);
|
|
190
|
-
var rowDOM = DOM.create('div', 'l7-select-control-item-row');
|
|
191
|
-
|
|
192
|
-
if (this.getIsMultiple()) {
|
|
193
|
-
optionDOM.appendChild(this.createCheckbox(isSelect));
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var textDOM = DOM.create('span');
|
|
197
|
-
textDOM.innerText = option.text;
|
|
198
|
-
rowDOM.appendChild(textDOM);
|
|
199
|
-
optionDOM.appendChild(rowDOM);
|
|
200
|
-
return optionDOM;
|
|
201
|
-
}
|
|
202
|
-
}, {
|
|
203
|
-
key: "createCheckbox",
|
|
204
|
-
value: function createCheckbox(isSelect) {
|
|
205
|
-
var checkboxDOM = DOM.create('input');
|
|
206
|
-
checkboxDOM.setAttribute('type', 'checkbox');
|
|
207
|
-
|
|
208
|
-
if (isSelect) {
|
|
209
|
-
DOM.setChecked(checkboxDOM, true);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
return checkboxDOM;
|
|
213
|
-
}
|
|
214
|
-
}, {
|
|
215
|
-
key: "isImageOptions",
|
|
216
|
-
value: function isImageOptions() {
|
|
217
|
-
// @ts-ignore
|
|
218
|
-
return !!this.controlOption.options.find(function (item) {
|
|
219
|
-
return item.img;
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
}, {
|
|
223
|
-
key: "transSelectValue",
|
|
224
|
-
value: function transSelectValue(value) {
|
|
225
|
-
return Array.isArray(value) ? value : [value];
|
|
226
|
-
}
|
|
227
|
-
}]);
|
|
228
|
-
|
|
229
|
-
return SelectControl;
|
|
230
|
-
}(PopperControl);
|
|
231
|
-
|
|
232
|
-
export { SelectControl as default };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import ButtonControl, { IButtonControlOption } from './baseControl/buttonControl';
|
|
2
|
-
export interface IExportImageControlOption extends IButtonControlOption {
|
|
3
|
-
imageType: 'png' | 'jpeg';
|
|
4
|
-
onExport: (base64: string) => void;
|
|
5
|
-
}
|
|
6
|
-
export { ExportImage };
|
|
7
|
-
export default class ExportImage extends ButtonControl<IExportImageControlOption> {
|
|
8
|
-
onAdd(): HTMLElement;
|
|
9
|
-
getDefault(option?: Partial<IExportImageControlOption>): IExportImageControlOption;
|
|
10
|
-
getImage(): Promise<string>;
|
|
11
|
-
protected onClick: () => Promise<void>;
|
|
12
|
-
/**
|
|
13
|
-
* 将多张图片合并为一张图片
|
|
14
|
-
* @protected
|
|
15
|
-
* @param base64List
|
|
16
|
-
*/
|
|
17
|
-
protected mergeImage: (...base64List: string[]) => Promise<string>;
|
|
18
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
-
import _get from "@babel/runtime/helpers/get";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
9
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
|
-
|
|
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); }; }
|
|
14
|
-
|
|
15
|
-
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; } }
|
|
16
|
-
|
|
17
|
-
import { createL7Icon } from "../utils/icon";
|
|
18
|
-
import ButtonControl from "./baseControl/buttonControl";
|
|
19
|
-
export { ExportImage };
|
|
20
|
-
|
|
21
|
-
var ExportImage = /*#__PURE__*/function (_ButtonControl) {
|
|
22
|
-
_inherits(ExportImage, _ButtonControl);
|
|
23
|
-
|
|
24
|
-
var _super = _createSuper(ExportImage);
|
|
25
|
-
|
|
26
|
-
function ExportImage() {
|
|
27
|
-
var _this;
|
|
28
|
-
|
|
29
|
-
_classCallCheck(this, ExportImage);
|
|
30
|
-
|
|
31
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
|
-
args[_key] = arguments[_key];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
36
|
-
|
|
37
|
-
_defineProperty(_assertThisInitialized(_this), "onClick", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
38
|
-
var onExport;
|
|
39
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
40
|
-
while (1) {
|
|
41
|
-
switch (_context.prev = _context.next) {
|
|
42
|
-
case 0:
|
|
43
|
-
onExport = _this.controlOption.onExport;
|
|
44
|
-
|
|
45
|
-
if (!(onExport === null || onExport === void 0)) {
|
|
46
|
-
_context.next = 5;
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
void 0;
|
|
51
|
-
_context.next = 10;
|
|
52
|
-
break;
|
|
53
|
-
|
|
54
|
-
case 5:
|
|
55
|
-
_context.t0 = onExport;
|
|
56
|
-
_context.next = 8;
|
|
57
|
-
return _this.getImage();
|
|
58
|
-
|
|
59
|
-
case 8:
|
|
60
|
-
_context.t1 = _context.sent;
|
|
61
|
-
(0, _context.t0)(_context.t1);
|
|
62
|
-
|
|
63
|
-
case 10:
|
|
64
|
-
case "end":
|
|
65
|
-
return _context.stop();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, _callee);
|
|
69
|
-
})));
|
|
70
|
-
|
|
71
|
-
_defineProperty(_assertThisInitialized(_this), "mergeImage", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
72
|
-
var _this$mapsService$get, _this$mapsService$get2;
|
|
73
|
-
|
|
74
|
-
var imageType,
|
|
75
|
-
_ref3,
|
|
76
|
-
_ref3$width,
|
|
77
|
-
width,
|
|
78
|
-
_ref3$height,
|
|
79
|
-
height,
|
|
80
|
-
canvas,
|
|
81
|
-
context,
|
|
82
|
-
_len2,
|
|
83
|
-
base64List,
|
|
84
|
-
_key2,
|
|
85
|
-
imgList,
|
|
86
|
-
_args2 = arguments;
|
|
87
|
-
|
|
88
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
89
|
-
while (1) {
|
|
90
|
-
switch (_context2.prev = _context2.next) {
|
|
91
|
-
case 0:
|
|
92
|
-
imageType = _this.controlOption.imageType;
|
|
93
|
-
_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;
|
|
94
|
-
canvas = document.createElement('canvas');
|
|
95
|
-
canvas.width = width;
|
|
96
|
-
canvas.height = height;
|
|
97
|
-
context = canvas.getContext('2d');
|
|
98
|
-
|
|
99
|
-
for (_len2 = _args2.length, base64List = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
100
|
-
base64List[_key2] = _args2[_key2];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
_context2.next = 9;
|
|
104
|
-
return Promise.all(base64List.map(function (base64) {
|
|
105
|
-
return new Promise(function (resolve) {
|
|
106
|
-
var img = new Image();
|
|
107
|
-
|
|
108
|
-
img.onload = function () {
|
|
109
|
-
resolve(img);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
img.src = base64;
|
|
113
|
-
});
|
|
114
|
-
}));
|
|
115
|
-
|
|
116
|
-
case 9:
|
|
117
|
-
imgList = _context2.sent;
|
|
118
|
-
imgList.forEach(function (img) {
|
|
119
|
-
context === null || context === void 0 ? void 0 : context.drawImage(img, 0, 0, width, height);
|
|
120
|
-
});
|
|
121
|
-
return _context2.abrupt("return", canvas.toDataURL("image/".concat(imageType)));
|
|
122
|
-
|
|
123
|
-
case 12:
|
|
124
|
-
case "end":
|
|
125
|
-
return _context2.stop();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}, _callee2);
|
|
129
|
-
})));
|
|
130
|
-
|
|
131
|
-
return _this;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
_createClass(ExportImage, [{
|
|
135
|
-
key: "onAdd",
|
|
136
|
-
value: function onAdd() {
|
|
137
|
-
var button = _get(_getPrototypeOf(ExportImage.prototype), "onAdd", this).call(this);
|
|
138
|
-
|
|
139
|
-
button.addEventListener('click', this.onClick);
|
|
140
|
-
return button;
|
|
141
|
-
}
|
|
142
|
-
}, {
|
|
143
|
-
key: "getDefault",
|
|
144
|
-
value: function getDefault(option) {
|
|
145
|
-
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(ExportImage.prototype), "getDefault", this).call(this, option)), {}, {
|
|
146
|
-
title: '导出图片',
|
|
147
|
-
btnIcon: createL7Icon('l7-icon-export-picture'),
|
|
148
|
-
imageType: 'png'
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}, {
|
|
152
|
-
key: "getImage",
|
|
153
|
-
value: function getImage() {
|
|
154
|
-
var mapImage = this.mapsService.exportMap('png');
|
|
155
|
-
var layerImage = this.scene.exportPng('png');
|
|
156
|
-
return this.mergeImage(mapImage, layerImage);
|
|
157
|
-
}
|
|
158
|
-
}]);
|
|
159
|
-
|
|
160
|
-
return ExportImage;
|
|
161
|
-
}(ButtonControl);
|
|
162
|
-
|
|
163
|
-
export { ExportImage as default };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import ButtonControl, { IButtonControlOption } from './baseControl/buttonControl';
|
|
2
|
-
export interface IFullscreenControlOption extends IButtonControlOption {
|
|
3
|
-
exitBtnText: IButtonControlOption['btnText'];
|
|
4
|
-
exitBtnIcon: IButtonControlOption['btnIcon'];
|
|
5
|
-
exitTitle: IButtonControlOption['title'];
|
|
6
|
-
}
|
|
7
|
-
export { Fullscreen };
|
|
8
|
-
export default class Fullscreen extends ButtonControl<IFullscreenControlOption> {
|
|
9
|
-
protected isFullscreen: boolean;
|
|
10
|
-
protected mapContainer: HTMLElement;
|
|
11
|
-
constructor(option?: Partial<IFullscreenControlOption>);
|
|
12
|
-
setOptions(newOptions: Partial<IFullscreenControlOption>): void;
|
|
13
|
-
onAdd(): HTMLElement;
|
|
14
|
-
onRemove(): void;
|
|
15
|
-
getDefault(option?: Partial<IFullscreenControlOption>): IFullscreenControlOption;
|
|
16
|
-
toggleFullscreen: () => Promise<void>;
|
|
17
|
-
protected onClick: () => void;
|
|
18
|
-
protected onFullscreenChange: () => void;
|
|
19
|
-
}
|
package/es/control/fullscreen.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
-
import _get from "@babel/runtime/helpers/get";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
9
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
|
-
|
|
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); }; }
|
|
14
|
-
|
|
15
|
-
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; } }
|
|
16
|
-
|
|
17
|
-
import { DOM } from '@antv/l7-utils';
|
|
18
|
-
import { createL7Icon } from "../utils/icon";
|
|
19
|
-
import ScreenFull from "../utils/screenfull";
|
|
20
|
-
import ButtonControl from "./baseControl/buttonControl";
|
|
21
|
-
export { Fullscreen };
|
|
22
|
-
|
|
23
|
-
var Fullscreen = /*#__PURE__*/function (_ButtonControl) {
|
|
24
|
-
_inherits(Fullscreen, _ButtonControl);
|
|
25
|
-
|
|
26
|
-
var _super = _createSuper(Fullscreen);
|
|
27
|
-
|
|
28
|
-
function Fullscreen(option) {
|
|
29
|
-
var _this;
|
|
30
|
-
|
|
31
|
-
_classCallCheck(this, Fullscreen);
|
|
32
|
-
|
|
33
|
-
_this = _super.call(this, option);
|
|
34
|
-
|
|
35
|
-
_defineProperty(_assertThisInitialized(_this), "isFullscreen", false);
|
|
36
|
-
|
|
37
|
-
_defineProperty(_assertThisInitialized(_this), "toggleFullscreen", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
38
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
|
-
while (1) {
|
|
40
|
-
switch (_context.prev = _context.next) {
|
|
41
|
-
case 0:
|
|
42
|
-
if (!ScreenFull.isEnabled) {
|
|
43
|
-
_context.next = 3;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_context.next = 3;
|
|
48
|
-
return ScreenFull.toggle(_this.mapContainer);
|
|
49
|
-
|
|
50
|
-
case 3:
|
|
51
|
-
case "end":
|
|
52
|
-
return _context.stop();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}, _callee);
|
|
56
|
-
})));
|
|
57
|
-
|
|
58
|
-
_defineProperty(_assertThisInitialized(_this), "onClick", function () {
|
|
59
|
-
_this.toggleFullscreen();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
_defineProperty(_assertThisInitialized(_this), "onFullscreenChange", function () {
|
|
63
|
-
_this.isFullscreen = !!document.fullscreenElement;
|
|
64
|
-
var _this$controlOption = _this.controlOption,
|
|
65
|
-
btnText = _this$controlOption.btnText,
|
|
66
|
-
btnIcon = _this$controlOption.btnIcon,
|
|
67
|
-
title = _this$controlOption.title,
|
|
68
|
-
exitBtnText = _this$controlOption.exitBtnText,
|
|
69
|
-
exitBtnIcon = _this$controlOption.exitBtnIcon,
|
|
70
|
-
exitTitle = _this$controlOption.exitTitle;
|
|
71
|
-
|
|
72
|
-
if (_this.isFullscreen) {
|
|
73
|
-
_this.setBtnTitle(exitTitle);
|
|
74
|
-
|
|
75
|
-
_this.setBtnText(exitBtnText);
|
|
76
|
-
|
|
77
|
-
_this.setBtnIcon(exitBtnIcon);
|
|
78
|
-
} else {
|
|
79
|
-
_this.setBtnTitle(title);
|
|
80
|
-
|
|
81
|
-
_this.setBtnText(btnText);
|
|
82
|
-
|
|
83
|
-
_this.setBtnIcon(btnIcon);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
_this.emit('fullscreenChange', _this.isFullscreen);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
if (!ScreenFull.isEnabled) {
|
|
90
|
-
console.warn('当前浏览器环境不支持对地图全屏化');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return _this;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
_createClass(Fullscreen, [{
|
|
97
|
-
key: "setOptions",
|
|
98
|
-
value: function setOptions(newOptions) {
|
|
99
|
-
var exitBtnText = newOptions.exitBtnText,
|
|
100
|
-
exitBtnIcon = newOptions.exitBtnIcon,
|
|
101
|
-
exitTitle = newOptions.exitTitle;
|
|
102
|
-
|
|
103
|
-
if (this.isFullscreen) {
|
|
104
|
-
if (this.checkUpdateOption(newOptions, ['exitBtnIcon'])) {
|
|
105
|
-
this.setBtnIcon(exitBtnIcon);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (this.checkUpdateOption(newOptions, ['exitBtnText'])) {
|
|
109
|
-
this.setBtnText(exitBtnText);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (this.checkUpdateOption(newOptions, ['exitTitle'])) {
|
|
113
|
-
this.setBtnTitle(exitTitle);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
_get(_getPrototypeOf(Fullscreen.prototype), "setOptions", this).call(this, newOptions);
|
|
118
|
-
}
|
|
119
|
-
}, {
|
|
120
|
-
key: "onAdd",
|
|
121
|
-
value: function onAdd() {
|
|
122
|
-
var button = _get(_getPrototypeOf(Fullscreen.prototype), "onAdd", this).call(this);
|
|
123
|
-
|
|
124
|
-
button.addEventListener('click', this.onClick);
|
|
125
|
-
this.mapContainer = DOM.getContainer(this.scene.getSceneConfig().id);
|
|
126
|
-
this.mapContainer.addEventListener('fullscreenchange', this.onFullscreenChange);
|
|
127
|
-
return button;
|
|
128
|
-
}
|
|
129
|
-
}, {
|
|
130
|
-
key: "onRemove",
|
|
131
|
-
value: function onRemove() {
|
|
132
|
-
_get(_getPrototypeOf(Fullscreen.prototype), "onRemove", this).call(this);
|
|
133
|
-
|
|
134
|
-
this.mapContainer.removeEventListener('fullscreenchange', this.onFullscreenChange);
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
key: "getDefault",
|
|
138
|
-
value: function getDefault(option) {
|
|
139
|
-
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(Fullscreen.prototype), "getDefault", this).call(this, option)), {}, {
|
|
140
|
-
title: '全屏',
|
|
141
|
-
btnIcon: createL7Icon('l7-icon-fullscreen'),
|
|
142
|
-
exitTitle: '退出全屏',
|
|
143
|
-
exitBtnIcon: createL7Icon('l7-icon-exit-fullscreen')
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}]);
|
|
147
|
-
|
|
148
|
-
return Fullscreen;
|
|
149
|
-
}(ButtonControl);
|
|
150
|
-
|
|
151
|
-
export { Fullscreen as default };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Point } from '@antv/l7-core';
|
|
2
|
-
import ButtonControl, { IButtonControlOption } from './baseControl/buttonControl';
|
|
3
|
-
export interface IGeoLocateOption extends IButtonControlOption {
|
|
4
|
-
transform: (position: Point) => Point | Promise<Point>;
|
|
5
|
-
}
|
|
6
|
-
export { GeoLocate };
|
|
7
|
-
export default class GeoLocate extends ButtonControl<IGeoLocateOption> {
|
|
8
|
-
constructor(option?: Partial<IGeoLocateOption>);
|
|
9
|
-
getDefault(option?: Partial<IGeoLocateOption>): IGeoLocateOption;
|
|
10
|
-
onAdd(): HTMLElement;
|
|
11
|
-
/**
|
|
12
|
-
* 通过浏览器 API 获取当前所在经纬度
|
|
13
|
-
*/
|
|
14
|
-
getGeoLocation: () => Promise<Point>;
|
|
15
|
-
onClick: () => Promise<void>;
|
|
16
|
-
}
|