@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.
Files changed (110) hide show
  1. package/es/control/BaseControl.d.ts +27 -0
  2. package/es/control/BaseControl.js +134 -0
  3. package/es/control/layer.d.ts +38 -0
  4. package/es/control/layer.js +340 -0
  5. package/es/control/logo.d.ts +6 -10
  6. package/es/control/logo.js +11 -41
  7. package/es/control/scale.d.ts +10 -20
  8. package/es/control/scale.js +53 -77
  9. package/es/control/zoom.d.ts +10 -21
  10. package/es/control/zoom.js +49 -76
  11. package/es/css/l7.css +502 -0
  12. package/es/images/logo.png +0 -0
  13. package/es/index.d.ts +8 -15
  14. package/es/index.js +9 -15
  15. package/es/interface.d.ts +20 -1
  16. package/es/popup.d.ts +35 -0
  17. package/es/popup.js +300 -0
  18. package/lib/control/BaseControl.js +160 -0
  19. package/lib/control/layer.js +362 -0
  20. package/lib/control/logo.js +23 -50
  21. package/lib/control/scale.js +62 -82
  22. package/lib/control/zoom.js +59 -78
  23. package/lib/css/l7.css +502 -0
  24. package/lib/images/logo.png +0 -0
  25. package/lib/index.js +50 -165
  26. package/lib/popup.js +317 -0
  27. package/package.json +5 -8
  28. package/es/assets/iconfont/iconfont.js +0 -53
  29. package/es/constants/index.d.ts +0 -60
  30. package/es/constants/index.js +0 -60
  31. package/es/control/baseControl/buttonControl.d.ts +0 -59
  32. package/es/control/baseControl/buttonControl.js +0 -191
  33. package/es/control/baseControl/control.d.ts +0 -106
  34. package/es/control/baseControl/control.js +0 -301
  35. package/es/control/baseControl/index.d.ts +0 -4
  36. package/es/control/baseControl/index.js +0 -4
  37. package/es/control/baseControl/popperControl.d.ts +0 -26
  38. package/es/control/baseControl/popperControl.js +0 -131
  39. package/es/control/baseControl/selectControl.d.ts +0 -46
  40. package/es/control/baseControl/selectControl.js +0 -232
  41. package/es/control/exportImage.d.ts +0 -18
  42. package/es/control/exportImage.js +0 -163
  43. package/es/control/fullscreen.d.ts +0 -19
  44. package/es/control/fullscreen.js +0 -151
  45. package/es/control/geoLocate.d.ts +0 -16
  46. package/es/control/geoLocate.js +0 -139
  47. package/es/control/layerControl.d.ts +0 -21
  48. package/es/control/layerControl.js +0 -172
  49. package/es/control/mapTheme.d.ts +0 -10
  50. package/es/control/mapTheme.js +0 -135
  51. package/es/control/mouseLocation.d.ts +0 -15
  52. package/es/control/mouseLocation.js +0 -104
  53. package/es/css/button.less +0 -70
  54. package/es/css/control.less +0 -71
  55. package/es/css/index.css +0 -567
  56. package/es/css/index.less +0 -12
  57. package/es/css/l7.less +0 -60
  58. package/es/css/layerPopup.less +0 -8
  59. package/es/css/logo.less +0 -18
  60. package/es/css/mouseLocation.less +0 -9
  61. package/es/css/popper.less +0 -64
  62. package/es/css/popup.less +0 -169
  63. package/es/css/scale.less +0 -34
  64. package/es/css/select.less +0 -86
  65. package/es/css/variables.less +0 -28
  66. package/es/css/zoom.less +0 -21
  67. package/es/images/quanping.svg +0 -12
  68. package/es/popup/layerPopup.d.ts +0 -78
  69. package/es/popup/layerPopup.js +0 -308
  70. package/es/popup/popup.d.ts +0 -147
  71. package/es/popup/popup.js +0 -636
  72. package/es/utils/icon.d.ts +0 -1
  73. package/es/utils/icon.js +0 -9
  74. package/es/utils/popper.d.ts +0 -75
  75. package/es/utils/popper.js +0 -286
  76. package/es/utils/screenfull.d.ts +0 -2
  77. package/es/utils/screenfull.js +0 -157
  78. package/lib/assets/iconfont/iconfont.js +0 -55
  79. package/lib/constants/index.js +0 -68
  80. package/lib/control/baseControl/buttonControl.js +0 -207
  81. package/lib/control/baseControl/control.js +0 -333
  82. package/lib/control/baseControl/index.js +0 -57
  83. package/lib/control/baseControl/popperControl.js +0 -142
  84. package/lib/control/baseControl/selectControl.js +0 -253
  85. package/lib/control/exportImage.js +0 -177
  86. package/lib/control/fullscreen.js +0 -164
  87. package/lib/control/geoLocate.js +0 -154
  88. package/lib/control/layerControl.js +0 -182
  89. package/lib/control/mapTheme.js +0 -151
  90. package/lib/control/mouseLocation.js +0 -120
  91. package/lib/css/button.less +0 -70
  92. package/lib/css/control.less +0 -71
  93. package/lib/css/index.css +0 -567
  94. package/lib/css/index.less +0 -12
  95. package/lib/css/l7.less +0 -60
  96. package/lib/css/layerPopup.less +0 -8
  97. package/lib/css/logo.less +0 -18
  98. package/lib/css/mouseLocation.less +0 -9
  99. package/lib/css/popper.less +0 -64
  100. package/lib/css/popup.less +0 -169
  101. package/lib/css/scale.less +0 -34
  102. package/lib/css/select.less +0 -86
  103. package/lib/css/variables.less +0 -28
  104. package/lib/css/zoom.less +0 -21
  105. package/lib/images/quanping.svg +0 -12
  106. package/lib/popup/layerPopup.js +0 -317
  107. package/lib/popup/popup.js +0 -651
  108. package/lib/utils/icon.js +0 -18
  109. package/lib/utils/popper.js +0 -297
  110. package/lib/utils/screenfull.js +0 -167
@@ -1,139 +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 { isNaN } from 'lodash';
18
- import { createL7Icon } from "../utils/icon";
19
- import ButtonControl from "./baseControl/buttonControl";
20
- export { GeoLocate };
21
-
22
- var GeoLocate = /*#__PURE__*/function (_ButtonControl) {
23
- _inherits(GeoLocate, _ButtonControl);
24
-
25
- var _super = _createSuper(GeoLocate);
26
-
27
- function GeoLocate(option) {
28
- var _this;
29
-
30
- _classCallCheck(this, GeoLocate);
31
-
32
- _this = _super.call(this, option);
33
-
34
- _defineProperty(_assertThisInitialized(_this), "getGeoLocation", function () {
35
- return new Promise(function (resolve, reject) {
36
- window.navigator.geolocation.getCurrentPosition(function (_ref) {
37
- var coords = _ref.coords;
38
-
39
- var _ref2 = coords !== null && coords !== void 0 ? coords : {},
40
- longitude = _ref2.longitude,
41
- latitude = _ref2.latitude;
42
-
43
- if (!isNaN(longitude) && !isNaN(latitude)) {
44
- resolve([longitude, latitude]);
45
- } else {
46
- reject();
47
- }
48
- }, function (e) {
49
- reject(e);
50
- });
51
- });
52
- });
53
-
54
- _defineProperty(_assertThisInitialized(_this), "onClick", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
55
- var transform, position, currentZoom;
56
- return _regeneratorRuntime.wrap(function _callee$(_context) {
57
- while (1) {
58
- switch (_context.prev = _context.next) {
59
- case 0:
60
- if (window.navigator.geolocation) {
61
- _context.next = 2;
62
- break;
63
- }
64
-
65
- return _context.abrupt("return");
66
-
67
- case 2:
68
- transform = _this.controlOption.transform;
69
- _context.next = 5;
70
- return _this.getGeoLocation();
71
-
72
- case 5:
73
- position = _context.sent;
74
- currentZoom = _this.mapsService.getZoom();
75
- _context.t0 = _this.mapsService;
76
- _context.t1 = currentZoom > 15 ? currentZoom : 15;
77
-
78
- if (!transform) {
79
- _context.next = 15;
80
- break;
81
- }
82
-
83
- _context.next = 12;
84
- return transform(position);
85
-
86
- case 12:
87
- _context.t2 = _context.sent;
88
- _context.next = 16;
89
- break;
90
-
91
- case 15:
92
- _context.t2 = position;
93
-
94
- case 16:
95
- _context.t3 = _context.t2;
96
-
97
- _context.t0.setZoomAndCenter.call(_context.t0, _context.t1, _context.t3);
98
-
99
- case 18:
100
- case "end":
101
- return _context.stop();
102
- }
103
- }
104
- }, _callee);
105
- })));
106
-
107
- if (!window.navigator.geolocation) {
108
- console.warn('当前浏览器环境不支持获取地理定位');
109
- }
110
-
111
- return _this;
112
- }
113
-
114
- _createClass(GeoLocate, [{
115
- key: "getDefault",
116
- value: function getDefault(option) {
117
- return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(GeoLocate.prototype), "getDefault", this).call(this, option)), {}, {
118
- title: '定位',
119
- btnIcon: createL7Icon('l7-icon-reposition')
120
- });
121
- }
122
- }, {
123
- key: "onAdd",
124
- value: function onAdd() {
125
- var button = _get(_getPrototypeOf(GeoLocate.prototype), "onAdd", this).call(this);
126
-
127
- button.addEventListener('click', this.onClick);
128
- return button;
129
- }
130
- /**
131
- * 通过浏览器 API 获取当前所在经纬度
132
- */
133
-
134
- }]);
135
-
136
- return GeoLocate;
137
- }(ButtonControl);
138
-
139
- export { GeoLocate as default };
@@ -1,21 +0,0 @@
1
- import { ILayer } from '@antv/l7-core';
2
- import SelectControl, { ISelectControlOption, ControlOptionItem } from './baseControl/selectControl';
3
- export interface ILayerControlOption extends ISelectControlOption {
4
- layers: ILayer[];
5
- }
6
- export { LayerControl };
7
- export default class LayerControl extends SelectControl<ILayerControlOption> {
8
- protected get layers(): ILayer[];
9
- getDefault(option?: Partial<ILayerControlOption>): ILayerControlOption;
10
- getLayerVisible(): string[];
11
- getLayerOptions(): ControlOptionItem[];
12
- setOptions(option: Partial<ILayerControlOption>): void;
13
- onAdd(): HTMLElement;
14
- bindLayerVisibleCallback: () => void;
15
- unbindLayerVisibleCallback: () => void;
16
- onRemove(): void;
17
- protected onLayerChange: () => void;
18
- protected onLayerVisibleChane: () => void;
19
- protected onSelectChange: () => void;
20
- protected getIsMultiple(): boolean;
21
- }
@@ -1,172 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
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 { createL7Icon } from "../utils/icon";
16
- import SelectControl from "./baseControl/selectControl";
17
- export { LayerControl };
18
-
19
- var LayerControl = /*#__PURE__*/function (_SelectControl) {
20
- _inherits(LayerControl, _SelectControl);
21
-
22
- var _super = _createSuper(LayerControl);
23
-
24
- function LayerControl() {
25
- var _this;
26
-
27
- _classCallCheck(this, LayerControl);
28
-
29
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
- args[_key] = arguments[_key];
31
- }
32
-
33
- _this = _super.call.apply(_super, [this].concat(args));
34
-
35
- _defineProperty(_assertThisInitialized(_this), "bindLayerVisibleCallback", function () {
36
- _this.layers.forEach(function (layer) {
37
- layer.on('show', _this.onLayerVisibleChane);
38
- layer.on('hide', _this.onLayerVisibleChane);
39
- });
40
- });
41
-
42
- _defineProperty(_assertThisInitialized(_this), "unbindLayerVisibleCallback", function () {
43
- _this.layers.forEach(function (layer) {
44
- layer.off('show', _this.onLayerVisibleChane);
45
- layer.off('hide', _this.onLayerVisibleChane);
46
- });
47
- });
48
-
49
- _defineProperty(_assertThisInitialized(_this), "onLayerChange", function () {
50
- var _this$controlOption$l;
51
-
52
- if ((_this$controlOption$l = _this.controlOption.layers) !== null && _this$controlOption$l !== void 0 && _this$controlOption$l.length) {
53
- return;
54
- }
55
-
56
- _this.selectValue = _this.getLayerVisible();
57
-
58
- _this.setOptions({
59
- options: _this.getLayerOptions()
60
- });
61
- });
62
-
63
- _defineProperty(_assertThisInitialized(_this), "onLayerVisibleChane", function () {
64
- _this.setSelectValue(_this.getLayerVisible());
65
- });
66
-
67
- _defineProperty(_assertThisInitialized(_this), "onSelectChange", function () {
68
- _this.layers.forEach(function (layer) {
69
- var needShow = _this.selectValue.includes(layer.name);
70
-
71
- var isShow = layer.isVisible();
72
-
73
- if (needShow && !isShow) {
74
- layer.show();
75
- }
76
-
77
- if (!needShow && isShow) {
78
- layer.hide();
79
- }
80
- });
81
- });
82
-
83
- return _this;
84
- }
85
-
86
- _createClass(LayerControl, [{
87
- key: "layers",
88
- get: function get() {
89
- return this.controlOption.layers || this.layerService.getLayers() || [];
90
- }
91
- }, {
92
- key: "getDefault",
93
- value: function getDefault(option) {
94
- return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(LayerControl.prototype), "getDefault", this).call(this, option)), {}, {
95
- title: '图层控制',
96
- btnIcon: createL7Icon('l7-icon-layer'),
97
- options: []
98
- });
99
- }
100
- }, {
101
- key: "getLayerVisible",
102
- value: function getLayerVisible() {
103
- return this.layers.filter(function (layer) {
104
- return layer.isVisible();
105
- }).map(function (layer) {
106
- return layer.name;
107
- });
108
- }
109
- }, {
110
- key: "getLayerOptions",
111
- value: function getLayerOptions() {
112
- return this.layers.map(function (layer) {
113
- return {
114
- text: layer.name,
115
- value: layer.name
116
- };
117
- });
118
- }
119
- }, {
120
- key: "setOptions",
121
- value: function setOptions(option) {
122
- var isLayerChange = this.checkUpdateOption(option, ['layers']);
123
-
124
- if (isLayerChange) {
125
- this.unbindLayerVisibleCallback();
126
- }
127
-
128
- _get(_getPrototypeOf(LayerControl.prototype), "setOptions", this).call(this, option);
129
-
130
- if (isLayerChange) {
131
- this.bindLayerVisibleCallback();
132
- this.selectValue = this.getLayerVisible();
133
- this.controlOption.options = this.getLayerOptions();
134
- this.popper.setContent(this.getPopperContent(this.controlOption.options));
135
- }
136
- }
137
- }, {
138
- key: "onAdd",
139
- value: function onAdd() {
140
- var _this$controlOption$o;
141
-
142
- if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
143
- this.controlOption.options = this.getLayerOptions();
144
- }
145
-
146
- if (!this.controlOption.defaultValue) {
147
- this.controlOption.defaultValue = this.getLayerVisible();
148
- }
149
-
150
- this.on('selectChange', this.onSelectChange);
151
- this.layerService.on('layerChange', this.onLayerChange);
152
- this.bindLayerVisibleCallback();
153
- return _get(_getPrototypeOf(LayerControl.prototype), "onAdd", this).call(this);
154
- }
155
- }, {
156
- key: "onRemove",
157
- value: function onRemove() {
158
- this.off('selectChange', this.onSelectChange);
159
- this.layerService.off('layerChange', this.onLayerChange);
160
- this.unbindLayerVisibleCallback();
161
- }
162
- }, {
163
- key: "getIsMultiple",
164
- value: function getIsMultiple() {
165
- return true;
166
- }
167
- }]);
168
-
169
- return LayerControl;
170
- }(SelectControl);
171
-
172
- export { LayerControl as default };
@@ -1,10 +0,0 @@
1
- import SelectControl, { ControlOptionItem, ISelectControlOption } from './baseControl/selectControl';
2
- export { MapTheme };
3
- export default class MapTheme extends SelectControl<ISelectControlOption> {
4
- getDefault(option?: Partial<ISelectControlOption>): ISelectControlOption;
5
- getStyleOptions(): ControlOptionItem[];
6
- getMapStyle(): any;
7
- onAdd(): HTMLElement;
8
- protected onMapThemeChange: () => void;
9
- protected getIsMultiple(): boolean;
10
- }
@@ -1,135 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
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
-
12
- 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); }; }
13
-
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; } }
15
-
16
- import { GaodeMapStyleConfig, MapboxMapStyleConfig } from "../constants";
17
- import { createL7Icon } from "../utils/icon";
18
- import SelectControl from "./baseControl/selectControl";
19
- export { MapTheme };
20
-
21
- var MapTheme = /*#__PURE__*/function (_SelectControl) {
22
- _inherits(MapTheme, _SelectControl);
23
-
24
- var _super = _createSuper(MapTheme);
25
-
26
- function MapTheme() {
27
- var _this;
28
-
29
- _classCallCheck(this, MapTheme);
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), "onMapThemeChange", function () {
38
- _this.mapsService.setMapStyle(_this.selectValue[0]);
39
- });
40
-
41
- return _this;
42
- }
43
-
44
- _createClass(MapTheme, [{
45
- key: "getDefault",
46
- value: function getDefault(option) {
47
- return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MapTheme.prototype), "getDefault", this).call(this, option)), {}, {
48
- title: '地图样式',
49
- btnIcon: createL7Icon('l7-icon-color'),
50
- options: []
51
- });
52
- }
53
- }, {
54
- key: "getStyleOptions",
55
- value: function getStyleOptions() {
56
- var mapStyleConfig = this.mapsService.getType() === 'mapbox' ? MapboxMapStyleConfig : GaodeMapStyleConfig;
57
- return Object.entries(this.mapsService.getMapStyleConfig()).filter(function (_ref) {
58
- var _ref2 = _slicedToArray(_ref, 2),
59
- key = _ref2[0],
60
- value = _ref2[1];
61
-
62
- return typeof value === 'string' && key !== 'blank';
63
- }).map(function (_ref3) {
64
- var _mapStyleConfig$key;
65
-
66
- var _ref4 = _slicedToArray(_ref3, 2),
67
- key = _ref4[0],
68
- value = _ref4[1];
69
-
70
- // @ts-ignore
71
- var _ref5 = (_mapStyleConfig$key = mapStyleConfig[key]) !== null && _mapStyleConfig$key !== void 0 ? _mapStyleConfig$key : {},
72
- text = _ref5.text,
73
- img = _ref5.img;
74
-
75
- return {
76
- text: text !== null && text !== void 0 ? text : key,
77
- value: value,
78
- img: img,
79
- key: key
80
- };
81
- });
82
- }
83
- }, {
84
- key: "getMapStyle",
85
- value: function getMapStyle() {
86
- return this.mapsService.getMapStyle();
87
- }
88
- }, {
89
- key: "onAdd",
90
- value: function onAdd() {
91
- var _this$controlOption$o,
92
- _this2 = this;
93
-
94
- if (!((_this$controlOption$o = this.controlOption.options) !== null && _this$controlOption$o !== void 0 && _this$controlOption$o.length)) {
95
- this.controlOption.options = this.getStyleOptions();
96
- }
97
-
98
- if (this.controlOption.defaultValue) {
99
- var _this$controlOption$o2, _this$controlOption$o3;
100
-
101
- var defaultValue = this.controlOption.defaultValue;
102
- this.controlOption.defaultValue = (_this$controlOption$o2 = (_this$controlOption$o3 = this.controlOption.options.find(function (item) {
103
- return item.key === defaultValue;
104
- })) === null || _this$controlOption$o3 === void 0 ? void 0 : _this$controlOption$o3.value) !== null && _this$controlOption$o2 !== void 0 ? _this$controlOption$o2 : defaultValue;
105
- } else {
106
- var defaultStyle = this.getMapStyle();
107
-
108
- if (defaultStyle) {
109
- this.controlOption.defaultValue = defaultStyle;
110
- } else {
111
- // @ts-ignore
112
- this.mapsService.map.once('styledata', function () {
113
- var mapboxStyle = _this2.mapsService.getMapStyle();
114
-
115
- _this2.controlOption.defaultValue = mapboxStyle;
116
-
117
- _this2.setSelectValue(mapboxStyle, false);
118
- });
119
- }
120
- }
121
-
122
- this.on('selectChange', this.onMapThemeChange);
123
- return _get(_getPrototypeOf(MapTheme.prototype), "onAdd", this).call(this);
124
- }
125
- }, {
126
- key: "getIsMultiple",
127
- value: function getIsMultiple() {
128
- return false;
129
- }
130
- }]);
131
-
132
- return MapTheme;
133
- }(SelectControl);
134
-
135
- export { MapTheme as default };
@@ -1,15 +0,0 @@
1
- import { Position } from '@antv/l7-core';
2
- import Control, { IControlOption } from './baseControl/control';
3
- export interface IMouseLocationControlOption extends IControlOption {
4
- transform: (position: Position) => Position;
5
- }
6
- export { MouseLocation };
7
- export default class MouseLocation extends Control<IMouseLocationControlOption> {
8
- protected location: Position;
9
- getLocation(): Position;
10
- getDefault(option?: Partial<IMouseLocationControlOption>): IMouseLocationControlOption;
11
- onAdd(): HTMLElement;
12
- onRemove(): void;
13
- protected onMouseMove: (e: any) => void;
14
- protected insertLocation2HTML(position: Position): void;
15
- }
@@ -1,104 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
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
-
12
- 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); }; }
13
-
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; } }
15
-
16
- import { PositionType } from '@antv/l7-core';
17
- import { DOM } from '@antv/l7-utils';
18
- import Control from "./baseControl/control";
19
- export { MouseLocation };
20
-
21
- var MouseLocation = /*#__PURE__*/function (_Control) {
22
- _inherits(MouseLocation, _Control);
23
-
24
- var _super = _createSuper(MouseLocation);
25
-
26
- function MouseLocation() {
27
- var _this;
28
-
29
- _classCallCheck(this, MouseLocation);
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), "location", [0, 0]);
38
-
39
- _defineProperty(_assertThisInitialized(_this), "onMouseMove", function (e) {
40
- var position = _this.location;
41
- var lngLat = e.lngLat || e.lnglat;
42
- var transform = _this.controlOption.transform;
43
-
44
- if (lngLat) {
45
- position = [lngLat.lng, lngLat.lat];
46
- }
47
-
48
- _this.location = position;
49
-
50
- if (transform) {
51
- position = transform(position);
52
- }
53
-
54
- _this.insertLocation2HTML(position);
55
-
56
- _this.emit('locationChange', position);
57
- });
58
-
59
- return _this;
60
- }
61
-
62
- _createClass(MouseLocation, [{
63
- key: "getLocation",
64
- value: function getLocation() {
65
- return this.location;
66
- }
67
- }, {
68
- key: "getDefault",
69
- value: function getDefault(option) {
70
- return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(MouseLocation.prototype), "getDefault", this).call(this, option)), {}, {
71
- position: PositionType.BOTTOMLEFT,
72
- transform: function transform(_ref) {
73
- var _ref2 = _slicedToArray(_ref, 2),
74
- lng = _ref2[0],
75
- lat = _ref2[1];
76
-
77
- return [+(+lng).toFixed(6), +(+lat).toFixed(6)];
78
- }
79
- });
80
- }
81
- }, {
82
- key: "onAdd",
83
- value: function onAdd() {
84
- var container = DOM.create('div', 'l7-control-mouse-location');
85
- container.innerHTML = '&nbsp;';
86
- this.mapsService.on('mousemove', this.onMouseMove);
87
- return container;
88
- }
89
- }, {
90
- key: "onRemove",
91
- value: function onRemove() {
92
- this.mapsService.off('mousemove', this.onMouseMove);
93
- }
94
- }, {
95
- key: "insertLocation2HTML",
96
- value: function insertLocation2HTML(position) {
97
- this.container.innerText = position.join(', ');
98
- }
99
- }]);
100
-
101
- return MouseLocation;
102
- }(Control);
103
-
104
- export { MouseLocation as default };
@@ -1,70 +0,0 @@
1
- @import 'variables.less';
2
-
3
- .l7-button-control {
4
- min-width: @l7-btn-control-size;
5
- height: @l7-btn-control-size;
6
- background-color: @l7-control-bg-color;
7
- border-width: 0;
8
- border-radius: @l7-btn-control-border-radius;
9
- outline: 0;
10
- cursor: pointer;
11
- transition: all 0.2s;
12
- display: flex;
13
- justify-content: center;
14
- align-items: center;
15
- padding: 0 ((@l7-btn-control-size - @l7-btn-icon-size) / 2);
16
- box-shadow: @l7-control-shadow;
17
- line-height: 16px;
18
-
19
- .l7-iconfont {
20
- fill: @l7-control-font-color;
21
- color: @l7-control-font-color;
22
- width: @l7-btn-icon-size;
23
- height: @l7-btn-icon-size;
24
- }
25
-
26
- &.l7-button-control--row {
27
- padding: 0 16px 0 13px;
28
-
29
- * + .l7-button-control__text {
30
- margin-left: 8px;
31
- }
32
- }
33
-
34
- &.l7-button-control--column {
35
- height: @l7-btn-column-height;
36
- flex-direction: column;
37
- .l7-iconfont {
38
- margin-top: 3px;
39
- }
40
- .l7-button-control__text {
41
- margin-top: 3px;
42
- font-size: 10px;
43
- transform: scale(0.83333);
44
- }
45
- }
46
-
47
- &:not(:disabled) {
48
- &:hover {
49
- background-color: @l7-btn-control-bg-hover-color;
50
- }
51
- &:active {
52
- background-color: @l7-btn-control-bg-active-color;
53
- }
54
- }
55
- &:disabled {
56
- background-color: @l7-btn-control-disabled-bg-color;
57
- color: @l7-btn-control-disabled-font-color;
58
- cursor: not-allowed;
59
- .l7-iconfont {
60
- fill: @l7-btn-control-disabled-font-color;
61
- color: @l7-btn-control-disabled-font-color;
62
- }
63
- &:hover {
64
- background-color: @l7-btn-control-disabled-bg-color;
65
- }
66
- &:active {
67
- background-color: @l7-btn-control-disabled-bg-color;
68
- }
69
- }
70
- }