@antv/l7-component 2.9.37 → 2.10.0
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/assets/iconfont/iconfont.js +53 -0
- package/es/constants/index.d.ts +60 -0
- package/es/constants/index.js +60 -0
- package/es/control/baseControl/buttonControl.d.ts +59 -0
- package/es/control/baseControl/buttonControl.js +191 -0
- package/es/control/baseControl/control.d.ts +113 -0
- package/es/control/baseControl/control.js +313 -0
- package/es/control/baseControl/index.d.ts +4 -0
- package/es/control/baseControl/index.js +4 -0
- package/es/control/baseControl/popperControl.d.ts +26 -0
- package/es/control/baseControl/popperControl.js +131 -0
- package/es/control/baseControl/selectControl.d.ts +46 -0
- package/es/control/baseControl/selectControl.js +232 -0
- package/es/control/exportImage.d.ts +18 -0
- package/es/control/exportImage.js +163 -0
- package/es/control/fullscreen.d.ts +19 -0
- package/es/control/fullscreen.js +151 -0
- package/es/control/geoLocate.d.ts +16 -0
- package/es/control/geoLocate.js +139 -0
- package/es/control/layerSwitch.d.ts +19 -0
- package/es/control/layerSwitch.js +172 -0
- package/es/control/logo.d.ts +10 -6
- package/es/control/logo.js +41 -11
- package/es/control/mapTheme.d.ts +10 -0
- package/es/control/mapTheme.js +135 -0
- package/es/control/mouseLocation.d.ts +15 -0
- package/es/control/mouseLocation.js +104 -0
- package/es/control/scale.d.ts +20 -10
- package/es/control/scale.js +77 -53
- package/es/control/zoom.d.ts +21 -10
- package/es/control/zoom.js +76 -49
- package/es/css/button.less +70 -0
- package/es/css/control.less +71 -0
- package/es/css/index.css +567 -0
- package/es/css/index.less +12 -0
- package/es/css/l7.less +60 -0
- package/es/css/layerPopup.less +8 -0
- package/es/css/logo.less +18 -0
- package/es/css/mouseLocation.less +9 -0
- package/es/css/popper.less +64 -0
- package/es/css/popup.less +169 -0
- package/es/css/scale.less +34 -0
- package/es/css/select.less +86 -0
- package/es/css/variables.less +28 -0
- package/es/css/zoom.less +21 -0
- package/es/images/logo.png +0 -0
- package/es/images/quanping.svg +12 -0
- package/es/index.d.ts +15 -8
- package/es/index.js +15 -9
- package/es/interface.d.ts +1 -20
- package/es/popup/layerPopup.d.ts +78 -0
- package/es/popup/layerPopup.js +308 -0
- package/es/popup/popup.d.ts +147 -0
- package/es/popup/popup.js +636 -0
- package/es/utils/icon.d.ts +1 -0
- package/es/utils/icon.js +9 -0
- package/es/utils/popper.d.ts +75 -0
- package/es/utils/popper.js +286 -0
- package/es/utils/screenfull.d.ts +2 -0
- package/es/utils/screenfull.js +157 -0
- package/lib/assets/iconfont/iconfont.js +55 -0
- package/lib/constants/index.js +68 -0
- package/lib/control/baseControl/buttonControl.js +207 -0
- package/lib/control/baseControl/control.js +340 -0
- package/lib/control/baseControl/index.js +57 -0
- package/lib/control/baseControl/popperControl.js +142 -0
- package/lib/control/baseControl/selectControl.js +253 -0
- package/lib/control/exportImage.js +177 -0
- package/lib/control/fullscreen.js +164 -0
- package/lib/control/geoLocate.js +154 -0
- package/lib/control/layerSwitch.js +183 -0
- package/lib/control/logo.js +50 -23
- package/lib/control/mapTheme.js +151 -0
- package/lib/control/mouseLocation.js +120 -0
- package/lib/control/scale.js +82 -62
- package/lib/control/zoom.js +78 -59
- package/lib/css/button.less +70 -0
- package/lib/css/control.less +71 -0
- package/lib/css/index.css +567 -0
- package/lib/css/index.less +12 -0
- package/lib/css/l7.less +60 -0
- package/lib/css/layerPopup.less +8 -0
- package/lib/css/logo.less +18 -0
- package/lib/css/mouseLocation.less +9 -0
- package/lib/css/popper.less +64 -0
- package/lib/css/popup.less +169 -0
- package/lib/css/scale.less +34 -0
- package/lib/css/select.less +86 -0
- package/lib/css/variables.less +28 -0
- package/lib/css/zoom.less +21 -0
- package/lib/images/logo.png +0 -0
- package/lib/images/quanping.svg +12 -0
- package/lib/index.js +165 -50
- package/lib/popup/layerPopup.js +317 -0
- package/lib/popup/popup.js +651 -0
- package/lib/utils/icon.js +18 -0
- package/lib/utils/popper.js +297 -0
- package/lib/utils/screenfull.js +167 -0
- package/package.json +8 -5
- package/es/control/BaseControl.d.ts +0 -27
- package/es/control/BaseControl.js +0 -134
- package/es/control/layer.d.ts +0 -38
- package/es/control/layer.js +0 -340
- package/es/css/l7.css +0 -502
- package/es/popup.d.ts +0 -35
- package/es/popup.js +0 -300
- package/lib/control/BaseControl.js +0 -160
- package/lib/control/layer.js +0 -362
- package/lib/css/l7.css +0 -502
- package/lib/popup.js +0 -317
package/lib/control/zoom.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.Zoom = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
|
|
@@ -15,19 +15,23 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
15
15
|
|
|
16
16
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
17
|
|
|
18
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
19
|
+
|
|
18
20
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
21
|
|
|
20
22
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
23
|
|
|
22
24
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
25
|
|
|
24
|
-
var
|
|
26
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
+
|
|
28
|
+
var _l7Core = require("@antv/l7-core");
|
|
25
29
|
|
|
26
|
-
var
|
|
30
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
var _icon = require("../utils/icon");
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
var _baseControl = require("./baseControl");
|
|
31
35
|
|
|
32
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); }; }
|
|
33
37
|
|
|
@@ -38,39 +42,73 @@ var Zoom = /*#__PURE__*/function (_Control) {
|
|
|
38
42
|
|
|
39
43
|
var _super = _createSuper(Zoom);
|
|
40
44
|
|
|
41
|
-
function Zoom(
|
|
45
|
+
function Zoom() {
|
|
42
46
|
var _this;
|
|
43
47
|
|
|
44
48
|
(0, _classCallCheck2.default)(this, Zoom);
|
|
45
|
-
|
|
46
|
-
(
|
|
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), "zoomIn", function () {
|
|
56
|
+
if (!_this.disabled && _this.mapsService.getZoom() < _this.mapsService.getMaxZoom()) {
|
|
57
|
+
_this.mapsService.zoomIn();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoomOut", function () {
|
|
61
|
+
if (!_this.disabled && _this.mapsService.getZoom() > _this.mapsService.getMinZoom()) {
|
|
62
|
+
_this.mapsService.zoomOut();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateDisabled", function () {
|
|
66
|
+
var mapsService = _this.mapsService;
|
|
67
|
+
|
|
68
|
+
_this.zoomInButton.removeAttribute('disabled');
|
|
69
|
+
|
|
70
|
+
_this.zoomOutButton.removeAttribute('disabled');
|
|
71
|
+
|
|
72
|
+
if (_this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
|
|
73
|
+
_this.zoomOutButton.setAttribute('disabled', 'true');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (_this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
|
|
77
|
+
_this.zoomInButton.setAttribute('disabled', 'true');
|
|
78
|
+
}
|
|
79
|
+
});
|
|
47
80
|
return _this;
|
|
48
81
|
}
|
|
49
82
|
|
|
50
83
|
(0, _createClass2.default)(Zoom, [{
|
|
51
84
|
key: "getDefault",
|
|
52
|
-
value: function getDefault() {
|
|
53
|
-
return {
|
|
54
|
-
position:
|
|
55
|
-
|
|
85
|
+
value: function getDefault(option) {
|
|
86
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(Zoom.prototype), "getDefault", this).call(this, option)), {}, {
|
|
87
|
+
position: _l7Core.PositionType.BOTTOMRIGHT,
|
|
88
|
+
name: 'zoom',
|
|
89
|
+
zoomInText: (0, _icon.createL7Icon)('l7-icon-enlarge'),
|
|
56
90
|
zoomInTitle: 'Zoom in',
|
|
57
|
-
zoomOutText: '
|
|
58
|
-
zoomOutTitle: 'Zoom out'
|
|
59
|
-
|
|
60
|
-
|
|
91
|
+
zoomOutText: (0, _icon.createL7Icon)('l7-icon-narrow'),
|
|
92
|
+
zoomOutTitle: 'Zoom out'
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
96
|
+
key: "setOptions",
|
|
97
|
+
value: function setOptions(newOptions) {
|
|
98
|
+
(0, _get2.default)((0, _getPrototypeOf2.default)(Zoom.prototype), "setOptions", this).call(this, newOptions);
|
|
99
|
+
|
|
100
|
+
if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle'])) {
|
|
101
|
+
this.resetButtonGroup(this.container);
|
|
102
|
+
}
|
|
61
103
|
}
|
|
62
104
|
}, {
|
|
63
105
|
key: "onAdd",
|
|
64
106
|
value: function onAdd() {
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
var container = _l7Utils.DOM.create('div', zoomName + ' l7-bar');
|
|
107
|
+
var container = _l7Utils.DOM.create('div', 'l7-control-zoom');
|
|
68
108
|
|
|
69
|
-
this.
|
|
70
|
-
this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, zoomName + '-out', container, this.zoomOut);
|
|
109
|
+
this.resetButtonGroup(container);
|
|
71
110
|
this.mapsService.on('zoomend', this.updateDisabled);
|
|
72
111
|
this.mapsService.on('zoomchange', this.updateDisabled);
|
|
73
|
-
this.updateDisabled();
|
|
74
112
|
return container;
|
|
75
113
|
}
|
|
76
114
|
}, {
|
|
@@ -94,50 +132,31 @@ var Zoom = /*#__PURE__*/function (_Control) {
|
|
|
94
132
|
return this;
|
|
95
133
|
}
|
|
96
134
|
}, {
|
|
97
|
-
key: "
|
|
98
|
-
value: function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
key: "zoomOut",
|
|
105
|
-
value: function zoomOut() {
|
|
106
|
-
if (!this.disabled && this.mapsService.getZoom() > this.mapsService.getMinZoom()) {
|
|
107
|
-
this.mapsService.zoomOut();
|
|
108
|
-
}
|
|
135
|
+
key: "resetButtonGroup",
|
|
136
|
+
value: function resetButtonGroup(container) {
|
|
137
|
+
_l7Utils.DOM.clearChildren(container);
|
|
138
|
+
|
|
139
|
+
this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, 'l7-button-control', container, this.zoomIn);
|
|
140
|
+
this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, 'l7-button-control', container, this.zoomOut);
|
|
141
|
+
this.updateDisabled();
|
|
109
142
|
}
|
|
110
143
|
}, {
|
|
111
144
|
key: "createButton",
|
|
112
145
|
value: function createButton(html, tile, className, container, fn) {
|
|
113
|
-
var link = _l7Utils.DOM.create('
|
|
146
|
+
var link = _l7Utils.DOM.create('button', className, container);
|
|
147
|
+
|
|
148
|
+
if (typeof html === 'string') {
|
|
149
|
+
link.innerHTML = html;
|
|
150
|
+
} else {
|
|
151
|
+
link.append(html);
|
|
152
|
+
}
|
|
114
153
|
|
|
115
|
-
link.innerHTML = html;
|
|
116
154
|
link.title = tile;
|
|
117
|
-
link.href = 'javascript:void(0)';
|
|
118
155
|
link.addEventListener('click', fn);
|
|
119
156
|
return link;
|
|
120
157
|
}
|
|
121
|
-
}, {
|
|
122
|
-
key: "updateDisabled",
|
|
123
|
-
value: function updateDisabled() {
|
|
124
|
-
var mapsService = this.mapsService;
|
|
125
|
-
var className = 'l7-disabled';
|
|
126
|
-
|
|
127
|
-
_l7Utils.DOM.removeClass(this.zoomInButton, className);
|
|
128
|
-
|
|
129
|
-
_l7Utils.DOM.removeClass(this.zoomOutButton, className);
|
|
130
|
-
|
|
131
|
-
if (this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
|
|
132
|
-
_l7Utils.DOM.addClass(this.zoomOutButton, className);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
|
|
136
|
-
_l7Utils.DOM.addClass(this.zoomInButton, className);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
158
|
}]);
|
|
140
159
|
return Zoom;
|
|
141
|
-
}(
|
|
160
|
+
}(_baseControl.Control);
|
|
142
161
|
|
|
143
|
-
exports.default = Zoom;
|
|
162
|
+
exports.default = exports.Zoom = Zoom;
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@import 'variables.less';
|
|
2
|
+
|
|
3
|
+
.l7-control-container {
|
|
4
|
+
font: 12px/1.5 'Helvetica Neue', Arial, Helvetica, sans-serif;
|
|
5
|
+
|
|
6
|
+
.l7-control {
|
|
7
|
+
position: relative;
|
|
8
|
+
z-index: 800;
|
|
9
|
+
float: left;
|
|
10
|
+
clear: both;
|
|
11
|
+
color: @l7-control-font-color;
|
|
12
|
+
font-size: @l7-control-font-size;
|
|
13
|
+
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
|
|
14
|
+
pointer-events: auto;
|
|
15
|
+
|
|
16
|
+
&.l7-control--hide {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
each(@position-list,{
|
|
22
|
+
.l7-@{value} {
|
|
23
|
+
@{value}: 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
position: absolute;
|
|
26
|
+
z-index: 1000;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
.l7-control:not(.l7-control--hide) {
|
|
29
|
+
margin-@{value}: @l7-control-space;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
.l7-center {
|
|
35
|
+
position: absolute;
|
|
36
|
+
display: flex;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
&.l7-top,
|
|
39
|
+
&.l7-bottom {
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
&.l7-left,
|
|
43
|
+
&.l7-right {
|
|
44
|
+
height: 100%;
|
|
45
|
+
}
|
|
46
|
+
.l7-control {
|
|
47
|
+
margin-right: @l7-control-space;
|
|
48
|
+
margin-bottom: @l7-control-space;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.l7-row {
|
|
53
|
+
flex-direction: row;
|
|
54
|
+
&.l7-top {
|
|
55
|
+
align-items: flex-start;
|
|
56
|
+
}
|
|
57
|
+
&.l7-bottom {
|
|
58
|
+
align-items: flex-end;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.l7-column {
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
&.l7-left {
|
|
65
|
+
align-items: flex-start;
|
|
66
|
+
}
|
|
67
|
+
&.l7-right {
|
|
68
|
+
align-items: flex-end;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|