@antv/l7-component 2.9.32-alpha.4 → 2.9.32-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/control/baseControl/buttonControl.d.ts +1 -1
- package/es/control/baseControl/control.d.ts +4 -5
- package/es/control/baseControl/control.js +18 -5
- package/es/control/baseControl/popperControl.d.ts +1 -1
- package/es/control/baseControl/selectControl.d.ts +2 -2
- package/es/control/baseControl/selectControl.js +5 -0
- package/es/control/zoom.d.ts +3 -2
- package/lib/assets/iconfont/iconfont.js +46 -30
- package/lib/constants/index.js +34 -56
- package/lib/control/baseControl/buttonControl.js +194 -105
- package/lib/control/baseControl/control.js +317 -156
- package/lib/control/baseControl/index.js +57 -22
- package/lib/control/baseControl/popperControl.js +136 -102
- package/lib/control/baseControl/selectControl.js +230 -130
- package/lib/control/exportImage.js +175 -81
- package/lib/control/fullscreen.js +157 -102
- package/lib/control/geoLocate.js +143 -67
- package/lib/control/layerControl.js +162 -116
- package/lib/control/logo.js +101 -70
- package/lib/control/mapTheme.js +144 -85
- package/lib/control/mouseLocation.js +112 -71
- package/lib/control/scale.js +180 -127
- package/lib/control/zoom.js +154 -111
- package/lib/index.js +251 -48
- package/lib/interface.js +4 -16
- package/lib/marker-layer.js +367 -249
- package/lib/marker.js +419 -277
- package/lib/popup/layerPopup.js +305 -188
- package/lib/popup/popup.js +602 -339
- package/lib/utils/anchor.js +37 -55
- package/lib/utils/icon.js +13 -32
- package/lib/utils/popper.js +268 -180
- package/lib/utils/screenfull.js +110 -103
- package/package.json +5 -5
|
@@ -1,83 +1,177 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
|
|
22
|
-
// src/control/exportImage.ts
|
|
23
|
-
var exportImage_exports = {};
|
|
24
|
-
__export(exportImage_exports, {
|
|
25
|
-
ExportImage: () => ExportImage,
|
|
26
|
-
default: () => ExportImage
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
27
7
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
8
|
+
exports.default = exports.ExportImage = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
+
|
|
22
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
23
|
+
|
|
24
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
+
|
|
26
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
+
|
|
28
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
+
|
|
30
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
+
|
|
32
|
+
var _icon = require("../utils/icon");
|
|
33
|
+
|
|
34
|
+
var _buttonControl = _interopRequireDefault(require("./baseControl/buttonControl"));
|
|
35
|
+
|
|
36
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
37
|
+
|
|
38
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
+
|
|
40
|
+
var ExportImage = /*#__PURE__*/function (_ButtonControl) {
|
|
41
|
+
(0, _inherits2.default)(ExportImage, _ButtonControl);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(ExportImage);
|
|
44
|
+
|
|
45
|
+
function ExportImage() {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
48
|
+
(0, _classCallCheck2.default)(this, ExportImage);
|
|
49
|
+
|
|
50
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
|
+
args[_key] = arguments[_key];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
55
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClick", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
56
|
+
var onExport;
|
|
57
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
58
|
+
while (1) {
|
|
59
|
+
switch (_context.prev = _context.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
onExport = _this.controlOption.onExport;
|
|
62
|
+
|
|
63
|
+
if (!(onExport === null || onExport === void 0)) {
|
|
64
|
+
_context.next = 5;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void 0;
|
|
69
|
+
_context.next = 10;
|
|
70
|
+
break;
|
|
71
|
+
|
|
72
|
+
case 5:
|
|
73
|
+
_context.t0 = onExport;
|
|
74
|
+
_context.next = 8;
|
|
75
|
+
return _this.getImage();
|
|
76
|
+
|
|
77
|
+
case 8:
|
|
78
|
+
_context.t1 = _context.sent;
|
|
79
|
+
(0, _context.t0)(_context.t1);
|
|
80
|
+
|
|
81
|
+
case 10:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context.stop();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, _callee);
|
|
87
|
+
})));
|
|
88
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mergeImage", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
89
|
+
var _this$mapsService$get, _this$mapsService$get2;
|
|
90
|
+
|
|
91
|
+
var imageType,
|
|
92
|
+
_ref3,
|
|
93
|
+
_ref3$width,
|
|
94
|
+
width,
|
|
95
|
+
_ref3$height,
|
|
96
|
+
height,
|
|
97
|
+
canvas,
|
|
98
|
+
context,
|
|
99
|
+
_len2,
|
|
100
|
+
base64List,
|
|
101
|
+
_key2,
|
|
102
|
+
imgList,
|
|
103
|
+
_args2 = arguments;
|
|
104
|
+
|
|
105
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
106
|
+
while (1) {
|
|
107
|
+
switch (_context2.prev = _context2.next) {
|
|
108
|
+
case 0:
|
|
109
|
+
imageType = _this.controlOption.imageType;
|
|
110
|
+
_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;
|
|
111
|
+
canvas = document.createElement('canvas');
|
|
112
|
+
canvas.width = width;
|
|
113
|
+
canvas.height = height;
|
|
114
|
+
context = canvas.getContext('2d');
|
|
115
|
+
|
|
116
|
+
for (_len2 = _args2.length, base64List = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
117
|
+
base64List[_key2] = _args2[_key2];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
_context2.next = 9;
|
|
121
|
+
return Promise.all(base64List.map(function (base64) {
|
|
122
|
+
return new Promise(function (resolve) {
|
|
123
|
+
var img = new Image();
|
|
124
|
+
|
|
125
|
+
img.onload = function () {
|
|
126
|
+
resolve(img);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
img.src = base64;
|
|
130
|
+
});
|
|
131
|
+
}));
|
|
132
|
+
|
|
133
|
+
case 9:
|
|
134
|
+
imgList = _context2.sent;
|
|
135
|
+
imgList.forEach(function (img) {
|
|
136
|
+
context === null || context === void 0 ? void 0 : context.drawImage(img, 0, 0, width, height);
|
|
137
|
+
});
|
|
138
|
+
return _context2.abrupt("return", canvas.toDataURL("image/".concat(imageType)));
|
|
139
|
+
|
|
140
|
+
case 12:
|
|
141
|
+
case "end":
|
|
142
|
+
return _context2.stop();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, _callee2);
|
|
146
|
+
})));
|
|
147
|
+
return _this;
|
|
78
148
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
149
|
+
|
|
150
|
+
(0, _createClass2.default)(ExportImage, [{
|
|
151
|
+
key: "onAdd",
|
|
152
|
+
value: function onAdd() {
|
|
153
|
+
var button = (0, _get2.default)((0, _getPrototypeOf2.default)(ExportImage.prototype), "onAdd", this).call(this);
|
|
154
|
+
button.addEventListener('click', this.onClick);
|
|
155
|
+
return button;
|
|
156
|
+
}
|
|
157
|
+
}, {
|
|
158
|
+
key: "getDefault",
|
|
159
|
+
value: function getDefault(option) {
|
|
160
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(ExportImage.prototype), "getDefault", this).call(this, option)), {}, {
|
|
161
|
+
title: '导出图片',
|
|
162
|
+
btnIcon: (0, _icon.createL7Icon)('l7-icon-export-picture'),
|
|
163
|
+
imageType: 'png'
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
key: "getImage",
|
|
168
|
+
value: function getImage() {
|
|
169
|
+
var mapImage = this.mapsService.exportMap('png');
|
|
170
|
+
var layerImage = this.scene.exportPng('png');
|
|
171
|
+
return this.mergeImage(mapImage, layerImage);
|
|
172
|
+
}
|
|
173
|
+
}]);
|
|
174
|
+
return ExportImage;
|
|
175
|
+
}(_buttonControl.default);
|
|
176
|
+
|
|
177
|
+
exports.default = exports.ExportImage = ExportImage;
|
|
@@ -1,109 +1,164 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
|
|
22
|
-
// src/control/fullscreen.ts
|
|
23
|
-
var fullscreen_exports = {};
|
|
24
|
-
__export(fullscreen_exports, {
|
|
25
|
-
Fullscreen: () => Fullscreen,
|
|
26
|
-
default: () => Fullscreen
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
27
7
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
8
|
+
exports.default = exports.Fullscreen = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
+
|
|
22
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
23
|
+
|
|
24
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
+
|
|
26
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
+
|
|
28
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
+
|
|
30
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
+
|
|
32
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
33
|
+
|
|
34
|
+
var _icon = require("../utils/icon");
|
|
35
|
+
|
|
36
|
+
var _screenfull = _interopRequireDefault(require("../utils/screenfull"));
|
|
37
|
+
|
|
38
|
+
var _buttonControl = _interopRequireDefault(require("./baseControl/buttonControl"));
|
|
39
|
+
|
|
40
|
+
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); }; }
|
|
41
|
+
|
|
42
|
+
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; } }
|
|
43
|
+
|
|
44
|
+
var Fullscreen = /*#__PURE__*/function (_ButtonControl) {
|
|
45
|
+
(0, _inherits2.default)(Fullscreen, _ButtonControl);
|
|
46
|
+
|
|
47
|
+
var _super = _createSuper(Fullscreen);
|
|
48
|
+
|
|
49
|
+
function Fullscreen(option) {
|
|
50
|
+
var _this;
|
|
51
|
+
|
|
52
|
+
(0, _classCallCheck2.default)(this, Fullscreen);
|
|
53
|
+
_this = _super.call(this, option);
|
|
54
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isFullscreen", false);
|
|
55
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleFullscreen", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
56
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
57
|
+
while (1) {
|
|
58
|
+
switch (_context.prev = _context.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
if (!_screenfull.default.isEnabled) {
|
|
61
|
+
_context.next = 3;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_context.next = 3;
|
|
66
|
+
return _screenfull.default.toggle(_this.mapContainer);
|
|
67
|
+
|
|
68
|
+
case 3:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context.stop();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, _callee);
|
|
74
|
+
})));
|
|
75
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClick", function () {
|
|
76
|
+
_this.toggleFullscreen();
|
|
77
|
+
});
|
|
78
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFullscreenChange", function () {
|
|
79
|
+
_this.isFullscreen = !!document.fullscreenElement;
|
|
80
|
+
var _this$controlOption = _this.controlOption,
|
|
81
|
+
btnText = _this$controlOption.btnText,
|
|
82
|
+
btnIcon = _this$controlOption.btnIcon,
|
|
83
|
+
title = _this$controlOption.title,
|
|
84
|
+
exitBtnText = _this$controlOption.exitBtnText,
|
|
85
|
+
exitBtnIcon = _this$controlOption.exitBtnIcon,
|
|
86
|
+
exitTitle = _this$controlOption.exitTitle;
|
|
87
|
+
|
|
88
|
+
if (_this.isFullscreen) {
|
|
89
|
+
_this.setBtnTitle(exitTitle);
|
|
90
|
+
|
|
91
|
+
_this.setBtnText(exitBtnText);
|
|
92
|
+
|
|
93
|
+
_this.setBtnIcon(exitBtnIcon);
|
|
59
94
|
} else {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
95
|
+
_this.setBtnTitle(title);
|
|
96
|
+
|
|
97
|
+
_this.setBtnText(btnText);
|
|
98
|
+
|
|
99
|
+
_this.setBtnIcon(btnIcon);
|
|
63
100
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
101
|
+
|
|
102
|
+
_this.emit('fullscreenChange', _this.isFullscreen);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
if (!_screenfull.default.isEnabled) {
|
|
106
|
+
console.warn('当前浏览器环境不支持对地图全屏化');
|
|
68
107
|
}
|
|
108
|
+
|
|
109
|
+
return _this;
|
|
69
110
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
111
|
+
|
|
112
|
+
(0, _createClass2.default)(Fullscreen, [{
|
|
113
|
+
key: "setOptions",
|
|
114
|
+
value: function setOptions(newOptions) {
|
|
115
|
+
var exitBtnText = newOptions.exitBtnText,
|
|
116
|
+
exitBtnIcon = newOptions.exitBtnIcon,
|
|
117
|
+
exitTitle = newOptions.exitTitle;
|
|
118
|
+
|
|
119
|
+
if (this.isFullscreen) {
|
|
120
|
+
if (this.checkUpdateOption(newOptions, ['exitBtnIcon'])) {
|
|
121
|
+
this.setBtnIcon(exitBtnIcon);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (this.checkUpdateOption(newOptions, ['exitBtnText'])) {
|
|
125
|
+
this.setBtnText(exitBtnText);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (this.checkUpdateOption(newOptions, ['exitTitle'])) {
|
|
129
|
+
this.setBtnTitle(exitTitle);
|
|
130
|
+
}
|
|
81
131
|
}
|
|
132
|
+
|
|
133
|
+
(0, _get2.default)((0, _getPrototypeOf2.default)(Fullscreen.prototype), "setOptions", this).call(this, newOptions);
|
|
82
134
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
135
|
+
}, {
|
|
136
|
+
key: "onAdd",
|
|
137
|
+
value: function onAdd() {
|
|
138
|
+
var button = (0, _get2.default)((0, _getPrototypeOf2.default)(Fullscreen.prototype), "onAdd", this).call(this);
|
|
139
|
+
button.addEventListener('click', this.onClick);
|
|
140
|
+
this.mapContainer = _l7Utils.DOM.getContainer(this.scene.getSceneConfig().id);
|
|
141
|
+
this.mapContainer.addEventListener('fullscreenchange', this.onFullscreenChange);
|
|
142
|
+
return button;
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
key: "onRemove",
|
|
146
|
+
value: function onRemove() {
|
|
147
|
+
(0, _get2.default)((0, _getPrototypeOf2.default)(Fullscreen.prototype), "onRemove", this).call(this);
|
|
148
|
+
this.mapContainer.removeEventListener('fullscreenchange', this.onFullscreenChange);
|
|
149
|
+
}
|
|
150
|
+
}, {
|
|
151
|
+
key: "getDefault",
|
|
152
|
+
value: function getDefault(option) {
|
|
153
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(Fullscreen.prototype), "getDefault", this).call(this, option)), {}, {
|
|
154
|
+
title: '全屏',
|
|
155
|
+
btnIcon: (0, _icon.createL7Icon)('l7-icon-fullscreen'),
|
|
156
|
+
exitTitle: '退出全屏',
|
|
157
|
+
exitBtnIcon: (0, _icon.createL7Icon)('l7-icon-exit-fullscreen')
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}]);
|
|
161
|
+
return Fullscreen;
|
|
162
|
+
}(_buttonControl.default);
|
|
163
|
+
|
|
164
|
+
exports.default = exports.Fullscreen = Fullscreen;
|