@summeruse/ol 0.1.6 → 0.2.0-alpha.0
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 +19 -0
- package/dist/index.js +564 -495
- package/es/components/index.d.ts +0 -2
- package/es/composables/index.d.ts +2 -0
- package/es/composables/useContextmenu/index.d.ts +71 -0
- package/es/composables/useContextmenu/index.mjs +77 -0
- package/es/composables/usePointermove/index.d.ts +57 -0
- package/es/composables/usePointermove/index.mjs +100 -0
- package/es/index.mjs +30 -30
- package/es/types/index.d.ts +2 -0
- package/es/utils/feature/index.mjs +49 -49
- package/lib/components/index.d.ts +0 -2
- package/lib/composables/index.d.ts +2 -0
- package/lib/composables/useContextmenu/index.d.ts +71 -0
- package/lib/composables/useContextmenu/index.js +1 -0
- package/lib/composables/usePointermove/index.d.ts +57 -0
- package/lib/composables/usePointermove/index.js +1 -0
- package/lib/index.js +1 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/utils/feature/index.js +1 -1
- package/package.json +3 -5
- package/es/components/n-ol-contextmenu/index.d.ts +0 -3
- package/es/components/n-ol-contextmenu/index.vue.d.ts +0 -3
- package/es/components/n-ol-contextmenu/index.vue.mjs +0 -49
- package/es/components/n-ol-contextmenu/index.vue2.mjs +0 -4
- package/es/components/n-ol-contextmenu/props.d.ts +0 -17
- package/es/components/n-ol-pointermove/index.d.ts +0 -3
- package/es/components/n-ol-pointermove/index.vue.d.ts +0 -3
- package/es/components/n-ol-pointermove/index.vue.mjs +0 -62
- package/es/components/n-ol-pointermove/index.vue2.mjs +0 -4
- package/es/components/n-ol-pointermove/props.d.ts +0 -22
- package/lib/components/n-ol-contextmenu/index.d.ts +0 -3
- package/lib/components/n-ol-contextmenu/index.vue.d.ts +0 -3
- package/lib/components/n-ol-contextmenu/index.vue.js +0 -1
- package/lib/components/n-ol-contextmenu/index.vue2.js +0 -1
- package/lib/components/n-ol-contextmenu/props.d.ts +0 -17
- package/lib/components/n-ol-pointermove/index.d.ts +0 -3
- package/lib/components/n-ol-pointermove/index.vue.d.ts +0 -3
- package/lib/components/n-ol-pointermove/index.vue.js +0 -1
- package/lib/components/n-ol-pointermove/index.vue2.js +0 -1
- package/lib/components/n-ol-pointermove/props.d.ts +0 -22
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Coordinate } from 'ol/coordinate';
|
|
2
|
+
import { FeatureLike } from 'ol/Feature';
|
|
3
|
+
import { CSSProperties, MaybeRefOrGetter, VNodeChild } from 'vue';
|
|
4
|
+
import { LayerLike, OLMap } from '../../types';
|
|
5
|
+
export interface PointermovePosition {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
interface PointermoveContentParams {
|
|
10
|
+
map: OLMap;
|
|
11
|
+
coordinate: Coordinate;
|
|
12
|
+
position: PointermovePosition;
|
|
13
|
+
feature: FeatureLike;
|
|
14
|
+
layer?: LayerLike;
|
|
15
|
+
}
|
|
16
|
+
type Cursor = CSSProperties['cursor'];
|
|
17
|
+
export type PointermoveItem<T extends Option = Option> = {
|
|
18
|
+
/** 提示内容,支持函数动态生成 */
|
|
19
|
+
content: ((params: PointermoveContentParams) => VNodeChild) | string;
|
|
20
|
+
/** 是否显示提示,可根据 feature 动态判断 */
|
|
21
|
+
visible?: ((params: PointermoveContentParams) => boolean) | boolean;
|
|
22
|
+
/** 位置偏移 */
|
|
23
|
+
offset?: {
|
|
24
|
+
x?: number;
|
|
25
|
+
y?: number;
|
|
26
|
+
};
|
|
27
|
+
/** 优先级,数字越大优先级越高,当多个 tooltip 匹配时,显示优先级最高的 */
|
|
28
|
+
priority?: number;
|
|
29
|
+
/** 鼠标样式,如 'pointer', 'crosshair', 'move' 等 */
|
|
30
|
+
cursor?: Cursor | ((params: PointermoveContentParams) => Cursor);
|
|
31
|
+
/** 固定在feature center */
|
|
32
|
+
fixedFeatureCenter?: boolean;
|
|
33
|
+
} & T;
|
|
34
|
+
export type PointermoveList<T extends Option = Option> = PointermoveItem<T>[];
|
|
35
|
+
export interface Option {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}
|
|
38
|
+
export declare function usePointermove<T extends Option>(mapRef: MaybeRefOrGetter<OLMap | undefined>, items: MaybeRefOrGetter<PointermoveList<T>>): {
|
|
39
|
+
visible: import('vue').ComputedRef<boolean>;
|
|
40
|
+
position: import('vue').ComputedRef<{
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
}>;
|
|
44
|
+
originalPosition: import('vue').ComputedRef<{
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}>;
|
|
48
|
+
feature: import('vue').ComputedRef<FeatureLike | undefined>;
|
|
49
|
+
content: import('vue').ComputedRef<string | (() => VNodeChild) | undefined>;
|
|
50
|
+
coordinate: import('vue').ComputedRef<Coordinate | undefined>;
|
|
51
|
+
option: import('vue').ComputedRef<T | undefined>;
|
|
52
|
+
hide: () => void;
|
|
53
|
+
};
|
|
54
|
+
export type UsePointermoveReturn = ReturnType<typeof usePointermove>;
|
|
55
|
+
export type UsePointermoveParams<T extends Option> = Parameters<typeof usePointermove<T>>;
|
|
56
|
+
export type UsePointermoveFn<T extends Option> = (...args: UsePointermoveParams<T>) => UsePointermoveReturn;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("ol/extent"),t=require("vue");function _(q,B){const p=t.ref(!1),c=t.ref({x:0,y:0}),d=t.ref(),E=t.ref(),y=t.ref({x:0,y:0}),P=t.ref(),b=t.ref(),M=t.computed(()=>({x:c.value.x+y.value.x,y:c.value.y+y.value.y}));let o,l="";function j(e){const a=t.toValue(B).filter(r=>{const i=r.visible;return typeof i=="function"?i(e):i??!0});return a.length===0?null:a.sort((r,i)=>(i.priority??0)-(r.priority??0))[0]}function h(e){var L,S;if(!o)return;const n=o.getEventCoordinate(e);P.value=n;const a=o.getEventPixel(e);let r,i;if(o.forEachFeatureAtPixel(a,(s,v)=>(r=s,i=v,!0)),!r){f();return}d.value=r;const m={map:o,position:{x:e.clientX,y:e.clientY},coordinate:n,feature:r,layer:i},u=j(m);if(u){const{content:s,cursor:v,visible:C,fixedFeatureCenter:X,offset:Y,priority:$,...T}=u;b.value={...T}}if(!u){f();return}const G=((L=u.offset)==null?void 0:L.x)??0,O=((S=u.offset)==null?void 0:S.y)??0;y.value={x:G,y:O};const R=u.fixedFeatureCenter??!0,F=r.getGeometry();if(R&&F){const s=F.getExtent(),v=U.getCenter(s),C=o.getPixelFromCoordinate(v),{top:X,left:Y}=o.getViewport().getBoundingClientRect();c.value.x=C[0]+Y,c.value.y=C[1]+X}else c.value={x:e.clientX,y:e.clientY};const x=u.content;E.value=typeof x=="function"?()=>x(m):x;const g=u.cursor,V=typeof g=="function"?g(m):g;if(V&&o){const s=o.getViewport();l||(l=s.style.cursor),s.style.cursor=V}p.value=!0}function f(){if(p.value=!1,d.value=void 0,o&&l!==void 0){const e=o.getViewport();e.style.cursor=l,l=""}}function A(e){if(!e)return;const n=e.getViewport();n.addEventListener("pointermove",h),n.addEventListener("pointerout",f)}function w(e){if(!e)return;const n=e.getViewport();n.removeEventListener("pointermove",h),n.removeEventListener("pointerout",f)}return t.watch(()=>t.toValue(q),(e,n)=>{n!==e&&(w(n),A(e),o=e)},{immediate:!0}),t.onBeforeUnmount(()=>{w(o)}),{visible:t.computed(()=>p.value),position:t.computed(()=>M.value),originalPosition:t.computed(()=>c.value),feature:t.computed(()=>d.value),content:t.computed(()=>E.value),coordinate:t.computed(()=>P.value),option:t.computed(()=>b.value),hide:f}}exports.usePointermove=_;
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./components/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./components/ol-map/index.vue.js"),a=require("./components/ol-map/props.js"),g=require("./composables/useContextmenu/index.js"),s=require("./composables/useDrawLineString/index.js"),P=require("./composables/useDrawPolygon/index.js"),S=require("./composables/useGraticule/index.js"),T=require("./composables/usePointermove/index.js"),E=require("./composables/useSwitchBaseLayer/index.js"),M=require("./constants/distance.js"),i=require("./constants/projection.js"),r=require("./utils/calculate/index.js"),c=require("./utils/distance/index.js"),e=require("./utils/feature/index.js"),u=require("./utils/format/index.js"),n=require("./utils/layer/index.js"),t=require("./utils/projection/index.js"),y=require("./utils/realCircle/index.js"),o=require("./utils/style/index.js");exports.OlMap=l.default;exports.olMapInjectionKey=a.olMapInjectionKey;exports.useOlMap=a.useOlMap;exports.useContextmenu=g.useContextmenu;exports.useDrawLineString=s.useDrawLineString;exports.useDrawPolygon=P.useDrawPolygon;exports.useGraticule=S.useGraticule;exports.usePointermove=T.usePointermove;exports.useSwitchBaseLayer=E.useSwitchBaseLayer;exports.ONE_NM=M.ONE_NM;exports.EPSG_3857=i.EPSG_3857;exports.EPSG_4326=i.EPSG_4326;exports.WGS84Projection=i.WGS84Projection;exports.WebMercatorProjection=i.WebMercatorProjection;exports.getAngle=r.getAngle;exports.getArea=r.getArea;exports.getCenter=r.getCenter;exports.getDestinationPoint=r.getDestinationPoint;exports.getExtentCenter=r.getExtentCenter;exports.getLineLength=r.getLineLength;exports.kmToNauticalMiles=c.kmToNauticalMiles;exports.nauticalMilesToKm=c.nauticalMilesToKm;exports.createCircle=e.createCircle;exports.createCircleFeature=e.createCircleFeature;exports.createFeature=e.createFeature;exports.createLineString=e.createLineString;exports.createLineStringFeature=e.createLineStringFeature;exports.createMultiLineString=e.createMultiLineString;exports.createMultiLineStringFeature=e.createMultiLineStringFeature;exports.createMultiPoint=e.createMultiPoint;exports.createMultiPointFeature=e.createMultiPointFeature;exports.createMultiPolygon=e.createMultiPolygon;exports.createMultiPolygonFeature=e.createMultiPolygonFeature;exports.createPoint=e.createPoint;exports.createPointFeature=e.createPointFeature;exports.createPolygon=e.createPolygon;exports.createPolygonFeature=e.createPolygonFeature;exports.toOlAngle=u.toOlAngle;exports.toTurfAngle=u.toTurfAngle;exports.createVectorLayer=n.createVectorLayer;exports.getBingLayer=n.getBingLayer;exports.getOSMLayer=n.getOSMLayer;exports.getTianDiTuLayer=n.getTianDiTuLayer;exports.getTianDiTuUrl=n.getTianDiTuUrl;exports.EPSG_3857ExtentToEPSG_4326=t.EPSG_3857ExtentToEPSG_4326;exports.EPSG_3857ToEPSG_4326=t.EPSG_3857ToEPSG_4326;exports.EPSG_4326ExtentToEPSG_3857=t.EPSG_4326ExtentToEPSG_3857;exports.EPSG_4326ToEPSG_3857=t.EPSG_4326ToEPSG_3857;exports.mercatorExtentToWgs84=t.mercatorExtentToWgs84;exports.mercatorToWgs84=t.mercatorToWgs84;exports.wgs84ExtentToMercator=t.wgs84ExtentToMercator;exports.wgs84ToMercator=t.wgs84ToMercator;exports.getRealCircleCoordinates=y.getRealCircleCoordinates;exports.createCircleStyle=o.createCircleStyle;exports.createStyle=o.createStyle;exports.createTextStyle=o.createTextStyle;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("ol"),i=require("ol/geom"),S=require("../style/index.js");function c(e){return new i.Point(e)}function a(e){return new i.LineString(e)}function l(e){return new i.Polygon(e)}function g(e,t){return new i.Circle(e,t)}function y(e){return new i.MultiPoint(e)}function s(e){return new i.MultiLineString(e)}function P(e){return new i.MultiPolygon(e)}function n(e){const{styleOptions:t,style:r,geometry:o,...f}=e??{},F=t?S.createStyle(t):r,u=new M.Feature({geometry:o,...f});return u.setStyle(F),u}function m(e,t){const r=c(e);return n({...t,geometry:r})}function L(e,t){const r=a(e);return n({...t,geometry:r})}function w(e,t){const r=l(e);return n({...t,geometry:r})}function C(e,t,r){const o=g(e,t);return n({...r,geometry:o})}function d(e,t){const r=y(e);return n({...t,geometry:r})}function p(e,t){const r=s(e);return n({...t,geometry:r})}function q(e,t){const r=P(e);return n({...t,geometry:r})}exports.createCircle=g;exports.createCircleFeature=C;exports.createFeature=n;exports.createLineString=a;exports.createLineStringFeature=L;exports.createMultiLineString=s;exports.createMultiLineStringFeature=p;exports.createMultiPoint=y;exports.createMultiPointFeature=d;exports.createMultiPolygon=P;exports.createMultiPolygonFeature=q;exports.createPoint=c;exports.createPointFeature=m;exports.createPolygon=l;exports.createPolygonFeature=w;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@summeruse/ol",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0-alpha.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "finalsummer",
|
|
7
7
|
"license": "ISC",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"keywords": [
|
|
11
11
|
"vue",
|
|
12
12
|
"ol",
|
|
13
|
-
"naive-ui",
|
|
14
13
|
"openlayers",
|
|
15
14
|
"vue3"
|
|
16
15
|
],
|
|
@@ -27,13 +26,12 @@
|
|
|
27
26
|
"lib"
|
|
28
27
|
],
|
|
29
28
|
"peerDependencies": {
|
|
30
|
-
"@turf/turf": "7.2.0",
|
|
31
|
-
"naive-ui": "^2.41.0",
|
|
32
29
|
"ol": "10.5.0",
|
|
33
30
|
"vue": "^3.5.13"
|
|
34
31
|
},
|
|
35
32
|
"dependencies": {
|
|
36
|
-
"@
|
|
33
|
+
"@turf/turf": "7.2.0",
|
|
34
|
+
"@summeruse/common": "0.2.0"
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|
|
39
37
|
"@turf/turf": "7.2.0",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { NOlContextmenuProps } from './props';
|
|
2
|
-
declare const _default: import('vue').DefineComponent<NOlContextmenuProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NOlContextmenuProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
3
|
-
export default _default;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { defineComponent as d, ref as a, onMounted as v, createBlock as x, openBlock as m, unref as g } from "vue";
|
|
2
|
-
import { NDropdown as w } from "naive-ui";
|
|
3
|
-
const y = /* @__PURE__ */ d({
|
|
4
|
-
__name: "index",
|
|
5
|
-
props: {
|
|
6
|
-
olMap: {},
|
|
7
|
-
createOptions: { type: Function }
|
|
8
|
-
},
|
|
9
|
-
setup(c) {
|
|
10
|
-
const s = c, { olMap: n } = s, o = a({
|
|
11
|
-
visible: !1,
|
|
12
|
-
x: 0,
|
|
13
|
-
y: 0
|
|
14
|
-
});
|
|
15
|
-
function r() {
|
|
16
|
-
o.value.visible = !1;
|
|
17
|
-
}
|
|
18
|
-
const i = a();
|
|
19
|
-
v(() => {
|
|
20
|
-
const l = n.getViewport();
|
|
21
|
-
l && (l.oncontextmenu = (e) => {
|
|
22
|
-
e.preventDefault();
|
|
23
|
-
const t = n.getEventPixel(e), p = n.getEventCoordinate(e), f = n.getFeaturesAtPixel(t);
|
|
24
|
-
i.value = s.createOptions({ event: e, pixel: t, coordinate: p, features: f }), o.value = {
|
|
25
|
-
visible: !0,
|
|
26
|
-
x: e.clientX,
|
|
27
|
-
y: e.clientY
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
function u(l, e) {
|
|
32
|
-
const { onClick: t } = e;
|
|
33
|
-
t && t(), o.value.visible = !1;
|
|
34
|
-
}
|
|
35
|
-
return (l, e) => (m(), x(g(w), {
|
|
36
|
-
placement: "bottom-start",
|
|
37
|
-
trigger: "manual",
|
|
38
|
-
show: i.value && i.value.length > 0 && o.value.visible,
|
|
39
|
-
x: o.value.x,
|
|
40
|
-
y: o.value.y,
|
|
41
|
-
options: i.value,
|
|
42
|
-
"on-clickoutside": r,
|
|
43
|
-
onSelect: u
|
|
44
|
-
}, null, 8, ["show", "x", "y", "options"]));
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
export {
|
|
48
|
-
y as default
|
|
49
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DropdownMixedOption } from 'naive-ui/es/dropdown/src/interface';
|
|
2
|
-
import { Map as OLMap } from 'ol';
|
|
3
|
-
import { Coordinate } from 'ol/coordinate';
|
|
4
|
-
import { FeatureLike } from 'ol/Feature';
|
|
5
|
-
import { Pixel } from 'ol/pixel';
|
|
6
|
-
export interface NOlContextmenuOptions {
|
|
7
|
-
event: MouseEvent;
|
|
8
|
-
pixel: Pixel;
|
|
9
|
-
coordinate: Coordinate;
|
|
10
|
-
features: FeatureLike[];
|
|
11
|
-
}
|
|
12
|
-
export interface NOlContextmenuProps {
|
|
13
|
-
olMap: OLMap;
|
|
14
|
-
createOptions: (options: NOlContextmenuOptions) => (DropdownMixedOption & {
|
|
15
|
-
onClick?: (options: NOlContextmenuOptions) => void;
|
|
16
|
-
})[];
|
|
17
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { NOlPointermoveProps } from './props';
|
|
2
|
-
declare const _default: import('vue').DefineComponent<NOlPointermoveProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NOlPointermoveProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
3
|
-
export default _default;
|
|
@@ -1,62 +0,0 @@
|
|
|
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({
|
|
6
|
-
__name: "index",
|
|
7
|
-
props: {
|
|
8
|
-
olMap: {},
|
|
9
|
-
createOptions: { type: Function }
|
|
10
|
-
},
|
|
11
|
-
setup(v) {
|
|
12
|
-
const t = v, e = n({
|
|
13
|
-
visible: !1,
|
|
14
|
-
x: 0,
|
|
15
|
-
y: 0
|
|
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);
|
|
21
|
-
e.value.visible = !1;
|
|
22
|
-
const o = t.createOptions({
|
|
23
|
-
pixel: a.pixel,
|
|
24
|
-
coordinate: a.coordinate,
|
|
25
|
-
features: l
|
|
26
|
-
});
|
|
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
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}), (r, a) => (A(), M(m(P), {
|
|
41
|
-
"show-arrow": p.value,
|
|
42
|
-
raw: c.value,
|
|
43
|
-
placement: i.value,
|
|
44
|
-
show: e.value.visible,
|
|
45
|
-
x: e.value.x,
|
|
46
|
-
y: e.value.y,
|
|
47
|
-
trigger: "manual",
|
|
48
|
-
class: "n-ol-pointermove",
|
|
49
|
-
"theme-overrides": {
|
|
50
|
-
boxShadow: "none"
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
default: B(() => [
|
|
54
|
-
F(m(N), { "dynamic-v-node": s.value }, null, 8, ["dynamic-v-node"])
|
|
55
|
-
]),
|
|
56
|
-
_: 1
|
|
57
|
-
}, 8, ["show-arrow", "raw", "placement", "show", "x", "y"]));
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
export {
|
|
61
|
-
S as default
|
|
62
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { PopoverPlacement } from 'naive-ui';
|
|
2
|
-
import { Map as OLMap } from 'ol';
|
|
3
|
-
import { Coordinate } from 'ol/coordinate';
|
|
4
|
-
import { FeatureLike } from 'ol/Feature';
|
|
5
|
-
import { Pixel } from 'ol/pixel';
|
|
6
|
-
import { VNodeChild } from 'vue';
|
|
7
|
-
export interface NOlPointermoveParams {
|
|
8
|
-
pixel: Pixel;
|
|
9
|
-
coordinate: Coordinate;
|
|
10
|
-
features: FeatureLike[];
|
|
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;
|
|
19
|
-
export interface NOlPointermoveProps {
|
|
20
|
-
olMap: OLMap;
|
|
21
|
-
createOptions: (data: NOlPointermoveParams) => NOlPointermoveOption;
|
|
22
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { NOlContextmenuProps } from './props';
|
|
2
|
-
declare const _default: import('vue').DefineComponent<NOlContextmenuProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NOlContextmenuProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
3
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),d=require("naive-ui"),f=t.defineComponent({__name:"index",props:{olMap:{},createOptions:{type:Function}},setup(u){const c=u,{olMap:i}=c,o=t.ref({visible:!1,x:0,y:0});function a(){o.value.visible=!1}const l=t.ref();t.onMounted(()=>{const s=i.getViewport();s&&(s.oncontextmenu=e=>{e.preventDefault();const n=i.getEventPixel(e),p=i.getEventCoordinate(e),v=i.getFeaturesAtPixel(n);l.value=c.createOptions({event:e,pixel:n,coordinate:p,features:v}),o.value={visible:!0,x:e.clientX,y:e.clientY}})});function r(s,e){const{onClick:n}=e;n&&n(),o.value.visible=!1}return(s,e)=>(t.openBlock(),t.createBlock(t.unref(d.NDropdown),{placement:"bottom-start",trigger:"manual",show:l.value&&l.value.length>0&&o.value.visible,x:o.value.x,y:o.value.y,options:l.value,"on-clickoutside":a,onSelect:r},null,8,["show","x","y","options"]))}});exports.default=f;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index.vue.js");exports.default=e.default;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DropdownMixedOption } from 'naive-ui/es/dropdown/src/interface';
|
|
2
|
-
import { Map as OLMap } from 'ol';
|
|
3
|
-
import { Coordinate } from 'ol/coordinate';
|
|
4
|
-
import { FeatureLike } from 'ol/Feature';
|
|
5
|
-
import { Pixel } from 'ol/pixel';
|
|
6
|
-
export interface NOlContextmenuOptions {
|
|
7
|
-
event: MouseEvent;
|
|
8
|
-
pixel: Pixel;
|
|
9
|
-
coordinate: Coordinate;
|
|
10
|
-
features: FeatureLike[];
|
|
11
|
-
}
|
|
12
|
-
export interface NOlContextmenuProps {
|
|
13
|
-
olMap: OLMap;
|
|
14
|
-
createOptions: (options: NOlContextmenuOptions) => (DropdownMixedOption & {
|
|
15
|
-
onClick?: (options: NOlContextmenuOptions) => void;
|
|
16
|
-
})[];
|
|
17
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { NOlPointermoveProps } from './props';
|
|
2
|
-
declare const _default: import('vue').DefineComponent<NOlPointermoveProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NOlPointermoveProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
3
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index.vue.js");exports.default=e.default;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { PopoverPlacement } from 'naive-ui';
|
|
2
|
-
import { Map as OLMap } from 'ol';
|
|
3
|
-
import { Coordinate } from 'ol/coordinate';
|
|
4
|
-
import { FeatureLike } from 'ol/Feature';
|
|
5
|
-
import { Pixel } from 'ol/pixel';
|
|
6
|
-
import { VNodeChild } from 'vue';
|
|
7
|
-
export interface NOlPointermoveParams {
|
|
8
|
-
pixel: Pixel;
|
|
9
|
-
coordinate: Coordinate;
|
|
10
|
-
features: FeatureLike[];
|
|
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;
|
|
19
|
-
export interface NOlPointermoveProps {
|
|
20
|
-
olMap: OLMap;
|
|
21
|
-
createOptions: (data: NOlPointermoveParams) => NOlPointermoveOption;
|
|
22
|
-
}
|