tg-map-vue3 3.6.4 → 3.6.7
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/CHANGELOG.md +3 -1
- package/dist/src/components/overlays/TgMarker.vue.d.ts +6 -0
- package/dist/src/map/lat-lng.d.ts +28 -1
- package/dist/src/map/map/extra/map-urls.d.ts +8 -0
- package/dist/src/map/map/extra/marker-clusterer.d.ts +5 -1
- package/dist/src/map/map/overlay/marker.d.ts +10 -0
- package/dist/tg-map.js +684 -615
- package/dist/tg-map.js.map +1 -1
- package/dist/tg-map.umd.cjs +5 -5
- package/dist/tg-map.umd.cjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## 3.6.x
|
|
4
4
|
|
|
5
|
-
- feat: 添加[MapUrls], 支持打开地图网页
|
|
5
|
+
- feat: 添加[MapUrls], 支持打开地图网页(导航和搜索)
|
|
6
|
+
- feat: [LatLng]和[TgMarker]添加`normalize`相关方法/参数, 处理经纬度不合法的问题
|
|
6
7
|
- fix: 百度地图的覆盖物([BaiduShape])不能隐藏填充/线条颜色的问题
|
|
7
8
|
- perf: [TgLabel]/[TgInfoBox]/[TgInfoWindow]和[TgMarker]不必紧密相邻, 可以放其他组件
|
|
8
9
|
- ***BREAKING CHANGE***: `placeService` -> `placesService`
|
|
@@ -59,4 +60,5 @@
|
|
|
59
60
|
[SearchBox]: src/map/map/extra/search-box.ts "搜索框"
|
|
60
61
|
[useTgMapInner]: src/components/map-hooks.ts
|
|
61
62
|
[LatLngBounds]: src/map/lat-lng.ts#L157
|
|
63
|
+
[LatLng]: src/map/lat-lng.ts#L26
|
|
62
64
|
[BaiduShape]: src/map/map/overlay/shape.ts#L32
|
|
@@ -39,6 +39,9 @@ declare const TgMarker: import("vue").DefineComponent<{
|
|
|
39
39
|
visible: {
|
|
40
40
|
type: PropType<boolean>;
|
|
41
41
|
};
|
|
42
|
+
normalizePositionForBaidu: {
|
|
43
|
+
type: PropType<boolean>;
|
|
44
|
+
};
|
|
42
45
|
'onUpdate:position': import("vue").Prop<import("../../utils/vue-utils").EventCallback<LatLng>>;
|
|
43
46
|
}, {
|
|
44
47
|
attrs: import("vue").ComputedRef<{
|
|
@@ -233,6 +236,9 @@ declare const TgMarker: import("vue").DefineComponent<{
|
|
|
233
236
|
visible: {
|
|
234
237
|
type: PropType<boolean>;
|
|
235
238
|
};
|
|
239
|
+
normalizePositionForBaidu: {
|
|
240
|
+
type: PropType<boolean>;
|
|
241
|
+
};
|
|
236
242
|
'onUpdate:position': import("vue").Prop<import("../../utils/vue-utils").EventCallback<LatLng>>;
|
|
237
243
|
}>> & {
|
|
238
244
|
onClick?: ((event: import("../../map/event").Tg.MouseEvent) => any) | undefined;
|
|
@@ -28,6 +28,18 @@ export declare class LatLng {
|
|
|
28
28
|
/** 坐标系 */
|
|
29
29
|
readonly coord: CoordType;
|
|
30
30
|
static ZERO: LatLng;
|
|
31
|
+
/**
|
|
32
|
+
* {@template latlng_normalize}
|
|
33
|
+
*
|
|
34
|
+
* 对经纬度进行标准化, 参考google的实现
|
|
35
|
+
*
|
|
36
|
+
* ## 行为不一致
|
|
37
|
+
* - google: google.maps.LatLng的构造器会对经纬度进行标准化, 所有点都能正常显示
|
|
38
|
+
* - baidu: BMap.Point的构造器不会对经纬度进行标准化, 超出范围的点显示到(0, 0)位置
|
|
39
|
+
*
|
|
40
|
+
* {@endtemplate}
|
|
41
|
+
*/
|
|
42
|
+
static _normalize(lng: number, lat: number): number[];
|
|
31
43
|
/** @param coord Baidu Map的坐标一般都是bd09 */
|
|
32
44
|
static fromBaidu(point: BMap.Point, coord: CoordType): LatLng;
|
|
33
45
|
/** @param coord Google Map的坐标依据地图类型不同是不一样的 */
|
|
@@ -49,7 +61,17 @@ export declare class LatLng {
|
|
|
49
61
|
coord: CoordType);
|
|
50
62
|
/** 转换坐标到指定坐标系 */
|
|
51
63
|
to(coordType: StringEnumValue<typeof CoordType>): LatLng;
|
|
52
|
-
|
|
64
|
+
/**
|
|
65
|
+
* TODO: normalize要不要默认设为true, 和google的行为保持一致?
|
|
66
|
+
* 转换成baidu的经纬度
|
|
67
|
+
* @param normalize 转换时是否进行标准化, 默认false
|
|
68
|
+
* @see _normalize {@macro latlng_normalize}
|
|
69
|
+
*/
|
|
70
|
+
toBaidu(coord: CoordType, normalize?: boolean): BMap.Point;
|
|
71
|
+
/**
|
|
72
|
+
* 转换成google的经纬度, 内部会自动进行标准化
|
|
73
|
+
* @see _normalize {@macro latlng_normalize}
|
|
74
|
+
*/
|
|
53
75
|
toGoogle(coord: CoordType): google.maps.LatLng;
|
|
54
76
|
toHere(coord: CoordType): H.geo.Point;
|
|
55
77
|
/**
|
|
@@ -61,6 +83,11 @@ export declare class LatLng {
|
|
|
61
83
|
* @throws 若当前coord和targetCoord相同, 会抛异常, 故请在外部判断
|
|
62
84
|
*/
|
|
63
85
|
_convert(targetCoord: CoordType): LngLatTuple;
|
|
86
|
+
/**
|
|
87
|
+
* 标准化, 返回合法的坐标点
|
|
88
|
+
* @see _normalize {@macro latlng_normalize}
|
|
89
|
+
*/
|
|
90
|
+
normalize(): LatLng;
|
|
64
91
|
equals(other: LatLng): boolean;
|
|
65
92
|
toString(): string;
|
|
66
93
|
}
|
|
@@ -15,6 +15,10 @@ export declare abstract class MapUrls {
|
|
|
15
15
|
* - baidu: 用{@link destination}当作起点
|
|
16
16
|
*/
|
|
17
17
|
abstract directions(origin: Location | undefined, destination: Location, mode?: DirectionMode): URL;
|
|
18
|
+
/**
|
|
19
|
+
* 搜索
|
|
20
|
+
*/
|
|
21
|
+
abstract search(location: Location): URL;
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
24
|
* @see https://developers.google.com/maps/documentation/urls/get-started
|
|
@@ -23,6 +27,8 @@ export declare class GoogleMapUrls extends MapUrls {
|
|
|
23
27
|
static BASE_URL: string;
|
|
24
28
|
/** @see https://developers.google.com/maps/documentation/urls/get-started#directions-action */
|
|
25
29
|
directions(origin: Location | undefined, destination: Location, mode?: GoogleDirectionMode): URL;
|
|
30
|
+
/** @see https://developers.google.com/maps/documentation/urls/get-started#search-action */
|
|
31
|
+
search(location: Location): URL;
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
28
34
|
* @see https://lbsyun.baidu.com/faq/api?title=webapi/uri
|
|
@@ -31,5 +37,7 @@ export declare class BaiduMapUrls extends MapUrls {
|
|
|
31
37
|
static BASE_URL: string;
|
|
32
38
|
/** @see https://lbsyun.baidu.com/faq/api?title=webapi/uri/web#:~:text=%E6%9C%8D%E5%8A%A1%E5%9C%B0%E5%9D%80-,http%3A//api.map.baidu.com/direction,-//PC%26Webapp%E6%9C%8D%E5%8A%A1 */
|
|
33
39
|
directions(origin: Location | undefined, destination: Location, mode?: DirectionMode): URL;
|
|
40
|
+
/** @see https://lbsyun.baidu.com/faq/api?title=webapi/uri/web#%E5%9B%BE%E5%8C%BA%E5%8A%9F%E8%83%BD:~:text=%E4%B8%8D%E4%BF%9D%E8%AF%81%E6%9C%8D%E5%8A%A1%E3%80%82-,2.1.2%20%E5%9C%B0%E5%9D%80%E8%A7%A3%E6%9E%90,-%E8%B0%83%E7%94%A8%E8%AF%A5 */
|
|
41
|
+
search(location: Location): URL;
|
|
34
42
|
}
|
|
35
43
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import GMarkerClusterer from '@google/markerclusterer';
|
|
2
|
+
import BMarkerClusterer from 'bmaplib.markerclusterer';
|
|
1
3
|
import type { Point, Size } from '../../types';
|
|
2
4
|
import type { BaiduMap } from '../baidu-map';
|
|
3
5
|
import type { GoogleMap } from '../google-map';
|
|
@@ -45,7 +47,7 @@ export interface ClusterIconStyle {
|
|
|
45
47
|
*/
|
|
46
48
|
export declare abstract class MarkerClusterer {
|
|
47
49
|
map: AbstractMap;
|
|
48
|
-
inner: any;
|
|
50
|
+
abstract inner: any;
|
|
49
51
|
constructor(map: AbstractMap);
|
|
50
52
|
/** baidu/google 拥有相同的函数名 */
|
|
51
53
|
clearMarkers(): void;
|
|
@@ -60,10 +62,12 @@ export declare abstract class MarkerClusterer {
|
|
|
60
62
|
abstract recreate(): void;
|
|
61
63
|
}
|
|
62
64
|
export declare class BaiduMarkerClusterer extends MarkerClusterer {
|
|
65
|
+
inner: BMarkerClusterer;
|
|
63
66
|
constructor(map: BaiduMap, options: MarkerClustererOptions);
|
|
64
67
|
recreate(): void;
|
|
65
68
|
}
|
|
66
69
|
export declare class GoogleMarkerClusterer extends MarkerClusterer {
|
|
70
|
+
inner: GMarkerClusterer;
|
|
67
71
|
constructor(map: GoogleMap, options: MarkerClustererOptions);
|
|
68
72
|
recreate(): void;
|
|
69
73
|
}
|
|
@@ -12,6 +12,15 @@ import type { BaiduLabelOverlay, GoogleLabelOverlay, LabelOverlay } from './labe
|
|
|
12
12
|
import { BaiduOverlay, GoogleOverlay, Overlay, type OverlayOptions } from './overlay';
|
|
13
13
|
export interface MarkerOptions extends OverlayOptions {
|
|
14
14
|
position: LatLng;
|
|
15
|
+
/**
|
|
16
|
+
* 执行{@link LatLng.toBaidu}时是否对经纬度进行标准化
|
|
17
|
+
*
|
|
18
|
+
* 因为{@link LatLng.toGoogle}内部是会自动标准化的, 并且LatLng绝大部分情况下是合法的,
|
|
19
|
+
* 所以添加这个参数, 只在使用者认为必要的时候, 执行标准化
|
|
20
|
+
*
|
|
21
|
+
* {@macro latlng_normalize}
|
|
22
|
+
*/
|
|
23
|
+
normalizePositionForBaidu?: boolean;
|
|
15
24
|
title?: string;
|
|
16
25
|
icon?: UnionIcon;
|
|
17
26
|
/** @default true */
|
|
@@ -88,6 +97,7 @@ export declare class BaiduMarker extends BaiduOverlay<BMarker> implements Marker
|
|
|
88
97
|
clickable: boolean;
|
|
89
98
|
draggable: boolean;
|
|
90
99
|
zIndex: number | undefined;
|
|
100
|
+
normalize?: boolean;
|
|
91
101
|
});
|
|
92
102
|
getPosition(): LatLng;
|
|
93
103
|
setPosition(position: LatLng): void;
|