@antv/l7-component 2.18.0 → 2.18.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.
- package/package.json +6 -6
- package/es/assets/iconfont/iconfont.js +0 -46
- 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 -177
- package/es/control/baseControl/control.d.ts +0 -112
- package/es/control/baseControl/control.js +0 -302
- 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 -120
- package/es/control/baseControl/selectControl.d.ts +0 -46
- package/es/control/baseControl/selectControl.js +0 -204
- package/es/control/exportImage.d.ts +0 -18
- package/es/control/exportImage.js +0 -159
- package/es/control/fullscreen.d.ts +0 -19
- package/es/control/fullscreen.js +0 -119
- package/es/control/geoLocate.d.ts +0 -16
- package/es/control/geoLocate.js +0 -107
- package/es/control/layerSwitch.d.ts +0 -19
- package/es/control/layerSwitch.js +0 -141
- package/es/control/logo.d.ts +0 -13
- package/es/control/logo.js +0 -75
- package/es/control/mapTheme.d.ts +0 -10
- package/es/control/mapTheme.js +0 -110
- package/es/control/mouseLocation.d.ts +0 -15
- package/es/control/mouseLocation.js +0 -83
- package/es/control/scale.d.ts +0 -34
- package/es/control/scale.js +0 -149
- package/es/control/zoom.d.ts +0 -38
- package/es/control/zoom.js +0 -132
- package/es/css/button.less +0 -70
- package/es/css/control.less +0 -71
- package/es/css/index.css +0 -594
- package/es/css/index.less +0 -12
- package/es/css/l7.less +0 -62
- 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 -185
- package/es/css/scale.less +0 -34
- package/es/css/select.less +0 -86
- package/es/css/variables.less +0 -30
- package/es/css/zoom.less +0 -29
- package/es/images/layers.png +0 -0
- package/es/images/layers.svg +0 -1
- package/es/images/logo.png +0 -0
- package/es/images/quanping.svg +0 -12
- package/es/index.d.ts +0 -18
- package/es/index.js +0 -49
- package/es/interface.d.ts +0 -18
- package/es/interface.js +0 -1
- package/es/marker-layer.d.ts +0 -54
- package/es/marker-layer.js +0 -343
- package/es/marker.d.ts +0 -55
- package/es/marker.js +0 -410
- package/es/popup/layerPopup.d.ts +0 -86
- package/es/popup/layerPopup.js +0 -312
- package/es/popup/popup.d.ts +0 -139
- package/es/popup/popup.js +0 -567
- package/es/utils/anchor.d.ts +0 -22
- package/es/utils/anchor.js +0 -31
- 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 -259
- package/es/utils/screenfull.d.ts +0 -2
- package/es/utils/screenfull.js +0 -128
- package/lib/assets/iconfont/iconfont.js +0 -48
- package/lib/constants/index.js +0 -68
- package/lib/control/baseControl/buttonControl.js +0 -183
- package/lib/control/baseControl/control.js +0 -314
- package/lib/control/baseControl/index.js +0 -39
- package/lib/control/baseControl/popperControl.js +0 -126
- package/lib/control/baseControl/selectControl.js +0 -210
- package/lib/control/exportImage.js +0 -165
- package/lib/control/fullscreen.js +0 -125
- package/lib/control/geoLocate.js +0 -113
- package/lib/control/layerSwitch.js +0 -147
- package/lib/control/logo.js +0 -81
- package/lib/control/mapTheme.js +0 -116
- package/lib/control/mouseLocation.js +0 -89
- package/lib/control/scale.js +0 -155
- package/lib/control/zoom.js +0 -138
- package/lib/css/button.less +0 -70
- package/lib/css/control.less +0 -71
- package/lib/css/index.css +0 -594
- package/lib/css/index.less +0 -12
- package/lib/css/l7.less +0 -62
- 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 -185
- package/lib/css/scale.less +0 -34
- package/lib/css/select.less +0 -86
- package/lib/css/variables.less +0 -30
- package/lib/css/zoom.less +0 -29
- package/lib/images/layers.png +0 -0
- package/lib/images/layers.svg +0 -1
- package/lib/images/logo.png +0 -0
- package/lib/images/quanping.svg +0 -12
- package/lib/index.js +0 -169
- package/lib/interface.js +0 -5
- package/lib/marker-layer.js +0 -349
- package/lib/marker.js +0 -417
- package/lib/popup/layerPopup.js +0 -317
- package/lib/popup/popup.js +0 -573
- package/lib/utils/anchor.js +0 -40
- package/lib/utils/icon.js +0 -16
- package/lib/utils/popper.js +0 -263
- package/lib/utils/screenfull.js +0 -136
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.LayerSwitch = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
var _icon = require("../utils/icon");
|
|
18
|
-
var _selectControl = _interopRequireDefault(require("./baseControl/selectControl"));
|
|
19
|
-
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); }; }
|
|
20
|
-
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; } }
|
|
21
|
-
var LayerSwitch = /*#__PURE__*/function (_SelectControl) {
|
|
22
|
-
(0, _inherits2.default)(LayerSwitch, _SelectControl);
|
|
23
|
-
var _super = _createSuper(LayerSwitch);
|
|
24
|
-
function LayerSwitch() {
|
|
25
|
-
var _this;
|
|
26
|
-
(0, _classCallCheck2.default)(this, LayerSwitch);
|
|
27
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
-
args[_key] = arguments[_key];
|
|
29
|
-
}
|
|
30
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onLayerChange", function () {
|
|
32
|
-
var _this$controlOption$l;
|
|
33
|
-
if ((_this$controlOption$l = _this.controlOption.layers) !== null && _this$controlOption$l !== void 0 && _this$controlOption$l.length) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
_this.selectValue = _this.getLayerVisible();
|
|
37
|
-
_this.setOptions({
|
|
38
|
-
options: _this.getLayerOptions()
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onLayerVisibleChane", function () {
|
|
42
|
-
_this.setSelectValue(_this.getLayerVisible());
|
|
43
|
-
});
|
|
44
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSelectChange", function () {
|
|
45
|
-
_this.layers.forEach(function (layer) {
|
|
46
|
-
var needShow = _this.selectValue.includes(layer.name);
|
|
47
|
-
var isShow = layer.isVisible();
|
|
48
|
-
if (needShow && !isShow) {
|
|
49
|
-
layer.show();
|
|
50
|
-
}
|
|
51
|
-
if (!needShow && isShow) {
|
|
52
|
-
layer.hide();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
return _this;
|
|
57
|
-
}
|
|
58
|
-
(0, _createClass2.default)(LayerSwitch, [{
|
|
59
|
-
key: "layers",
|
|
60
|
-
get: function get() {
|
|
61
|
-
var layerService = this.layerService;
|
|
62
|
-
var layers = this.controlOption.layers;
|
|
63
|
-
if (Array.isArray(layers) && layers.length) {
|
|
64
|
-
var layerInstances = [];
|
|
65
|
-
layers.forEach(function (layer) {
|
|
66
|
-
if (layer instanceof Object) {
|
|
67
|
-
layerInstances.push(layer);
|
|
68
|
-
}
|
|
69
|
-
if (typeof layer === 'string') {
|
|
70
|
-
var targetLayer = layerService.getLayer(layer) || layerService.getLayerByName(layer);
|
|
71
|
-
if (targetLayer) {
|
|
72
|
-
layerInstances.push(targetLayer);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return layerInstances;
|
|
77
|
-
}
|
|
78
|
-
return layerService.getLayers() || [];
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
key: "getDefault",
|
|
82
|
-
value: function getDefault(option) {
|
|
83
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(LayerSwitch.prototype), "getDefault", this).call(this, option)), {}, {
|
|
84
|
-
title: '图层控制',
|
|
85
|
-
btnIcon: (0, _icon.createL7Icon)('l7-icon-layer'),
|
|
86
|
-
options: []
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}, {
|
|
90
|
-
key: "getLayerVisible",
|
|
91
|
-
value: function getLayerVisible() {
|
|
92
|
-
return this.layers.filter(function (layer) {
|
|
93
|
-
return layer.isVisible();
|
|
94
|
-
}).map(function (layer) {
|
|
95
|
-
return layer.name;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
key: "getLayerOptions",
|
|
100
|
-
value: function getLayerOptions() {
|
|
101
|
-
return this.layers.map(function (layer) {
|
|
102
|
-
return {
|
|
103
|
-
text: layer.name,
|
|
104
|
-
value: layer.name
|
|
105
|
-
};
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}, {
|
|
109
|
-
key: "setOptions",
|
|
110
|
-
value: function setOptions(option) {
|
|
111
|
-
var isLayerChange = this.checkUpdateOption(option, ['layers']);
|
|
112
|
-
(0, _get2.default)((0, _getPrototypeOf2.default)(LayerSwitch.prototype), "setOptions", this).call(this, option);
|
|
113
|
-
if (isLayerChange) {
|
|
114
|
-
this.selectValue = this.getLayerVisible();
|
|
115
|
-
this.controlOption.options = this.getLayerOptions();
|
|
116
|
-
this.popper.setContent(this.getPopperContent(this.controlOption.options));
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}, {
|
|
120
|
-
key: "onAdd",
|
|
121
|
-
value: function onAdd() {
|
|
122
|
-
var _this$controlOption$o;
|
|
123
|
-
if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
|
|
124
|
-
this.controlOption.options = this.getLayerOptions();
|
|
125
|
-
}
|
|
126
|
-
if (!this.controlOption.defaultValue) {
|
|
127
|
-
this.controlOption.defaultValue = this.getLayerVisible();
|
|
128
|
-
}
|
|
129
|
-
this.on('selectChange', this.onSelectChange);
|
|
130
|
-
this.layerService.on('layerChange', this.onLayerChange);
|
|
131
|
-
return (0, _get2.default)((0, _getPrototypeOf2.default)(LayerSwitch.prototype), "onAdd", this).call(this);
|
|
132
|
-
}
|
|
133
|
-
}, {
|
|
134
|
-
key: "onRemove",
|
|
135
|
-
value: function onRemove() {
|
|
136
|
-
this.off('selectChange', this.onSelectChange);
|
|
137
|
-
this.layerService.off('layerChange', this.onLayerChange);
|
|
138
|
-
}
|
|
139
|
-
}, {
|
|
140
|
-
key: "getIsMultiple",
|
|
141
|
-
value: function getIsMultiple() {
|
|
142
|
-
return true;
|
|
143
|
-
}
|
|
144
|
-
}]);
|
|
145
|
-
return LayerSwitch;
|
|
146
|
-
}(_selectControl.default);
|
|
147
|
-
exports.default = exports.LayerSwitch = LayerSwitch;
|
package/lib/control/logo.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.Logo = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
15
|
-
var _baseControl = require("./baseControl");
|
|
16
|
-
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); }; }
|
|
17
|
-
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; } }
|
|
18
|
-
var Logo = /*#__PURE__*/function (_Control) {
|
|
19
|
-
(0, _inherits2.default)(Logo, _Control);
|
|
20
|
-
var _super = _createSuper(Logo);
|
|
21
|
-
function Logo() {
|
|
22
|
-
(0, _classCallCheck2.default)(this, Logo);
|
|
23
|
-
return _super.apply(this, arguments);
|
|
24
|
-
}
|
|
25
|
-
(0, _createClass2.default)(Logo, [{
|
|
26
|
-
key: "getDefault",
|
|
27
|
-
value: function getDefault() {
|
|
28
|
-
return {
|
|
29
|
-
position: _baseControl.PositionType.BOTTOMLEFT,
|
|
30
|
-
name: 'logo',
|
|
31
|
-
href: 'https://l7.antv.antgroup.com/',
|
|
32
|
-
img: 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*GRb1TKp4HcMAAAAAAAAAAAAAARQnAQ'
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
|
-
key: "onAdd",
|
|
37
|
-
value: function onAdd() {
|
|
38
|
-
var container = _l7Utils.DOM.create('div', 'l7-control-logo');
|
|
39
|
-
this.setLogoContent(container);
|
|
40
|
-
return container;
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
key: "onRemove",
|
|
44
|
-
value: function onRemove() {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
key: "setOptions",
|
|
49
|
-
value: function setOptions(option) {
|
|
50
|
-
(0, _get2.default)((0, _getPrototypeOf2.default)(Logo.prototype), "setOptions", this).call(this, option);
|
|
51
|
-
if (this.checkUpdateOption(option, ['img', 'href'])) {
|
|
52
|
-
_l7Utils.DOM.clearChildren(this.container);
|
|
53
|
-
this.setLogoContent(this.container);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
key: "setLogoContent",
|
|
58
|
-
value: function setLogoContent(container) {
|
|
59
|
-
var _this$controlOption = this.controlOption,
|
|
60
|
-
href = _this$controlOption.href,
|
|
61
|
-
img = _this$controlOption.img;
|
|
62
|
-
var imgDOM = _l7Utils.DOM.create('img');
|
|
63
|
-
imgDOM.setAttribute('src', img);
|
|
64
|
-
imgDOM.setAttribute('aria-label', 'AntV logo');
|
|
65
|
-
_l7Utils.DOM.setUnDraggable(imgDOM);
|
|
66
|
-
if (href) {
|
|
67
|
-
var anchorDOM = _l7Utils.DOM.create('a', 'l7-control-logo-link');
|
|
68
|
-
anchorDOM.target = '_blank';
|
|
69
|
-
anchorDOM.href = href;
|
|
70
|
-
anchorDOM.rel = 'noopener nofollow';
|
|
71
|
-
anchorDOM.setAttribute('rel', 'noopener nofollow');
|
|
72
|
-
anchorDOM.appendChild(imgDOM);
|
|
73
|
-
container.appendChild(anchorDOM);
|
|
74
|
-
} else {
|
|
75
|
-
container.appendChild(imgDOM);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}]);
|
|
79
|
-
return Logo;
|
|
80
|
-
}(_baseControl.Control);
|
|
81
|
-
exports.default = exports.Logo = Logo;
|
package/lib/control/mapTheme.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.MapTheme = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
16
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
-
var _constants = require("../constants");
|
|
19
|
-
var _icon = require("../utils/icon");
|
|
20
|
-
var _selectControl = _interopRequireDefault(require("./baseControl/selectControl"));
|
|
21
|
-
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); }; }
|
|
22
|
-
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; } }
|
|
23
|
-
var MapTheme = /*#__PURE__*/function (_SelectControl) {
|
|
24
|
-
(0, _inherits2.default)(MapTheme, _SelectControl);
|
|
25
|
-
var _super = _createSuper(MapTheme);
|
|
26
|
-
function MapTheme() {
|
|
27
|
-
var _this;
|
|
28
|
-
(0, _classCallCheck2.default)(this, MapTheme);
|
|
29
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
|
-
args[_key] = arguments[_key];
|
|
31
|
-
}
|
|
32
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
33
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMapThemeChange", function () {
|
|
34
|
-
_this.mapsService.setMapStyle(_this.selectValue[0]);
|
|
35
|
-
});
|
|
36
|
-
return _this;
|
|
37
|
-
}
|
|
38
|
-
(0, _createClass2.default)(MapTheme, [{
|
|
39
|
-
key: "getDefault",
|
|
40
|
-
value: function getDefault(option) {
|
|
41
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(MapTheme.prototype), "getDefault", this).call(this, option)), {}, {
|
|
42
|
-
title: '地图样式',
|
|
43
|
-
btnIcon: (0, _icon.createL7Icon)('l7-icon-color'),
|
|
44
|
-
options: []
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
key: "getStyleOptions",
|
|
49
|
-
value: function getStyleOptions() {
|
|
50
|
-
var mapStyleConfig = this.mapsService.getType() === 'mapbox' ? _constants.MapboxMapStyleConfig : _constants.GaodeMapStyleConfig;
|
|
51
|
-
return Object.entries(this.mapsService.getMapStyleConfig()).filter(function (_ref) {
|
|
52
|
-
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
53
|
-
key = _ref2[0],
|
|
54
|
-
value = _ref2[1];
|
|
55
|
-
return typeof value === 'string' && key !== 'blank';
|
|
56
|
-
}).map(function (_ref3) {
|
|
57
|
-
var _mapStyleConfig$key;
|
|
58
|
-
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
59
|
-
key = _ref4[0],
|
|
60
|
-
value = _ref4[1];
|
|
61
|
-
// @ts-ignore
|
|
62
|
-
var _ref5 = (_mapStyleConfig$key = mapStyleConfig[key]) !== null && _mapStyleConfig$key !== void 0 ? _mapStyleConfig$key : {},
|
|
63
|
-
text = _ref5.text,
|
|
64
|
-
img = _ref5.img;
|
|
65
|
-
return {
|
|
66
|
-
text: text !== null && text !== void 0 ? text : key,
|
|
67
|
-
value: value,
|
|
68
|
-
img: img,
|
|
69
|
-
key: key
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "getMapStyle",
|
|
75
|
-
value: function getMapStyle() {
|
|
76
|
-
return this.mapsService.getMapStyle();
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "onAdd",
|
|
80
|
-
value: function onAdd() {
|
|
81
|
-
var _this$controlOption$o,
|
|
82
|
-
_this2 = this;
|
|
83
|
-
if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
|
|
84
|
-
this.controlOption.options = this.getStyleOptions();
|
|
85
|
-
}
|
|
86
|
-
if (this.controlOption.defaultValue) {
|
|
87
|
-
var _this$controlOption$o2, _this$controlOption$o3;
|
|
88
|
-
var defaultValue = this.controlOption.defaultValue;
|
|
89
|
-
this.controlOption.defaultValue = (_this$controlOption$o2 = (_this$controlOption$o3 = this.controlOption.options.find(function (item) {
|
|
90
|
-
return item.key === defaultValue;
|
|
91
|
-
})) === null || _this$controlOption$o3 === void 0 ? void 0 : _this$controlOption$o3.value) !== null && _this$controlOption$o2 !== void 0 ? _this$controlOption$o2 : defaultValue;
|
|
92
|
-
} else {
|
|
93
|
-
var defaultStyle = this.getMapStyle();
|
|
94
|
-
if (defaultStyle) {
|
|
95
|
-
this.controlOption.defaultValue = defaultStyle;
|
|
96
|
-
} else {
|
|
97
|
-
// @ts-ignore
|
|
98
|
-
this.mapsService.map.once('styledata', function () {
|
|
99
|
-
var mapboxStyle = _this2.mapsService.getMapStyle();
|
|
100
|
-
_this2.controlOption.defaultValue = mapboxStyle;
|
|
101
|
-
_this2.setSelectValue(mapboxStyle, false);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
this.on('selectChange', this.onMapThemeChange);
|
|
106
|
-
return (0, _get2.default)((0, _getPrototypeOf2.default)(MapTheme.prototype), "onAdd", this).call(this);
|
|
107
|
-
}
|
|
108
|
-
}, {
|
|
109
|
-
key: "getIsMultiple",
|
|
110
|
-
value: function getIsMultiple() {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
}]);
|
|
114
|
-
return MapTheme;
|
|
115
|
-
}(_selectControl.default);
|
|
116
|
-
exports.default = exports.MapTheme = MapTheme;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.MouseLocation = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
16
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
-
var _l7Core = require("@antv/l7-core");
|
|
19
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
20
|
-
var _control = _interopRequireDefault(require("./baseControl/control"));
|
|
21
|
-
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); }; }
|
|
22
|
-
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; } }
|
|
23
|
-
var MouseLocation = /*#__PURE__*/function (_Control) {
|
|
24
|
-
(0, _inherits2.default)(MouseLocation, _Control);
|
|
25
|
-
var _super = _createSuper(MouseLocation);
|
|
26
|
-
function MouseLocation() {
|
|
27
|
-
var _this;
|
|
28
|
-
(0, _classCallCheck2.default)(this, MouseLocation);
|
|
29
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
|
-
args[_key] = arguments[_key];
|
|
31
|
-
}
|
|
32
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
33
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "location", [0, 0]);
|
|
34
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseMove", function (e) {
|
|
35
|
-
var position = _this.location;
|
|
36
|
-
var lngLat = e.lngLat || e.lnglat;
|
|
37
|
-
var transform = _this.controlOption.transform;
|
|
38
|
-
if (lngLat) {
|
|
39
|
-
position = [lngLat.lng, lngLat.lat];
|
|
40
|
-
}
|
|
41
|
-
_this.location = position;
|
|
42
|
-
if (transform) {
|
|
43
|
-
position = transform(position);
|
|
44
|
-
}
|
|
45
|
-
_this.insertLocation2HTML(position);
|
|
46
|
-
_this.emit('locationChange', position);
|
|
47
|
-
});
|
|
48
|
-
return _this;
|
|
49
|
-
}
|
|
50
|
-
(0, _createClass2.default)(MouseLocation, [{
|
|
51
|
-
key: "getLocation",
|
|
52
|
-
value: function getLocation() {
|
|
53
|
-
return this.location;
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
key: "getDefault",
|
|
57
|
-
value: function getDefault(option) {
|
|
58
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(MouseLocation.prototype), "getDefault", this).call(this, option)), {}, {
|
|
59
|
-
position: _l7Core.PositionType.BOTTOMLEFT,
|
|
60
|
-
transform: function transform(_ref) {
|
|
61
|
-
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
62
|
-
lng = _ref2[0],
|
|
63
|
-
lat = _ref2[1];
|
|
64
|
-
return [+(+lng).toFixed(6), +(+lat).toFixed(6)];
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "onAdd",
|
|
70
|
-
value: function onAdd() {
|
|
71
|
-
var container = _l7Utils.DOM.create('div', 'l7-control-mouse-location');
|
|
72
|
-
container.innerHTML = ' ';
|
|
73
|
-
this.mapsService.on('mousemove', this.onMouseMove);
|
|
74
|
-
return container;
|
|
75
|
-
}
|
|
76
|
-
}, {
|
|
77
|
-
key: "onRemove",
|
|
78
|
-
value: function onRemove() {
|
|
79
|
-
this.mapsService.off('mousemove', this.onMouseMove);
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
key: "insertLocation2HTML",
|
|
83
|
-
value: function insertLocation2HTML(position) {
|
|
84
|
-
this.container.innerText = position.join(', ');
|
|
85
|
-
}
|
|
86
|
-
}]);
|
|
87
|
-
return MouseLocation;
|
|
88
|
-
}(_control.default);
|
|
89
|
-
exports.default = exports.MouseLocation = MouseLocation;
|
package/lib/control/scale.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.Scale = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
18
|
-
var _baseControl = require("./baseControl");
|
|
19
|
-
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); }; }
|
|
20
|
-
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; } }
|
|
21
|
-
var Scale = /*#__PURE__*/function (_Control) {
|
|
22
|
-
(0, _inherits2.default)(Scale, _Control);
|
|
23
|
-
var _super = _createSuper(Scale);
|
|
24
|
-
function Scale() {
|
|
25
|
-
var _this;
|
|
26
|
-
(0, _classCallCheck2.default)(this, Scale);
|
|
27
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
-
args[_key] = arguments[_key];
|
|
29
|
-
}
|
|
30
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "update", function () {
|
|
32
|
-
var mapsService = _this.mapsService;
|
|
33
|
-
var maxWidth = _this.controlOption.maxWidth;
|
|
34
|
-
var y = mapsService.getSize()[1] / 2;
|
|
35
|
-
var p1 = mapsService.containerToLngLat([0, y]);
|
|
36
|
-
var p2 = mapsService.containerToLngLat([maxWidth, y]);
|
|
37
|
-
var maxMeters = (0, _l7Utils.lnglatDistance)([p1.lng, p1.lat], [p2.lng, p2.lat]);
|
|
38
|
-
_this.updateScales(maxMeters);
|
|
39
|
-
});
|
|
40
|
-
return _this;
|
|
41
|
-
}
|
|
42
|
-
(0, _createClass2.default)(Scale, [{
|
|
43
|
-
key: "getDefault",
|
|
44
|
-
value: function getDefault(option) {
|
|
45
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(Scale.prototype), "getDefault", this).call(this, option)), {}, {
|
|
46
|
-
name: 'scale',
|
|
47
|
-
position: _baseControl.PositionType.BOTTOMLEFT,
|
|
48
|
-
maxWidth: 100,
|
|
49
|
-
metric: true,
|
|
50
|
-
updateWhenIdle: false,
|
|
51
|
-
imperial: false,
|
|
52
|
-
lockWidth: true
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
key: "onAdd",
|
|
57
|
-
value: function onAdd() {
|
|
58
|
-
var className = 'l7-control-scale';
|
|
59
|
-
var container = _l7Utils.DOM.create('div', className);
|
|
60
|
-
this.resetScaleLines(container);
|
|
61
|
-
var updateWhenIdle = this.controlOption.updateWhenIdle;
|
|
62
|
-
this.mapsService.on(updateWhenIdle ? 'moveend' : 'mapmove', this.update);
|
|
63
|
-
this.mapsService.on(updateWhenIdle ? 'zoomend' : 'zoomchange', this.update);
|
|
64
|
-
return container;
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
key: "onRemove",
|
|
68
|
-
value: function onRemove() {
|
|
69
|
-
var updateWhenIdle = this.controlOption.updateWhenIdle;
|
|
70
|
-
this.mapsService.off(updateWhenIdle ? 'zoomend' : 'zoomchange', this.update);
|
|
71
|
-
this.mapsService.off(updateWhenIdle ? 'moveend' : 'mapmove', this.update);
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "setOptions",
|
|
75
|
-
value: function setOptions(newOption) {
|
|
76
|
-
(0, _get2.default)((0, _getPrototypeOf2.default)(Scale.prototype), "setOptions", this).call(this, newOption);
|
|
77
|
-
if (this.checkUpdateOption(newOption, ['lockWidth', 'maxWidth', 'metric', 'updateWhenIdle', 'imperial'])) {
|
|
78
|
-
this.resetScaleLines(this.container);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
key: "updateScales",
|
|
83
|
-
value: function updateScales(maxMeters) {
|
|
84
|
-
var _this$controlOption = this.controlOption,
|
|
85
|
-
metric = _this$controlOption.metric,
|
|
86
|
-
imperial = _this$controlOption.imperial;
|
|
87
|
-
if (metric && maxMeters) {
|
|
88
|
-
this.updateMetric(maxMeters);
|
|
89
|
-
}
|
|
90
|
-
if (imperial && maxMeters) {
|
|
91
|
-
this.updateImperial(maxMeters);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}, {
|
|
95
|
-
key: "resetScaleLines",
|
|
96
|
-
value: function resetScaleLines(container) {
|
|
97
|
-
_l7Utils.DOM.clearChildren(container);
|
|
98
|
-
var _this$controlOption2 = this.controlOption,
|
|
99
|
-
metric = _this$controlOption2.metric,
|
|
100
|
-
imperial = _this$controlOption2.imperial,
|
|
101
|
-
maxWidth = _this$controlOption2.maxWidth,
|
|
102
|
-
lockWidth = _this$controlOption2.lockWidth;
|
|
103
|
-
if (lockWidth) {
|
|
104
|
-
_l7Utils.DOM.addStyle(container, "width: ".concat(maxWidth, "px"));
|
|
105
|
-
}
|
|
106
|
-
if (metric) {
|
|
107
|
-
this.mScale = _l7Utils.DOM.create('div', 'l7-control-scale-line', container);
|
|
108
|
-
}
|
|
109
|
-
if (imperial) {
|
|
110
|
-
this.iScale = _l7Utils.DOM.create('div', 'l7-control-scale-line', container);
|
|
111
|
-
}
|
|
112
|
-
this.update();
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
key: "updateScale",
|
|
116
|
-
value: function updateScale(scale, text, ratio) {
|
|
117
|
-
var maxWidth = this.controlOption.maxWidth;
|
|
118
|
-
scale.style.width = Math.round(maxWidth * ratio) + 'px';
|
|
119
|
-
scale.innerHTML = text;
|
|
120
|
-
}
|
|
121
|
-
}, {
|
|
122
|
-
key: "getRoundNum",
|
|
123
|
-
value: function getRoundNum(num) {
|
|
124
|
-
var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1);
|
|
125
|
-
var d = num / pow10;
|
|
126
|
-
d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;
|
|
127
|
-
return pow10 * d;
|
|
128
|
-
}
|
|
129
|
-
}, {
|
|
130
|
-
key: "updateMetric",
|
|
131
|
-
value: function updateMetric(maxMeters) {
|
|
132
|
-
var meters = this.getRoundNum(maxMeters);
|
|
133
|
-
var label = meters < 1000 ? meters + ' m' : meters / 1000 + ' km';
|
|
134
|
-
this.updateScale(this.mScale, label, meters / maxMeters);
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
key: "updateImperial",
|
|
138
|
-
value: function updateImperial(maxMeters) {
|
|
139
|
-
var maxFeet = maxMeters * 3.2808399;
|
|
140
|
-
var maxMiles;
|
|
141
|
-
var miles;
|
|
142
|
-
var feet;
|
|
143
|
-
if (maxFeet > 5280) {
|
|
144
|
-
maxMiles = maxFeet / 5280;
|
|
145
|
-
miles = this.getRoundNum(maxMiles);
|
|
146
|
-
this.updateScale(this.iScale, miles + ' mi', miles / maxMiles);
|
|
147
|
-
} else {
|
|
148
|
-
feet = this.getRoundNum(maxFeet);
|
|
149
|
-
this.updateScale(this.iScale, feet + ' ft', feet / maxFeet);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}]);
|
|
153
|
-
return Scale;
|
|
154
|
-
}(_baseControl.Control);
|
|
155
|
-
exports.default = exports.Scale = Scale;
|