tg-map-vue3 3.7.2 → 3.7.3

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 CHANGED
@@ -3,6 +3,7 @@
3
3
  ## 3.7.x
4
4
 
5
5
  - feat: 添加[IconSequence]到[TgPolyline]中
6
+ - ***BREAKING CHANGE***: [MapStyle]简化成纯对象, 方便使用
6
7
 
7
8
  ## 3.6.x
8
9
 
@@ -67,3 +68,4 @@
67
68
  [LatLngBounds]: src/map/lat-lng.ts#L157
68
69
  [LatLng]: src/map/lat-lng.ts#L26
69
70
  [BaiduShape]: src/map/map/overlay/shape.ts#L32
71
+ [MapStyle]: src/map/map/map-options.ts#72
@@ -43,7 +43,7 @@ export declare class BaiduMap extends AbstractMap {
43
43
  setZoom(zoom: number): void;
44
44
  setMinZoom(zoom: number): void;
45
45
  setMaxZoom(zoom: number): void;
46
- setMapStyle(mapStyle: MapStyle): void;
46
+ setMapStyle(mapStyle?: MapStyle): void;
47
47
  setBuildInMapTypeId(id: BuildInMapTypeId): void;
48
48
  setMapType(mapType: MapType): void;
49
49
  getMapType(): MapType;
@@ -41,7 +41,7 @@ export declare class GoogleMap extends AbstractMap {
41
41
  setCenter(latlng: LatLng): void;
42
42
  setMinZoom(zoom: number): void;
43
43
  setMaxZoom(zoom: number): void;
44
- setMapStyle(mapStyle: MapStyle): void;
44
+ setMapStyle(mapStyle?: MapStyle): void;
45
45
  setBuildInMapTypeId(id: BuildInMapTypeId): void;
46
46
  setMapType(mapType: MapType): void;
47
47
  getMapType(): MapType;
@@ -40,7 +40,7 @@ export declare class HereMap extends AbstractMap {
40
40
  setDoubleClickZoom(enable: boolean): void;
41
41
  setMinZoom(zoom: number): void;
42
42
  setMaxZoom(zoom: number): void;
43
- setMapStyle(mapStyle: MapStyle): void;
43
+ setMapStyle(mapStyle?: MapStyle): void;
44
44
  setBuildInMapTypeId(id: BuildInMapTypeId): void;
45
45
  setMapType(mapType: MapType): void;
46
46
  getMapType(): MapType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="baidumap-web-sdk" />
1
2
  /// <reference types="google.maps" />
2
3
  import { LatLng } from '../lat-lng';
3
4
  import type { BuildInMapTypeId } from './map-type';
@@ -43,14 +44,19 @@ export interface MapOptions {
43
44
  export declare namespace MapOptions {
44
45
  function create(options?: Partial<MapOptions>): MapOptions;
45
46
  }
47
+ /**
48
+ * ## 本地样式编辑器
49
+ * - google: https://mapstyle.withgoogle.com/
50
+ * - baidu: https://lbsyun.baidu.com/apiconsole/custommap
51
+ *
52
+ * ## 关于云端样式
53
+ * - google: mapId只有创建时有效, 之后再更改无效
54
+ * - baidu: styleId无效, 原因未知
55
+ */
46
56
  export interface MapStyle {
47
- toBaidu(): BMap.MapStyleV2;
48
- toGoogle(): google.maps.MapTypeStyle[];
49
- }
50
- export declare class SimpleMapStyle implements MapStyle {
51
57
  baidu: BMap.MapStyleV2;
52
- google: google.maps.MapTypeStyle[];
53
- constructor(baidu: BMap.MapStyleV2, google: google.maps.MapTypeStyle[]);
54
- toBaidu(): BMap.MapStyleV2;
55
- toGoogle(): google.maps.MapTypeStyle[];
58
+ google: {
59
+ styles?: google.maps.MapTypeStyle[];
60
+ mapId?: string;
61
+ };
56
62
  }
@@ -116,7 +116,7 @@ export declare abstract class AbstractMap implements CoordTypeSupplier, Tg.Event
116
116
  abstract setCenter(latlng: LatLng): void;
117
117
  abstract setMinZoom(zoom: number): void;
118
118
  abstract setMaxZoom(zoom: number): void;
119
- abstract setMapStyle(mapStyle: MapStyle): void;
119
+ abstract setMapStyle(mapStyle?: MapStyle): void;
120
120
  /** setMapType的便利版, 只能够用来设置内置地图类型 */
121
121
  abstract setBuildInMapTypeId(id: BuildInMapTypeId): void;
122
122
  abstract setMapType(mapType: MapType): void;
package/dist/tg-map.js CHANGED
@@ -4222,7 +4222,7 @@ class Gi extends Tt {
4222
4222
  mapType: r.buildInMapTypeId && ((s = this.buildInMapTypeId2BIMT.get(r.buildInMapTypeId)) == null ? void 0 : s.asBaiduMapType()),
4223
4223
  enableMapClick: !1
4224
4224
  // 关闭底图点击功能
4225
- }), this.map.centerAndZoom(r.center.toBaidu(this.coordType), r.zoom + ee), this.setGestureHandling(r.gestureHandling), r.infoWindowMode === "multi" && console.warn("baidu不支持多个InfoWindow, 可能会出现未知问题"), r.mapStyle && this.map.setMapStyleV2(r.mapStyle.toBaidu()), this.setEventTargetDelegate(new ae(this.map, this)), this.map.addEventListener("addoverlay", (n) => {
4225
+ }), this.map.centerAndZoom(r.center.toBaidu(this.coordType), r.zoom + ee), this.setGestureHandling(r.gestureHandling), r.infoWindowMode === "multi" && console.warn("baidu不支持多个InfoWindow, 可能会出现未知问题"), r.mapStyle && this.map.setMapStyleV2(r.mapStyle.baidu), this.setEventTargetDelegate(new ae(this.map, this)), this.map.addEventListener("addoverlay", (n) => {
4226
4226
  const a = n.target.__info_box__;
4227
4227
  a && (console.debug("add:info-box", a), this.map.addOverlay(a));
4228
4228
  }), this.map.addEventListener("removeoverlay", (n) => {
@@ -4297,7 +4297,7 @@ class Gi extends Tt {
4297
4297
  this.map.setMaxZoom(e + ee);
4298
4298
  }
4299
4299
  setMapStyle(e) {
4300
- this.map.setMapStyleV2(e.toBaidu());
4300
+ this.map.setMapStyleV2((e == null ? void 0 : e.baidu) ?? { styleJson: [] });
4301
4301
  }
4302
4302
  setBuildInMapTypeId(e) {
4303
4303
  var s;
@@ -4381,7 +4381,7 @@ class Gi extends Tt {
4381
4381
  }
4382
4382
  class Zi extends Tt {
4383
4383
  constructor(e, r) {
4384
- var n;
4384
+ var n, a;
4385
4385
  super(e);
4386
4386
  c(this, "buildInMapTypeId2BIMT");
4387
4387
  c(this, "googleMapTypeId2BIMT");
@@ -4407,7 +4407,8 @@ class Zi extends Tt {
4407
4407
  gestureHandling: r.gestureHandling,
4408
4408
  minZoom: r.minZoom,
4409
4409
  maxZoom: r.maxZoom,
4410
- styles: (n = r.mapStyle) == null ? void 0 : n.toGoogle(),
4410
+ styles: (n = r.mapStyle) == null ? void 0 : n.google.styles,
4411
+ mapId: (a = r.mapStyle) == null ? void 0 : a.google.mapId,
4411
4412
  mapTypeId: s == null ? void 0 : s.getGoogleMapTypeId()
4412
4413
  }), this.setEventTargetDelegate(new re(this.map, this));
4413
4414
  }
@@ -4464,7 +4465,10 @@ class Zi extends Tt {
4464
4465
  this.map.setOptions({ maxZoom: e });
4465
4466
  }
4466
4467
  setMapStyle(e) {
4467
- this.map.setOptions({ styles: e.toGoogle() });
4468
+ this.map.setOptions({
4469
+ styles: e == null ? void 0 : e.google.styles,
4470
+ mapId: e == null ? void 0 : e.google.mapId
4471
+ });
4468
4472
  }
4469
4473
  setBuildInMapTypeId(e) {
4470
4474
  var s;