@antv/l7-component 2.25.7 → 2.25.9
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.d.ts +21 -0
- package/es/assets/iconfont/iconfont.js +61 -0
- package/es/constants/index.d.ts +60 -0
- package/es/constants/index.js +60 -0
- package/es/control/baseControl/buttonControl.d.ts +60 -0
- package/es/control/baseControl/buttonControl.js +142 -0
- package/es/control/baseControl/control.d.ts +112 -0
- package/es/control/baseControl/control.js +256 -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 +28 -0
- package/es/control/baseControl/popperControl.js +92 -0
- package/es/control/baseControl/selectControl.d.ts +53 -0
- package/es/control/baseControl/selectControl.js +173 -0
- package/es/control/exportImage.d.ts +19 -0
- package/es/control/exportImage.js +73 -0
- package/es/control/fullscreen.d.ts +20 -0
- package/es/control/fullscreen.js +88 -0
- package/es/control/geoLocate.d.ts +17 -0
- package/es/control/geoLocate.js +60 -0
- package/es/control/layerSwitch.d.ts +27 -0
- package/es/control/layerSwitch.js +155 -0
- package/es/control/logo.d.ts +14 -0
- package/es/control/logo.js +49 -0
- package/es/control/mapTheme.d.ts +11 -0
- package/es/control/mapTheme.js +69 -0
- package/es/control/mouseLocation.d.ts +16 -0
- package/es/control/mouseLocation.js +52 -0
- package/es/control/scale.d.ts +35 -0
- package/es/control/scale.js +121 -0
- package/es/control/swipe.d.ts +66 -0
- package/es/control/swipe.js +392 -0
- package/es/control/zoom.d.ts +39 -0
- package/es/control/zoom.js +100 -0
- package/es/css/button.less +77 -0
- package/es/css/control.less +82 -0
- package/es/css/index.css +653 -0
- package/es/css/index.less +13 -0
- package/es/css/l7.less +69 -0
- package/es/css/layerPopup.less +9 -0
- package/es/css/logo.less +21 -0
- package/es/css/mouseLocation.less +9 -0
- package/es/css/popper.less +74 -0
- package/es/css/popup.less +176 -0
- package/es/css/scale.less +37 -0
- package/es/css/select.less +96 -0
- package/es/css/swipe.less +80 -0
- package/es/css/variables.less +29 -0
- package/es/css/zoom.less +34 -0
- package/es/images/layers.png +0 -0
- package/es/images/layers.svg +1 -0
- package/es/images/logo.png +0 -0
- package/es/images/quanping.svg +12 -0
- package/es/index.d.ts +19 -0
- package/es/index.js +717 -0
- package/es/interface.d.ts +29 -0
- package/es/interface.js +1 -0
- package/es/marker-layer.d.ts +46 -0
- package/es/marker-layer.js +509 -0
- package/es/marker.d.ts +66 -0
- package/es/marker.js +495 -0
- package/es/popup/layerPopup.d.ts +105 -0
- package/es/popup/layerPopup.js +341 -0
- package/es/popup/popup.d.ts +147 -0
- package/es/popup/popup.js +587 -0
- package/es/utils/anchor.d.ts +22 -0
- package/es/utils/anchor.js +31 -0
- package/es/utils/eventManager.d.ts +42 -0
- package/es/utils/eventManager.js +84 -0
- package/es/utils/icon.d.ts +1 -0
- package/es/utils/icon.js +12 -0
- package/es/utils/popper.d.ts +76 -0
- package/es/utils/popper.js +257 -0
- package/es/utils/screenfull.d.ts +2 -0
- package/es/utils/screenfull.js +106 -0
- package/lib/assets/iconfont/iconfont.d.ts +21 -0
- package/lib/assets/iconfont/iconfont.js +68 -0
- package/lib/constants/index.d.ts +60 -0
- package/lib/constants/index.js +66 -0
- package/lib/control/baseControl/buttonControl.d.ts +60 -0
- package/lib/control/baseControl/buttonControl.js +149 -0
- package/lib/control/baseControl/control.d.ts +112 -0
- package/lib/control/baseControl/control.js +269 -0
- package/lib/control/baseControl/index.d.ts +4 -0
- package/lib/control/baseControl/index.js +39 -0
- package/lib/control/baseControl/popperControl.d.ts +28 -0
- package/lib/control/baseControl/popperControl.js +99 -0
- package/lib/control/baseControl/selectControl.d.ts +53 -0
- package/lib/control/baseControl/selectControl.js +180 -0
- package/lib/control/exportImage.d.ts +19 -0
- package/lib/control/exportImage.js +80 -0
- package/lib/control/fullscreen.d.ts +20 -0
- package/lib/control/fullscreen.js +95 -0
- package/lib/control/geoLocate.d.ts +17 -0
- package/lib/control/geoLocate.js +67 -0
- package/lib/control/layerSwitch.d.ts +27 -0
- package/lib/control/layerSwitch.js +162 -0
- package/lib/control/logo.d.ts +14 -0
- package/lib/control/logo.js +55 -0
- package/lib/control/mapTheme.d.ts +11 -0
- package/lib/control/mapTheme.js +76 -0
- package/lib/control/mouseLocation.d.ts +16 -0
- package/lib/control/mouseLocation.js +59 -0
- package/lib/control/scale.d.ts +35 -0
- package/lib/control/scale.js +128 -0
- package/lib/control/swipe.d.ts +66 -0
- package/lib/control/swipe.js +399 -0
- package/lib/control/zoom.d.ts +39 -0
- package/lib/control/zoom.js +107 -0
- package/lib/css/button.less +77 -0
- package/lib/css/control.less +82 -0
- package/lib/css/index.css +653 -0
- package/lib/css/index.less +13 -0
- package/lib/css/l7.less +69 -0
- package/lib/css/layerPopup.less +9 -0
- package/lib/css/logo.less +21 -0
- package/lib/css/mouseLocation.less +9 -0
- package/lib/css/popper.less +74 -0
- package/lib/css/popup.less +176 -0
- package/lib/css/scale.less +37 -0
- package/lib/css/select.less +96 -0
- package/lib/css/swipe.less +80 -0
- package/lib/css/variables.less +29 -0
- package/lib/css/zoom.less +34 -0
- package/lib/images/layers.png +0 -0
- package/lib/images/layers.svg +1 -0
- package/lib/images/logo.png +0 -0
- package/lib/images/quanping.svg +12 -0
- package/lib/index.d.ts +19 -0
- package/lib/index.js +844 -0
- package/lib/interface.d.ts +29 -0
- package/lib/interface.js +5 -0
- package/lib/marker-layer.d.ts +46 -0
- package/lib/marker-layer.js +518 -0
- package/lib/marker.d.ts +66 -0
- package/lib/marker.js +502 -0
- package/lib/popup/layerPopup.d.ts +105 -0
- package/lib/popup/layerPopup.js +348 -0
- package/lib/popup/popup.d.ts +147 -0
- package/lib/popup/popup.js +594 -0
- package/lib/utils/anchor.d.ts +22 -0
- package/lib/utils/anchor.js +38 -0
- package/lib/utils/eventManager.d.ts +42 -0
- package/lib/utils/eventManager.js +92 -0
- package/lib/utils/icon.d.ts +1 -0
- package/lib/utils/icon.js +19 -0
- package/lib/utils/popper.d.ts +76 -0
- package/lib/utils/popper.js +264 -0
- package/lib/utils/screenfull.d.ts +2 -0
- package/lib/utils/screenfull.js +112 -0
- package/package.json +5 -5
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import { PositionType } from '@antv/l7-core';
|
|
4
|
+
import { DOM } from '@antv/l7-utils';
|
|
5
|
+
import { createL7Icon } from "../utils/icon";
|
|
6
|
+
import { Control } from "./baseControl";
|
|
7
|
+
export { Zoom };
|
|
8
|
+
export default class Zoom extends Control {
|
|
9
|
+
constructor(...args) {
|
|
10
|
+
super(...args);
|
|
11
|
+
_defineProperty(this, "disabled", void 0);
|
|
12
|
+
_defineProperty(this, "zoomInButton", void 0);
|
|
13
|
+
_defineProperty(this, "zoomOutButton", void 0);
|
|
14
|
+
_defineProperty(this, "zoomNumDiv", void 0);
|
|
15
|
+
_defineProperty(this, "zoomIn", () => {
|
|
16
|
+
if (!this.disabled && this.mapsService.getZoom() < this.mapsService.getMaxZoom()) {
|
|
17
|
+
this.mapsService.zoomIn();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
_defineProperty(this, "zoomOut", () => {
|
|
21
|
+
if (!this.disabled && this.mapsService.getZoom() > this.mapsService.getMinZoom()) {
|
|
22
|
+
this.mapsService.zoomOut();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
_defineProperty(this, "updateDisabled", () => {
|
|
26
|
+
const mapsService = this.mapsService;
|
|
27
|
+
this.zoomInButton.removeAttribute('disabled');
|
|
28
|
+
this.zoomOutButton.removeAttribute('disabled');
|
|
29
|
+
if (this.disabled || mapsService.getZoom() <= mapsService.getMinZoom()) {
|
|
30
|
+
this.zoomOutButton.setAttribute('disabled', 'true');
|
|
31
|
+
}
|
|
32
|
+
if (this.controlOption.showZoom && this.zoomNumDiv) {
|
|
33
|
+
this.zoomNumDiv.innerText = String(Math.floor(mapsService.getZoom()));
|
|
34
|
+
}
|
|
35
|
+
if (this.disabled || mapsService.getZoom() >= mapsService.getMaxZoom()) {
|
|
36
|
+
this.zoomInButton.setAttribute('disabled', 'true');
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
getDefault(option) {
|
|
41
|
+
return _objectSpread(_objectSpread({}, super.getDefault(option)), {}, {
|
|
42
|
+
position: PositionType.BOTTOMRIGHT,
|
|
43
|
+
name: 'zoom',
|
|
44
|
+
zoomInText: createL7Icon('l7-icon-enlarge'),
|
|
45
|
+
zoomInTitle: 'Zoom in',
|
|
46
|
+
zoomOutText: createL7Icon('l7-icon-narrow'),
|
|
47
|
+
zoomOutTitle: 'Zoom out',
|
|
48
|
+
showZoom: false
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
setOptions(newOptions) {
|
|
52
|
+
super.setOptions(newOptions);
|
|
53
|
+
if (this.checkUpdateOption(newOptions, ['zoomInText', 'zoomInTitle', 'zoomOutText', 'zoomOutTitle', 'showZoom'])) {
|
|
54
|
+
this.resetButtonGroup(this.container);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
onAdd() {
|
|
58
|
+
const container = DOM.create('div', 'l7-control-zoom');
|
|
59
|
+
this.resetButtonGroup(container);
|
|
60
|
+
this.mapsService.on('zoomend', this.updateDisabled);
|
|
61
|
+
this.mapsService.on('zoomchange', this.updateDisabled);
|
|
62
|
+
return container;
|
|
63
|
+
}
|
|
64
|
+
onRemove() {
|
|
65
|
+
this.mapsService.off('zoomend', this.updateDisabled);
|
|
66
|
+
this.mapsService.off('zoomchange', this.updateDisabled);
|
|
67
|
+
}
|
|
68
|
+
disable() {
|
|
69
|
+
this.disabled = true;
|
|
70
|
+
this.updateDisabled();
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
enable() {
|
|
74
|
+
this.disabled = false;
|
|
75
|
+
this.updateDisabled();
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
resetButtonGroup(container) {
|
|
79
|
+
DOM.clearChildren(container);
|
|
80
|
+
this.zoomInButton = this.createButton(this.controlOption.zoomInText, this.controlOption.zoomInTitle, 'l7-button-control', container, this.zoomIn);
|
|
81
|
+
if (this.controlOption.showZoom) {
|
|
82
|
+
this.zoomNumDiv = this.createButton('0', '', 'l7-button-control l7-control-zoom__number', container);
|
|
83
|
+
}
|
|
84
|
+
this.zoomOutButton = this.createButton(this.controlOption.zoomOutText, this.controlOption.zoomOutTitle, 'l7-button-control', container, this.zoomOut);
|
|
85
|
+
this.updateDisabled();
|
|
86
|
+
}
|
|
87
|
+
createButton(html, tile, className, container, fn) {
|
|
88
|
+
const link = DOM.create('button', className, container);
|
|
89
|
+
if (typeof html === 'string') {
|
|
90
|
+
link.innerHTML = html;
|
|
91
|
+
} else {
|
|
92
|
+
link.append(html);
|
|
93
|
+
}
|
|
94
|
+
link.title = tile;
|
|
95
|
+
if (fn) {
|
|
96
|
+
link.addEventListener('click', fn);
|
|
97
|
+
}
|
|
98
|
+
return link;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@import url('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
|
+
|
|
38
|
+
.l7-iconfont {
|
|
39
|
+
margin-top: 3px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.l7-button-control__text {
|
|
43
|
+
margin-top: 3px;
|
|
44
|
+
font-size: 10px;
|
|
45
|
+
transform: scale(0.83333);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:not(:disabled) {
|
|
50
|
+
&:hover {
|
|
51
|
+
background-color: @l7-btn-control-bg-hover-color;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:active {
|
|
55
|
+
background-color: @l7-btn-control-bg-active-color;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:disabled {
|
|
60
|
+
background-color: @l7-btn-control-disabled-bg-color;
|
|
61
|
+
color: @l7-btn-control-disabled-font-color;
|
|
62
|
+
cursor: not-allowed;
|
|
63
|
+
|
|
64
|
+
.l7-iconfont {
|
|
65
|
+
fill: @l7-btn-control-disabled-font-color;
|
|
66
|
+
color: @l7-btn-control-disabled-font-color;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:hover {
|
|
70
|
+
background-color: @l7-btn-control-disabled-bg-color;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:active {
|
|
74
|
+
background-color: @l7-btn-control-disabled-bg-color;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@import url('variables.less');
|
|
2
|
+
|
|
3
|
+
.l7-control-container {
|
|
4
|
+
font:
|
|
5
|
+
12px/1.5 'Helvetica Neue',
|
|
6
|
+
Arial,
|
|
7
|
+
Helvetica,
|
|
8
|
+
sans-serif;
|
|
9
|
+
|
|
10
|
+
.l7-control {
|
|
11
|
+
position: relative;
|
|
12
|
+
z-index: @l7-control-z-index;
|
|
13
|
+
float: left;
|
|
14
|
+
clear: both;
|
|
15
|
+
color: @l7-control-font-color;
|
|
16
|
+
font-size: @l7-control-font-size;
|
|
17
|
+
pointer-events: visiblepainted; /* IE 9-10 doesn't have auto */
|
|
18
|
+
pointer-events: auto;
|
|
19
|
+
|
|
20
|
+
&.l7-control--hide {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
each(@position-list,{
|
|
26
|
+
.l7-@{value} {
|
|
27
|
+
@{value}: 0;
|
|
28
|
+
display: flex;
|
|
29
|
+
position: absolute;
|
|
30
|
+
z-index: @l7-control-z-index;
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
.l7-control:not(.l7-control--hide) {
|
|
33
|
+
margin-@{value}: @l7-control-space;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
.l7-center {
|
|
39
|
+
position: absolute;
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
|
|
43
|
+
&.l7-top,
|
|
44
|
+
&.l7-bottom {
|
|
45
|
+
width: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.l7-left,
|
|
49
|
+
&.l7-right {
|
|
50
|
+
height: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.l7-control {
|
|
54
|
+
margin-right: @l7-control-space;
|
|
55
|
+
margin-bottom: @l7-control-space;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.l7-row {
|
|
60
|
+
flex-direction: row;
|
|
61
|
+
|
|
62
|
+
&.l7-top {
|
|
63
|
+
align-items: flex-start;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.l7-bottom {
|
|
67
|
+
align-items: flex-end;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.l7-column {
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
|
|
74
|
+
&.l7-left {
|
|
75
|
+
align-items: flex-start;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.l7-right {
|
|
79
|
+
align-items: flex-end;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|