@vsleem-realsee-viewer/projection-plugin 2.0.7 → 2.0.8
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/dist/BimControl-DEu7f-MB.mjs +47 -0
- package/dist/CadControl-V1kj2Sda.mjs +528 -0
- package/dist/GeoControl-BVlaq3lj.mjs +1668 -0
- package/dist/ScaleControl-ozGBcKS4.mjs +72 -0
- package/dist/components/BimControl.vue.d.ts +49 -0
- package/dist/components/CadControl.vue.d.ts +1 -2
- package/dist/components/ConfigProvider.vue.d.ts +18 -0
- package/dist/components/Projection.vue.d.ts +17 -118
- package/dist/components/ProjectionViewer.vue.d.ts +336 -0
- package/dist/components/{SpaceMapping.vue.d.ts → SpaceMapViewer.vue.d.ts} +20 -1
- package/dist/en-US-Dck5fGJH.mjs +21 -0
- package/dist/enums/index.d.ts +4 -0
- package/dist/{index-BAKg9BcH.mjs → index-BvEgK94y.mjs} +7983 -7714
- package/dist/index.css +1 -1
- package/dist/index.d.ts +19 -2
- package/dist/index.mjs +5 -4
- package/dist/index.umd.js +51 -52
- package/dist/locales/index.d.ts +20 -0
- package/dist/locales/lang/en-US.json.d.ts +45 -0
- package/dist/locales/lang/zh-CN.json.d.ts +45 -0
- package/dist/{resize-B144Vkj1.mjs → resize-Bvzb1xAn.mjs} +6 -6
- package/dist/types/antd.d.ts +1 -0
- package/dist/types/index.d.ts +40 -2
- package/package.json +3 -3
- package/dist/BimfaceControl-mNoxunKU.mjs +0 -277
- package/dist/CadControl-CMG_x23G.mjs +0 -517
- package/dist/ForgeControl-B3zcU_f4.mjs +0 -194
- package/dist/MapControl-CUQRIRA1.mjs +0 -1691
- package/dist/ScaleControl-BTcdEU94.mjs +0 -73
- package/dist/components/BimfaceControl.vue.d.ts +0 -33
- package/dist/components/ForgeControl.vue.d.ts +0 -11
- package/dist/components/SvgIcon.vue.d.ts +0 -29
- package/dist/edit-DRtArG5y.mjs +0 -4
- package/dist/position-CKTdZLcJ.mjs +0 -4
- /package/dist/components/{MapControl.vue.d.ts → GeoControl.vue.d.ts} +0 -0
- /package/dist/components/{SpaceBinding.vue.d.ts → SpaceBindViewer.vue.d.ts} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineComponent as v, ref as _, computed as P, watch as B, createElementBlock as w, openBlock as h, renderSlot as y, normalizeProps as C, guardReactiveProps as g } from "vue";
|
|
2
|
+
import { Point as i } from "@vsleem-realsee-viewer/shared";
|
|
3
|
+
import { y as x } from "./index-BvEgK94y.mjs";
|
|
4
|
+
const M = { class: "vsleem-bim-control" }, b = /* @__PURE__ */ v({
|
|
5
|
+
name: "BimControl",
|
|
6
|
+
__name: "BimControl",
|
|
7
|
+
props: {
|
|
8
|
+
currentModel: {},
|
|
9
|
+
points: {}
|
|
10
|
+
},
|
|
11
|
+
setup(u, { expose: c }) {
|
|
12
|
+
const r = u, t = _([]), a = P(() => ({
|
|
13
|
+
currentModel: r.currentModel,
|
|
14
|
+
points: t.value,
|
|
15
|
+
setPoint1: p,
|
|
16
|
+
setPoint2: m
|
|
17
|
+
}));
|
|
18
|
+
B(() => r.points, l, { deep: !0, immediate: !0 });
|
|
19
|
+
function l() {
|
|
20
|
+
t.value = s(r.points || []);
|
|
21
|
+
}
|
|
22
|
+
function s(e) {
|
|
23
|
+
return e.map((n) => d(n));
|
|
24
|
+
}
|
|
25
|
+
function p(e) {
|
|
26
|
+
e && (t.value[0] = new i(e));
|
|
27
|
+
}
|
|
28
|
+
function m(e) {
|
|
29
|
+
e && (t.value[1] = new i(e));
|
|
30
|
+
}
|
|
31
|
+
function d(e, n = !0) {
|
|
32
|
+
const o = new i(e);
|
|
33
|
+
return o.y = n ? -o.y : o.y, o;
|
|
34
|
+
}
|
|
35
|
+
function f() {
|
|
36
|
+
return { points: s(t.value) };
|
|
37
|
+
}
|
|
38
|
+
return c({
|
|
39
|
+
getData: f
|
|
40
|
+
}), (e, n) => (h(), w("div", M, [
|
|
41
|
+
y(e.$slots, "bimViewer", C(g(a.value)), void 0, !0)
|
|
42
|
+
]));
|
|
43
|
+
}
|
|
44
|
+
}), D = /* @__PURE__ */ x(b, [["__scopeId", "data-v-86c694e2"]]);
|
|
45
|
+
export {
|
|
46
|
+
D as default
|
|
47
|
+
};
|
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import { defineComponent as tn, shallowRef as un, watch as V, onBeforeUnmount as dn, createVNode as u, isVNode as F, cloneVNode as K, ref as E, reactive as pn, onMounted as mn, onUnmounted as vn, unref as T, createElementBlock as U, openBlock as H, createBlock as fn, createCommentVNode as W, createElementVNode as P, withModifiers as gn, withCtx as A, createTextVNode as Y, toDisplayString as R } from "vue";
|
|
2
|
+
import { utils as N, CanvasElement as hn, CanvasPointElement as q, Point as J, CanvasImageElement as Sn, DataHelper as yn } from "@vsleem-realsee-viewer/shared";
|
|
3
|
+
import { z as Cn, D as wn, _ as Q, E as Dn, K as en, G as bn, d as $n, b as Z, f as xn, P as k, H as zn, x as In, n as nn, y as _n } from "./index-BvEgK94y.mjs";
|
|
4
|
+
import { u as En, S as Tn } from "./resize-Bvzb1xAn.mjs";
|
|
5
|
+
function Mn(n, a, g) {
|
|
6
|
+
var e = g || {}, t = e.noTrailing, h = t === void 0 ? !1 : t, x = e.noLeading, l = x === void 0 ? !1 : x, f = e.debounceMode, i = f === void 0 ? void 0 : f, o, s = !1, d = 0;
|
|
7
|
+
function C() {
|
|
8
|
+
o && clearTimeout(o);
|
|
9
|
+
}
|
|
10
|
+
function M(w) {
|
|
11
|
+
var D = w || {}, S = D.upcomingOnly, _ = S === void 0 ? !1 : S;
|
|
12
|
+
C(), s = !_;
|
|
13
|
+
}
|
|
14
|
+
function z() {
|
|
15
|
+
for (var w = arguments.length, D = new Array(w), S = 0; S < w; S++)
|
|
16
|
+
D[S] = arguments[S];
|
|
17
|
+
var _ = this, p = Date.now() - d;
|
|
18
|
+
if (s)
|
|
19
|
+
return;
|
|
20
|
+
function y() {
|
|
21
|
+
d = Date.now(), a.apply(_, D);
|
|
22
|
+
}
|
|
23
|
+
function m() {
|
|
24
|
+
o = void 0;
|
|
25
|
+
}
|
|
26
|
+
!l && i && !o && y(), C(), i === void 0 && p > n ? l ? (d = Date.now(), h || (o = setTimeout(i ? m : y, n))) : y() : h !== !0 && (o = setTimeout(i ? m : y, i === void 0 ? n - p : n));
|
|
27
|
+
}
|
|
28
|
+
return z.cancel = M, z;
|
|
29
|
+
}
|
|
30
|
+
function Pn(n, a, g) {
|
|
31
|
+
var e = {}, t = e.atBegin, h = t === void 0 ? !1 : t;
|
|
32
|
+
return Mn(n, a, {
|
|
33
|
+
debounceMode: h !== !1
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const Nn = new en("antSpinMove", {
|
|
37
|
+
to: {
|
|
38
|
+
opacity: 1
|
|
39
|
+
}
|
|
40
|
+
}), On = new en("antRotate", {
|
|
41
|
+
to: {
|
|
42
|
+
transform: "rotate(405deg)"
|
|
43
|
+
}
|
|
44
|
+
}), Bn = (n) => ({
|
|
45
|
+
[`${n.componentCls}`]: Q(Q({}, Dn(n)), {
|
|
46
|
+
position: "absolute",
|
|
47
|
+
display: "none",
|
|
48
|
+
color: n.colorPrimary,
|
|
49
|
+
textAlign: "center",
|
|
50
|
+
verticalAlign: "middle",
|
|
51
|
+
opacity: 0,
|
|
52
|
+
transition: `transform ${n.motionDurationSlow} ${n.motionEaseInOutCirc}`,
|
|
53
|
+
"&-spinning": {
|
|
54
|
+
position: "static",
|
|
55
|
+
display: "inline-block",
|
|
56
|
+
opacity: 1
|
|
57
|
+
},
|
|
58
|
+
"&-nested-loading": {
|
|
59
|
+
position: "relative",
|
|
60
|
+
[`> div > ${n.componentCls}`]: {
|
|
61
|
+
position: "absolute",
|
|
62
|
+
top: 0,
|
|
63
|
+
insetInlineStart: 0,
|
|
64
|
+
zIndex: 4,
|
|
65
|
+
display: "block",
|
|
66
|
+
width: "100%",
|
|
67
|
+
height: "100%",
|
|
68
|
+
maxHeight: n.contentHeight,
|
|
69
|
+
[`${n.componentCls}-dot`]: {
|
|
70
|
+
position: "absolute",
|
|
71
|
+
top: "50%",
|
|
72
|
+
insetInlineStart: "50%",
|
|
73
|
+
margin: -n.spinDotSize / 2
|
|
74
|
+
},
|
|
75
|
+
[`${n.componentCls}-text`]: {
|
|
76
|
+
position: "absolute",
|
|
77
|
+
top: "50%",
|
|
78
|
+
width: "100%",
|
|
79
|
+
paddingTop: (n.spinDotSize - n.fontSize) / 2 + 2,
|
|
80
|
+
textShadow: `0 1px 2px ${n.colorBgContainer}`
|
|
81
|
+
// FIXME: shadow
|
|
82
|
+
},
|
|
83
|
+
[`&${n.componentCls}-show-text ${n.componentCls}-dot`]: {
|
|
84
|
+
marginTop: -(n.spinDotSize / 2) - 10
|
|
85
|
+
},
|
|
86
|
+
"&-sm": {
|
|
87
|
+
[`${n.componentCls}-dot`]: {
|
|
88
|
+
margin: -n.spinDotSizeSM / 2
|
|
89
|
+
},
|
|
90
|
+
[`${n.componentCls}-text`]: {
|
|
91
|
+
paddingTop: (n.spinDotSizeSM - n.fontSize) / 2 + 2
|
|
92
|
+
},
|
|
93
|
+
[`&${n.componentCls}-show-text ${n.componentCls}-dot`]: {
|
|
94
|
+
marginTop: -(n.spinDotSizeSM / 2) - 10
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"&-lg": {
|
|
98
|
+
[`${n.componentCls}-dot`]: {
|
|
99
|
+
margin: -(n.spinDotSizeLG / 2)
|
|
100
|
+
},
|
|
101
|
+
[`${n.componentCls}-text`]: {
|
|
102
|
+
paddingTop: (n.spinDotSizeLG - n.fontSize) / 2 + 2
|
|
103
|
+
},
|
|
104
|
+
[`&${n.componentCls}-show-text ${n.componentCls}-dot`]: {
|
|
105
|
+
marginTop: -(n.spinDotSizeLG / 2) - 10
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
[`${n.componentCls}-container`]: {
|
|
110
|
+
position: "relative",
|
|
111
|
+
transition: `opacity ${n.motionDurationSlow}`,
|
|
112
|
+
"&::after": {
|
|
113
|
+
position: "absolute",
|
|
114
|
+
top: 0,
|
|
115
|
+
insetInlineEnd: 0,
|
|
116
|
+
bottom: 0,
|
|
117
|
+
insetInlineStart: 0,
|
|
118
|
+
zIndex: 10,
|
|
119
|
+
width: "100%",
|
|
120
|
+
height: "100%",
|
|
121
|
+
background: n.colorBgContainer,
|
|
122
|
+
opacity: 0,
|
|
123
|
+
transition: `all ${n.motionDurationSlow}`,
|
|
124
|
+
content: '""',
|
|
125
|
+
pointerEvents: "none"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
[`${n.componentCls}-blur`]: {
|
|
129
|
+
clear: "both",
|
|
130
|
+
opacity: 0.5,
|
|
131
|
+
userSelect: "none",
|
|
132
|
+
pointerEvents: "none",
|
|
133
|
+
"&::after": {
|
|
134
|
+
opacity: 0.4,
|
|
135
|
+
pointerEvents: "auto"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
// tip
|
|
140
|
+
// ------------------------------
|
|
141
|
+
"&-tip": {
|
|
142
|
+
color: n.spinDotDefault
|
|
143
|
+
},
|
|
144
|
+
// dots
|
|
145
|
+
// ------------------------------
|
|
146
|
+
[`${n.componentCls}-dot`]: {
|
|
147
|
+
position: "relative",
|
|
148
|
+
display: "inline-block",
|
|
149
|
+
fontSize: n.spinDotSize,
|
|
150
|
+
width: "1em",
|
|
151
|
+
height: "1em",
|
|
152
|
+
"&-item": {
|
|
153
|
+
position: "absolute",
|
|
154
|
+
display: "block",
|
|
155
|
+
width: (n.spinDotSize - n.marginXXS / 2) / 2,
|
|
156
|
+
height: (n.spinDotSize - n.marginXXS / 2) / 2,
|
|
157
|
+
backgroundColor: n.colorPrimary,
|
|
158
|
+
borderRadius: "100%",
|
|
159
|
+
transform: "scale(0.75)",
|
|
160
|
+
transformOrigin: "50% 50%",
|
|
161
|
+
opacity: 0.3,
|
|
162
|
+
animationName: Nn,
|
|
163
|
+
animationDuration: "1s",
|
|
164
|
+
animationIterationCount: "infinite",
|
|
165
|
+
animationTimingFunction: "linear",
|
|
166
|
+
animationDirection: "alternate",
|
|
167
|
+
"&:nth-child(1)": {
|
|
168
|
+
top: 0,
|
|
169
|
+
insetInlineStart: 0
|
|
170
|
+
},
|
|
171
|
+
"&:nth-child(2)": {
|
|
172
|
+
top: 0,
|
|
173
|
+
insetInlineEnd: 0,
|
|
174
|
+
animationDelay: "0.4s"
|
|
175
|
+
},
|
|
176
|
+
"&:nth-child(3)": {
|
|
177
|
+
insetInlineEnd: 0,
|
|
178
|
+
bottom: 0,
|
|
179
|
+
animationDelay: "0.8s"
|
|
180
|
+
},
|
|
181
|
+
"&:nth-child(4)": {
|
|
182
|
+
bottom: 0,
|
|
183
|
+
insetInlineStart: 0,
|
|
184
|
+
animationDelay: "1.2s"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"&-spin": {
|
|
188
|
+
transform: "rotate(45deg)",
|
|
189
|
+
animationName: On,
|
|
190
|
+
animationDuration: "1.2s",
|
|
191
|
+
animationIterationCount: "infinite",
|
|
192
|
+
animationTimingFunction: "linear"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
// Sizes
|
|
196
|
+
// ------------------------------
|
|
197
|
+
// small
|
|
198
|
+
[`&-sm ${n.componentCls}-dot`]: {
|
|
199
|
+
fontSize: n.spinDotSizeSM,
|
|
200
|
+
i: {
|
|
201
|
+
width: (n.spinDotSizeSM - n.marginXXS / 2) / 2,
|
|
202
|
+
height: (n.spinDotSizeSM - n.marginXXS / 2) / 2
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
// large
|
|
206
|
+
[`&-lg ${n.componentCls}-dot`]: {
|
|
207
|
+
fontSize: n.spinDotSizeLG,
|
|
208
|
+
i: {
|
|
209
|
+
width: (n.spinDotSizeLG - n.marginXXS) / 2,
|
|
210
|
+
height: (n.spinDotSizeLG - n.marginXXS) / 2
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
[`&${n.componentCls}-show-text ${n.componentCls}-text`]: {
|
|
214
|
+
display: "block"
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
}), Ln = Cn("Spin", (n) => {
|
|
218
|
+
const a = wn(n, {
|
|
219
|
+
spinDotDefault: n.colorTextDescription,
|
|
220
|
+
spinDotSize: n.controlHeightLG / 2,
|
|
221
|
+
spinDotSizeSM: n.controlHeightLG * 0.35,
|
|
222
|
+
spinDotSizeLG: n.controlHeight
|
|
223
|
+
});
|
|
224
|
+
return [Bn(a)];
|
|
225
|
+
}, {
|
|
226
|
+
contentHeight: 400
|
|
227
|
+
});
|
|
228
|
+
var Rn = function(n, a) {
|
|
229
|
+
var g = {};
|
|
230
|
+
for (var e in n) Object.prototype.hasOwnProperty.call(n, e) && a.indexOf(e) < 0 && (g[e] = n[e]);
|
|
231
|
+
if (n != null && typeof Object.getOwnPropertySymbols == "function") for (var t = 0, e = Object.getOwnPropertySymbols(n); t < e.length; t++)
|
|
232
|
+
a.indexOf(e[t]) < 0 && Object.prototype.propertyIsEnumerable.call(n, e[t]) && (g[e[t]] = n[e[t]]);
|
|
233
|
+
return g;
|
|
234
|
+
};
|
|
235
|
+
const Xn = () => ({
|
|
236
|
+
prefixCls: String,
|
|
237
|
+
spinning: {
|
|
238
|
+
type: Boolean,
|
|
239
|
+
default: void 0
|
|
240
|
+
},
|
|
241
|
+
size: String,
|
|
242
|
+
wrapperClassName: String,
|
|
243
|
+
tip: k.any,
|
|
244
|
+
delay: Number,
|
|
245
|
+
indicator: k.any
|
|
246
|
+
});
|
|
247
|
+
let X = null;
|
|
248
|
+
function Gn(n, a) {
|
|
249
|
+
return !!n && !!a && !isNaN(Number(a));
|
|
250
|
+
}
|
|
251
|
+
function Hn(n) {
|
|
252
|
+
const a = n.indicator;
|
|
253
|
+
X = typeof a == "function" ? a : () => u(a, null, null);
|
|
254
|
+
}
|
|
255
|
+
const O = tn({
|
|
256
|
+
compatConfig: {
|
|
257
|
+
MODE: 3
|
|
258
|
+
},
|
|
259
|
+
name: "ASpin",
|
|
260
|
+
inheritAttrs: !1,
|
|
261
|
+
props: bn(Xn(), {
|
|
262
|
+
size: "default",
|
|
263
|
+
spinning: !0,
|
|
264
|
+
wrapperClassName: ""
|
|
265
|
+
}),
|
|
266
|
+
setup(n, a) {
|
|
267
|
+
let {
|
|
268
|
+
attrs: g,
|
|
269
|
+
slots: e
|
|
270
|
+
} = a;
|
|
271
|
+
const {
|
|
272
|
+
prefixCls: t,
|
|
273
|
+
size: h,
|
|
274
|
+
direction: x
|
|
275
|
+
} = $n("spin", n), [l, f] = Ln(t), i = un(n.spinning && !Gn(n.spinning, n.delay));
|
|
276
|
+
let o;
|
|
277
|
+
return V([() => n.spinning, () => n.delay], () => {
|
|
278
|
+
o?.cancel(), o = Pn(n.delay, () => {
|
|
279
|
+
i.value = n.spinning;
|
|
280
|
+
}), o?.();
|
|
281
|
+
}, {
|
|
282
|
+
immediate: !0,
|
|
283
|
+
flush: "post"
|
|
284
|
+
}), dn(() => {
|
|
285
|
+
o?.cancel();
|
|
286
|
+
}), () => {
|
|
287
|
+
var s, d;
|
|
288
|
+
const {
|
|
289
|
+
class: C
|
|
290
|
+
} = g, M = Rn(g, ["class"]), {
|
|
291
|
+
tip: z = (s = e.tip) === null || s === void 0 ? void 0 : s.call(e)
|
|
292
|
+
} = n, w = (d = e.default) === null || d === void 0 ? void 0 : d.call(e), D = {
|
|
293
|
+
[f.value]: !0,
|
|
294
|
+
[t.value]: !0,
|
|
295
|
+
[`${t.value}-sm`]: h.value === "small",
|
|
296
|
+
[`${t.value}-lg`]: h.value === "large",
|
|
297
|
+
[`${t.value}-spinning`]: i.value,
|
|
298
|
+
[`${t.value}-show-text`]: !!z,
|
|
299
|
+
[`${t.value}-rtl`]: x.value === "rtl",
|
|
300
|
+
[C]: !!C
|
|
301
|
+
};
|
|
302
|
+
function S(p) {
|
|
303
|
+
const y = `${p}-dot`;
|
|
304
|
+
let m = zn(e, n, "indicator");
|
|
305
|
+
return m === null ? null : (Array.isArray(m) && (m = m.length === 1 ? m[0] : m), F(m) ? K(m, {
|
|
306
|
+
class: y
|
|
307
|
+
}) : X && F(X()) ? K(X(), {
|
|
308
|
+
class: y
|
|
309
|
+
}) : u("span", {
|
|
310
|
+
class: `${y} ${p}-dot-spin`
|
|
311
|
+
}, [u("i", {
|
|
312
|
+
class: `${p}-dot-item`
|
|
313
|
+
}, null), u("i", {
|
|
314
|
+
class: `${p}-dot-item`
|
|
315
|
+
}, null), u("i", {
|
|
316
|
+
class: `${p}-dot-item`
|
|
317
|
+
}, null), u("i", {
|
|
318
|
+
class: `${p}-dot-item`
|
|
319
|
+
}, null)]));
|
|
320
|
+
}
|
|
321
|
+
const _ = u("div", Z(Z({}, M), {}, {
|
|
322
|
+
class: D,
|
|
323
|
+
"aria-live": "polite",
|
|
324
|
+
"aria-busy": i.value
|
|
325
|
+
}), [S(t.value), z ? u("div", {
|
|
326
|
+
class: `${t.value}-text`
|
|
327
|
+
}, [z]) : null]);
|
|
328
|
+
if (w && xn(w).length) {
|
|
329
|
+
const p = {
|
|
330
|
+
[`${t.value}-container`]: !0,
|
|
331
|
+
[`${t.value}-blur`]: i.value
|
|
332
|
+
};
|
|
333
|
+
return l(u("div", {
|
|
334
|
+
class: [`${t.value}-nested-loading`, n.wrapperClassName, f.value]
|
|
335
|
+
}, [i.value && u("div", {
|
|
336
|
+
key: "loading"
|
|
337
|
+
}, [_]), u("div", {
|
|
338
|
+
class: p,
|
|
339
|
+
key: "container"
|
|
340
|
+
}, [w])]));
|
|
341
|
+
}
|
|
342
|
+
return l(_);
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
O.setDefaultIndicator = Hn;
|
|
347
|
+
O.install = function(n) {
|
|
348
|
+
return n.component(O.name, O), n;
|
|
349
|
+
};
|
|
350
|
+
const An = { class: "vsleem-cad-control" }, Vn = { class: "tool-button" }, jn = {
|
|
351
|
+
key: 0,
|
|
352
|
+
class: "distance"
|
|
353
|
+
}, Fn = /* @__PURE__ */ tn({
|
|
354
|
+
name: "CadControl",
|
|
355
|
+
__name: "CadControl",
|
|
356
|
+
props: {
|
|
357
|
+
currentModel: {},
|
|
358
|
+
points: {},
|
|
359
|
+
connected: { type: Boolean }
|
|
360
|
+
},
|
|
361
|
+
emits: ["change"],
|
|
362
|
+
setup(n, { expose: a, emit: g }) {
|
|
363
|
+
const e = g, t = n, [h] = In("CadControl"), x = E(!0), l = E(0), f = E(), i = E(), o = E([]), s = E(), d = pn({ x: 0, y: 0, scale: 1 }), C = E([]), M = E(0), z = N.debounce(S, 300);
|
|
364
|
+
V(() => t.currentModel?.id, z), V(() => t.points, y), mn(() => {
|
|
365
|
+
En(f, z);
|
|
366
|
+
}), vn(() => {
|
|
367
|
+
w();
|
|
368
|
+
});
|
|
369
|
+
function w() {
|
|
370
|
+
i.value && (i.value.unBindEvent(), i.value = void 0);
|
|
371
|
+
}
|
|
372
|
+
function D(v) {
|
|
373
|
+
return ["#5bb36f", "#ff4d4f", "rgba(91, 179, 111, 0.8)"][v];
|
|
374
|
+
}
|
|
375
|
+
async function S() {
|
|
376
|
+
try {
|
|
377
|
+
T(f) && (await _(), await p(), await y()), l.value = 0;
|
|
378
|
+
} finally {
|
|
379
|
+
x.value = !1;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function _() {
|
|
383
|
+
const v = f.value?.getBoundingClientRect(), { width: c, height: I } = v;
|
|
384
|
+
i.value?.unBindEvent(), i.value = new hn({
|
|
385
|
+
container: f.value,
|
|
386
|
+
width: c,
|
|
387
|
+
height: I,
|
|
388
|
+
isDrawAssist: !0,
|
|
389
|
+
onClick(r, b) {
|
|
390
|
+
const $ = new q({
|
|
391
|
+
x: r,
|
|
392
|
+
y: b,
|
|
393
|
+
text: l.value + 1,
|
|
394
|
+
backgroundColor: D(l.value)
|
|
395
|
+
});
|
|
396
|
+
o.value[l.value] = $, i.value?.draw();
|
|
397
|
+
const { x: G, y: B } = $, L = N.toModelCoord(G, B, d);
|
|
398
|
+
C.value[l.value] = new J(L), sn(), e("change", j());
|
|
399
|
+
},
|
|
400
|
+
draw(r) {
|
|
401
|
+
if (s.value?.draw(r), t.connected && o.value.length === 2) {
|
|
402
|
+
const [b, $] = o.value;
|
|
403
|
+
r.lineWidth = 2 / (i.value?.scale ?? 1), r.beginPath(), r.moveTo($.x, $.y), r.lineTo(b.x, b.y), r.strokeStyle = D(2), r.stroke();
|
|
404
|
+
}
|
|
405
|
+
o.value.forEach((b) => {
|
|
406
|
+
i.value && b.draw(r, i.value);
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
function p() {
|
|
412
|
+
return new Promise((v, c) => {
|
|
413
|
+
if (!t.currentModel?.modelValue)
|
|
414
|
+
return s.value = void 0, v(void 0);
|
|
415
|
+
x.value = !0;
|
|
416
|
+
const I = f.value?.getBoundingClientRect(), { width: r, height: b } = I;
|
|
417
|
+
s.value = new Sn({
|
|
418
|
+
src: t.currentModel?.modelValue,
|
|
419
|
+
onload($) {
|
|
420
|
+
if (!s.value) return;
|
|
421
|
+
const { scale: G, x: B, y: L, sw: rn, sh: cn } = N.getImageTransform(
|
|
422
|
+
r,
|
|
423
|
+
b,
|
|
424
|
+
$.width,
|
|
425
|
+
$.height
|
|
426
|
+
);
|
|
427
|
+
s.value.width = rn, s.value.height = cn, s.value.x = B, s.value.y = L, d.x = B, d.y = L, d.scale = G, v(s.value);
|
|
428
|
+
},
|
|
429
|
+
onerror() {
|
|
430
|
+
x.value = !1, c("image error");
|
|
431
|
+
},
|
|
432
|
+
redraw: () => i.value?.draw()
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
async function y() {
|
|
437
|
+
C.value = [...N.cloneDeep(t.points || [])], await m(), await on(), i.value?.draw();
|
|
438
|
+
}
|
|
439
|
+
function m() {
|
|
440
|
+
o.value = C.value.map((v, c) => {
|
|
441
|
+
const { x: I, y: r } = v, { x: b, y: $ } = N.toCanvasCoord(I, r, d);
|
|
442
|
+
return new q({
|
|
443
|
+
x: b,
|
|
444
|
+
y: $,
|
|
445
|
+
text: c + 1,
|
|
446
|
+
backgroundColor: D(c)
|
|
447
|
+
});
|
|
448
|
+
}), i.value?.draw();
|
|
449
|
+
}
|
|
450
|
+
function on() {
|
|
451
|
+
if (t.points?.length === 2) {
|
|
452
|
+
const v = t.currentModel, c = v?.findParentSpace();
|
|
453
|
+
if (v && c) {
|
|
454
|
+
const I = yn.srcPointToDstPoint(t.points, v, c);
|
|
455
|
+
if (I.length === 2) {
|
|
456
|
+
const r = J.distXY(I[0], I[1]);
|
|
457
|
+
M.value = parseFloat((r / 1e3).toFixed(2));
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function an() {
|
|
463
|
+
l.value = 0;
|
|
464
|
+
}
|
|
465
|
+
function ln() {
|
|
466
|
+
l.value = 1;
|
|
467
|
+
}
|
|
468
|
+
function sn() {
|
|
469
|
+
l.value = l.value === 0 ? 1 : 0;
|
|
470
|
+
}
|
|
471
|
+
function j() {
|
|
472
|
+
return {
|
|
473
|
+
points: C.value
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
return a({
|
|
477
|
+
getData: j
|
|
478
|
+
}), (v, c) => (H(), U("div", An, [
|
|
479
|
+
x.value ? (H(), fn(T(O), {
|
|
480
|
+
key: 0,
|
|
481
|
+
class: "cad-spin"
|
|
482
|
+
})) : W("", !0),
|
|
483
|
+
P("canvas", {
|
|
484
|
+
ref_key: "canvasElRef",
|
|
485
|
+
ref: f,
|
|
486
|
+
class: "cad-wrapper",
|
|
487
|
+
onSelectstart: c[0] || (c[0] = gn(() => {
|
|
488
|
+
}, ["prevent"]))
|
|
489
|
+
}, null, 544),
|
|
490
|
+
P("div", Vn, [
|
|
491
|
+
u(T(Tn), null, {
|
|
492
|
+
default: A(() => [
|
|
493
|
+
u(T(nn), {
|
|
494
|
+
type: "primary",
|
|
495
|
+
ghost: l.value !== 0,
|
|
496
|
+
onClick: an
|
|
497
|
+
}, {
|
|
498
|
+
default: A(() => [
|
|
499
|
+
Y(R(T(h)?.locationPoint1), 1)
|
|
500
|
+
]),
|
|
501
|
+
_: 1
|
|
502
|
+
}, 8, ["ghost"]),
|
|
503
|
+
M.value ? (H(), U("div", jn, [
|
|
504
|
+
P("div", null, R(T(h)?.distance), 1),
|
|
505
|
+
c[1] || (c[1] = P("div", { class: "divider" }, null, -1)),
|
|
506
|
+
P("div", null, R(M.value) + " m", 1)
|
|
507
|
+
])) : W("", !0),
|
|
508
|
+
u(T(nn), {
|
|
509
|
+
type: "primary",
|
|
510
|
+
danger: "",
|
|
511
|
+
ghost: l.value != 1,
|
|
512
|
+
onClick: ln
|
|
513
|
+
}, {
|
|
514
|
+
default: A(() => [
|
|
515
|
+
Y(R(T(h)?.locationPoint2), 1)
|
|
516
|
+
]),
|
|
517
|
+
_: 1
|
|
518
|
+
}, 8, ["ghost"])
|
|
519
|
+
]),
|
|
520
|
+
_: 1
|
|
521
|
+
})
|
|
522
|
+
])
|
|
523
|
+
]));
|
|
524
|
+
}
|
|
525
|
+
}), qn = /* @__PURE__ */ _n(Fn, [["__scopeId", "data-v-02d78fb1"]]);
|
|
526
|
+
export {
|
|
527
|
+
qn as default
|
|
528
|
+
};
|