tg-map-vue3 3.4.7 → 3.5.1

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
@@ -1,5 +1,10 @@
1
1
  # 更新日志
2
2
 
3
+ ## 3.5.x
4
+
5
+ - fix: [LatLngBounds]为空时中心点计算问题
6
+ - ***BREAKING CHANGE***: `useTgMap` -> [useTgMapInner]
7
+
3
8
  ## 3.4.x
4
9
 
5
10
  - feat: 添加矩形[TgRectangle]
@@ -38,3 +43,5 @@
38
43
  [PlacesService]: src/map/map/extra/places-service.ts "位置服务"
39
44
  [Autocomplete]: src/map/map/extra/autocomplete.ts "自动完成"
40
45
  [SearchBox]: src/map/map/extra/search-box.ts "搜索框"
46
+ [useTgMapInner]: src/components/map-hooks.ts
47
+ [LatLngBounds]: src/map/lat-lng.ts#L157
@@ -1,5 +1,5 @@
1
- import { createEmptyVNode } from '../../utils/vue-utils';
2
1
  import { ControlPosition } from '../../map/map/controls/control';
2
+ import { createEmptyVNode } from '../../utils/vue-utils';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  position: {
5
5
  type: import("vue").PropType<import("../../utils/mapped-types").StringEnumValue<typeof ControlPosition>>;
@@ -1,7 +1,7 @@
1
1
  import { type Ref } from 'vue';
2
2
  import { type AbstractMap } from '.';
3
3
  /** 作为Vue3下, `MapMixin`的替代 */
4
- export declare function useTgMap(): {
4
+ export declare function useTgMapInner(): {
5
5
  mapRef: Ref<AbstractMap | undefined>;
6
6
  /** 读取map对象, 只要放在<tg-map>里面的组件(除#overlay插槽外)都能够立即读取到map对象 */
7
7
  readonly map: AbstractMap;
@@ -14,7 +14,7 @@ declare module 'vue' {
14
14
  [MIXIN_HOOK_DESTROY]?(): void;
15
15
  }
16
16
  }
17
- /** @deprecated 使用{@link useTgMap}替代 */
17
+ /** @deprecated 使用{@link useTgMapInner}替代 */
18
18
  declare const MapMixin: import("vue").DefineComponent<{}, {}, {}, {}, {
19
19
  recreate(): void;
20
20
  }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
@@ -2,7 +2,7 @@
2
2
  /// <reference types="google.maps" />
3
3
  /// <reference types="heremaps" />
4
4
  import { type LngLatTuple } from 'coordtransform';
5
- import { type StringEnumValue } from '../components';
5
+ import { type StringEnumValue } from '../utils/mapped-types';
6
6
  export declare enum CoordType {
7
7
  wgs84 = "wgs84",
8
8
  gcj02 = "gcj02",
package/dist/tg-map.js CHANGED
@@ -125,21 +125,40 @@ function se(i, t) {
125
125
  function je(i) {
126
126
  throw new Error(`Unexpected object: ${i}`);
127
127
  }
128
+ function hs() {
129
+ }
130
+ function Ve(i) {
131
+ return i;
132
+ }
133
+ function cs(i, t) {
134
+ return i instanceof t;
135
+ }
136
+ function ds(i, t) {
137
+ if (i instanceof t)
138
+ return i;
139
+ }
140
+ function Te(i, t) {
141
+ if ((i == null ? void 0 : i.$options.name) === t.name)
142
+ return i;
143
+ }
144
+ function us(i) {
145
+ return i;
146
+ }
128
147
  function E(i) {
129
148
  throw new Error(i);
130
149
  }
131
150
  function Zt(i) {
132
151
  throw new Error(`Unsupported: ${i}`);
133
152
  }
134
- function hs(i) {
153
+ function ps(i) {
135
154
  throw new Error(`todo: ${i}`);
136
155
  }
137
- function cs(i) {
156
+ function gs(i) {
138
157
  return i;
139
158
  }
140
159
  function me(...i) {
141
160
  }
142
- function ds(i) {
161
+ function ms(i) {
143
162
  return i != null;
144
163
  }
145
164
  var Q = /* @__PURE__ */ ((i) => (i.wgs84 = "wgs84", i.gcj02 = "gcj02", i.bd09 = "bd09", i))(Q || {});
@@ -263,6 +282,8 @@ const J = class {
263
282
  return this.sw.lat <= e && e <= this.ne.lat && J.isBetweenLng(this.sw.lng, this.ne.lng, r);
264
283
  }
265
284
  getCenter() {
285
+ if (this.sw.equals(this.ne))
286
+ return this.sw;
266
287
  const t = (this.sw.lat + this.ne.lat) / 2, e = (this.sw.lng + this.ne.lng + (this.sw.lng < this.ne.lng ? 0 : 360)) / 2;
267
288
  return y.create(t, e, this.coord);
268
289
  }
@@ -421,13 +442,13 @@ function Vt() {
421
442
  function qr(i) {
422
443
  i != null && (jt = Ht(Ur, i));
423
444
  }
424
- var Ve;
445
+ var Fe;
425
446
  ((i) => {
426
447
  function t(e) {
427
448
  return e.scrollWidth > e.clientWidth || e.scrollHeight > e.clientHeight;
428
449
  }
429
450
  i.isScrollable = t;
430
- })(Ve || (Ve = {}));
451
+ })(Fe || (Fe = {}));
431
452
  var ae;
432
453
  ((i) => {
433
454
  function t(h, o) {
@@ -487,25 +508,6 @@ var le;
487
508
  }
488
509
  i.listenChanged = r;
489
510
  })(le || (le = {}));
490
- function us() {
491
- }
492
- function Fe(i) {
493
- return i;
494
- }
495
- function ps(i, t) {
496
- return i instanceof t;
497
- }
498
- function gs(i, t) {
499
- if (i instanceof t)
500
- return i;
501
- }
502
- function Te(i, t) {
503
- if ((i == null ? void 0 : i.$options.name) === t.name)
504
- return i;
505
- }
506
- function ms(i) {
507
- return i;
508
- }
509
511
  function Ft(i, t, e) {
510
512
  return i.addListener(t, e).remove;
511
513
  }
@@ -3842,7 +3844,7 @@ class Oi extends nt {
3842
3844
  });
3843
3845
  }
3844
3846
  setGestureHandling(e = G.auto) {
3845
- switch (e === G.auto && (e = this.element.parentElement && Ve.isScrollable(this.element.parentElement) ? G.cooperative : G.greedy), e) {
3847
+ switch (e === G.auto && (e = this.element.parentElement && Fe.isScrollable(this.element.parentElement) ? G.cooperative : G.greedy), e) {
3846
3848
  case G.cooperative:
3847
3849
  this.map.disableScrollWheelZoom(), this.map.enableDragging(), this.map.enableDoubleClickZoom();
3848
3850
  break;
@@ -4554,7 +4556,7 @@ const Cs = () => {
4554
4556
  },
4555
4557
  data() {
4556
4558
  return {
4557
- map: Fe(),
4559
+ map: Ve(),
4558
4560
  isDestroyed: !1
4559
4561
  };
4560
4562
  },
@@ -5212,8 +5214,8 @@ const Is = /* @__PURE__ */ U(Fi, [["render", Ui]]), qi = C({
5212
5214
  return {
5213
5215
  attrs: F(t, i),
5214
5216
  marker: void 0,
5215
- label: Fe(),
5216
- info: Fe(),
5217
+ label: Ve(),
5218
+ info: Ve(),
5217
5219
  emittedPosition: void 0
5218
5220
  };
5219
5221
  },
@@ -5881,21 +5883,21 @@ export {
5881
5883
  gr as createEmptyVNode,
5882
5884
  ki as createPropertyObject,
5883
5885
  Ms as createPropertyObjectTyped,
5884
- cs as debug,
5886
+ gs as debug,
5885
5887
  Zs as default,
5886
5888
  L as eventProp,
5887
5889
  Os as extractVNodeFromSlotsByComponent,
5888
5890
  Ts as findByComponentType,
5889
5891
  ns as getDestination,
5890
5892
  Vt as getTgMapConfig,
5891
- ds as isDef,
5892
- ps as isInstanceOf,
5893
- us as lateinit,
5893
+ ms as isDef,
5894
+ cs as isInstanceOf,
5895
+ hs as lateinit,
5894
5896
  me as noop,
5895
5897
  m as optionalProp,
5896
5898
  bi as path,
5897
5899
  R as requiredProp,
5898
- gs as safeAs,
5900
+ ds as safeAs,
5899
5901
  Te as safeAsComponent,
5900
5902
  qr as setTgMapConfig,
5901
5903
  Bi as splitAttrs,
@@ -5903,11 +5905,11 @@ export {
5903
5905
  Pi as stringUnionPropFromValues,
5904
5906
  E as throwError,
5905
5907
  Zt as throwUnsupported,
5906
- hs as todo,
5907
- Fe as typed,
5908
- ms as unwrapStringEnumValue,
5908
+ ps as todo,
5909
+ Ve as typed,
5910
+ us as unwrapStringEnumValue,
5909
5911
  Cs as useEventLogMethods,
5910
5912
  F as useSplittedAttrs,
5911
- Gi as useTgMap
5913
+ Gi as useTgMapInner
5912
5914
  };
5913
5915
  //# sourceMappingURL=tg-map.js.map