@summeruse/ol 0.1.1 → 0.1.2

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,17 @@
1
1
  # @summeruse/ol
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 007fa24: n-ol-pointermove 的 createOptions 添加 `followTarget` 参数
8
+
9
+ ## 0.1.2-beta.0
10
+
11
+ ### Patch Changes
12
+
13
+ - 007fa24: n-ol-pointermove 的 createOptions 添加 `followTarget` 参数
14
+
3
15
  ## 0.1.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ # @summeruse/ol
2
+
1
3
  <p align="center">
2
4
  <img width="144px" src="https://642661520.github.io/SummerUse/summeruse_logo_256.png" />
3
5
  </p>
package/dist/index.js CHANGED
@@ -1,25 +1,26 @@
1
- import { defineComponent as U, ref as g, onMounted as j, createBlock as pe, openBlock as H, unref as Z, shallowRef as Me, withCtx as ke, createVNode as Fe, inject as Te, watch as d, provide as Ae, createElementBlock as _e, renderSlot as Re, computed as Se, render as z, onUnmounted as he, toValue as Ze } from "vue";
1
+ import { defineComponent as U, ref as S, onMounted as j, createBlock as pe, openBlock as H, unref as Z, shallowRef as Me, withCtx as Fe, createVNode as Te, inject as ke, watch as m, provide as Ae, createElementBlock as _e, renderSlot as Re, computed as Se, render as z, onUnmounted as he, toValue as Ze } from "vue";
2
2
  import { NDropdown as ze, NPopover as Ge } from "naive-ui";
3
3
  import { RenderVNode as Be } from "@summeruse/common";
4
- import { Map as De, View as je, Feature as Q, Overlay as G } from "ol";
4
+ import { getCenter as De } from "ol/extent";
5
+ import { Map as je, View as Ne, Feature as Q, Overlay as G } from "ol";
5
6
  import { Zoom as oe, Attribution as re, Rotate as ie, FullScreen as ae, OverviewMap as ce, ScaleLine as le } from "ol/control";
6
- import { DragPan as se, MouseWheelZoom as ue, DoubleClickZoom as fe, PinchRotate as de, PinchZoom as me, DragRotate as ye, KeyboardPan as ve, KeyboardZoom as we, Draw as Oe, Modify as Ee } from "ol/interaction";
7
- import { Point as Ne, LineString as $, Polygon as K, Circle as Ve, MultiPoint as We, MultiLineString as $e, MultiPolygon as Ke } from "ol/geom";
7
+ import { DragPan as se, MouseWheelZoom as ue, DoubleClickZoom as fe, PinchRotate as me, PinchZoom as de, DragRotate as ye, KeyboardPan as ge, KeyboardZoom as ve, Draw as Oe, Modify as xe } from "ol/interaction";
8
+ import { Point as Ve, LineString as W, Polygon as K, Circle as $e, MultiPoint as We, MultiLineString as Ke, MultiPolygon as Xe } from "ol/geom";
8
9
  import q from "ol/layer/Vector";
9
10
  import J from "ol/source/Vector";
10
- import { destination as Xe, lineString as Ye, length as Ue, area as He, polygon as Qe, bearing as qe, midpoint as Je } from "@turf/turf";
11
- import { Circle as et, Stroke as T, Fill as B, Text as tt, Icon as nt, Style as ot } from "ol/style";
12
- import { Tile as ee, Graticule as rt } from "ol/layer";
13
- import { XYZ as it, BingMaps as at, OSM as ct } from "ol/source";
14
- import { transform as be, transformExtent as xe } from "ol/proj";
15
- const Zt = /* @__PURE__ */ U({
11
+ import { destination as Ye, lineString as Ue, length as He, area as Qe, polygon as qe, bearing as Je, midpoint as et } from "@turf/turf";
12
+ import { Circle as tt, Stroke as k, Fill as B, Text as nt, Icon as ot, Style as rt } from "ol/style";
13
+ import { Tile as ee, Graticule as it } from "ol/layer";
14
+ import { XYZ as at, BingMaps as ct, OSM as lt } from "ol/source";
15
+ import { transform as Ee, transformExtent as be } from "ol/proj";
16
+ const Gt = /* @__PURE__ */ U({
16
17
  __name: "index",
17
18
  props: {
18
19
  olMap: {},
19
20
  createOptions: { type: Function }
20
21
  },
21
22
  setup(t) {
22
- const e = t, { olMap: n } = e, a = g({
23
+ const e = t, { olMap: n } = e, a = S({
23
24
  visible: !1,
24
25
  x: 0,
25
26
  y: 0
@@ -27,13 +28,13 @@ const Zt = /* @__PURE__ */ U({
27
28
  function r() {
28
29
  a.value.visible = !1;
29
30
  }
30
- const i = g();
31
+ const i = S();
31
32
  j(() => {
32
33
  const f = n.getViewport();
33
34
  f && (f.oncontextmenu = (s) => {
34
35
  s.preventDefault();
35
- const l = n.getEventPixel(s), w = n.getEventCoordinate(s), y = n.getFeaturesAtPixel(l);
36
- i.value = e.createOptions({ event: s, pixel: l, coordinate: w, features: y }), a.value = {
36
+ const l = n.getEventPixel(s), d = n.getEventCoordinate(s), g = n.getFeaturesAtPixel(l);
37
+ i.value = e.createOptions({ event: s, pixel: l, coordinate: d, features: g }), a.value = {
37
38
  visible: !0,
38
39
  x: s.clientX,
39
40
  y: s.clientY
@@ -55,29 +56,40 @@ const Zt = /* @__PURE__ */ U({
55
56
  onSelect: c
56
57
  }, null, 8, ["show", "x", "y", "options"]));
57
58
  }
58
- }), zt = /* @__PURE__ */ U({
59
+ }), Bt = /* @__PURE__ */ U({
59
60
  __name: "index",
60
61
  props: {
61
62
  olMap: {},
62
63
  createOptions: { type: Function }
63
64
  },
64
65
  setup(t) {
65
- const e = t, n = g({
66
+ const e = t, n = S({
66
67
  visible: !1,
67
68
  x: 0,
68
69
  y: 0
69
- }), a = Me(), r = g("bottom-start"), i = g(!1), c = g(!1);
70
+ }), a = Me(), r = S("bottom-start"), i = S(!1), c = S(!1);
70
71
  return j(() => {
71
72
  var f;
72
73
  (f = e.olMap) == null || f.on("pointermove", (s) => {
73
- const l = e.olMap.getFeaturesAtPixel(s.pixel), { clientX: w, clientY: y } = s.originalEvent;
74
+ const l = e.olMap.getFeaturesAtPixel(s.pixel);
74
75
  n.value.visible = !1;
75
- const m = e.createOptions({
76
+ const d = e.createOptions({
76
77
  pixel: s.pixel,
77
78
  coordinate: s.coordinate,
78
79
  features: l
79
80
  });
80
- m && (a.value = m.content, r.value = m.placement || "bottom-start", c.value = m.showArrow || !1, i.value = m.raw || !1, n.value.visible = !0, n.value.x = w, n.value.y = y);
81
+ if (d) {
82
+ if (a.value = d.content, r.value = d.placement || "bottom-start", c.value = d.showArrow || !1, i.value = d.raw || !1, n.value.visible = !0, d.followTarget === "feature" && l.length > 0) {
83
+ const w = l[0].getGeometry();
84
+ if (w) {
85
+ const E = w.getExtent(), p = De(E), h = e.olMap.getPixelFromCoordinate(p), { top: b, left: L } = e.olMap.getViewport().getBoundingClientRect();
86
+ n.value.x = h[0] + L, n.value.y = h[1] + b;
87
+ return;
88
+ }
89
+ }
90
+ const { clientX: g, clientY: v } = s.originalEvent;
91
+ n.value.x = g, n.value.y = v;
92
+ }
81
93
  });
82
94
  }), (f, s) => (H(), pe(Z(Ge), {
83
95
  "show-arrow": c.value,
@@ -92,20 +104,20 @@ const Zt = /* @__PURE__ */ U({
92
104
  boxShadow: "none"
93
105
  }
94
106
  }, {
95
- default: ke(() => [
96
- Fe(Z(Be), { "dynamic-v-node": a.value }, null, 8, ["dynamic-v-node"])
107
+ default: Fe(() => [
108
+ Te(Z(Be), { "dynamic-v-node": a.value }, null, 8, ["dynamic-v-node"])
97
109
  ]),
98
110
  _: 1
99
111
  }, 8, ["show-arrow", "raw", "placement", "show", "x", "y"]));
100
112
  }
101
113
  }), Le = Symbol("olMapInjectionKey");
102
- function Gt() {
103
- return Te(Le);
114
+ function Dt() {
115
+ return ke(Le);
104
116
  }
105
- const Bt = /* @__PURE__ */ U({
117
+ const jt = /* @__PURE__ */ U({
106
118
  __name: "index",
107
119
  props: {
108
- olMap: { default: () => new De() },
120
+ olMap: { default: () => new je() },
109
121
  center: { default: () => [0, 0] },
110
122
  zoom: { default: 2 },
111
123
  minZoom: { default: 2 },
@@ -127,87 +139,87 @@ const Bt = /* @__PURE__ */ U({
127
139
  altShiftDragRotate: { type: Boolean }
128
140
  },
129
141
  setup(t, { expose: e }) {
130
- const n = t, a = g(), r = n.olMap, i = new je({
142
+ const n = t, a = S(), r = n.olMap, i = new Ne({
131
143
  projection: n.projection,
132
144
  extent: n.extent
133
145
  });
134
- r.setView(i), d(() => n.zoom, (o) => {
146
+ r.setView(i), m(() => n.zoom, (o) => {
135
147
  i.setZoom(o);
136
148
  }, {
137
149
  immediate: !0
138
- }), d(() => n.center, (o) => {
150
+ }), m(() => n.center, (o) => {
139
151
  i.setCenter(o);
140
152
  }, {
141
153
  immediate: !0
142
- }), d(() => n.constrainResolution, (o) => {
154
+ }), m(() => n.constrainResolution, (o) => {
143
155
  i.setConstrainResolution(o);
144
156
  }, {
145
157
  immediate: !0
146
- }), d(() => n.minZoom, (o) => {
158
+ }), m(() => n.minZoom, (o) => {
147
159
  o && i.setMinZoom(o);
148
160
  }, {
149
161
  immediate: !0
150
- }), d(() => n.maxZoom, (o) => {
162
+ }), m(() => n.maxZoom, (o) => {
151
163
  o && i.setMaxZoom(o);
152
164
  }, {
153
165
  immediate: !0
154
- }), d(a, (o) => {
166
+ }), m(a, (o) => {
155
167
  o && r.setTarget(o);
156
168
  }), e({
157
169
  olMap: r
158
170
  }), Ae(Le, r);
159
- const c = r.getControls().getArray(), f = c.find((o) => o instanceof oe) || new oe(), s = c.find((o) => o instanceof re) || new re(), l = c.find((o) => o instanceof ie) || new ie(), w = c.find((o) => o instanceof ae) || new ae(), y = c.find((o) => o instanceof ce) || new ce(), m = c.find((o) => o instanceof le) || new le();
160
- d(() => n.showZoom, (o) => {
171
+ const c = r.getControls().getArray(), f = c.find((o) => o instanceof oe) || new oe(), s = c.find((o) => o instanceof re) || new re(), l = c.find((o) => o instanceof ie) || new ie(), d = c.find((o) => o instanceof ae) || new ae(), g = c.find((o) => o instanceof ce) || new ce(), v = c.find((o) => o instanceof le) || new le();
172
+ m(() => n.showZoom, (o) => {
161
173
  f.setMap(o ? r : null);
162
174
  }, {
163
175
  immediate: !0
164
- }), d(() => n.showAttribution, (o) => {
176
+ }), m(() => n.showAttribution, (o) => {
165
177
  s.setMap(o ? r : null);
166
178
  }, {
167
179
  immediate: !0
168
- }), d(() => n.showRotate, (o) => {
180
+ }), m(() => n.showRotate, (o) => {
169
181
  l.setMap(o ? r : null);
170
182
  }, {
171
183
  immediate: !0
172
- }), d(() => n.showFullScreen, (o) => {
173
- w.setMap(o ? r : null);
184
+ }), m(() => n.showFullScreen, (o) => {
185
+ d.setMap(o ? r : null);
174
186
  }, {
175
187
  immediate: !0
176
- }), d(() => n.showOverview, (o) => {
177
- y.setMap(o ? r : null);
188
+ }), m(() => n.showOverview, (o) => {
189
+ g.setMap(o ? r : null);
178
190
  }, {
179
191
  immediate: !0
180
- }), d(() => n.showScale, (o) => {
181
- m.setMap(o ? r : null);
192
+ }), m(() => n.showScale, (o) => {
193
+ v.setMap(o ? r : null);
182
194
  }, {
183
195
  immediate: !0
184
196
  });
185
- const v = r.getInteractions().getArray(), p = v.find((o) => o instanceof se) || new se(), E = v.find((o) => o instanceof ue) || new ue(), S = v.find((o) => o instanceof fe) || new fe(), b = v.find((o) => o instanceof de) || new de(), x = v.find((o) => o instanceof me) || new me(), I = v.find((o) => o instanceof ye) || new ye(), u = v.find((o) => o instanceof ve) || new ve(), h = v.find((o) => o instanceof we) || new we();
186
- return r.removeInteraction(p), r.addInteraction(p), r.removeInteraction(E), r.addInteraction(E), r.removeInteraction(S), r.addInteraction(S), r.removeInteraction(b), r.addInteraction(b), r.removeInteraction(x), r.addInteraction(x), r.removeInteraction(I), r.addInteraction(I), r.removeInteraction(u), r.removeInteraction(h), d(() => n.dragPan, (o) => {
187
- p.setActive(o);
197
+ const y = r.getInteractions().getArray(), w = y.find((o) => o instanceof se) || new se(), E = y.find((o) => o instanceof ue) || new ue(), p = y.find((o) => o instanceof fe) || new fe(), h = y.find((o) => o instanceof me) || new me(), b = y.find((o) => o instanceof de) || new de(), L = y.find((o) => o instanceof ye) || new ye(), u = y.find((o) => o instanceof ge) || new ge(), O = y.find((o) => o instanceof ve) || new ve();
198
+ return r.removeInteraction(w), r.addInteraction(w), r.removeInteraction(E), r.addInteraction(E), r.removeInteraction(p), r.addInteraction(p), r.removeInteraction(h), r.addInteraction(h), r.removeInteraction(b), r.addInteraction(b), r.removeInteraction(L), r.addInteraction(L), r.removeInteraction(u), r.removeInteraction(O), m(() => n.dragPan, (o) => {
199
+ w.setActive(o);
188
200
  }, {
189
201
  immediate: !0
190
- }), d(() => n.mouseWheelZoom, (o) => {
202
+ }), m(() => n.mouseWheelZoom, (o) => {
191
203
  E.setActive(o);
192
204
  }, {
193
205
  immediate: !0
194
- }), d(() => n.doubleClickZoom, (o) => {
195
- S.setActive(o);
206
+ }), m(() => n.doubleClickZoom, (o) => {
207
+ p.setActive(o);
196
208
  }, {
197
209
  immediate: !0
198
- }), d(() => n.pinchRotate, (o) => {
199
- b.setActive(o);
210
+ }), m(() => n.pinchRotate, (o) => {
211
+ h.setActive(o);
200
212
  }, {
201
213
  immediate: !0
202
- }), d(() => n.pinchZoom, (o) => {
203
- x.setActive(o);
214
+ }), m(() => n.pinchZoom, (o) => {
215
+ b.setActive(o);
204
216
  }, {
205
217
  immediate: !0
206
- }), d(() => n.altShiftDragRotate, (o) => {
207
- I.setActive(o);
218
+ }), m(() => n.altShiftDragRotate, (o) => {
219
+ L.setActive(o);
208
220
  }, {
209
221
  immediate: !0
210
- }), (o, O) => (H(), _e("div", {
222
+ }), (o, x) => (H(), _e("div", {
211
223
  ref_key: "mapRef",
212
224
  ref: a
213
225
  }, [
@@ -224,154 +236,154 @@ function X(t) {
224
236
  function Y(t) {
225
237
  return t < -180 ? Y(t + 360) : t > 180 ? Y(t - 360) : t;
226
238
  }
227
- function lt(t, e, n) {
228
- return Xe(t, e, Y(n), { units: "meters" }).geometry.coordinates;
239
+ function st(t, e, n) {
240
+ return Ye(t, e, Y(n), { units: "meters" }).geometry.coordinates;
229
241
  }
230
- function Dt(t) {
231
- const e = Ye(t);
232
- return Ue(e, { units: "meters" });
242
+ function Nt(t) {
243
+ const e = Ue(t);
244
+ return He(e, { units: "meters" });
233
245
  }
234
- function jt(t) {
235
- return He(Qe(t));
246
+ function Vt(t) {
247
+ return Qe(qe(t));
236
248
  }
237
- function Nt(t, e) {
238
- return X(qe(t, e));
249
+ function $t(t, e) {
250
+ return X(Je(t, e));
239
251
  }
240
- function st(t, e) {
241
- return Je(t, e).geometry.coordinates;
252
+ function ut(t, e) {
253
+ return et(t, e).geometry.coordinates;
242
254
  }
243
255
  function Pe(t) {
244
- return st([t[0], t[1]], [t[2], t[3]]);
245
- }
246
- const Ie = 1852, A = "EPSG:3857", _ = "EPSG:4326", ge = A, ut = _;
247
- function Vt(t) {
248
- return t * 1e3 / Ie;
256
+ return ut([t[0], t[1]], [t[2], t[3]]);
249
257
  }
258
+ const Ce = 1852, A = "EPSG:3857", _ = "EPSG:4326", we = A, ft = _;
250
259
  function Wt(t) {
251
- return t * Ie / 1e3;
260
+ return t * 1e3 / Ce;
261
+ }
262
+ function Kt(t) {
263
+ return t * Ce / 1e3;
252
264
  }
253
- function ft(t) {
265
+ function mt(t) {
254
266
  const { fillOptions: e, strokeOptions: n, ...a } = t;
255
- return new et({
267
+ return new tt({
256
268
  ...a,
257
269
  fill: e ? new B(e) : void 0,
258
- stroke: n ? new T(n) : void 0
270
+ stroke: n ? new k(n) : void 0
259
271
  });
260
272
  }
261
273
  function R(t) {
262
274
  const { fillOptions: e, strokeOptions: n, backgroundFillOptions: a, backgroundStrokeOptions: r, ...i } = t;
263
- return new tt({
275
+ return new nt({
264
276
  ...i,
265
277
  fill: e ? new B(e) : void 0,
266
- stroke: n ? new T(n) : void 0,
278
+ stroke: n ? new k(n) : void 0,
267
279
  backgroundFill: a ? new B(a) : void 0,
268
- backgroundStroke: r ? new T(r) : void 0
280
+ backgroundStroke: r ? new k(r) : void 0
269
281
  });
270
282
  }
271
- function P(t) {
272
- const { fillOptions: e, strokeOptions: n, iconOptions: a, circleOptions: r, textOptions: i, ...c } = t, f = e ? new B(e) : void 0, s = n ? new T(n) : void 0, l = a ? new nt(a) : void 0, w = r ? ft(r) : void 0, y = i ? R(i) : void 0;
273
- return new ot({
283
+ function C(t) {
284
+ const { fillOptions: e, strokeOptions: n, iconOptions: a, circleOptions: r, textOptions: i, ...c } = t, f = e ? new B(e) : void 0, s = n ? new k(n) : void 0, l = a ? new ot(a) : void 0, d = r ? mt(r) : void 0, g = i ? R(i) : void 0;
285
+ return new rt({
274
286
  ...c,
275
287
  fill: f,
276
288
  stroke: s,
277
- image: l || w,
278
- text: y
289
+ image: l || d,
290
+ text: g
279
291
  });
280
292
  }
281
293
  function dt(t) {
282
- return new Ne(t);
283
- }
284
- function mt(t) {
285
- return new $(t);
294
+ return new Ve(t);
286
295
  }
287
296
  function yt(t) {
297
+ return new W(t);
298
+ }
299
+ function gt(t) {
288
300
  return new K(t);
289
301
  }
290
302
  function vt(t, e) {
291
- return new Ve(t, e);
303
+ return new $e(t, e);
292
304
  }
293
305
  function wt(t) {
294
306
  return new We(t);
295
307
  }
296
- function gt(t) {
297
- return new $e(t);
298
- }
299
308
  function pt(t) {
300
309
  return new Ke(t);
301
310
  }
311
+ function St(t) {
312
+ return new Xe(t);
313
+ }
302
314
  function M(t) {
303
- const { styleOptions: e, ...n } = t ?? {}, a = e ? P(e) : n.style;
315
+ const { styleOptions: e, ...n } = t ?? {}, a = e ? C(e) : n.style;
304
316
  return new Q({
305
317
  ...n,
306
318
  style: a
307
319
  });
308
320
  }
309
- function $t(t, e) {
321
+ function Xt(t, e) {
310
322
  const n = dt(t);
311
323
  return M({
312
324
  ...e,
313
325
  geometry: n
314
326
  });
315
327
  }
316
- function Kt(t, e) {
317
- const n = mt(t);
328
+ function Yt(t, e) {
329
+ const n = yt(t);
318
330
  return M({
319
331
  ...e,
320
332
  geometry: n
321
333
  });
322
334
  }
323
- function Xt(t, e) {
324
- const n = yt(t);
335
+ function Ut(t, e) {
336
+ const n = gt(t);
325
337
  return M({
326
338
  ...e,
327
339
  geometry: n
328
340
  });
329
341
  }
330
- function Yt(t, e, n) {
342
+ function Ht(t, e, n) {
331
343
  const a = vt(t, e);
332
344
  return M({
333
345
  ...n,
334
346
  geometry: a
335
347
  });
336
348
  }
337
- function Ut(t, e) {
349
+ function Qt(t, e) {
338
350
  const n = wt(t);
339
351
  return M({
340
352
  ...e,
341
353
  geometry: n
342
354
  });
343
355
  }
344
- function Ht(t, e) {
345
- const n = gt(t);
356
+ function qt(t, e) {
357
+ const n = pt(t);
346
358
  return M({
347
359
  ...e,
348
360
  geometry: n
349
361
  });
350
362
  }
351
- function Qt(t, e) {
352
- const n = pt(t);
363
+ function Jt(t, e) {
364
+ const n = St(t);
353
365
  return M({
354
366
  ...e,
355
367
  geometry: n
356
368
  });
357
369
  }
358
- function St(t) {
359
- const { type: e = "img", projection: n = ge, key: a } = t, r = t.url || "https://t{0-4}.tianditu.gov.cn", i = `&tk=${a}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
360
- return `${r}/${e}_${n === ut ? "c" : n === ge ? "w" : "c"}/wmts?LAYER=${e}${i}`;
370
+ function ht(t) {
371
+ const { type: e = "img", projection: n = we, key: a } = t, r = t.url || "https://t{0-4}.tianditu.gov.cn", i = `&tk=${a}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
372
+ return `${r}/${e}_${n === ft ? "c" : n === we ? "w" : "c"}/wmts?LAYER=${e}${i}`;
361
373
  }
362
- function qt(t) {
374
+ function en(t) {
363
375
  const { zIndex: e, projection: n, className: a } = t;
364
376
  return new ee({
365
377
  className: a,
366
- source: new it({
367
- url: St(t),
378
+ source: new at({
379
+ url: ht(t),
368
380
  projection: n,
369
381
  crossOrigin: "Anonymous"
370
382
  }),
371
383
  zIndex: e
372
384
  });
373
385
  }
374
- function Jt({
386
+ function tn({
375
387
  name: t,
376
388
  zIndex: e,
377
389
  key: n,
@@ -379,7 +391,7 @@ function Jt({
379
391
  }) {
380
392
  return new ee({
381
393
  className: a,
382
- source: new at({
394
+ source: new ct({
383
395
  key: n,
384
396
  imagerySet: t,
385
397
  placeholderTiles: !1
@@ -387,17 +399,17 @@ function Jt({
387
399
  zIndex: e
388
400
  });
389
401
  }
390
- function en(t) {
402
+ function nn(t) {
391
403
  return new ee({
392
404
  className: t == null ? void 0 : t.className,
393
- source: new ct({
405
+ source: new lt({
394
406
  crossOrigin: "Anonymous"
395
407
  }),
396
408
  zIndex: t == null ? void 0 : t.zIndex
397
409
  });
398
410
  }
399
- function tn(t) {
400
- const { styleOptions: e, ...n } = t || {}, a = e ? P(e) : void 0, r = new J(), i = new q({
411
+ function on(t) {
412
+ const { styleOptions: e, ...n } = t || {}, a = e ? C(e) : void 0, r = new J(), i = new q({
401
413
  source: r,
402
414
  ...n,
403
415
  style: a || n.style
@@ -408,86 +420,86 @@ function tn(t) {
408
420
  };
409
421
  }
410
422
  function te(t) {
411
- return be(t, _, A);
423
+ return Ee(t, _, A);
412
424
  }
413
- const nn = te;
414
- function ht(t) {
415
- return be(t, A, _);
416
- }
417
- const on = ht;
425
+ const rn = te;
418
426
  function Ot(t) {
419
- return xe(t, _, A);
427
+ return Ee(t, A, _);
420
428
  }
421
- const rn = Ot;
429
+ const an = Ot;
430
+ function xt(t) {
431
+ return be(t, _, A);
432
+ }
433
+ const cn = xt;
422
434
  function ne(t) {
423
- return xe(t, A, _);
435
+ return be(t, A, _);
424
436
  }
425
- const an = ne;
426
- function cn(t, e, n = 60) {
437
+ const ln = ne;
438
+ function sn(t, e, n = 60) {
427
439
  const a = [], r = 360 / n;
428
440
  for (let i = -180; i < 180; i = i + r)
429
- a.push(lt(t, e, i));
441
+ a.push(st(t, e, i));
430
442
  return [a];
431
443
  }
432
444
  function D(t) {
433
445
  const e = document.createElement("div");
434
446
  return e.innerHTML = t, e.style.cursor = "pointer", e.style.userSelect = "none", e.style.backgroundColor = "red", e.style.color = "white", e.style.borderRadius = "5px", e.style.padding = "0 5px", e.style.fontSize = "12px", e.style.border = "2px solid white", e;
435
447
  }
436
- function ln(t, e) {
437
- const n = g(!0), a = g([]), r = Se(() => a.value.map((u) => u.getGeometry().getCoordinates())), i = new J(), c = e.styleOptions ? P(e.styleOptions) : e == null ? void 0 : e.style, f = new q({
448
+ function un(t, e) {
449
+ const n = S(!0), a = S([]), r = Se(() => a.value.map((u) => u.getGeometry().getCoordinates())), i = new J(), c = e.styleOptions ? C(e.styleOptions) : e == null ? void 0 : e.style, f = new q({
438
450
  source: i,
439
451
  style: c,
440
452
  zIndex: e == null ? void 0 : e.zIndex
441
453
  });
442
454
  t.addLayer(f);
443
- const s = e.drawStyleOptions ? P(e.drawStyleOptions) : e == null ? void 0 : e.drawStyle, l = new Oe({
455
+ const s = e.drawStyleOptions ? C(e.drawStyleOptions) : e == null ? void 0 : e.drawStyle, l = new Oe({
444
456
  source: i,
445
457
  style: s || c,
446
458
  type: "LineString"
447
459
  });
448
460
  l.setActive(!1);
449
- const w = e.modifyStyleOptions ? P(e.modifyStyleOptions) : e == null ? void 0 : e.modifyStyle, y = new Ee({
461
+ const d = e.modifyStyleOptions ? C(e.modifyStyleOptions) : e == null ? void 0 : e.modifyStyle, g = new xe({
450
462
  source: i,
451
- style: w || c
452
- }), m = /* @__PURE__ */ new Set();
463
+ style: d || c
464
+ }), v = /* @__PURE__ */ new Set();
453
465
  t.addInteraction(l), j(() => {
454
- t.addInteraction(y);
466
+ t.addInteraction(g);
455
467
  }), i.on("addfeature", () => {
456
468
  e.size && i.getFeatures().length >= e.size && l.setActive(!1);
457
469
  }), i.on("removefeature", () => {
458
470
  e.size && i.getFeatures().length < e.size && l.setActive(!0);
459
471
  });
460
- const v = () => {
461
- m.forEach((u) => {
472
+ const y = () => {
473
+ v.forEach((u) => {
462
474
  t.removeOverlay(u);
463
- }), m.clear();
475
+ }), v.clear();
464
476
  };
465
477
  i.on("change", () => {
466
- v(), i.getFeatures().forEach((u) => {
467
- const h = u.getGeometry(), o = Pe(ne(h.getExtent()));
468
- let O = document.createElement("div");
469
- e.deleteFeatureLabel ? z(e.deleteFeatureLabel, O) : O = D("删除线"), O.addEventListener("click", () => {
478
+ y(), i.getFeatures().forEach((u) => {
479
+ const O = u.getGeometry(), o = Pe(ne(O.getExtent()));
480
+ let x = document.createElement("div");
481
+ e.deleteFeatureLabel ? z(e.deleteFeatureLabel, x) : x = D("删除线"), x.addEventListener("click", () => {
470
482
  i.removeFeature(u);
471
483
  });
472
- const k = new G({
484
+ const F = new G({
473
485
  position: te(o),
474
486
  positioning: "center-center",
475
- element: O
487
+ element: x
476
488
  });
477
- m.add(k), t.addOverlay(k);
478
- const C = h.getCoordinates();
479
- C.length < 3 || C.forEach((N, V) => {
480
- let L = document.createElement("div");
481
- e.deletePointLabel ? z(e.deletePointLabel, L) : L = D("删除点"), L.addEventListener("click", () => {
482
- u.setGeometry(new $(C.filter((Ce, W) => W !== V)));
489
+ v.add(F), t.addOverlay(F);
490
+ const I = O.getCoordinates();
491
+ I.length < 3 || I.forEach((N, V) => {
492
+ let P = document.createElement("div");
493
+ e.deletePointLabel ? z(e.deletePointLabel, P) : P = D("删除点"), P.addEventListener("click", () => {
494
+ u.setGeometry(new W(I.filter((Ie, $) => $ !== V)));
483
495
  });
484
- const F = new G({
496
+ const T = new G({
485
497
  position: N,
486
498
  positioning: "top-center",
487
499
  offset: [0, -30],
488
- element: L
500
+ element: P
489
501
  });
490
- m.add(F), t.addOverlay(F);
502
+ v.add(T), t.addOverlay(T);
491
503
  });
492
504
  });
493
505
  }), l.on("change:active", () => {
@@ -495,97 +507,97 @@ function ln(t, e) {
495
507
  }), i.on("change", () => {
496
508
  a.value = i.getFeatures();
497
509
  });
498
- const p = () => {
499
- v(), t.removeLayer(f), t.removeInteraction(l), t.removeInteraction(y);
510
+ const w = () => {
511
+ y(), t.removeLayer(f), t.removeInteraction(l), t.removeInteraction(g);
500
512
  }, E = () => {
501
513
  e.size && a.value.length >= e.size || l.setActive(!0);
502
- }, S = () => {
514
+ }, p = () => {
503
515
  l.setActive(!1);
504
- }, b = (u) => {
505
- i.clear(), u.forEach((h) => {
506
- if (h.length < 2)
516
+ }, h = (u) => {
517
+ i.clear(), u.forEach((O) => {
518
+ if (O.length < 2)
507
519
  return;
508
520
  const o = new Q({
509
- geometry: new $(h)
521
+ geometry: new W(O)
510
522
  });
511
523
  i.addFeature(o);
512
524
  });
513
- }, x = () => {
514
- b(e.defaultCoordinates || []);
525
+ }, b = () => {
526
+ h(e.defaultCoordinates || []);
515
527
  };
516
- x();
517
- const I = () => {
518
- i.clear(), S();
528
+ b();
529
+ const L = () => {
530
+ i.clear(), p();
519
531
  };
520
532
  return he(() => {
521
- p();
533
+ w();
522
534
  }), {
523
535
  inDraw: n,
524
536
  start: E,
525
- stop: S,
526
- clear: I,
527
- setFeatures: b,
528
- reset: x,
537
+ stop: p,
538
+ clear: L,
539
+ setFeatures: h,
540
+ reset: b,
529
541
  features: a,
530
542
  coordinates: r,
531
- destroy: p
543
+ destroy: w
532
544
  };
533
545
  }
534
- function sn(t, e) {
535
- const n = g(!0), a = g([]), r = Se(() => a.value.map((u) => u.getGeometry().getCoordinates())), i = e.styleOptions ? P(e.styleOptions) : e == null ? void 0 : e.style, c = new J(), f = new q({
546
+ function fn(t, e) {
547
+ const n = S(!0), a = S([]), r = Se(() => a.value.map((u) => u.getGeometry().getCoordinates())), i = e.styleOptions ? C(e.styleOptions) : e == null ? void 0 : e.style, c = new J(), f = new q({
536
548
  source: c,
537
549
  style: i,
538
550
  zIndex: e == null ? void 0 : e.zIndex
539
551
  });
540
552
  t.addLayer(f);
541
- const s = e.drawStyleOptions ? P(e.drawStyleOptions) : e == null ? void 0 : e.drawStyle, l = new Oe({
553
+ const s = e.drawStyleOptions ? C(e.drawStyleOptions) : e == null ? void 0 : e.drawStyle, l = new Oe({
542
554
  source: c,
543
555
  style: s || i,
544
556
  type: "Polygon"
545
557
  });
546
558
  l.setActive(!1);
547
- const w = e.modifyStyleOptions ? P(e.modifyStyleOptions) : e == null ? void 0 : e.modifyStyle, y = new Ee({
559
+ const d = e.modifyStyleOptions ? C(e.modifyStyleOptions) : e == null ? void 0 : e.modifyStyle, g = new xe({
548
560
  source: c,
549
- style: w || i
550
- }), m = /* @__PURE__ */ new Set();
561
+ style: d || i
562
+ }), v = /* @__PURE__ */ new Set();
551
563
  t.addInteraction(l), j(() => {
552
- t.addInteraction(y);
564
+ t.addInteraction(g);
553
565
  }), c.on("addfeature", () => {
554
566
  e.size && c.getFeatures().length >= e.size && l.setActive(!1);
555
567
  }), c.on("removefeature", () => {
556
568
  e.size && c.getFeatures().length < e.size && l.setActive(!0);
557
569
  });
558
- const v = () => {
559
- m.forEach((u) => {
570
+ const y = () => {
571
+ v.forEach((u) => {
560
572
  t.removeOverlay(u);
561
- }), m.clear();
573
+ }), v.clear();
562
574
  };
563
575
  c.on("change", () => {
564
- v(), c.getFeatures().forEach((u) => {
565
- const h = u.getGeometry(), o = Pe(ne(h.getExtent()));
566
- let O = document.createElement("div");
567
- e.deleteFeatureLabel ? z(e.deleteFeatureLabel, O) : O = D("删除区域"), O.addEventListener("click", () => {
576
+ y(), c.getFeatures().forEach((u) => {
577
+ const O = u.getGeometry(), o = Pe(ne(O.getExtent()));
578
+ let x = document.createElement("div");
579
+ e.deleteFeatureLabel ? z(e.deleteFeatureLabel, x) : x = D("删除区域"), x.addEventListener("click", () => {
568
580
  c.removeFeature(u);
569
581
  });
570
- const k = new G({
582
+ const F = new G({
571
583
  position: te(o),
572
584
  positioning: "center-center",
573
- element: O
585
+ element: x
574
586
  });
575
- m.add(k), t.addOverlay(k);
576
- const C = h.getCoordinates()[0];
577
- C.length < 3 || C.forEach((N, V) => {
578
- let L = document.createElement("div");
579
- e.deletePointLabel ? z(e.deletePointLabel, L) : L = D("删除点"), L.addEventListener("click", () => {
580
- u.setGeometry(new K([C.filter((Ce, W) => W !== V)]));
587
+ v.add(F), t.addOverlay(F);
588
+ const I = O.getCoordinates()[0];
589
+ I.length < 3 || I.forEach((N, V) => {
590
+ let P = document.createElement("div");
591
+ e.deletePointLabel ? z(e.deletePointLabel, P) : P = D("删除点"), P.addEventListener("click", () => {
592
+ u.setGeometry(new K([I.filter((Ie, $) => $ !== V)]));
581
593
  });
582
- const F = new G({
594
+ const T = new G({
583
595
  position: N,
584
596
  positioning: "top-center",
585
597
  offset: [0, -30],
586
- element: L
598
+ element: P
587
599
  });
588
- m.add(F), t.addOverlay(F);
600
+ v.add(T), t.addOverlay(T);
589
601
  });
590
602
  });
591
603
  }), l.on("change:active", () => {
@@ -593,58 +605,58 @@ function sn(t, e) {
593
605
  }), c.on("change", () => {
594
606
  a.value = c.getFeatures();
595
607
  });
596
- const p = () => {
597
- v(), t.removeLayer(f), t.removeInteraction(l), t.removeInteraction(y);
608
+ const w = () => {
609
+ y(), t.removeLayer(f), t.removeInteraction(l), t.removeInteraction(g);
598
610
  }, E = () => {
599
611
  e.size && a.value.length >= e.size || l.setActive(!0);
600
- }, S = () => {
612
+ }, p = () => {
601
613
  l.setActive(!1);
602
- }, b = (u) => {
603
- c.clear(), u == null || u.forEach((h) => {
604
- h.forEach((o) => {
614
+ }, h = (u) => {
615
+ c.clear(), u == null || u.forEach((O) => {
616
+ O.forEach((o) => {
605
617
  if (o.length < 2)
606
618
  return;
607
619
  o[0] !== o[o.length - 1] && o.push(o[0]);
608
- const O = new Q({
620
+ const x = new Q({
609
621
  geometry: new K([o])
610
622
  });
611
- c.addFeature(O);
623
+ c.addFeature(x);
612
624
  });
613
625
  });
614
- }, x = () => {
615
- b(e.defaultCoordinates);
626
+ }, b = () => {
627
+ h(e.defaultCoordinates);
616
628
  };
617
- x();
618
- const I = () => {
619
- c.clear(), S();
629
+ b();
630
+ const L = () => {
631
+ c.clear(), p();
620
632
  };
621
633
  return he(() => {
622
- p();
634
+ w();
623
635
  }), {
624
636
  inDraw: n,
625
637
  start: E,
626
- stop: S,
627
- clear: I,
628
- setFeatures: b,
629
- reset: x,
638
+ stop: p,
639
+ clear: L,
640
+ setFeatures: h,
641
+ reset: b,
630
642
  features: a,
631
643
  coordinates: r,
632
- destroy: p
644
+ destroy: w
633
645
  };
634
646
  }
635
- function un(t) {
636
- const e = g(t.defaultShow || !1), { strokeStyleOption: n, strokeStyle: a, labelStyleOption: r, latLabelStyleOption: i, lonLabelStyleOption: c, latLabelStyle: f, lonLabelStyle: s, ...l } = t.graticuleOptions || {}, w = n ? new T(n) : a, y = r ? R(r) : void 0, m = (i ? R(i) : f) || y, v = (c ? R(c) : s) || y, p = new rt({
647
+ function mn(t) {
648
+ const e = S(t.defaultShow || !1), { strokeStyleOption: n, strokeStyle: a, labelStyleOption: r, latLabelStyleOption: i, lonLabelStyleOption: c, latLabelStyle: f, lonLabelStyle: s, ...l } = t.graticuleOptions || {}, d = n ? new k(n) : a, g = r ? R(r) : void 0, v = (i ? R(i) : f) || g, y = (c ? R(c) : s) || g, w = new it({
637
649
  ...l,
638
- strokeStyle: w,
639
- latLabelStyle: m,
640
- lonLabelStyle: v
650
+ strokeStyle: d,
651
+ latLabelStyle: v,
652
+ lonLabelStyle: y
641
653
  });
642
- return d(
654
+ return m(
643
655
  e,
644
656
  (E) => {
645
- if (p.setMap(null), E) {
646
- const S = Ze(t.olMap);
647
- S && p.setMap(S);
657
+ if (w.setMap(null), E) {
658
+ const p = Ze(t.olMap);
659
+ p && w.setMap(p);
648
660
  }
649
661
  },
650
662
  {
@@ -655,13 +667,13 @@ function un(t) {
655
667
  showGraticule: e
656
668
  };
657
669
  }
658
- function fn(t) {
659
- const e = g(t.defaultLayerName || Object.keys(t.layers)[0]);
670
+ function dn(t) {
671
+ const e = S(t.defaultLayerName || Object.keys(t.layers)[0]);
660
672
  return Object.values(t.layers).forEach((n) => {
661
673
  n.forEach((a) => {
662
674
  t.olMap.addLayer(a);
663
675
  });
664
- }), d(
676
+ }), m(
665
677
  e,
666
678
  () => {
667
679
  Object.entries(t.layers).forEach(([n, a]) => {
@@ -678,59 +690,59 @@ function fn(t) {
678
690
  }
679
691
  export {
680
692
  A as EPSG_3857,
681
- an as EPSG_3857ExtentToEPSG_4326,
682
- on as EPSG_3857ToEPSG_4326,
693
+ ln as EPSG_3857ExtentToEPSG_4326,
694
+ an as EPSG_3857ToEPSG_4326,
683
695
  _ as EPSG_4326,
684
- rn as EPSG_4326ExtentToEPSG_3857,
685
- nn as EPSG_4326ToEPSG_3857,
686
- Zt as NOlContextmenu,
687
- zt as NOlPointermove,
688
- Ie as ONE_NM,
689
- Bt as OlMap,
690
- ut as WGS84Projection,
691
- ge as WebMercatorProjection,
696
+ cn as EPSG_4326ExtentToEPSG_3857,
697
+ rn as EPSG_4326ToEPSG_3857,
698
+ Gt as NOlContextmenu,
699
+ Bt as NOlPointermove,
700
+ Ce as ONE_NM,
701
+ jt as OlMap,
702
+ ft as WGS84Projection,
703
+ we as WebMercatorProjection,
692
704
  vt as createCircle,
693
- Yt as createCircleFeature,
694
- ft as createCircleStyle,
705
+ Ht as createCircleFeature,
706
+ mt as createCircleStyle,
695
707
  M as createFeature,
696
- mt as createLineString,
697
- Kt as createLineStringFeature,
698
- gt as createMultiLineString,
699
- Ht as createMultiLineStringFeature,
708
+ yt as createLineString,
709
+ Yt as createLineStringFeature,
710
+ pt as createMultiLineString,
711
+ qt as createMultiLineStringFeature,
700
712
  wt as createMultiPoint,
701
- Ut as createMultiPointFeature,
702
- pt as createMultiPolygon,
703
- Qt as createMultiPolygonFeature,
713
+ Qt as createMultiPointFeature,
714
+ St as createMultiPolygon,
715
+ Jt as createMultiPolygonFeature,
704
716
  dt as createPoint,
705
- $t as createPointFeature,
706
- yt as createPolygon,
707
- Xt as createPolygonFeature,
708
- P as createStyle,
717
+ Xt as createPointFeature,
718
+ gt as createPolygon,
719
+ Ut as createPolygonFeature,
720
+ C as createStyle,
709
721
  R as createTextStyle,
710
- tn as createVectorLayer,
711
- Nt as getAngle,
712
- jt as getArea,
713
- Jt as getBingLayer,
714
- st as getCenter,
715
- lt as getDestinationPoint,
722
+ on as createVectorLayer,
723
+ $t as getAngle,
724
+ Vt as getArea,
725
+ tn as getBingLayer,
726
+ ut as getCenter,
727
+ st as getDestinationPoint,
716
728
  Pe as getExtentCenter,
717
- Dt as getLineLength,
718
- en as getOSMLayer,
719
- cn as getRealCircleCoordinates,
720
- qt as getTianDiTuLayer,
721
- St as getTianDiTuUrl,
722
- Vt as kmToNauticalMiles,
729
+ Nt as getLineLength,
730
+ nn as getOSMLayer,
731
+ sn as getRealCircleCoordinates,
732
+ en as getTianDiTuLayer,
733
+ ht as getTianDiTuUrl,
734
+ Wt as kmToNauticalMiles,
723
735
  ne as mercatorExtentToWgs84,
724
- ht as mercatorToWgs84,
725
- Wt as nauticalMilesToKm,
736
+ Ot as mercatorToWgs84,
737
+ Kt as nauticalMilesToKm,
726
738
  Le as olMapInjectionKey,
727
739
  X as toOlAngle,
728
740
  Y as toTurfAngle,
729
- ln as useDrawLineString,
730
- sn as useDrawPolygon,
731
- un as useGraticule,
732
- Gt as useOlMap,
733
- fn as useSwitchBaseLayer,
734
- Ot as wgs84ExtentToMercator,
741
+ un as useDrawLineString,
742
+ fn as useDrawPolygon,
743
+ mn as useGraticule,
744
+ Dt as useOlMap,
745
+ dn as useSwitchBaseLayer,
746
+ xt as wgs84ExtentToMercator,
735
747
  te as wgs84ToMercator
736
748
  };
@@ -1,34 +1,46 @@
1
- import { defineComponent as d, ref as t, shallowRef as w, onMounted as x, createBlock as h, openBlock as y, unref as p, withCtx as b, createVNode as _ } from "vue";
2
- import { RenderVNode as g } from "@summeruse/common";
3
- import { NPopover as M } from "naive-ui";
4
- const k = /* @__PURE__ */ d({
1
+ import { defineComponent as b, ref as n, shallowRef as _, onMounted as C, createBlock as M, openBlock as A, unref as m, withCtx as B, createVNode as F } from "vue";
2
+ import { RenderVNode as N } from "@summeruse/common";
3
+ import { NPopover as P } from "naive-ui";
4
+ import { getCenter as R } from "ol/extent";
5
+ const S = /* @__PURE__ */ b({
5
6
  __name: "index",
6
7
  props: {
7
8
  olMap: {},
8
9
  createOptions: { type: Function }
9
10
  },
10
- setup(u) {
11
- const l = u, e = t({
11
+ setup(v) {
12
+ const t = v, e = n({
12
13
  visible: !1,
13
14
  x: 0,
14
15
  y: 0
15
- }), r = w(), s = t("bottom-start"), i = t(!1), c = t(!1);
16
- return x(() => {
17
- var n;
18
- (n = l.olMap) == null || n.on("pointermove", (o) => {
19
- const v = l.olMap.getFeaturesAtPixel(o.pixel), { clientX: m, clientY: f } = o.originalEvent;
16
+ }), s = _(), i = n("bottom-start"), c = n(!1), p = n(!1);
17
+ return C(() => {
18
+ var r;
19
+ (r = t.olMap) == null || r.on("pointermove", (a) => {
20
+ const l = t.olMap.getFeaturesAtPixel(a.pixel);
20
21
  e.value.visible = !1;
21
- const a = l.createOptions({
22
- pixel: o.pixel,
23
- coordinate: o.coordinate,
24
- features: v
22
+ const o = t.createOptions({
23
+ pixel: a.pixel,
24
+ coordinate: a.coordinate,
25
+ features: l
25
26
  });
26
- a && (r.value = a.content, s.value = a.placement || "bottom-start", c.value = a.showArrow || !1, i.value = a.raw || !1, e.value.visible = !0, e.value.x = m, e.value.y = f);
27
+ if (o) {
28
+ if (s.value = o.content, i.value = o.placement || "bottom-start", p.value = o.showArrow || !1, c.value = o.raw || !1, e.value.visible = !0, o.followTarget === "feature" && l.length > 0) {
29
+ const u = l[0].getGeometry();
30
+ if (u) {
31
+ const x = u.getExtent(), g = R(x), f = t.olMap.getPixelFromCoordinate(g), { top: h, left: y } = t.olMap.getViewport().getBoundingClientRect();
32
+ e.value.x = f[0] + y, e.value.y = f[1] + h;
33
+ return;
34
+ }
35
+ }
36
+ const { clientX: d, clientY: w } = a.originalEvent;
37
+ e.value.x = d, e.value.y = w;
38
+ }
27
39
  });
28
- }), (n, o) => (y(), h(p(M), {
29
- "show-arrow": c.value,
30
- raw: i.value,
31
- placement: s.value,
40
+ }), (r, a) => (A(), M(m(P), {
41
+ "show-arrow": p.value,
42
+ raw: c.value,
43
+ placement: i.value,
32
44
  show: e.value.visible,
33
45
  x: e.value.x,
34
46
  y: e.value.y,
@@ -38,13 +50,13 @@ const k = /* @__PURE__ */ d({
38
50
  boxShadow: "none"
39
51
  }
40
52
  }, {
41
- default: b(() => [
42
- _(p(g), { "dynamic-v-node": r.value }, null, 8, ["dynamic-v-node"])
53
+ default: B(() => [
54
+ F(m(N), { "dynamic-v-node": s.value }, null, 8, ["dynamic-v-node"])
43
55
  ]),
44
56
  _: 1
45
57
  }, 8, ["show-arrow", "raw", "placement", "show", "x", "y"]));
46
58
  }
47
59
  });
48
60
  export {
49
- k as default
61
+ S as default
50
62
  };
@@ -4,17 +4,19 @@ import { Coordinate } from 'ol/coordinate';
4
4
  import { FeatureLike } from 'ol/Feature';
5
5
  import { Pixel } from 'ol/pixel';
6
6
  import { VNodeChild } from 'vue';
7
- export interface NOlPointermoveOptions {
7
+ export interface NOlPointermoveParams {
8
8
  pixel: Pixel;
9
9
  coordinate: Coordinate;
10
10
  features: FeatureLike[];
11
11
  }
12
+ export type NOlPointermoveOption = {
13
+ content: (() => VNodeChild) | VNodeChild | string;
14
+ raw?: boolean;
15
+ showArrow?: boolean;
16
+ placement?: PopoverPlacement;
17
+ followTarget?: 'mouse' | 'feature';
18
+ } | undefined;
12
19
  export interface NOlPointermoveProps {
13
20
  olMap: OLMap;
14
- createOptions: (data: NOlPointermoveOptions) => {
15
- content: (() => VNodeChild) | VNodeChild | string;
16
- raw?: boolean;
17
- showArrow?: boolean;
18
- placement?: PopoverPlacement;
19
- } | undefined;
21
+ createOptions: (data: NOlPointermoveParams) => NOlPointermoveOption;
20
22
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=require("@summeruse/common"),m=require("naive-ui"),w=e.defineComponent({__name:"index",props:{olMap:{},createOptions:{type:Function}},setup(u){const n=u,o=e.ref({visible:!1,x:0,y:0}),r=e.shallowRef(),s=e.ref("bottom-start"),i=e.ref(!1),c=e.ref(!1);return e.onMounted(()=>{var l;(l=n.olMap)==null||l.on("pointermove",t=>{const v=n.olMap.getFeaturesAtPixel(t.pixel),{clientX:p,clientY:f}=t.originalEvent;o.value.visible=!1;const a=n.createOptions({pixel:t.pixel,coordinate:t.coordinate,features:v});a&&(r.value=a.content,s.value=a.placement||"bottom-start",c.value=a.showArrow||!1,i.value=a.raw||!1,o.value.visible=!0,o.value.x=p,o.value.y=f)})}),(l,t)=>(e.openBlock(),e.createBlock(e.unref(m.NPopover),{"show-arrow":c.value,raw:i.value,placement:s.value,show:o.value.visible,x:o.value.x,y:o.value.y,trigger:"manual",class:"n-ol-pointermove","theme-overrides":{boxShadow:"none"}},{default:e.withCtx(()=>[e.createVNode(e.unref(d.RenderVNode),{"dynamic-v-node":r.value},null,8,["dynamic-v-node"])]),_:1},8,["show-arrow","raw","placement","show","x","y"]))}});exports.default=w;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),y=require("@summeruse/common"),b=require("naive-ui"),_=require("ol/extent"),M=e.defineComponent({__name:"index",props:{olMap:{},createOptions:{type:Function}},setup(f){const n=f,t=e.ref({visible:!1,x:0,y:0}),s=e.shallowRef(),i=e.ref("bottom-start"),c=e.ref(!1),u=e.ref(!1);return e.onMounted(()=>{var a;(a=n.olMap)==null||a.on("pointermove",r=>{const l=n.olMap.getFeaturesAtPixel(r.pixel);t.value.visible=!1;const o=n.createOptions({pixel:r.pixel,coordinate:r.coordinate,features:l});if(o){if(s.value=o.content,i.value=o.placement||"bottom-start",u.value=o.showArrow||!1,c.value=o.raw||!1,t.value.visible=!0,o.followTarget==="feature"&&l.length>0){const p=l[0].getGeometry();if(p){const w=p.getExtent(),x=_.getCenter(w),v=n.olMap.getPixelFromCoordinate(x),{top:g,left:h}=n.olMap.getViewport().getBoundingClientRect();t.value.x=v[0]+h,t.value.y=v[1]+g;return}}const{clientX:d,clientY:m}=r.originalEvent;t.value.x=d,t.value.y=m}})}),(a,r)=>(e.openBlock(),e.createBlock(e.unref(b.NPopover),{"show-arrow":u.value,raw:c.value,placement:i.value,show:t.value.visible,x:t.value.x,y:t.value.y,trigger:"manual",class:"n-ol-pointermove","theme-overrides":{boxShadow:"none"}},{default:e.withCtx(()=>[e.createVNode(e.unref(y.RenderVNode),{"dynamic-v-node":s.value},null,8,["dynamic-v-node"])]),_:1},8,["show-arrow","raw","placement","show","x","y"]))}});exports.default=M;
@@ -4,17 +4,19 @@ import { Coordinate } from 'ol/coordinate';
4
4
  import { FeatureLike } from 'ol/Feature';
5
5
  import { Pixel } from 'ol/pixel';
6
6
  import { VNodeChild } from 'vue';
7
- export interface NOlPointermoveOptions {
7
+ export interface NOlPointermoveParams {
8
8
  pixel: Pixel;
9
9
  coordinate: Coordinate;
10
10
  features: FeatureLike[];
11
11
  }
12
+ export type NOlPointermoveOption = {
13
+ content: (() => VNodeChild) | VNodeChild | string;
14
+ raw?: boolean;
15
+ showArrow?: boolean;
16
+ placement?: PopoverPlacement;
17
+ followTarget?: 'mouse' | 'feature';
18
+ } | undefined;
12
19
  export interface NOlPointermoveProps {
13
20
  olMap: OLMap;
14
- createOptions: (data: NOlPointermoveOptions) => {
15
- content: (() => VNodeChild) | VNodeChild | string;
16
- raw?: boolean;
17
- showArrow?: boolean;
18
- placement?: PopoverPlacement;
19
- } | undefined;
21
+ createOptions: (data: NOlPointermoveParams) => NOlPointermoveOption;
20
22
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@summeruse/ol",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "description": "",
6
6
  "author": "finalsummer",
7
7
  "license": "ISC",