tg-map-vue3 3.4.4 → 3.4.6

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
@@ -4,7 +4,9 @@
4
4
 
5
5
  - feat: 添加矩形[TgRectangle]
6
6
  - feat: 点/圆/矩形/多边形/多段线 在`editable`/`draggable`模式时支持双向绑定
7
+ - fix: 修复[TgCircle]在某些情况下半径会变成0的问题
7
8
  - ***BREAKING CHANGE***: [TgPolygon].polygon, [TgPolyline].polyline 属性, 统一改成`overlay`
9
+ - ***BREAKING CHANGE***: 修复`setDisableDoubleClickZoom(type)`在google/baidu行为相反的问题, 并且重命名为`setDoubleClickZoom(enable)`
8
10
 
9
11
  ## 3.3.x
10
12
 
@@ -27,6 +29,7 @@
27
29
  - ***BREAKING CHANGE***: 迁移到Vue3
28
30
 
29
31
  [TgMap]: src/components/TgMap.vue
32
+ [TgCircle]: src/components/overlays/TgCircle.vue
30
33
  [TgRectangle]: src/components/overlays/TgRectangle.vue
31
34
  [TgPolygon]: src/components/overlays/TgPolygon.vue
32
35
  [TgPolyline]: src/components/overlays/TgPolyline.vue
@@ -22,7 +22,6 @@ import { BaiduPolygon } from './overlay/polygon';
22
22
  import { BaiduPolyline } from './overlay/polyline';
23
23
  import { BaiduRectangle } from './overlay/rectangle';
24
24
  export declare class BaiduMap extends AbstractMap {
25
- setDefaultCursor(cursor: string): void;
26
25
  private buildInMapTypeId2BIMT;
27
26
  private baiduMapType2BIMT;
28
27
  private map;
@@ -34,8 +33,9 @@ export declare class BaiduMap extends AbstractMap {
34
33
  removeEventListener<K extends keyof AbstractMapEventMap>(type: K, listener: (event: AbstractMapEventMap[K]) => void): void;
35
34
  fromContainerPointToLatLng(point: Point): LatLng;
36
35
  fromLatLngToContainerPoint(latLng: LatLng): Point;
36
+ setDefaultCursor(cursor: string): void;
37
37
  setDraggable(draggable: boolean): void;
38
- setDisableDoubleClickZoom(type: boolean): void;
38
+ setDoubleClickZoom(enable: boolean): void;
39
39
  getCenter(): LatLng;
40
40
  setCenter(latlng: LatLng): void;
41
41
  getZoom(): number;
@@ -24,7 +24,6 @@ import { GooglePolyline } from './overlay/polyline';
24
24
  import { GoogleRectangle } from './overlay/rectangle';
25
25
  export declare class GoogleMap extends AbstractMap {
26
26
  mapOptions: MapOptions;
27
- setDefaultCursor(cursor: string): void;
28
27
  private buildInMapTypeId2BIMT;
29
28
  private googleMapTypeId2BIMT;
30
29
  private map;
@@ -34,8 +33,9 @@ export declare class GoogleMap extends AbstractMap {
34
33
  get coordType(): import("../lat-lng").CoordType;
35
34
  fromContainerPointToLatLng(point: Point): LatLng;
36
35
  fromLatLngToContainerPoint(latLng: LatLng): Point;
36
+ setDefaultCursor(cursor: string): void;
37
37
  setDraggable(draggable: boolean): void;
38
- setDisableDoubleClickZoom(type: boolean): void;
38
+ setDoubleClickZoom(enable: boolean): void;
39
39
  getCenter(): LatLng;
40
40
  setCenter(latlng: LatLng): void;
41
41
  setMinZoom(zoom: number): void;
@@ -24,7 +24,6 @@ import type { PolylineOptions, PolylineOverlay } from './overlay/polyline';
24
24
  import type { RectangleOptions, RectangleOverlay } from './overlay/rectangle';
25
25
  export declare class HereMap extends AbstractMap {
26
26
  mapOptions: MapOptions;
27
- setDefaultCursor(cursor: string): void;
28
27
  private map;
29
28
  defaultLayers: H.service.DefaultLayers;
30
29
  constructor(element: HTMLElement, mapOptions: MapOptions);
@@ -35,8 +34,9 @@ export declare class HereMap extends AbstractMap {
35
34
  setGestureHandling(gestureHandling: GestureHandlingOptions): void;
36
35
  fromContainerPointToLatLng(point: Point): LatLng;
37
36
  fromLatLngToContainerPoint(latLng: LatLng): Point;
37
+ setDefaultCursor(cursor: string): void;
38
38
  setDraggable(draggable: boolean): void;
39
- setDisableDoubleClickZoom(type: boolean): void;
39
+ setDoubleClickZoom(enable: boolean): void;
40
40
  setMinZoom(zoom: number): void;
41
41
  setMaxZoom(zoom: number): void;
42
42
  setMapStyle(mapStyle: MapStyle): void;
@@ -95,14 +95,15 @@ export declare abstract class AbstractMap implements CoordTypeSupplier, Tg.Event
95
95
  abstract fromContainerPointToLatLng(point: Point): LatLng;
96
96
  /** @see fromContainerPointToLatLng */
97
97
  abstract fromLatLngToContainerPoint(latLng: LatLng): Point;
98
+ abstract setDefaultCursor(cursor: CSS.Property.Cursor): void;
98
99
  /**
99
100
  * ## 不同行为
100
101
  * - baidu: 禁用拖拽后, 依然可以滚轮缩放
101
102
  * - google: 禁用拖拽后, 不能滚轮缩放
102
103
  */
103
104
  abstract setDraggable(draggable: boolean): void;
104
- abstract setDefaultCursor(cursor: CSS.Property.Cursor): void;
105
- abstract setDisableDoubleClickZoom(type: boolean): void;
105
+ /** 启用/禁用双击放大 */
106
+ abstract setDoubleClickZoom(enable: boolean): void;
106
107
  abstract getCenter(): LatLng;
107
108
  /**
108
109
  * ## {@link setZoom}和{@link setCenter}的调用顺序问题
package/dist/tg-map.js CHANGED
@@ -2766,14 +2766,18 @@ class at extends ur {
2766
2766
  static create(e) {
2767
2767
  const r = this.coordType, s = new BMap.Circle(e.center.toBaidu(r), e.radius, {
2768
2768
  enableClicking: e.clickable,
2769
- enableEditing: e.editable,
2769
+ // 详见: {@macros circle.baidu.radius_maybe_zero}
2770
+ enableEditing: !1,
2771
+ // options.editable,
2770
2772
  strokeColor: e.strokeColor,
2771
2773
  strokeOpacity: e.strokeOpacity,
2772
2774
  strokeWeight: e.strokeWeight,
2773
2775
  fillColor: e.fillColor,
2774
2776
  fillOpacity: e.fillOpacity
2775
- });
2776
- return new at(s, r, this, { editable: !!e.editable }).visibleOptionInternal(e.visible);
2777
+ }), n = new at(s, r, this, { editable: !!e.editable }).visibleOptionInternal(e.visible);
2778
+ return n.state.editable && setTimeout(() => {
2779
+ n.state.editable && s.enableEditing();
2780
+ }, 0), n;
2777
2781
  }
2778
2782
  createDelegate() {
2779
2783
  return this.eventHubDelegate = new Re(super.createDelegate(), {
@@ -3581,7 +3585,7 @@ class vt extends yt {
3581
3585
  strokeOpacity: e.strokeOpacity,
3582
3586
  strokeWeight: e.strokeWeight
3583
3587
  });
3584
- return new vt(s, r, this, { editable: e.editable === !0 }).visibleOptionInternal(e.visible);
3588
+ return new vt(s, r, this, { editable: !!e.editable }).visibleOptionInternal(e.visible);
3585
3589
  }
3586
3590
  getPath() {
3587
3591
  return this.innerOverlay.getPath().map((e) => y.fromBaidu(e, this.coordType));
@@ -3833,9 +3837,6 @@ class Oi extends nt {
3833
3837
  a && (console.debug("remove:info-box", a), this.map.removeOverlay(a));
3834
3838
  });
3835
3839
  }
3836
- setDefaultCursor(e) {
3837
- this.innerMap.setDefaultCursor(e);
3838
- }
3839
3840
  setGestureHandling(e = G.auto) {
3840
3841
  switch (e === G.auto && (e = this.element.parentElement && Ve.isScrollable(this.element.parentElement) ? G.cooperative : G.greedy), e) {
3841
3842
  case G.cooperative:
@@ -3875,10 +3876,13 @@ class Oi extends nt {
3875
3876
  fromLatLngToContainerPoint(e) {
3876
3877
  return this.innerMap.pointToPixel(e.toBaidu(this.coordType));
3877
3878
  }
3879
+ setDefaultCursor(e) {
3880
+ this.innerMap.setDefaultCursor(e);
3881
+ }
3878
3882
  setDraggable(e) {
3879
3883
  e ? this.innerMap.enableDragging() : this.innerMap.disableDragging();
3880
3884
  }
3881
- setDisableDoubleClickZoom(e) {
3885
+ setDoubleClickZoom(e) {
3882
3886
  e ? this.map.enableDoubleClickZoom() : this.map.disableDoubleClickZoom();
3883
3887
  }
3884
3888
  getCenter() {
@@ -4011,9 +4015,6 @@ class Ci extends nt {
4011
4015
  mapTypeId: s == null ? void 0 : s.getGoogleMapTypeId()
4012
4016
  }), this.setEventTargetDelegate(new ee(this.map, this));
4013
4017
  }
4014
- setDefaultCursor(e) {
4015
- this.innerMap.setOptions({ draggableCursor: e });
4016
- }
4017
4018
  setGestureHandling(e) {
4018
4019
  this.map.setOptions({
4019
4020
  gestureHandling: e
@@ -4045,11 +4046,14 @@ class Ci extends nt {
4045
4046
  const o = Math.pow(2, h), l = r.fromLatLngToPoint(e.toGoogle(this.coordType));
4046
4047
  return l == null ? q.ZERO : { x: (l.x - n.x) * o, y: (l.y - a.y) * o };
4047
4048
  }
4049
+ setDefaultCursor(e) {
4050
+ this.innerMap.setOptions({ draggableCursor: e });
4051
+ }
4048
4052
  setDraggable(e) {
4049
4053
  this.innerMap.setOptions({ draggable: e });
4050
4054
  }
4051
- setDisableDoubleClickZoom(e) {
4052
- this.map.setOptions({ disableDoubleClickZoom: e });
4055
+ setDoubleClickZoom(e) {
4056
+ this.map.setOptions({ disableDoubleClickZoom: !e });
4053
4057
  }
4054
4058
  getCenter() {
4055
4059
  return y.fromGoogle(this.map.getCenter() ?? Y.LATLNG_ZERO, this.coordType);
@@ -4155,9 +4159,6 @@ class wi extends nt {
4155
4159
  center: (a = r.center) == null ? void 0 : a.toHere(this.coordType)
4156
4160
  }), new H.mapevents.Behavior(new H.mapevents.MapEvents(this.map)), H.ui.UI.createDefault(this.map, this.defaultLayers);
4157
4161
  }
4158
- setDefaultCursor(e) {
4159
- throw new Error("Method not implemented.");
4160
- }
4161
4162
  get innerMap() {
4162
4163
  return this.map;
4163
4164
  }
@@ -4180,10 +4181,13 @@ class wi extends nt {
4180
4181
  fromLatLngToContainerPoint(e) {
4181
4182
  throw new Error("Method not implemented.");
4182
4183
  }
4184
+ setDefaultCursor(e) {
4185
+ throw new Error("Method not implemented.");
4186
+ }
4183
4187
  setDraggable(e) {
4184
4188
  throw new Error("Method not implemented.");
4185
4189
  }
4186
- setDisableDoubleClickZoom(e) {
4190
+ setDoubleClickZoom(e) {
4187
4191
  throw new Error("Method not implemented.");
4188
4192
  }
4189
4193
  setMinZoom(e) {