@buerli.io/buerligons 0.1.0 → 0.1.1-beta.20261102135059
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/lib/index.js +1086 -1007
- package/dist/lib/types/postpro/pipeline/surface.d.ts +19 -5
- package/package.json +2 -2
package/dist/lib/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { BuerliCadFacade as e, ScgClassType as t, ScgGraphicType as n, WASMClient as r, WSClient as i, ccUtils as a, createApi as o, getApiFacade as s, onClient as c, syncSelection as l } from "@buerli.io/classcad";
|
|
2
2
|
import { BuerliGeometry as u, BuerliPluginsGeometry as d, CameraHelper as f, GlobalTransform as p, Overlay as m, PluginManager as h, useBuerli as g, useDrawing as _ } from "@buerli.io/react";
|
|
3
|
-
import { AppStyle as v, AppearanceEditor as y, Boolean as b, BoundingBoxInfo as x, Box as S, CSysDisplay as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { BuerliScope as
|
|
7
|
-
import { Canvas as
|
|
8
|
-
import { BackSide as
|
|
9
|
-
import { DFGLUT as
|
|
3
|
+
import { AppStyle as v, AppearanceEditor as y, Boolean as b, BoundingBoxInfo as x, Box as S, CSysDisplay as C, CSysDisplayMode as ee, Chamfer as w, CircularPattern as te, CircularPatternConstraint as ne, CompositeCurve as T, CompositeCurveObj as re, Cone as ie, ContextMenu as ae, Cylinder as oe, Cylindrical as se, Dimensions as ce, Drawing as le, EditMode as ue, EntityDeletion as de, Expressions as fe, Extrusion as pe, Fastened as me, FastenedOrigin as he, Fillet as ge, Gear as _e, GeometryOverridesManager as ve, Group as ye, HUD as be, HoveredConstraintDisplay as xe, Icon as Se, Import as Ce, LinearPattern as we, LinearPatternConstraint as Te, MateScope as Ee, Measure as De, Menu as Oe, Mirror as ke, Parallel as Ae, Planar as je, PluginGeometryBounds as Me, ProductManagement as Ne, Readfile as Pe, Revolute as Fe, Revolve as Ie, Rotate as Le, SessionManagement as Re, Sketch as ze, Slice as Be, SliceBySheet as Ve, Slider as He, Sphere as Ue, Spherical as We, StageLook as Ge, ThemeToggle as Ke, TransformByCsys as qe, Translate as Je, TreeObjScope as Ye, Twist as Xe, WorkAxis as Ze, WorkAxisObj as Qe, WorkCSys as $e, WorkCSysObj as et, WorkCoordSystemObj as tt, WorkPlane as nt, WorkPlaneObj as rt, WorkPoint as it, WorkPointObj as at, conversionUtils as ot, createTreeObjSelItem as st, elements as ct, getCADState as lt, getMateRefIds as ut, getStage as dt, getViewOptions as ft, iconRef as pt, mateUtils as mt, sessionClient as ht, setViewOptions as gt, sketchIntersectionUtils as _t, sketchUtils as E, useEditMode as vt, useIsSketchActive as yt, useOperationSequence as bt, useRCadThemeMode as xt, useStage as St, useVisibleSolids as Ct, viewpoints as wt } from "@buerli.io/react-cad";
|
|
4
|
+
import D, * as Tt from "react";
|
|
5
|
+
import Et from "styled-components";
|
|
6
|
+
import { BuerliScope as O, MeshTypes as Dt, api as Ot, createGraphicItem as kt, createInfo as At, getDrawing as k, init as jt, showMessage as Mt } from "@buerli.io/core";
|
|
7
|
+
import { Canvas as Nt, events as Pt, extend as Ft, useFrame as It, useThree as A } from "@react-three/fiber";
|
|
8
|
+
import { BackSide as Lt, BlendMode as Rt, Color as zt, DataTexture as Bt, DoubleSide as Vt, FloatType as Ht, HalfFloatType as Ut, InstancedBufferAttribute as Wt, IntType as Gt, Layers as Kt, Line2NodeMaterial as qt, LinearFilter as Jt, Matrix4 as Yt, Mesh as Xt, MeshBasicNodeMaterial as Zt, MeshPhysicalNodeMaterial as Qt, MeshStandardNodeMaterial as $t, NearestFilter as en, NoBlending as tn, NodeMaterial as nn, NodeUpdateType as rn, NormalBlending as an, PMREMGenerator as on, PlaneGeometry as sn, PointsNodeMaterial as cn, QuadMesh as ln, RGBAFormat as un, RGFormat as dn, RedFormat as fn, RenderPipeline as pn, RenderTarget as mn, RendererUtils as hn, Scene as gn, SphereGeometry as _n, Sprite as vn, TempNode as yn, Texture as bn, UnsignedByteType as xn, Vector2 as Sn, Vector3 as Cn, Vector4 as wn, WebGPURenderer as Tn } from "three/webgpu";
|
|
9
|
+
import { DFGLUT as En, Discard as Dn, Fn as j, If as M, Loop as On, abs as N, acesFilmicToneMapping as kn, attribute as An, cameraProjectionMatrix as jn, cameraViewMatrix as Mn, ceil as Nn, clamp as P, color as Pn, cos as Fn, cross as In, diffuseColor as Ln, distance as Rn, dot as F, exp as zn, float as I, floor as L, fract as Bn, frontFacing as Vn, fwidth as Hn, getViewPosition as Un, instancedBufferAttribute as Wn, int as Gn, ivec2 as Kn, length as qn, materialColor as Jn, materialOpacity as Yn, max as R, min as z, mix as B, mod as Xn, modelWorldMatrix as Zn, modelWorldMatrixInverse as Qn, mrt as $n, normalView as er, normalize as V, output as tr, pass as nr, passTexture as rr, pmremTexture as ir, positionGeometry as ar, positionLocal as or, positionWorld as sr, pow as cr, reference as lr, reflect as ur, roughness as dr, round as fr, sRGBTransferEOTF as pr, sRGBTransferOETF as mr, screenDPR as hr, select as H, sin as gr, smoothstep as U, sqrt as _r, step as vr, texture as yr, uniform as W, uv as G, varying as br, vec2 as K, vec3 as q, vec4 as J } from "three/tsl";
|
|
10
10
|
import { create as xr } from "zustand";
|
|
11
11
|
import * as Y from "three";
|
|
12
12
|
import { Bounds as Sr, GizmoHelper as Cr, GizmoViewcube as wr, GizmoViewport as Tr, Html as Er, PivotControls as Dr, useBounds as Or } from "@react-three/drei";
|
|
13
13
|
import { Fragment as kr, jsx as X, jsxs as Z } from "react/jsx-runtime";
|
|
14
14
|
import { Dropdown as Ar, Tooltip as jr } from "antd";
|
|
15
15
|
//#region src/readOnly.ts
|
|
16
|
-
var Mr =
|
|
16
|
+
var Mr = D.createContext(!1), Nr = () => D.useContext(Mr), Pr = /* @__PURE__ */ new Set(), Fr = (e, t) => {
|
|
17
17
|
t ? Pr.add(e) : Pr.delete(e);
|
|
18
18
|
}, Ir = (e) => e !== void 0 && Pr.has(e), Lr = !1, Rr = (e) => {
|
|
19
19
|
Lr = e;
|
|
20
|
-
}, zr = () => Lr, Br, Vr = (e) => (
|
|
20
|
+
}, zr = () => Lr, Br, Vr = (e) => (ht.setSessionClient(e), wt.syncViewpoints(e), Br?.(), Br = l(e), e), Hr = (e) => o(e).v1.common.setDatabaseSettings({
|
|
21
21
|
isGraphicEnabled: !0,
|
|
22
22
|
isCCGraphicEnabled: !1,
|
|
23
23
|
isInvisibleGraphicEnabled: !0,
|
|
@@ -27,17 +27,17 @@ var Mr = O.createContext(!1), Nr = () => O.useContext(Mr), Pr = /* @__PURE__ */
|
|
|
27
27
|
angleTol: 0,
|
|
28
28
|
doCurveTessellation: !1
|
|
29
29
|
}).catch((e) => console.error("[buerligons] the engine settings were not taken", e)), Ur = (e) => [
|
|
30
|
-
|
|
30
|
+
ce,
|
|
31
31
|
De,
|
|
32
32
|
x,
|
|
33
|
-
|
|
33
|
+
fe,
|
|
34
34
|
Ne,
|
|
35
35
|
y,
|
|
36
36
|
...e ? [Re] : []
|
|
37
37
|
], Wr = !0, Gr = (e) => {
|
|
38
|
-
e !== Wr && (Wr = e,
|
|
38
|
+
e !== Wr && (Wr = e, jt({ globalPlugins: Ur(e) }));
|
|
39
39
|
}, Kr = dt();
|
|
40
|
-
|
|
40
|
+
jt({
|
|
41
41
|
theme: {
|
|
42
42
|
primary: Kr.pick,
|
|
43
43
|
secondary: Kr.hover,
|
|
@@ -62,9 +62,9 @@ kt({
|
|
|
62
62
|
globalPlugins: Ur(!0),
|
|
63
63
|
plugins: {
|
|
64
64
|
[t.CCSketch]: ze,
|
|
65
|
-
[t.CCExtrusion]:
|
|
66
|
-
[t.CCChamfer]:
|
|
67
|
-
[t.CCConstantRadiusFillet]:
|
|
65
|
+
[t.CCExtrusion]: pe,
|
|
66
|
+
[t.CCChamfer]: w,
|
|
67
|
+
[t.CCConstantRadiusFillet]: ge,
|
|
68
68
|
[t.CCUnion]: b,
|
|
69
69
|
[t.CCWorkAxis]: Ze,
|
|
70
70
|
[t.CCWorkPlane]: nt,
|
|
@@ -72,59 +72,59 @@ kt({
|
|
|
72
72
|
[t.CCRevolve]: Ie,
|
|
73
73
|
[t.CCBox]: S,
|
|
74
74
|
[t.CCSphere]: Ue,
|
|
75
|
-
[t.CCCylinder]:
|
|
76
|
-
[t.CCCone]:
|
|
75
|
+
[t.CCCylinder]: oe,
|
|
76
|
+
[t.CCCone]: ie,
|
|
77
77
|
[t.CCWorkCSys]: $e,
|
|
78
78
|
[t.CCIntersection]: b,
|
|
79
79
|
[t.CCSubtraction]: b,
|
|
80
80
|
[t.CCSlice]: Be,
|
|
81
81
|
[t.CCSliceBySheet]: Ve,
|
|
82
82
|
[t.CCLinearPattern]: we,
|
|
83
|
-
[t.CCCircularPattern]:
|
|
84
|
-
[t.CCCompositeCurve]:
|
|
83
|
+
[t.CCCircularPattern]: te,
|
|
84
|
+
[t.CCCompositeCurve]: T,
|
|
85
85
|
[t.CCTransformationByCSys]: qe,
|
|
86
86
|
[t.CCTranslation]: Je,
|
|
87
87
|
[t.CCTwist]: Xe,
|
|
88
88
|
[t.CCRotation]: Le,
|
|
89
|
-
[t.CCFastenedOriginConstraint]:
|
|
90
|
-
[t.CCFastenedConstraint]:
|
|
89
|
+
[t.CCFastenedOriginConstraint]: he,
|
|
90
|
+
[t.CCFastenedConstraint]: me,
|
|
91
91
|
[t.CCSliderConstraint]: He,
|
|
92
92
|
[t.CCRevoluteConstraint]: Fe,
|
|
93
|
-
[t.CCCylindricalConstraint]:
|
|
93
|
+
[t.CCCylindricalConstraint]: se,
|
|
94
94
|
[t.CCPlanarConstraint]: je,
|
|
95
95
|
[t.CCParallelConstraint]: Ae,
|
|
96
96
|
[t.CCSphericalConstraint]: We,
|
|
97
|
-
[t.CCGroupConstraint]:
|
|
97
|
+
[t.CCGroupConstraint]: ye,
|
|
98
98
|
[t.CCLinearPatternConstraint]: Te,
|
|
99
|
-
[t.CCCircularPatternConstraint]:
|
|
100
|
-
[t.CCGearRelation]:
|
|
99
|
+
[t.CCCircularPatternConstraint]: ne,
|
|
100
|
+
[t.CCGearRelation]: _e,
|
|
101
101
|
[t.CCImport]: Ce,
|
|
102
|
-
[t.CCEntityDeletion]:
|
|
102
|
+
[t.CCEntityDeletion]: de,
|
|
103
103
|
[t.CCMirror]: ke
|
|
104
104
|
}
|
|
105
105
|
}), c((e, t) => {
|
|
106
|
-
Fr(t, e instanceof r), Rr(e instanceof i && e.url.startsWith("/")), Wr && (e instanceof i || e instanceof r) && Vr(e), e.on("connected", () => Hr(t)),
|
|
106
|
+
Fr(t, e instanceof r), Rr(e instanceof i && e.url.startsWith("/")), Wr && (e instanceof i || e instanceof r) && Vr(e), e.on("connected", () => Hr(t)), k(t)?.cad.connection.connected && Hr(t);
|
|
107
107
|
});
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/postpro/compat/grid.ts
|
|
110
110
|
var qr = (e) => {
|
|
111
111
|
let t = e.uniforms;
|
|
112
112
|
return !!t && "cellSize" in t && "sectionSize" in t && "fadeDistance" in t && "worldCamProjPosition" in t;
|
|
113
|
-
}, Jr = class extends
|
|
113
|
+
}, Jr = class extends Zt {
|
|
114
114
|
constructor(e) {
|
|
115
115
|
super();
|
|
116
|
-
let t = (t, n) =>
|
|
116
|
+
let t = (t, n) => lr("value", n, e[t]), n = t("fadeDistance", "float"), r = t("worldCamProjPosition", "vec3"), i = ar.xzy;
|
|
117
117
|
e.infiniteGrid.value && (i = i.mul(n.add(1)));
|
|
118
|
-
let a =
|
|
119
|
-
e.followCamera.value && (a = J(a.xyz.add(r.sub(t("worldPlanePosition", "vec3"))), 1), i =
|
|
118
|
+
let a = Zn.mul(J(i, 1));
|
|
119
|
+
e.followCamera.value && (a = J(a.xyz.add(r.sub(t("worldPlanePosition", "vec3"))), 1), i = Qn.mul(a).xyz), this.vertexNode = jn.mul(Mn).mul(a);
|
|
120
120
|
let o = br(i), s = br(a.xyz), c = (e, t) => {
|
|
121
|
-
let n = o.xz.div(e), r =
|
|
122
|
-
return
|
|
121
|
+
let n = o.xz.div(e), r = N(Bn(n.sub(.5)).sub(.5)).div(Hn(n));
|
|
122
|
+
return I(1).sub(z(z(r.x, r.y).add(1).sub(t), 1));
|
|
123
123
|
};
|
|
124
|
-
this.colorNode =
|
|
125
|
-
let e = c(t("cellSize", "float"), t("cellThickness", "float")), i = c(t("sectionSize", "float"), t("sectionThickness", "float")), a =
|
|
126
|
-
return
|
|
127
|
-
|
|
124
|
+
this.colorNode = j(() => {
|
|
125
|
+
let e = c(t("cellSize", "float"), t("cellThickness", "float")), i = c(t("sectionSize", "float"), t("sectionThickness", "float")), a = I(1).sub(z(Rn(r.mul(t("fadeFrom", "float")), s).div(n), 1)), o = B(t("cellColor", "color"), t("sectionColor", "color"), z(1, t("sectionThickness", "float").mul(i))), l = e.add(i).mul(cr(a, t("fadeStrength", "float"))), u = B(l.mul(.75), l, i);
|
|
126
|
+
return M(u.lessThanEqual(0), () => {
|
|
127
|
+
Dn();
|
|
128
128
|
}), J(o, u);
|
|
129
129
|
})();
|
|
130
130
|
}
|
|
@@ -157,26 +157,26 @@ function Zr(e) {
|
|
|
157
157
|
function Qr(e) {
|
|
158
158
|
let t = e;
|
|
159
159
|
if (!t.isLineMaterial) return null;
|
|
160
|
-
let n = new
|
|
160
|
+
let n = new qt({ dashed: t.dashed });
|
|
161
161
|
return n.worldUnits = t.worldUnits, n.vertexColors = t.vertexColors, n.alphaToCoverage = t.alphaToCoverage, n;
|
|
162
162
|
}
|
|
163
163
|
//#endregion
|
|
164
164
|
//#region src/postpro/compat/points.ts
|
|
165
|
-
var $r = /* @__PURE__ */ new Set(), ei = class extends
|
|
165
|
+
var $r = /* @__PURE__ */ new Set(), ei = class extends Zt {
|
|
166
166
|
setup(e) {
|
|
167
167
|
return e.object.isPoints && $r.add(e.object), this.vertexNode = J(2, 2, 2, 1), super.setup(e);
|
|
168
168
|
}
|
|
169
169
|
}, ti = (e) => e.name === "buerli-points" ? new ei() : null;
|
|
170
170
|
function ni(e) {
|
|
171
|
-
let t = e.material, n = e.geometry.getAttribute("position"), r = e.geometry.getAttribute("rgba"), i = [new
|
|
171
|
+
let t = e.material, n = e.geometry.getAttribute("position"), r = e.geometry.getAttribute("rgba"), i = [new Wt(n.array, 3), new Wt(r.array, 4)], a = new cn({
|
|
172
172
|
transparent: !0,
|
|
173
173
|
depthWrite: !1,
|
|
174
174
|
depthTest: !0
|
|
175
175
|
});
|
|
176
|
-
a.alphaTest = .5, a.positionNode =
|
|
177
|
-
let o =
|
|
178
|
-
a.colorNode = o.rgb.mul(s.rgb), a.opacityNode = o.a.mul(s.a), a.sizeNode =
|
|
179
|
-
let c = new
|
|
176
|
+
a.alphaTest = .5, a.positionNode = Wn(i[0], "vec3");
|
|
177
|
+
let o = Wn(i[1], "vec4"), s = yr(t.uniforms.tex.value, G());
|
|
178
|
+
a.colorNode = o.rgb.mul(s.rgb), a.opacityNode = o.a.mul(s.a), a.sizeNode = lr("value", "float", t.uniforms.size).div(hr);
|
|
179
|
+
let c = new vn(a);
|
|
180
180
|
return c.geometry = c.geometry.clone(), c.count = n.count, c.frustumCulled = !1, c.renderOrder = e.renderOrder, c.raycast = () => {}, c.userData = {
|
|
181
181
|
position: n,
|
|
182
182
|
rgba: r,
|
|
@@ -230,50 +230,50 @@ function gi(e) {
|
|
|
230
230
|
if (e.name === "buerli-body") {
|
|
231
231
|
let t = e.userData.look;
|
|
232
232
|
if (t) return vi(t);
|
|
233
|
-
let n = new
|
|
234
|
-
return n.roughnessNode =
|
|
233
|
+
let n = new $t();
|
|
234
|
+
return n.roughnessNode = I(mi.roughness), n.metalnessNode = I(mi.metalness), n;
|
|
235
235
|
}
|
|
236
236
|
if (e.transparent && e.isMeshLambertMaterial) {
|
|
237
|
-
let e = new
|
|
238
|
-
return e.roughnessNode =
|
|
237
|
+
let e = new $t();
|
|
238
|
+
return e.roughnessNode = I(1), e.metalnessNode = I(0), e.opacityNode = z(Yn.mul(hi), 1), e;
|
|
239
239
|
}
|
|
240
240
|
return null;
|
|
241
241
|
}
|
|
242
242
|
var _i = (e) => (e.clearcoat ?? 0) > 0 || (e.sheen ?? 0) > 0 || (e.transmission ?? 0) > 0 || (e.specularIntensity ?? 1) !== 1 || (e.specularColor ?? "#ffffff").toLowerCase() !== "#ffffff" || (e.ior ?? 1.5) !== 1.5;
|
|
243
243
|
function vi(e) {
|
|
244
|
-
let t = _i(e) ? new
|
|
245
|
-
return t.roughnessNode = e.roughness === void 0 ?
|
|
244
|
+
let t = _i(e) ? new Qt() : new $t();
|
|
245
|
+
return t.roughnessNode = e.roughness === void 0 ? I(mi.roughness) : I(e.roughness), t.metalnessNode = e.metalness === void 0 ? I(mi.metalness) : I(e.metalness), e.emissive && (e.emissiveIntensity ?? 1) > 0 && (t.emissiveNode = Pn(e.emissive).mul(e.emissiveIntensity ?? 1)), t instanceof Qt && (t.iorNode = I(e.ior ?? 1.5), (e.clearcoat ?? 0) > 0 && (t.clearcoatNode = I(e.clearcoat), t.clearcoatRoughnessNode = I(e.clearcoatRoughness ?? 0)), (e.sheen ?? 0) > 0 && (t.sheenNode = Pn(e.sheenColor ?? "#ffffff").mul(e.sheen), t.sheenRoughnessNode = I(1)), (e.transmission ?? 0) > 0 && (t.opacityNode = Yn.mul(1 - yi * e.transmission))), t;
|
|
246
246
|
}
|
|
247
|
-
var yi = .85, bi =
|
|
248
|
-
let n = e.sub(t.mul(
|
|
249
|
-
return
|
|
250
|
-
|
|
247
|
+
var yi = .85, bi = j(([e, t]) => {
|
|
248
|
+
let n = e.sub(t.mul(L(e.div(t)))), r = I(1).sub(vr(1, n)), i = vr(3, n).mul(I(1).sub(vr(t.sub(2), n)));
|
|
249
|
+
return M(r.add(i).lessThan(.01), () => {
|
|
250
|
+
Dn();
|
|
251
251
|
}), J(1);
|
|
252
|
-
}), xi = class extends
|
|
252
|
+
}), xi = class extends Zt {
|
|
253
253
|
constructor() {
|
|
254
254
|
super();
|
|
255
|
-
let e =
|
|
256
|
-
this.colorNode = bi(t, br(
|
|
255
|
+
let e = ar.y.negate().add(.5), t = br(e.mul(An("units", "float")));
|
|
256
|
+
this.colorNode = bi(t, br(An("periodLength", "float")));
|
|
257
257
|
}
|
|
258
|
-
}, Si = class extends
|
|
258
|
+
}, Si = class extends Zt {
|
|
259
259
|
constructor() {
|
|
260
260
|
super();
|
|
261
|
-
let e = br(
|
|
262
|
-
this.colorNode = bi(e, br(
|
|
261
|
+
let e = br(An("t", "float").mul(An("units", "float")));
|
|
262
|
+
this.colorNode = bi(e, br(An("periodLength", "float")));
|
|
263
263
|
}
|
|
264
264
|
setupPosition(e) {
|
|
265
|
-
let t =
|
|
266
|
-
return
|
|
265
|
+
let t = ar.x.mul(An("tubeRadius", "float")).add(An("radius", "float")), n = An("t", "float").mul(An("arcAngle", "float"));
|
|
266
|
+
return or.assign(q(Fn(n).mul(t), gr(n).mul(t), ar.z.mul(An("tubeRadius", "float")))), super.setupPosition(e);
|
|
267
267
|
}
|
|
268
268
|
}, Ci = (e) => e.name === "rcad-sketch-line" ? new xi() : null, wi = (e) => e.name === "rcad-sketch-arc" ? new Si() : null, Ti = /* @__PURE__ */ new Map(), Ei = /* @__PURE__ */ new WeakSet(), Di = (e) => !!e && !(e.array instanceof Float32Array);
|
|
269
269
|
function Oi(e) {
|
|
270
270
|
if (Ei.has(e)) return;
|
|
271
271
|
Ei.add(e);
|
|
272
272
|
let t = e.setAttribute.bind(e);
|
|
273
|
-
e.setAttribute = ((e, n) => (e === "aTroikaGlyphIndex" && Di(n) && (n.gpuType =
|
|
273
|
+
e.setAttribute = ((e, n) => (e === "aTroikaGlyphIndex" && Di(n) && (n.gpuType = Gt), t(e, n)));
|
|
274
274
|
let n = e.getAttribute("aTroikaGlyphIndex");
|
|
275
|
-
if (n && Di(n) && n.gpuType !==
|
|
276
|
-
let t = new
|
|
275
|
+
if (n && Di(n) && n.gpuType !== Gt) {
|
|
276
|
+
let t = new Wt(n.array, n.itemSize, n.normalized, n.meshPerAttribute);
|
|
277
277
|
e.setAttribute("aTroikaGlyphIndex", t);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
@@ -283,8 +283,8 @@ function Ai(e) {
|
|
|
283
283
|
if (!e || !t || !n) return e ?? void 0;
|
|
284
284
|
let r = ki.get(e);
|
|
285
285
|
if (!r) {
|
|
286
|
-
let t = new
|
|
287
|
-
t.minFilter = t.magFilter =
|
|
286
|
+
let t = new Bt(/* @__PURE__ */ new Uint8Array(4), 1, 1, un);
|
|
287
|
+
t.minFilter = t.magFilter = Jt, t.generateMipmaps = !1, r = {
|
|
288
288
|
data: t,
|
|
289
289
|
version: -1
|
|
290
290
|
}, ki.set(e, r);
|
|
@@ -300,7 +300,7 @@ function Ai(e) {
|
|
|
300
300
|
return r.data;
|
|
301
301
|
}
|
|
302
302
|
function ji(e) {
|
|
303
|
-
return e.updateBeforeType =
|
|
303
|
+
return e.updateBeforeType = rn.OBJECT, e.updateBefore = (e) => {
|
|
304
304
|
let t = e.object?.geometry;
|
|
305
305
|
t && Oi(t);
|
|
306
306
|
}, e;
|
|
@@ -308,42 +308,42 @@ function ji(e) {
|
|
|
308
308
|
function Mi() {
|
|
309
309
|
for (let [e, t] of Ti) e.getAttribute("aTroikaGlyphBounds") && (Ti.delete(e), t.needsUpdate = !0);
|
|
310
310
|
}
|
|
311
|
-
var Ni = class extends
|
|
311
|
+
var Ni = class extends Zt {
|
|
312
312
|
uniforms;
|
|
313
313
|
constructor(e) {
|
|
314
314
|
super(), this.uniforms = e;
|
|
315
315
|
}
|
|
316
316
|
u(e, t) {
|
|
317
|
-
return
|
|
317
|
+
return lr("value", t, this.uniforms[e]);
|
|
318
318
|
}
|
|
319
319
|
glyph() {
|
|
320
|
-
let e = this.u.bind(this), t = e("uTroikaPositionOffset", "vec2"), n =
|
|
320
|
+
let e = this.u.bind(this), t = e("uTroikaPositionOffset", "vec2"), n = An("aTroikaGlyphBounds", "vec4"), r = J(n.x.add(t.x), n.y.sub(t.y), n.z.add(t.x), n.w.sub(t.y)), i = e("uTroikaEdgeOffset", "float").add(e("uTroikaBlurRadius", "float")), a = e("uTroikaClipRect", "vec4"), o = P(r.xy.sub(i), a.xy, a.zw), s = P(r.zw.add(i), a.xy, a.zw);
|
|
321
321
|
return {
|
|
322
322
|
bounds: r,
|
|
323
|
-
clippedXY: o.add(s.sub(o).mul(
|
|
323
|
+
clippedXY: o.add(s.sub(o).mul(ar.xy)).sub(r.xy).div(r.zw.sub(r.xy))
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
326
|
setupPosition(e) {
|
|
327
327
|
if (!e.geometry?.getAttribute("aTroikaGlyphBounds")) return super.setupPosition(e);
|
|
328
|
-
let t = this.u.bind(this), { bounds: n, clippedXY: r } = this.glyph(), i = n.xy.add(n.zw.sub(n.xy).mul(r)), a = t("uTroikaCurveRadius", "float"), o = i.x.div(a), s = q(o.sin().mul(a), i.y, a.sub(o.cos().mul(a))), c = q(i,
|
|
329
|
-
return
|
|
328
|
+
let t = this.u.bind(this), { bounds: n, clippedXY: r } = this.glyph(), i = n.xy.add(n.zw.sub(n.xy).mul(r)), a = t("uTroikaCurveRadius", "float"), o = i.x.div(a), s = q(o.sin().mul(a), i.y, a.sub(o.cos().mul(a))), c = q(i, ar.z);
|
|
329
|
+
return or.assign(t("uTroikaOrient", "mat3").mul(H(a.equal(0), c, s))), super.setupPosition(e);
|
|
330
330
|
}
|
|
331
331
|
setup(e) {
|
|
332
332
|
let t = e.geometry;
|
|
333
333
|
if (t && Oi(t), !t?.getAttribute("aTroikaGlyphBounds") || !t.getAttribute("position")) return t && !Number.isFinite(t.instanceCount) && (t.instanceCount = 0), t && e.material && Ti.set(t, e.material), this.vertexNode = J(2, 2, 2, 1), super.setup(e);
|
|
334
|
-
let n = this.u.bind(this), { bounds: r, clippedXY: i } = this.glyph(), a = br(i), o = br(r.zw.sub(r.xy)), s = n("uTroikaSDFTextureSize", "vec2"), c = n("uTroikaSDFGlyphSize", "float"), l = t.getAttribute("aTroikaGlyphIndex").array instanceof Float32Array ?
|
|
335
|
-
return this.colorNode =
|
|
336
|
-
let e =
|
|
337
|
-
|
|
338
|
-
|
|
334
|
+
let n = this.u.bind(this), { bounds: r, clippedXY: i } = this.glyph(), a = br(i), o = br(r.zw.sub(r.xy)), s = n("uTroikaSDFTextureSize", "vec2"), c = n("uTroikaSDFGlyphSize", "float"), l = t.getAttribute("aTroikaGlyphIndex").array instanceof Float32Array ? An("aTroikaGlyphIndex", "float") : I(ji(An("aTroikaGlyphIndex", "uint"))), u = K(c).div(s), d = L(l.div(4)), f = s.x.div(c), p = u.mul(K(Xn(d, f), L(d.div(f)))), m = br(J(p, p.add(u))), h = br(Xn(l, 4)), g = !!e.geometry?.getAttribute("aTroikaGlyphColor"), _ = n("uTroikaUseGlyphColors", "bool"), v = g ? br(An("aTroikaGlyphColor", "vec3").div(255)) : null, y = this.uniforms.uTroikaSDFTexture, b = yr(Ai(y.value) ?? new bn()).onObjectUpdate(() => Ai(y.value));
|
|
335
|
+
return this.colorNode = j(() => {
|
|
336
|
+
let e = qn(Hn(a.mul(o))).mul(.5), t = I(.5).div(c), r = P(a, t, I(1).sub(t)), i = b.sample(m.xy.add(m.zw.sub(m.xy).mul(r))), s = L(h.add(.5)), l = H(s.equal(0), i.r, H(s.equal(1), i.g, H(s.equal(2), i.b, i.a))), u = l.greaterThan(.5), d = H(u, I(1).sub(l), l), f = I(1).sub(cr(d.mul(2), I(1).div(n("uTroikaSDFExponent", "float")))).mul(R(o.x, o.y)), p = H(u, f.negate(), f).add(qn(a.sub(r).mul(o))), g = n("uTroikaEdgeOffset", "float"), y = R(e, n("uTroikaBlurRadius", "float")), x = I(1).sub(U(g.sub(y), g.add(y), p));
|
|
337
|
+
M(x.equal(0), () => {
|
|
338
|
+
Dn();
|
|
339
339
|
});
|
|
340
|
-
let S =
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
let S = Jn, C = Yn, ee = v ? H(_, v, S) : S, w = J(ee, C.mul(n("uTroikaFillOpacity", "float"))).toVar(), te = n("uTroikaStrokeWidth", "float"), ne = H(te.equal(0), w, J(n("uTroikaStrokeColor", "color"), n("uTroikaStrokeOpacity", "float")));
|
|
341
|
+
M(w.a.equal(0), () => {
|
|
342
|
+
w.rgb.assign(ne.rgb);
|
|
343
343
|
});
|
|
344
|
-
let
|
|
345
|
-
return J(
|
|
346
|
-
})(), this.opacityNode =
|
|
344
|
+
let T = B(w, ne, U(te.negate().sub(e), te.negate().add(e), p));
|
|
345
|
+
return J(T.rgb, T.a.mul(x));
|
|
346
|
+
})(), this.opacityNode = I(1), super.setup(e);
|
|
347
347
|
}
|
|
348
348
|
}, Pi = [
|
|
349
349
|
Qr,
|
|
@@ -397,7 +397,7 @@ var Bi = class extends Error {
|
|
|
397
397
|
}
|
|
398
398
|
};
|
|
399
399
|
async function Vi({ canvas: e }, t) {
|
|
400
|
-
let n = await Ri(), r = new
|
|
400
|
+
let n = await Ri(), r = new Tn({
|
|
401
401
|
canvas: e,
|
|
402
402
|
antialias: !0,
|
|
403
403
|
alpha: !0,
|
|
@@ -422,7 +422,7 @@ async function Vi({ canvas: e }, t) {
|
|
|
422
422
|
//#endregion
|
|
423
423
|
//#region src/components/canvas/Gizmo/utils.ts
|
|
424
424
|
var Hi = (e, t, n, r) => {
|
|
425
|
-
let i =
|
|
425
|
+
let i = k(e).geometry.cache[n.object.userData.containerId].meshes.filter((e) => e.loops.some((e) => e.indexOf(t) !== -1)), a = i.find((e) => e.type === "plane");
|
|
426
426
|
if (a) return a.normal.clone();
|
|
427
427
|
let o = i.find((e) => e.type === "cylinder");
|
|
428
428
|
if (o) {
|
|
@@ -438,12 +438,12 @@ var Hi = (e, t, n, r) => {
|
|
|
438
438
|
}
|
|
439
439
|
return i[0] && n.face?.normal.clone().normalize() || new Y.Vector3(0, 0, 1);
|
|
440
440
|
}, Ui = (e, t) => {
|
|
441
|
-
let n =
|
|
442
|
-
return
|
|
441
|
+
let n = k(e), r = n.structure.currentProduct || -1, i = n.structure.tree[r]?.children || [];
|
|
442
|
+
return mt.getProductRigidSet(e, t, i);
|
|
443
443
|
}, Wi = (e, t, n) => {
|
|
444
444
|
let r = t?.object;
|
|
445
445
|
if (!r) return null;
|
|
446
|
-
let i =
|
|
446
|
+
let i = k(e), a = r.userData.productId;
|
|
447
447
|
if (typeof t.index == "number" && r.userData.pointMap) {
|
|
448
448
|
let e = r.userData.pointMap[t.index];
|
|
449
449
|
if (e) return {
|
|
@@ -532,12 +532,12 @@ var Hi = (e, t, n, r) => {
|
|
|
532
532
|
}
|
|
533
533
|
return null;
|
|
534
534
|
}, Gi = 16, Ki, qi = ({ drawingId: e, productId: t, matrix: n }) => {
|
|
535
|
-
let r =
|
|
535
|
+
let r = St(), i = D.useRef(null), a = D.useRef(null), s = D.useRef(!1), { position: c, rotation: l } = D.useMemo(() => ({
|
|
536
536
|
position: new Y.Vector3().setFromMatrixPosition(n).toArray(),
|
|
537
537
|
rotation: new Y.Euler().setFromRotationMatrix(n).toArray()
|
|
538
|
-
}), [n]), u =
|
|
538
|
+
}), [n]), u = D.useCallback(({ component: n }) => {
|
|
539
539
|
if (s.current) return;
|
|
540
|
-
let r =
|
|
540
|
+
let r = k(e), a = r.structure.currentProduct, l = r.structure.currentInstance, u = Ui(e, t);
|
|
541
541
|
if (!a || !l || !u || !t) return;
|
|
542
542
|
let d = r.api.structure.calculateGlobalTransformation(l).clone().invert(), f = r.api.structure.calculateGlobalTransformation(t).premultiply(d), p = f.invert(), m = new Y.Vector3(...c).applyMatrix4(f).toArray(), h = n === "Arrow" ? "TRANSLATION_1D" : n === "Slider" ? "TRANSLATION_2D" : "ROTATION", g = (r.interaction.selected || []).map((t) => t.prodRefId ? Ui(e, t.prodRefId) : null), _ = g.filter((e, t) => e && t === g.indexOf(e)).map((e) => r.structure.tree[e].members?.productRef?.value || e);
|
|
543
543
|
i.current = {
|
|
@@ -553,8 +553,8 @@ var Hi = (e, t, n, r) => {
|
|
|
553
553
|
e,
|
|
554
554
|
t,
|
|
555
555
|
c
|
|
556
|
-
]), d =
|
|
557
|
-
let n =
|
|
556
|
+
]), d = D.useCallback(async (t) => {
|
|
557
|
+
let n = k(e).structure.currentProduct || -1, r = {
|
|
558
558
|
xDir: [
|
|
559
559
|
t.elements[0],
|
|
560
560
|
t.elements[1],
|
|
@@ -580,22 +580,22 @@ var Hi = (e, t, n, r) => {
|
|
|
580
580
|
rotation: r,
|
|
581
581
|
offset: i
|
|
582
582
|
}).catch(console.warn), await Ki, await new Promise((e) => setTimeout(e, Gi)), Ki = null, a.current &&= (d(a.current.clone()), null);
|
|
583
|
-
}, [e]), f =
|
|
583
|
+
}, [e]), f = D.useCallback((e, t, n, r) => {
|
|
584
584
|
if (!i.current) return;
|
|
585
585
|
let o = i.current.mPInv.clone().multiply(n).multiply(i.current.mL0CInv);
|
|
586
586
|
Ki ? a.current = o : d(o);
|
|
587
|
-
}, [d]), m =
|
|
587
|
+
}, [d]), m = D.useCallback(() => {
|
|
588
588
|
if (!i.current) return;
|
|
589
589
|
i.current = null, a.current = null;
|
|
590
|
-
let t =
|
|
590
|
+
let t = k(e).structure.currentProduct || -1;
|
|
591
591
|
o(e).v1.assembly.finishMovingUnderConstraints({ id: t });
|
|
592
592
|
}, [e]);
|
|
593
|
-
return
|
|
593
|
+
return D.useEffect(() => {
|
|
594
594
|
let e = (e) => s.current = e.shiftKey;
|
|
595
595
|
return window.addEventListener("keydown", e), window.addEventListener("keyup", e), () => {
|
|
596
596
|
window.removeEventListener("keydown", e), window.removeEventListener("keyup", e);
|
|
597
597
|
};
|
|
598
|
-
}, []), /* @__PURE__ */ X(
|
|
598
|
+
}, []), /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
599
599
|
drawingId: e,
|
|
600
600
|
objectId: t,
|
|
601
601
|
children: /* @__PURE__ */ X(Dr, {
|
|
@@ -633,7 +633,7 @@ var Hi = (e, t, n, r) => {
|
|
|
633
633
|
}
|
|
634
634
|
return i;
|
|
635
635
|
}, Qi = (e, t, r) => {
|
|
636
|
-
let i =
|
|
636
|
+
let i = k(e), o = i.structure.tree, s = i.api.selection, c = i.selection.active;
|
|
637
637
|
if (!r || !c) return;
|
|
638
638
|
let l = i.selection.refs[i.selection.active], u = i.structure.currentProduct || -1, d = o[a.assembly.getMatePath(e, t).pop() || -1];
|
|
639
639
|
if (d && l.isSelectable(Ye, { object: d })) {
|
|
@@ -642,13 +642,13 @@ var Hi = (e, t, n, r) => {
|
|
|
642
642
|
return;
|
|
643
643
|
}
|
|
644
644
|
let f = [];
|
|
645
|
-
if (l.isSelectable(
|
|
645
|
+
if (l.isSelectable(O, r.container.type)) f = [{
|
|
646
646
|
...r,
|
|
647
647
|
type: r.container.type,
|
|
648
648
|
graphicId: r.container.id,
|
|
649
649
|
productId: t
|
|
650
650
|
}];
|
|
651
|
-
else if (l.isSelectable(
|
|
651
|
+
else if (l.isSelectable(O, n.LOOP) && Dt.indexOf(r.type) >= 0) {
|
|
652
652
|
let e = r, n = [];
|
|
653
653
|
if (e.loops) {
|
|
654
654
|
let t = e.loops;
|
|
@@ -659,7 +659,7 @@ var Hi = (e, t, n, r) => {
|
|
|
659
659
|
...a.map[e],
|
|
660
660
|
productId: t
|
|
661
661
|
})) : [];
|
|
662
|
-
} else if (l.isSelectable(
|
|
662
|
+
} else if (l.isSelectable(O, r.type)) f = [{
|
|
663
663
|
...r,
|
|
664
664
|
productId: t
|
|
665
665
|
}];
|
|
@@ -667,15 +667,15 @@ var Hi = (e, t, n, r) => {
|
|
|
667
667
|
s.unselectAll();
|
|
668
668
|
return;
|
|
669
669
|
}
|
|
670
|
-
let p = f.map((e) =>
|
|
670
|
+
let p = f.map((e) => kt(e.productId, e));
|
|
671
671
|
p.find((e) => !s.isItemSelected(e)) === void 0 ? s.unselect(p, c) : s.select(p, c);
|
|
672
672
|
}, $i = (e, t) => {
|
|
673
|
-
let n =
|
|
673
|
+
let n = k(e).structure.currentInstance, r = k(e).structure.currentProduct;
|
|
674
674
|
return t.map((e) => {
|
|
675
675
|
switch (e.scope) {
|
|
676
|
-
case
|
|
676
|
+
case O: {
|
|
677
677
|
let t = e.data;
|
|
678
|
-
return
|
|
678
|
+
return At({
|
|
679
679
|
objectId: t.container.ownerId,
|
|
680
680
|
graphicId: t.graphicId,
|
|
681
681
|
containerId: t.container.id,
|
|
@@ -684,14 +684,14 @@ var Hi = (e, t, n, r) => {
|
|
|
684
684
|
}
|
|
685
685
|
case Ye: {
|
|
686
686
|
let t = e.data.object;
|
|
687
|
-
return
|
|
687
|
+
return At({
|
|
688
688
|
objectId: t.id,
|
|
689
689
|
prodRefId: n || r
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
692
|
case Ee: {
|
|
693
693
|
let t = e.data.csys, n = e.data.path;
|
|
694
|
-
return
|
|
694
|
+
return At({
|
|
695
695
|
objectId: t.id,
|
|
696
696
|
objectPath: n,
|
|
697
697
|
prodRefId: n[0]
|
|
@@ -713,9 +713,9 @@ var Hi = (e, t, n, r) => {
|
|
|
713
713
|
t.push(n);
|
|
714
714
|
}
|
|
715
715
|
};
|
|
716
|
-
|
|
716
|
+
Ft({ Background: ea });
|
|
717
717
|
var ta = ({ drawingId: e, children: n }) => {
|
|
718
|
-
let [r, i] =
|
|
718
|
+
let [r, i] = D.useState(null), o = Nr(), s = A((e) => e.raycaster.params.Line?.threshold), c = A((e) => e.raycaster.params.Points?.threshold), { camera: l, size: u } = A(), { lineThreshold: d, pointThreshold: p } = D.useMemo(() => ({
|
|
719
719
|
lineThreshold: s || f.calculateScaleFactor(l.position, 4, l, u),
|
|
720
720
|
pointThreshold: c || f.calculateScaleFactor(l.position, 6, l, u)
|
|
721
721
|
}), [
|
|
@@ -723,9 +723,9 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
723
723
|
u,
|
|
724
724
|
s,
|
|
725
725
|
c
|
|
726
|
-
]), m =
|
|
727
|
-
let n =
|
|
728
|
-
if (
|
|
726
|
+
]), m = D.useCallback((t) => {
|
|
727
|
+
let n = k(e), r = n.selection.active !== null;
|
|
728
|
+
if (E.isSketchActive(e) && !r) return;
|
|
729
729
|
t.stopPropagation();
|
|
730
730
|
let i = n.interaction.hovered;
|
|
731
731
|
if (t.nativeEvent.buttons !== 0) {
|
|
@@ -737,7 +737,7 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
737
737
|
}
|
|
738
738
|
let a = Zi(t.intersections, d, p), o = a?.object?.userData, s = Xi(a);
|
|
739
739
|
if (!s || !o) return;
|
|
740
|
-
let c =
|
|
740
|
+
let c = At({
|
|
741
741
|
objectId: s.container.ownerId,
|
|
742
742
|
graphicId: s.graphicId,
|
|
743
743
|
containerId: s.container.id,
|
|
@@ -751,9 +751,9 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
751
751
|
e,
|
|
752
752
|
d,
|
|
753
753
|
p
|
|
754
|
-
]), h =
|
|
755
|
-
let n =
|
|
756
|
-
if (
|
|
754
|
+
]), h = D.useCallback((t) => {
|
|
755
|
+
let n = k(e), r = n.selection.active !== null;
|
|
756
|
+
if (E.isSketchActive(e) && !r) return;
|
|
757
757
|
t.stopPropagation();
|
|
758
758
|
let i = n.interaction.hovered;
|
|
759
759
|
if (!Xi(Zi(t.intersections, d, p)) && i && i.graphicId) {
|
|
@@ -764,10 +764,10 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
764
764
|
e,
|
|
765
765
|
d,
|
|
766
766
|
p
|
|
767
|
-
]), g =
|
|
767
|
+
]), g = D.useCallback((n) => {
|
|
768
768
|
if (n.delta > 4) return;
|
|
769
|
-
let r =
|
|
770
|
-
if (
|
|
769
|
+
let r = k(e), s = r.selection.active !== null;
|
|
770
|
+
if (E.isSketchActive(e) && !s) return;
|
|
771
771
|
n.stopPropagation();
|
|
772
772
|
let c = r.structure.tree[r.structure.currentProduct || -1]?.class || "", l = a.base.isA(c, t.CCPart), u = Zi(n.intersections, d, p), f = u?.object?.userData, m = Xi(u);
|
|
773
773
|
if (!m || !f) return;
|
|
@@ -779,7 +779,7 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
779
779
|
let t = Wi(e, u, n.ray);
|
|
780
780
|
i(t);
|
|
781
781
|
}
|
|
782
|
-
let h =
|
|
782
|
+
let h = At({
|
|
783
783
|
objectId: m.container.ownerId,
|
|
784
784
|
graphicId: m.graphicId,
|
|
785
785
|
containerId: m.container.id,
|
|
@@ -791,12 +791,12 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
791
791
|
d,
|
|
792
792
|
p,
|
|
793
793
|
o
|
|
794
|
-
]), v =
|
|
794
|
+
]), v = D.useCallback((t) => {
|
|
795
795
|
if (t.delta > 4) return;
|
|
796
|
-
let n =
|
|
797
|
-
(!
|
|
796
|
+
let n = k(e), r = n.selection.active !== null;
|
|
797
|
+
(!E.isSketchActive(e) || r) && (t.stopPropagation(), n.api.interaction.setSelected([]), n.api.selection?.unselectAll());
|
|
798
798
|
}, [e]), y = _(e, (e) => e.interaction.selected);
|
|
799
|
-
return
|
|
799
|
+
return D.useEffect(() => {
|
|
800
800
|
(!y || y.length === 0) && r && i(null);
|
|
801
801
|
}, [y, r]), /* @__PURE__ */ Z(kr, { children: [
|
|
802
802
|
/* @__PURE__ */ X("group", {
|
|
@@ -831,8 +831,8 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
831
831
|
} };
|
|
832
832
|
})
|
|
833
833
|
})), ra = ({ children: e, group: t, id: n }) => {
|
|
834
|
-
let r = na((e) => e.outlinedMeshes), i = na((e) => e.setOutlinedMeshes), a = na((e) => e.removeMesh), o =
|
|
835
|
-
return
|
|
834
|
+
let r = na((e) => e.outlinedMeshes), i = na((e) => e.setOutlinedMeshes), a = na((e) => e.removeMesh), o = D.useRef(null);
|
|
835
|
+
return D.useEffect(() => {
|
|
836
836
|
if (!r[t]?.[n] && o.current) {
|
|
837
837
|
let e = [];
|
|
838
838
|
o.current.traverse((t) => {
|
|
@@ -845,7 +845,7 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
845
845
|
r,
|
|
846
846
|
i,
|
|
847
847
|
e
|
|
848
|
-
]),
|
|
848
|
+
]), D.useEffect(() => () => a(t, n), [
|
|
849
849
|
t,
|
|
850
850
|
n,
|
|
851
851
|
a
|
|
@@ -854,8 +854,8 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
854
854
|
children: e
|
|
855
855
|
});
|
|
856
856
|
}, ia = ({ group: e, id: t }) => {
|
|
857
|
-
let { scene: n } =
|
|
858
|
-
return
|
|
857
|
+
let { scene: n } = A(), r = na((e) => e.outlinedMeshes), i = na((e) => e.setOutlinedMeshes), a = na((e) => e.removeMesh);
|
|
858
|
+
return D.useEffect(() => {
|
|
859
859
|
if (!r[e]?.[t]) {
|
|
860
860
|
let r;
|
|
861
861
|
n?.traverse((e) => {
|
|
@@ -872,16 +872,16 @@ var ta = ({ drawingId: e, children: n }) => {
|
|
|
872
872
|
r,
|
|
873
873
|
i,
|
|
874
874
|
n
|
|
875
|
-
]),
|
|
875
|
+
]), D.useEffect(() => () => a(e, t), [
|
|
876
876
|
e,
|
|
877
877
|
t,
|
|
878
878
|
a
|
|
879
879
|
]), null;
|
|
880
880
|
};
|
|
881
881
|
function aa({ drawingId: e, info: n, group: r }) {
|
|
882
|
-
let i = _(e, (e) => e.geometry.cache[n.containerId || -1]), o = i?.meshes.find((e) => e.graphicId === n.graphicId), s = i?.color || "#808080", c = _(e, (e) => e.selection.refs[e.selection.active || -1]), l = _(e, (e) => e.structure.tree[e.structure.currentProduct || -1]?.class) || "", u = a.base.isA(l, t.CCPart), d = n.graphicId && n.prodRefId ? n.prodRefId : n.objectId, f = _(e, (e) => e.structure.tree[n.objectId]?.class) || "", h = _(e, (e) => e.structure.tree[d]?.class) || "", g =
|
|
882
|
+
let i = _(e, (e) => e.geometry.cache[n.containerId || -1]), o = i?.meshes.find((e) => e.graphicId === n.graphicId), s = i?.color || "#808080", c = _(e, (e) => e.selection.refs[e.selection.active || -1]), l = _(e, (e) => e.structure.tree[e.structure.currentProduct || -1]?.class) || "", u = a.base.isA(l, t.CCPart), d = n.graphicId && n.prodRefId ? n.prodRefId : n.objectId, f = _(e, (e) => e.structure.tree[n.objectId]?.class) || "", h = _(e, (e) => e.structure.tree[d]?.class) || "", g = k(e).structure.tree, v = _(e, (e) => e.structure.tree[e.structure.currentInstance || -1]?.children)?.find((t) => t === d || g[t].members?.productRef?.value === d || a.base.getDescendants(e, t).some((e) => e === d)) || -1, y = _(e, (e) => e.structure.tree[v]);
|
|
883
883
|
if (!c && !u && (a.base.isA(f, t.CCGroupConstraint) || a.base.isA(f, t.CCLinearPatternConstraint) || a.base.isA(f, t.CCCircularPatternConstraint))) {
|
|
884
|
-
let t = (
|
|
884
|
+
let t = (k(e).structure.tree[n.objectId].members?.instances)?.members.map((e) => e.value);
|
|
885
885
|
return /* @__PURE__ */ X(kr, { children: t?.map((e) => /* @__PURE__ */ X(ia, {
|
|
886
886
|
group: r,
|
|
887
887
|
id: e
|
|
@@ -937,7 +937,7 @@ function aa({ drawingId: e, info: n, group: r }) {
|
|
|
937
937
|
}, o.graphicId)] }) : y && c?.isSelectable(Ye, { object: y }) ? /* @__PURE__ */ X(ia, {
|
|
938
938
|
group: r,
|
|
939
939
|
id: v
|
|
940
|
-
}, v) : i && c?.isSelectable(
|
|
940
|
+
}, v) : i && c?.isSelectable(O, i.type) ? /* @__PURE__ */ X(ra, {
|
|
941
941
|
group: r,
|
|
942
942
|
id: i.graphicId,
|
|
943
943
|
children: /* @__PURE__ */ X(p, {
|
|
@@ -950,7 +950,7 @@ function aa({ drawingId: e, info: n, group: r }) {
|
|
|
950
950
|
opacity: 0
|
|
951
951
|
})
|
|
952
952
|
})
|
|
953
|
-
}, i.graphicId) : o && c?.isSelectable(
|
|
953
|
+
}, i.graphicId) : o && c?.isSelectable(O, o.type) ? /* @__PURE__ */ X(ra, {
|
|
954
954
|
group: r,
|
|
955
955
|
id: o.graphicId,
|
|
956
956
|
children: /* @__PURE__ */ X(p, {
|
|
@@ -981,8 +981,8 @@ var oa = (e, t, n, r) => {
|
|
|
981
981
|
point: 7
|
|
982
982
|
};
|
|
983
983
|
function la({ drawingId: e, info: r, type: i }) {
|
|
984
|
-
let o = _(e, (e) => e.structure.tree[r.objectId]), s = _(e, (e) => e.plugin.visible.indexOf(r.objectId) !== -1) || !1, c = _(e, (e) => e.geometry.cache[r.containerId || -1]), l = c?.meshes.find((e) => e.graphicId === r.graphicId), u = l ? void 0 : c?.map[r.graphicId || -1], d = c?.points.find((e) => e.graphicId === r.graphicId), f = c?.color, h = _(e, (e) => e.selection.refs[e.selection.active || -1]), g =
|
|
985
|
-
return r.prodRefId ? o?.class === t.CCWorkPoint && !s ? /* @__PURE__ */ X(
|
|
984
|
+
let o = _(e, (e) => e.structure.tree[r.objectId]), s = _(e, (e) => e.plugin.visible.indexOf(r.objectId) !== -1) || !1, c = _(e, (e) => e.geometry.cache[r.containerId || -1]), l = c?.meshes.find((e) => e.graphicId === r.graphicId), u = l ? void 0 : c?.map[r.graphicId || -1], d = c?.points.find((e) => e.graphicId === r.graphicId), f = c?.color, h = _(e, (e) => e.selection.refs[e.selection.active || -1]), g = St(), v = oa(i, !!h, f, g), y = sa(i), b = ca(i), x = _(e, (e) => e.structure.tree[e.structure.currentProduct || -1]?.class) || "", S = a.base.isA(x, t.CCPart);
|
|
985
|
+
return r.prodRefId ? o?.class === t.CCWorkPoint && !s ? /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
986
986
|
drawingId: e,
|
|
987
987
|
objectId: r.prodRefId,
|
|
988
988
|
children: /* @__PURE__ */ X(at, {
|
|
@@ -990,7 +990,7 @@ function la({ drawingId: e, info: r, type: i }) {
|
|
|
990
990
|
objectId: r.objectId,
|
|
991
991
|
color: v
|
|
992
992
|
})
|
|
993
|
-
}) }) : o?.class === t.CCWorkAxis && !s ? /* @__PURE__ */ X(
|
|
993
|
+
}) }) : o?.class === t.CCWorkAxis && !s ? /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
994
994
|
drawingId: e,
|
|
995
995
|
objectId: r.prodRefId,
|
|
996
996
|
children: /* @__PURE__ */ X(Qe, {
|
|
@@ -998,7 +998,7 @@ function la({ drawingId: e, info: r, type: i }) {
|
|
|
998
998
|
objectId: r.objectId,
|
|
999
999
|
color: v
|
|
1000
1000
|
})
|
|
1001
|
-
}) }) : o?.class === t.CCWorkPlane && !s ? /* @__PURE__ */ X(
|
|
1001
|
+
}) }) : o?.class === t.CCWorkPlane && !s ? /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
1002
1002
|
drawingId: e,
|
|
1003
1003
|
objectId: r.prodRefId,
|
|
1004
1004
|
children: /* @__PURE__ */ X(rt, {
|
|
@@ -1007,7 +1007,7 @@ function la({ drawingId: e, info: r, type: i }) {
|
|
|
1007
1007
|
color: v,
|
|
1008
1008
|
opacity: .22
|
|
1009
1009
|
})
|
|
1010
|
-
}) }) : o?.class === t.CCWorkCoordSystem && !s && S ? /* @__PURE__ */ X(
|
|
1010
|
+
}) }) : o?.class === t.CCWorkCoordSystem && !s && S ? /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
1011
1011
|
drawingId: e,
|
|
1012
1012
|
objectId: r.prodRefId,
|
|
1013
1013
|
children: /* @__PURE__ */ X(tt, {
|
|
@@ -1015,7 +1015,7 @@ function la({ drawingId: e, info: r, type: i }) {
|
|
|
1015
1015
|
objectId: r.objectId,
|
|
1016
1016
|
color: v
|
|
1017
1017
|
})
|
|
1018
|
-
}) }) : o?.class === t.CCWorkCSys && !s && S ? /* @__PURE__ */ X(
|
|
1018
|
+
}) }) : o?.class === t.CCWorkCSys && !s && S ? /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
1019
1019
|
drawingId: e,
|
|
1020
1020
|
objectId: r.prodRefId,
|
|
1021
1021
|
children: /* @__PURE__ */ X(et, {
|
|
@@ -1023,15 +1023,15 @@ function la({ drawingId: e, info: r, type: i }) {
|
|
|
1023
1023
|
objectId: r.objectId,
|
|
1024
1024
|
color: v
|
|
1025
1025
|
})
|
|
1026
|
-
}) }) : o?.class === t.CCCompositeCurve && !s && S ? /* @__PURE__ */ X(
|
|
1026
|
+
}) }) : o?.class === t.CCCompositeCurve && !s && S ? /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
1027
1027
|
drawingId: e,
|
|
1028
1028
|
objectId: r.prodRefId,
|
|
1029
|
-
children: /* @__PURE__ */ X(
|
|
1029
|
+
children: /* @__PURE__ */ X(re, {
|
|
1030
1030
|
drawingId: e,
|
|
1031
1031
|
objectId: r.objectId,
|
|
1032
1032
|
color: v
|
|
1033
1033
|
})
|
|
1034
|
-
}) }) : !r.graphicId || !r.containerId ? null : c && l && h?.isSelectable(
|
|
1034
|
+
}) }) : !r.graphicId || !r.containerId ? null : c && l && h?.isSelectable(O, n.LOOP) ? /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
1035
1035
|
drawingId: e,
|
|
1036
1036
|
objectId: r.prodRefId,
|
|
1037
1037
|
children: l.loops.flat().map((e) => /* @__PURE__ */ X(m.Spline, {
|
|
@@ -1049,7 +1049,7 @@ function la({ drawingId: e, info: r, type: i }) {
|
|
|
1049
1049
|
opacity: b.wash,
|
|
1050
1050
|
renderOrder: y
|
|
1051
1051
|
})
|
|
1052
|
-
}) : u && (!h || h?.isSelectable(
|
|
1052
|
+
}) : u && (!h || h?.isSelectable(O, u.type)) ? /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
1053
1053
|
drawingId: e,
|
|
1054
1054
|
objectId: r.prodRefId,
|
|
1055
1055
|
children: /* @__PURE__ */ X(m.Spline, {
|
|
@@ -1058,7 +1058,7 @@ function la({ drawingId: e, info: r, type: i }) {
|
|
|
1058
1058
|
renderOrder: y,
|
|
1059
1059
|
lineWidth: b.line
|
|
1060
1060
|
})
|
|
1061
|
-
}) }) : d && (!h || h?.isSelectable(
|
|
1061
|
+
}) }) : d && (!h || h?.isSelectable(O, d.type)) ? /* @__PURE__ */ X(be, { children: /* @__PURE__ */ X(p, {
|
|
1062
1062
|
drawingId: e,
|
|
1063
1063
|
objectId: r.prodRefId,
|
|
1064
1064
|
children: /* @__PURE__ */ X(m.Point, {
|
|
@@ -1080,7 +1080,7 @@ var ua = (e) => {
|
|
|
1080
1080
|
};
|
|
1081
1081
|
function fa({ drawingId: e }) {
|
|
1082
1082
|
let t = ua(e), n = da(e);
|
|
1083
|
-
return /* @__PURE__ */ Z(kr, { children: [t && /* @__PURE__ */ Z(
|
|
1083
|
+
return /* @__PURE__ */ Z(kr, { children: [t && /* @__PURE__ */ Z(D.Fragment, { children: [/* @__PURE__ */ X(aa, {
|
|
1084
1084
|
drawingId: e,
|
|
1085
1085
|
info: t,
|
|
1086
1086
|
group: "hovered"
|
|
@@ -1088,7 +1088,7 @@ function fa({ drawingId: e }) {
|
|
|
1088
1088
|
drawingId: e,
|
|
1089
1089
|
info: t,
|
|
1090
1090
|
type: "hovered"
|
|
1091
|
-
})] }, t.uniqueIdent + "h"), n?.map((t) => /* @__PURE__ */ Z(
|
|
1091
|
+
})] }, t.uniqueIdent + "h"), n?.map((t) => /* @__PURE__ */ Z(D.Fragment, { children: [/* @__PURE__ */ X(aa, {
|
|
1092
1092
|
drawingId: e,
|
|
1093
1093
|
info: t,
|
|
1094
1094
|
group: "selected"
|
|
@@ -1101,7 +1101,7 @@ function fa({ drawingId: e }) {
|
|
|
1101
1101
|
//#endregion
|
|
1102
1102
|
//#region src/components/canvas/Interaction/ContextMenu/utils.ts
|
|
1103
1103
|
var pa = (e, t) => {
|
|
1104
|
-
let r =
|
|
1104
|
+
let r = k(t), i = r.structure.tree, o = r.selection.active !== null, s = e.filter((e) => e.object.userData?.objId || e.object.userData?.isBuerliGeometry);
|
|
1105
1105
|
if (o) {
|
|
1106
1106
|
let e = r.selection.refs[r.selection.active];
|
|
1107
1107
|
s = s.filter((r) => {
|
|
@@ -1111,26 +1111,26 @@ var pa = (e, t) => {
|
|
|
1111
1111
|
if (!c) return !1;
|
|
1112
1112
|
let l = c.productId || -1, u = a.assembly.getMatePath(t, l).pop() || -1, d = i[u], f = d ? e.isSelectable(Ye, { object: d }) : !1, p = r.index ?? -1, m = r.faceIndex ?? -1, h = c.pointMap?.[p] || c.lineMap?.[p] || c.meshMap?.[m];
|
|
1113
1113
|
if (!h) return !1;
|
|
1114
|
-
let g = e.isSelectable(
|
|
1114
|
+
let g = e.isSelectable(O, h.container.type), _ = e.isSelectable(O, n.LOOP) && Dt.indexOf(h.type) >= 0, v = e.isSelectable(O, h.type);
|
|
1115
1115
|
return f || g || _ || v;
|
|
1116
1116
|
});
|
|
1117
1117
|
} else {
|
|
1118
|
-
let e =
|
|
1118
|
+
let e = E.isSketchActive(t), n = e ? r.plugin.refs[r.plugin.active.feature || -1].objectId : void 0;
|
|
1119
1119
|
s = s.filter((r) => {
|
|
1120
1120
|
let a = r.object.userData?.objId;
|
|
1121
|
-
return !a || !
|
|
1121
|
+
return !a || !E.isSketchObj(i[a]) ? !0 : e ? E.getSketchId(t, a) === n : !1;
|
|
1122
1122
|
});
|
|
1123
1123
|
}
|
|
1124
1124
|
let c = {};
|
|
1125
1125
|
return s.forEach((e) => {
|
|
1126
1126
|
let n = e.object.userData?.objId;
|
|
1127
|
-
if (n &&
|
|
1128
|
-
let r =
|
|
1127
|
+
if (n && E.isSketchObj(i[n])) {
|
|
1128
|
+
let r = E.getSketchId(t, n);
|
|
1129
1129
|
r && !c[r] && (c[r] = e.distance);
|
|
1130
1130
|
}
|
|
1131
1131
|
}), s.sort((e, n) => {
|
|
1132
|
-
let r = e.object.userData?.objId, a = n.object.userData?.objId, o =
|
|
1133
|
-
return r && a && o && s && o === s ?
|
|
1132
|
+
let r = e.object.userData?.objId, a = n.object.userData?.objId, o = E.getSketchId(t, r), s = E.getSketchId(t, a), l = c[o] || e.distance, u = c[s] || n.distance;
|
|
1133
|
+
return r && a && o && s && o === s ? E.getSketchPriority(i[a]) - E.getSketchPriority(i[r]) || r - a : l - u;
|
|
1134
1134
|
});
|
|
1135
1135
|
}, ma = (e, t, n) => {
|
|
1136
1136
|
if (e.length === 0) return;
|
|
@@ -1144,7 +1144,7 @@ var pa = (e, t) => {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
return i;
|
|
1146
1146
|
}, ha = (e, t) => {
|
|
1147
|
-
let r =
|
|
1147
|
+
let r = k(t), i = r.structure.tree, o = r.selection.refs[r.selection.active || -1];
|
|
1148
1148
|
if (!o) return e;
|
|
1149
1149
|
let s = [], c = (e) => s.indexOf(e) === -1 && (s.push(e), !0);
|
|
1150
1150
|
return e.filter((e) => {
|
|
@@ -1153,20 +1153,20 @@ var pa = (e, t) => {
|
|
|
1153
1153
|
let s = r.productId, l = a.assembly.getMatePath(t, s).pop() || -1, u = i[l];
|
|
1154
1154
|
if (u && o.isSelectable(Ye, { object: u })) return c(l.toString());
|
|
1155
1155
|
let d = Xi(e);
|
|
1156
|
-
return d ? o.isSelectable(
|
|
1156
|
+
return d ? o.isSelectable(O, d.container.type) ? c(`${s}|${d.container.id}`) : !!(o.isSelectable(O, n.LOOP) && Dt.indexOf(d.type) >= 0 || o.isSelectable(O, d.type)) : !1;
|
|
1157
1157
|
});
|
|
1158
1158
|
}, ga = (e, t) => {
|
|
1159
|
-
let n =
|
|
1159
|
+
let n = k(e), r = t.object?.userData;
|
|
1160
1160
|
if (r?.objId) {
|
|
1161
1161
|
let e = n.structure.currentProduct || -1, t = n.structure.tree[r.objId];
|
|
1162
|
-
return t ?
|
|
1162
|
+
return t ? At({
|
|
1163
1163
|
objectId: t.id,
|
|
1164
1164
|
prodRefId: e
|
|
1165
1165
|
}) : void 0;
|
|
1166
1166
|
}
|
|
1167
1167
|
if (r?.isBuerliGeometry) {
|
|
1168
1168
|
let e = t.index ?? -1, n = t.faceIndex ?? -1, i = r?.pointMap?.[e] || r?.lineMap?.[e] || r?.meshMap?.[n];
|
|
1169
|
-
return i ?
|
|
1169
|
+
return i ? At({
|
|
1170
1170
|
objectId: i.container.ownerId,
|
|
1171
1171
|
graphicId: i.graphicId,
|
|
1172
1172
|
containerId: i.container.id,
|
|
@@ -1176,7 +1176,7 @@ var pa = (e, t) => {
|
|
|
1176
1176
|
}, _a = (e, t, n, r) => t.type === "arc" || t.type === "circle" ? t.normal.clone().normalize() : Hi(e, t.graphicId, n, r), va = (e, t, n) => {
|
|
1177
1177
|
let r = t?.object;
|
|
1178
1178
|
if (!r) return;
|
|
1179
|
-
let i =
|
|
1179
|
+
let i = k(e), a = r.userData.productId, o = i.api.structure.calculateGlobalTransformation(a), s = new Y.Matrix3().getNormalMatrix(o), c = o.clone().invert(), l = t.point.clone().applyMatrix4(c), u = n.clone().applyMatrix4(c), d = new Y.Vector3(0, 0, 1);
|
|
1180
1180
|
if (typeof t.index == "number" && r.userData.pointMap) {
|
|
1181
1181
|
let n = r.userData.pointMap[t.index];
|
|
1182
1182
|
if (n) {
|
|
@@ -1203,7 +1203,7 @@ var pa = (e, t) => {
|
|
|
1203
1203
|
}
|
|
1204
1204
|
return d.dot(u.direction) > 0 && d.negate(), d.applyNormalMatrix(s);
|
|
1205
1205
|
}, ya = (e, t) => {
|
|
1206
|
-
let n =
|
|
1206
|
+
let n = k(e);
|
|
1207
1207
|
if (t.containerId && t.graphicId) {
|
|
1208
1208
|
let e = n.geometry.cache[t.containerId];
|
|
1209
1209
|
return e.map[t.graphicId]?.type || e.points.find((e) => e.graphicId === t?.graphicId)?.type;
|
|
@@ -1211,18 +1211,18 @@ var pa = (e, t) => {
|
|
|
1211
1211
|
return n.structure.tree[t.objectId].class;
|
|
1212
1212
|
};
|
|
1213
1213
|
function ba(e, n) {
|
|
1214
|
-
let r =
|
|
1214
|
+
let r = k(e), i = r.structure.tree, o = (r.interaction.selected || []).filter((e) => {
|
|
1215
1215
|
let n = i[e.prodRefId || -1]?.class;
|
|
1216
1216
|
return a.base.isA(n, t.IProductReference);
|
|
1217
1217
|
}).map((e) => e.prodRefId);
|
|
1218
1218
|
return o.indexOf(n) === -1 && o.push(n), o;
|
|
1219
1219
|
}
|
|
1220
1220
|
function xa(e, t, n) {
|
|
1221
|
-
let r =
|
|
1221
|
+
let r = k(e), i = r.structure.currentProduct, a = r.graphic.containers[t]?.owner, o = r.interaction.selected || [], s = r.structure.tree[i]?.solids || [], c = o.filter((e) => e.containerId && s.indexOf(e.containerId) !== -1).map((e) => n ? e.objectId : e.containerId);
|
|
1222
1222
|
return c.indexOf(n ? a : t) === -1 && s.indexOf(t) !== -1 && c.push(n ? a : t), c;
|
|
1223
1223
|
}
|
|
1224
1224
|
function Sa(e, n) {
|
|
1225
|
-
let r =
|
|
1225
|
+
let r = k(e).structure.tree;
|
|
1226
1226
|
return (r[(r[n]?.children || []).find((e) => a.base.isA(r[e]?.class, t.CCGeometrySet)) || -1]?.children || []).filter((e) => a.base.isA(r[e].class, t.CCWorkCSys) || a.base.isA(r[e].class, t.CCWorkCoordSystem));
|
|
1227
1227
|
}
|
|
1228
1228
|
//#endregion
|
|
@@ -1240,9 +1240,9 @@ var Ca = class extends Y.Object3D {
|
|
|
1240
1240
|
t.push(n);
|
|
1241
1241
|
}
|
|
1242
1242
|
};
|
|
1243
|
-
|
|
1243
|
+
Ft({ ContextMenuTrigger: Ca });
|
|
1244
1244
|
var wa = ({ drawingId: e, menuContent: t }) => {
|
|
1245
|
-
let n =
|
|
1245
|
+
let n = A((e) => e.raycaster.params.Line?.threshold), r = A((e) => e.raycaster.params.Points?.threshold), { camera: i, size: o } = A(), { lineThreshold: s, pointThreshold: c } = D.useMemo(() => ({
|
|
1246
1246
|
lineThreshold: n || f.calculateScaleFactor(i.position, 4, i, o),
|
|
1247
1247
|
pointThreshold: r || f.calculateScaleFactor(i.position, 6, i, o)
|
|
1248
1248
|
}), [
|
|
@@ -1250,22 +1250,22 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1250
1250
|
o,
|
|
1251
1251
|
n,
|
|
1252
1252
|
r
|
|
1253
|
-
]), l =
|
|
1254
|
-
let t =
|
|
1253
|
+
]), l = D.useCallback(() => {
|
|
1254
|
+
let t = k(e).api.interaction.setHovered;
|
|
1255
1255
|
t(null), d(null);
|
|
1256
|
-
}, [e]), [u, d] =
|
|
1257
|
-
|
|
1256
|
+
}, [e]), [u, d] = D.useState(null);
|
|
1257
|
+
D.useEffect(() => {
|
|
1258
1258
|
u ? lt().api.blankDiv.show(l) : lt().api.blankDiv.hide();
|
|
1259
|
-
}, [u, l]),
|
|
1259
|
+
}, [u, l]), D.useEffect(() => {
|
|
1260
1260
|
let e = (e) => {
|
|
1261
1261
|
u && e.target.className === "ant-dropdown ant-dropdown-placement-bottomLeft " && e.preventDefault();
|
|
1262
1262
|
};
|
|
1263
1263
|
return window.addEventListener("contextmenu", e), () => window.removeEventListener("contextmenu", e);
|
|
1264
1264
|
}, [u]);
|
|
1265
|
-
let p =
|
|
1265
|
+
let p = D.useCallback((n) => {
|
|
1266
1266
|
if (n.delta > 4) return;
|
|
1267
1267
|
n.stopPropagation();
|
|
1268
|
-
let r =
|
|
1268
|
+
let r = k(e), i = r.structure.currentProduct, o = r.structure.currentInstance, l = At({
|
|
1269
1269
|
objectId: i,
|
|
1270
1270
|
prodRefId: o
|
|
1271
1271
|
}), u = pa(n.intersections, e), f = ma(u, s, c);
|
|
@@ -1311,7 +1311,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1311
1311
|
s,
|
|
1312
1312
|
t,
|
|
1313
1313
|
c
|
|
1314
|
-
]), { menuItems: m, caption: h, icon: g } =
|
|
1314
|
+
]), { menuItems: m, caption: h, icon: g } = D.useMemo(() => {
|
|
1315
1315
|
if (!u) return {
|
|
1316
1316
|
menuItems: void 0,
|
|
1317
1317
|
caption: "",
|
|
@@ -1330,7 +1330,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1330
1330
|
]);
|
|
1331
1331
|
return /* @__PURE__ */ Z(kr, { children: [/* @__PURE__ */ X("contextMenuTrigger", { onContextMenu: p }), u && m && /* @__PURE__ */ X(Er, {
|
|
1332
1332
|
position: u.clickInfo.clickPos,
|
|
1333
|
-
children: /* @__PURE__ */ X(
|
|
1333
|
+
children: /* @__PURE__ */ X(ae, {
|
|
1334
1334
|
items: m,
|
|
1335
1335
|
menuInfo: u,
|
|
1336
1336
|
caption: h,
|
|
@@ -1340,34 +1340,34 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1340
1340
|
children: /* @__PURE__ */ X("div", { onContextMenu: (e) => e.preventDefault() })
|
|
1341
1341
|
})
|
|
1342
1342
|
})] });
|
|
1343
|
-
}, Ta = ({ url: e }) => /* @__PURE__ */ X(
|
|
1343
|
+
}, Ta = ({ url: e }) => /* @__PURE__ */ X(Se, {
|
|
1344
1344
|
url: e,
|
|
1345
1345
|
size: 16
|
|
1346
1346
|
}), Ea = ({ url: e }) => /* @__PURE__ */ X("span", {
|
|
1347
1347
|
className: "ant-dropdown-menu-item-icon",
|
|
1348
1348
|
style: { display: "inline-flex" },
|
|
1349
|
-
children: /* @__PURE__ */ X(
|
|
1349
|
+
children: /* @__PURE__ */ X(Se, {
|
|
1350
1350
|
url: e,
|
|
1351
1351
|
size: 16
|
|
1352
1352
|
})
|
|
1353
|
-
}), Da =
|
|
1353
|
+
}), Da = pt("part"), Oa = pt("arcCenter"), ka = pt("assembly"), Aa = pt("circleCenter"), ja = pt("dimLinear"), Ma = pt("fastened"), Na = pt("group"), Pa = pt("solid"), Fa = pt("line"), Ia = pt("point"), La = pt("sketch"), Ra = pt("workPoint"), za = pt("workAxis"), Ba = pt("workPlane"), Va = pt("workCSys"), Ha = pt("solidLine"), Ua = pt("constructionLine"), Q = (e) => /* @__PURE__ */ X(Se, {
|
|
1354
1354
|
name: e,
|
|
1355
1355
|
size: 16
|
|
1356
1356
|
}), Wa = (e, t, n, r) => {
|
|
1357
|
-
let i =
|
|
1357
|
+
let i = k(e), o = i.structure.tree, s = i.selection.refs[i.selection.active || -1], c = a.assembly.getMatePath(e, t).pop() || -1, l = o[c], u = o[c]?.name, d = o[n?.container.ownerId || -1]?.name || "", f = l && s ? s.isSelectable(Ye, { object: l }) : !1, p = n && s ? s.isSelectable(O, n.container.type) : !1, m = f || p ? "" : " " + n.type;
|
|
1358
1358
|
return (r ? d : u) + m;
|
|
1359
1359
|
}, Ga = (e, n) => {
|
|
1360
|
-
let r =
|
|
1360
|
+
let r = k(e).structure.tree[n || -1];
|
|
1361
1361
|
return r ? a.base.isA(r.class, t.CCPoint) ? Ia : a.base.isA(r.class, t.CCLine) ? Fa : a.base.isA(r.class, t.CCArc) ? Oa : a.base.isA(r.class, t.CCCircle) ? Aa : a.base.isA(r.class, t.CC2DConstraint) ? ja : a.base.isA(r.class, t.CCWorkPoint) ? Ra : a.base.isA(r.class, t.CCWorkAxis) ? za : a.base.isA(r.class, t.CCWorkPlane) ? Ba : a.base.isA(r.class, t.CCWorkCSys) || a.base.isA(r.class, t.CCWorkCoordSystem) ? Va : Pa : Pa;
|
|
1362
1362
|
}, Ka = (e) => {
|
|
1363
1363
|
e?.refresh().reset().fit().clip();
|
|
1364
1364
|
}, qa = (e, t) => {
|
|
1365
|
-
let n =
|
|
1365
|
+
let n = k(e), r = n.structure.currentProduct, i = n.plugin.global.find((e) => n.plugin.refs[e].name === "Appearance Editor");
|
|
1366
1366
|
if (!r || !i) return;
|
|
1367
1367
|
let a = xa(e, t, !1);
|
|
1368
1368
|
n.plugin.refs[i].set({ solidIds: a }), n.api.plugin.setActiveGlobal(i, !0);
|
|
1369
1369
|
}, Ja = (e, t) => {
|
|
1370
|
-
let n =
|
|
1370
|
+
let n = k(e), r = n.structure.currentProduct, i = n.structure.tree;
|
|
1371
1371
|
if (!r) return;
|
|
1372
1372
|
let s = i[t]?.members?.productId?.value || t, c = Sa(e, r), l = Sa(e, s);
|
|
1373
1373
|
if (c.length === 0 || l.length === 0) return;
|
|
@@ -1386,7 +1386,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1386
1386
|
useCurrentTransform: !0
|
|
1387
1387
|
}).catch(console.warn);
|
|
1388
1388
|
}, Ya = (e, t) => {
|
|
1389
|
-
let n =
|
|
1389
|
+
let n = k(e).structure.currentProduct;
|
|
1390
1390
|
if (!n) return;
|
|
1391
1391
|
let r = ba(e, t);
|
|
1392
1392
|
o(e).v1.assembly.group({
|
|
@@ -1395,10 +1395,10 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1395
1395
|
instanceIds: r
|
|
1396
1396
|
}).catch(console.warn);
|
|
1397
1397
|
}, Xa = (e, t) => {
|
|
1398
|
-
let n =
|
|
1398
|
+
let n = k(e).api.interaction.setHovered;
|
|
1399
1399
|
n(t);
|
|
1400
1400
|
}, Za = (e, n, r) => {
|
|
1401
|
-
let i =
|
|
1401
|
+
let i = k(e), o = i.structure.currentProduct, s = i.structure.tree[n], c = i.selection.refs[i.selection.active || ""], l = c !== void 0, u = c?.isSelectable(Ye, { object: s }) || !1;
|
|
1402
1402
|
if (l && !u || !o) return;
|
|
1403
1403
|
if (c) {
|
|
1404
1404
|
if (a.base.isA(s.class, t.IProductReference)) {
|
|
@@ -1412,17 +1412,17 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1412
1412
|
return;
|
|
1413
1413
|
}
|
|
1414
1414
|
let d = i.api.interaction.select;
|
|
1415
|
-
d(
|
|
1415
|
+
d(At({
|
|
1416
1416
|
objectId: n,
|
|
1417
1417
|
prodRefId: o
|
|
1418
1418
|
}), r);
|
|
1419
1419
|
}, Qa = (e, t, n, r) => {
|
|
1420
|
-
let i =
|
|
1420
|
+
let i = k(e);
|
|
1421
1421
|
if (i.selection.active !== null) {
|
|
1422
1422
|
Qi(e, t, n);
|
|
1423
1423
|
return;
|
|
1424
1424
|
}
|
|
1425
|
-
let a =
|
|
1425
|
+
let a = At({
|
|
1426
1426
|
objectId: n.container.ownerId,
|
|
1427
1427
|
graphicId: n.graphicId,
|
|
1428
1428
|
containerId: n.container.id,
|
|
@@ -1430,40 +1430,40 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1430
1430
|
}), o = i.api.interaction.select;
|
|
1431
1431
|
o(a, r);
|
|
1432
1432
|
}, $a = (e, t) => {
|
|
1433
|
-
t.interactionInfo.containerId ?
|
|
1433
|
+
t.interactionInfo.containerId ? k(e).api.geometry.setConfig(t.interactionInfo.containerId, {
|
|
1434
1434
|
meshes: { hidden: !0 },
|
|
1435
1435
|
edges: { hidden: !0 },
|
|
1436
1436
|
disabled: !0
|
|
1437
|
-
}) :
|
|
1437
|
+
}) : k(e).api.plugin.setVisiblePlugin(t.interactionInfo.objectId, !1);
|
|
1438
1438
|
}, eo = (e, n, r) => {
|
|
1439
|
-
let i =
|
|
1439
|
+
let i = k(e);
|
|
1440
1440
|
a.base.isA(i.structure.tree[n]?.class, t.IProductReference) && (i.api.geometry.setConfig(n, r ? null : {
|
|
1441
1441
|
meshes: { hidden: !0 },
|
|
1442
1442
|
edges: { hidden: !0 },
|
|
1443
1443
|
disabled: !0
|
|
1444
1444
|
}), (i.structure.tree[n]?.children || []).forEach((t) => eo(e, t, r)));
|
|
1445
1445
|
}, to = (e, t, n) => {
|
|
1446
|
-
let r =
|
|
1446
|
+
let r = k(e), i = r.structure.tree, a = r.api.plugin;
|
|
1447
1447
|
(i[t].children || []).map((e) => i[e]?.members?.refObj?.value).forEach((e) => e !== n && a.setVisiblePlugin(e, !1));
|
|
1448
1448
|
}, no = (e, t) => {
|
|
1449
|
-
let n =
|
|
1449
|
+
let n = k(e), r = n.structure.tree, i = n.api.geometry;
|
|
1450
1450
|
(r[n.structure.currentProduct || -1]?.solids || []).forEach((e) => e !== t && i.setConfig(e, {
|
|
1451
1451
|
meshes: { hidden: !0 },
|
|
1452
1452
|
edges: { hidden: !0 },
|
|
1453
1453
|
disabled: !0
|
|
1454
1454
|
}));
|
|
1455
1455
|
}, ro = (e, n) => {
|
|
1456
|
-
let r =
|
|
1456
|
+
let r = k(e), i = r.structure.currentInstance, o = r.structure.tree, s = a.base.getDescendants(e, i || -1).filter((e) => a.base.isA(o[e].class, t.IProductReference)), c = a.base.getDescendants(e, n), l = a.base.getAncestors(e, n);
|
|
1457
1457
|
s.filter((e) => c.indexOf(e) === -1 && l.indexOf(e) === -1 && e !== n).forEach((e) => r.api.geometry.setConfig(e, {
|
|
1458
1458
|
meshes: { hidden: !0 },
|
|
1459
1459
|
edges: { hidden: !0 },
|
|
1460
1460
|
disabled: !0
|
|
1461
1461
|
}));
|
|
1462
1462
|
}, io = (e, t, n) => {
|
|
1463
|
-
let r =
|
|
1463
|
+
let r = k(e), i = r.structure.tree, a = r.api.plugin;
|
|
1464
1464
|
(i[t].children || []).map((e) => i[e]?.members?.refObj?.value).forEach((e) => a.setVisiblePlugin(e, n));
|
|
1465
1465
|
}, ao = (e, t) => {
|
|
1466
|
-
let n =
|
|
1466
|
+
let n = k(e), r = n.structure.tree, i = n.api.geometry;
|
|
1467
1467
|
(r[n.structure.currentProduct || -1]?.solids || []).forEach((e) => i.setConfig(e, t ? null : {
|
|
1468
1468
|
meshes: { hidden: !0 },
|
|
1469
1469
|
edges: { hidden: !0 },
|
|
@@ -1472,10 +1472,10 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1472
1472
|
}, oo = (e, t) => {
|
|
1473
1473
|
io(e, t, !0), ao(e, !0);
|
|
1474
1474
|
}, so = (e, t) => {
|
|
1475
|
-
let n =
|
|
1475
|
+
let n = k(e), r = n.structure.currentInstance;
|
|
1476
1476
|
(n.structure.tree[r || -1]?.children || []).forEach((n) => eo(e, n, t));
|
|
1477
1477
|
}, co = (e, n, r) => {
|
|
1478
|
-
let i =
|
|
1478
|
+
let i = k(e).structure.tree, o = ba(e, n), s = o.map((e) => {
|
|
1479
1479
|
let n = i[e]?.members?.productId?.value || e, r = (i[n]?.children || []).find((e) => a.base.isA(i[e]?.class, t.CCGeometrySet));
|
|
1480
1480
|
return (i[r || -1]?.children || []).filter((e) => a.base.isA(i[e].class, t.CCWorkCSys) || a.base.isA(i[e].class, t.CCWorkCoordSystem));
|
|
1481
1481
|
});
|
|
@@ -1487,7 +1487,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1487
1487
|
up: s
|
|
1488
1488
|
});
|
|
1489
1489
|
}, uo = (e, t) => {
|
|
1490
|
-
let n =
|
|
1490
|
+
let n = k(e), r = n.structure.currentProduct, i = t.interactionInfo?.containerId;
|
|
1491
1491
|
if (!r || !i) return;
|
|
1492
1492
|
let a = xa(e, i, !0), s = ot.solidsV1(e, a);
|
|
1493
1493
|
o(e).v1.part.entityDeletion({
|
|
@@ -1501,7 +1501,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1501
1501
|
let r = ba(e, n).sort((e, t) => t - e);
|
|
1502
1502
|
o(e).v1.assembly.deleteInstance({ ids: r }).catch(console.warn);
|
|
1503
1503
|
}, po = (e, t, n, r, i) => {
|
|
1504
|
-
let a =
|
|
1504
|
+
let a = E.getSketchId(e, t.interactionInfo.objectId), o = E.getSketchNormalViewInfo(e, a, t.clickInfo.clickPos, n.position.distanceTo(r?.target));
|
|
1505
1505
|
if (!o) return;
|
|
1506
1506
|
let { globBox: s, position: c, target: l, up: u } = o;
|
|
1507
1507
|
i?.refresh(s).moveTo(c).lookAt({
|
|
@@ -1509,7 +1509,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1509
1509
|
up: u
|
|
1510
1510
|
});
|
|
1511
1511
|
}, mo = (e, t, n) => {
|
|
1512
|
-
let r =
|
|
1512
|
+
let r = E.getSketchId(e, t.interactionInfo.objectId), i = E.getSketchFitInfo(e, r, 4.8);
|
|
1513
1513
|
if (!i) return;
|
|
1514
1514
|
let { globBox: a, position: o, target: s, up: c } = i;
|
|
1515
1515
|
n?.refresh(a).moveTo(o).lookAt({
|
|
@@ -1517,13 +1517,13 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1517
1517
|
up: c
|
|
1518
1518
|
}).fit().clip();
|
|
1519
1519
|
}, ho = async (e, t) => {
|
|
1520
|
-
let n =
|
|
1520
|
+
let n = k(e), r = n.structure.currentProduct, i = t.interactionInfo.graphicId || t.interactionInfo.objectId, a = await o(e).v1.sketch.create({
|
|
1521
1521
|
id: r,
|
|
1522
1522
|
planeId: i
|
|
1523
1523
|
});
|
|
1524
1524
|
a.result && n.api.plugin.setActiveFeature(a.result);
|
|
1525
1525
|
}, go = (e) => e ? new Y.Vector3(e.value.x, e.value.y, e.value.z) : new Y.Vector3(), _o = (e, n, r, i, o) => {
|
|
1526
|
-
let s =
|
|
1526
|
+
let s = k(e).structure.tree[n.interactionInfo?.objectId || -1];
|
|
1527
1527
|
if (!s || !a.base.isA(s.class, t.CCWorkPlane)) return;
|
|
1528
1528
|
let c = n.clickInfo.clickPos, l = go(s.members?.Normal).normalize(), u = c.clone().addScaledVector(l, r.position.distanceTo(i?.target)), d = l.clone().cross(r.up.clone().cross(l));
|
|
1529
1529
|
o?.refresh().moveTo(u).lookAt({
|
|
@@ -1546,9 +1546,9 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1546
1546
|
for (; r.length && t(r[r.length - 1]);) r.pop();
|
|
1547
1547
|
return r;
|
|
1548
1548
|
}, bo = (e, n, r) => {
|
|
1549
|
-
let i =
|
|
1549
|
+
let i = E.getSketchId(e, n.interactionInfo.objectId), s = k(e), c = s.structure.tree, l = s.interaction.selected?.map((e) => e.objectId) || [];
|
|
1550
1550
|
n.interactionInfo.objectId && l.indexOf(n.interactionInfo.objectId) === -1 && l.push(n.interactionInfo.objectId);
|
|
1551
|
-
let u = l.filter((e) => a.base.isA(c[e].class, t.CCLine) &&
|
|
1551
|
+
let u = l.filter((e) => a.base.isA(c[e].class, t.CCLine) && E.isConstruction(c[e]) !== r), d = l.filter((e) => a.base.isA(c[e].class, t.CCArc) && E.isConstruction(c[e]) !== r), f = l.filter((e) => a.base.isA(c[e].class, t.CCCircle) && E.isConstruction(c[e]) !== r);
|
|
1552
1552
|
o(e).v1.sketch.updateGeometry({
|
|
1553
1553
|
id: i,
|
|
1554
1554
|
lines: u.map((e) => ({
|
|
@@ -1565,13 +1565,13 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1565
1565
|
}))
|
|
1566
1566
|
}).catch(console.warn);
|
|
1567
1567
|
}, xo = (e) => {
|
|
1568
|
-
let r = _(e, (e) => e.structure.currentProduct) || -1, i =
|
|
1569
|
-
return
|
|
1568
|
+
let r = _(e, (e) => e.structure.currentProduct) || -1, i = k(e).structure.tree[r]?.class || "", o = a.base.isA(i, t.CCPart), s = Nr(), c = ui() === "realistic", l = A((e) => e.camera), u = A((e) => e.controls), d = Or(), f = bt(e, r), p = D.useRef(!1);
|
|
1569
|
+
return D.useEffect(() => {
|
|
1570
1570
|
let e = (e) => p.current = e.ctrlKey || e.shiftKey;
|
|
1571
1571
|
return document.addEventListener("keydown", e, !0), document.addEventListener("keyup", e, !0), () => {
|
|
1572
1572
|
document.removeEventListener("keydown", e, !0), document.removeEventListener("keyup", e, !0);
|
|
1573
1573
|
};
|
|
1574
|
-
}),
|
|
1574
|
+
}), D.useMemo(() => {
|
|
1575
1575
|
let r = {
|
|
1576
1576
|
label: c ? "Flat look" : "Realistic look",
|
|
1577
1577
|
icon: Q("look"),
|
|
@@ -1610,10 +1610,10 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1610
1610
|
icon: Q("select"),
|
|
1611
1611
|
key: "select",
|
|
1612
1612
|
children: (t) => {
|
|
1613
|
-
let n =
|
|
1614
|
-
return n.selection.refs[n.selection.active || ""] === void 0 ?
|
|
1613
|
+
let n = k(e), r = n.structure.tree, i = t.clickInfo.intersections;
|
|
1614
|
+
return n.selection.refs[n.selection.active || ""] === void 0 ? E.isSketchActive(e) && (i = i.filter((e) => {
|
|
1615
1615
|
let t = r[e.object.userData?.objId || -1];
|
|
1616
|
-
return t && (
|
|
1616
|
+
return t && (E.isSketchGeometry(t) || E.is2DConstraint(t));
|
|
1617
1617
|
})) : i = ha(i, e), i.map((t, n) => {
|
|
1618
1618
|
let i = t.object.userData.objId, a = r[i], s = Xi(t), c = a !== void 0;
|
|
1619
1619
|
return {
|
|
@@ -1675,35 +1675,35 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1675
1675
|
onClick: (t) => {
|
|
1676
1676
|
ao(e, !1);
|
|
1677
1677
|
}
|
|
1678
|
-
},
|
|
1678
|
+
}, C = {
|
|
1679
1679
|
label: "Hide all instances",
|
|
1680
1680
|
icon: Q("eyeOff"),
|
|
1681
1681
|
key: "hideAllInstances",
|
|
1682
1682
|
onClick: (t) => {
|
|
1683
1683
|
so(e, !1);
|
|
1684
1684
|
}
|
|
1685
|
-
},
|
|
1685
|
+
}, ee = {
|
|
1686
1686
|
label: "Show all",
|
|
1687
1687
|
icon: Q("eye"),
|
|
1688
1688
|
key: "showAll",
|
|
1689
1689
|
onClick: (t) => {
|
|
1690
1690
|
o && f ? oo(e, f) : so(e, !0);
|
|
1691
1691
|
}
|
|
1692
|
-
},
|
|
1692
|
+
}, w = {
|
|
1693
1693
|
label: "Show mates",
|
|
1694
1694
|
icon: Q("eye"),
|
|
1695
1695
|
key: "showMates",
|
|
1696
1696
|
onClick: (t) => {
|
|
1697
1697
|
t.interactionInfo.prodRefId && co(e, t.interactionInfo.prodRefId, !0);
|
|
1698
1698
|
}
|
|
1699
|
-
},
|
|
1699
|
+
}, te = {
|
|
1700
1700
|
label: "Hide mates",
|
|
1701
1701
|
icon: Q("eyeOff"),
|
|
1702
1702
|
key: "hideMates",
|
|
1703
1703
|
onClick: (t) => {
|
|
1704
1704
|
t.interactionInfo.prodRefId && co(e, t.interactionInfo.prodRefId, !1);
|
|
1705
1705
|
}
|
|
1706
|
-
},
|
|
1706
|
+
}, ne = [
|
|
1707
1707
|
o ? a : null,
|
|
1708
1708
|
o ? null : m,
|
|
1709
1709
|
o ? null : h,
|
|
@@ -1712,11 +1712,11 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1712
1712
|
{ type: "divider" },
|
|
1713
1713
|
_,
|
|
1714
1714
|
o ? y : b,
|
|
1715
|
-
o ? S :
|
|
1716
|
-
|
|
1715
|
+
o ? S : C,
|
|
1716
|
+
ee,
|
|
1717
1717
|
o ? null : { type: "divider" },
|
|
1718
|
-
o ? null :
|
|
1719
|
-
o ? null :
|
|
1718
|
+
o ? null : w,
|
|
1719
|
+
o ? null : te,
|
|
1720
1720
|
o ? null : { type: "divider" },
|
|
1721
1721
|
o ? null : {
|
|
1722
1722
|
label: "Edit",
|
|
@@ -1746,11 +1746,11 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1746
1746
|
o ? uo(e, t) : fo(e, t);
|
|
1747
1747
|
}
|
|
1748
1748
|
}
|
|
1749
|
-
],
|
|
1749
|
+
], T = {
|
|
1750
1750
|
headerName: o ? "Solid" : "Product instance",
|
|
1751
1751
|
headerIcon: /* @__PURE__ */ X(Ta, { url: Pa }),
|
|
1752
|
-
menuElements:
|
|
1753
|
-
},
|
|
1752
|
+
menuElements: ne
|
|
1753
|
+
}, re = [
|
|
1754
1754
|
i,
|
|
1755
1755
|
r,
|
|
1756
1756
|
{ type: "divider" },
|
|
@@ -1770,11 +1770,11 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1770
1770
|
mo(e, t, d);
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
|
-
],
|
|
1773
|
+
], ie = [
|
|
1774
1774
|
g,
|
|
1775
1775
|
{ type: "divider" },
|
|
1776
|
-
...
|
|
1777
|
-
],
|
|
1776
|
+
...re
|
|
1777
|
+
], ae = [
|
|
1778
1778
|
{
|
|
1779
1779
|
label: "Convert to construction line",
|
|
1780
1780
|
icon: /* @__PURE__ */ X(Ea, { url: Ua }),
|
|
@@ -1792,45 +1792,45 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1792
1792
|
}
|
|
1793
1793
|
},
|
|
1794
1794
|
{ type: "divider" },
|
|
1795
|
-
...
|
|
1796
|
-
],
|
|
1795
|
+
...ie
|
|
1796
|
+
], oe = [
|
|
1797
1797
|
g,
|
|
1798
1798
|
{ type: "divider" },
|
|
1799
1799
|
_,
|
|
1800
1800
|
v,
|
|
1801
1801
|
x,
|
|
1802
|
-
|
|
1802
|
+
ee,
|
|
1803
1803
|
{ type: "divider" },
|
|
1804
1804
|
i,
|
|
1805
1805
|
r
|
|
1806
|
-
],
|
|
1806
|
+
], se = [
|
|
1807
1807
|
{
|
|
1808
1808
|
objType: n.POINT,
|
|
1809
|
-
...
|
|
1809
|
+
...T
|
|
1810
1810
|
},
|
|
1811
1811
|
{
|
|
1812
1812
|
objType: n.CURVEPOINT,
|
|
1813
|
-
...
|
|
1813
|
+
...T
|
|
1814
1814
|
},
|
|
1815
1815
|
{
|
|
1816
1816
|
objType: n.LINE,
|
|
1817
|
-
...
|
|
1817
|
+
...T
|
|
1818
1818
|
},
|
|
1819
1819
|
{
|
|
1820
1820
|
objType: n.ARC,
|
|
1821
|
-
...
|
|
1821
|
+
...T
|
|
1822
1822
|
},
|
|
1823
1823
|
{
|
|
1824
1824
|
objType: n.CIRCLE,
|
|
1825
|
-
...
|
|
1825
|
+
...T
|
|
1826
1826
|
},
|
|
1827
1827
|
{
|
|
1828
1828
|
objType: n.NURBSCURVE,
|
|
1829
|
-
...
|
|
1829
|
+
...T
|
|
1830
1830
|
},
|
|
1831
1831
|
{
|
|
1832
1832
|
objType: n.PLANE,
|
|
1833
|
-
...
|
|
1833
|
+
...T,
|
|
1834
1834
|
menuElements: [
|
|
1835
1835
|
o ? {
|
|
1836
1836
|
label: "New Sketch",
|
|
@@ -1841,31 +1841,31 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1841
1841
|
}
|
|
1842
1842
|
} : null,
|
|
1843
1843
|
o ? { type: "divider" } : null,
|
|
1844
|
-
...
|
|
1844
|
+
...ne
|
|
1845
1845
|
]
|
|
1846
1846
|
},
|
|
1847
1847
|
{
|
|
1848
1848
|
objType: n.CYLINDER,
|
|
1849
|
-
...
|
|
1849
|
+
...T
|
|
1850
1850
|
},
|
|
1851
1851
|
{
|
|
1852
1852
|
objType: n.CONE,
|
|
1853
|
-
...
|
|
1853
|
+
...T
|
|
1854
1854
|
},
|
|
1855
1855
|
{
|
|
1856
1856
|
objType: n.SPHERE,
|
|
1857
|
-
...
|
|
1857
|
+
...T
|
|
1858
1858
|
},
|
|
1859
1859
|
{
|
|
1860
1860
|
objType: n.NURBSSURFACE,
|
|
1861
|
-
...
|
|
1861
|
+
...T
|
|
1862
1862
|
},
|
|
1863
1863
|
{
|
|
1864
1864
|
objType: t.CCPart,
|
|
1865
1865
|
headerName: "Part",
|
|
1866
1866
|
headerIcon: /* @__PURE__ */ X(Ta, { url: Da }),
|
|
1867
1867
|
menuElements: [
|
|
1868
|
-
|
|
1868
|
+
ee,
|
|
1869
1869
|
{ type: "divider" },
|
|
1870
1870
|
i,
|
|
1871
1871
|
r
|
|
@@ -1876,7 +1876,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1876
1876
|
headerName: "Assembly",
|
|
1877
1877
|
headerIcon: /* @__PURE__ */ X(Ta, { url: ka }),
|
|
1878
1878
|
menuElements: [
|
|
1879
|
-
|
|
1879
|
+
ee,
|
|
1880
1880
|
{ type: "divider" },
|
|
1881
1881
|
i,
|
|
1882
1882
|
r
|
|
@@ -1886,49 +1886,49 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1886
1886
|
objType: t.CCSketch,
|
|
1887
1887
|
headerName: "Sketch",
|
|
1888
1888
|
headerIcon: /* @__PURE__ */ X(Ta, { url: La }),
|
|
1889
|
-
menuElements:
|
|
1889
|
+
menuElements: re
|
|
1890
1890
|
},
|
|
1891
1891
|
{
|
|
1892
1892
|
objType: t.CCPoint,
|
|
1893
1893
|
headerName: "Point",
|
|
1894
1894
|
headerIcon: /* @__PURE__ */ X(Ta, { url: La }),
|
|
1895
|
-
menuElements:
|
|
1895
|
+
menuElements: ie
|
|
1896
1896
|
},
|
|
1897
1897
|
{
|
|
1898
1898
|
objType: t.CCLine,
|
|
1899
1899
|
headerName: "Line",
|
|
1900
1900
|
headerIcon: /* @__PURE__ */ X(Ta, { url: La }),
|
|
1901
|
-
menuElements:
|
|
1901
|
+
menuElements: ae
|
|
1902
1902
|
},
|
|
1903
1903
|
{
|
|
1904
1904
|
objType: t.CCArc,
|
|
1905
1905
|
headerName: "Arc",
|
|
1906
1906
|
headerIcon: /* @__PURE__ */ X(Ta, { url: La }),
|
|
1907
|
-
menuElements:
|
|
1907
|
+
menuElements: ae
|
|
1908
1908
|
},
|
|
1909
1909
|
{
|
|
1910
1910
|
objType: t.CCCircle,
|
|
1911
1911
|
headerName: "Circle",
|
|
1912
1912
|
headerIcon: /* @__PURE__ */ X(Ta, { url: La }),
|
|
1913
|
-
menuElements:
|
|
1913
|
+
menuElements: ae
|
|
1914
1914
|
},
|
|
1915
1915
|
{
|
|
1916
1916
|
objType: t.CC2DConstraint,
|
|
1917
1917
|
headerName: "Constraint",
|
|
1918
1918
|
headerIcon: /* @__PURE__ */ X(Ta, { url: La }),
|
|
1919
|
-
menuElements:
|
|
1919
|
+
menuElements: ie
|
|
1920
1920
|
},
|
|
1921
1921
|
{
|
|
1922
1922
|
objType: t.CCWorkPoint,
|
|
1923
1923
|
headerName: "Workpoint",
|
|
1924
1924
|
headerIcon: /* @__PURE__ */ X(Ta, { url: Ra }),
|
|
1925
|
-
menuElements:
|
|
1925
|
+
menuElements: oe
|
|
1926
1926
|
},
|
|
1927
1927
|
{
|
|
1928
1928
|
objType: t.CCWorkAxis,
|
|
1929
1929
|
headerName: "Workaxis",
|
|
1930
1930
|
headerIcon: /* @__PURE__ */ X(Ta, { url: za }),
|
|
1931
|
-
menuElements:
|
|
1931
|
+
menuElements: oe
|
|
1932
1932
|
},
|
|
1933
1933
|
{
|
|
1934
1934
|
objType: t.CCWorkPlane,
|
|
@@ -1944,7 +1944,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1944
1944
|
}
|
|
1945
1945
|
},
|
|
1946
1946
|
{ type: "divider" },
|
|
1947
|
-
...
|
|
1947
|
+
...oe,
|
|
1948
1948
|
{
|
|
1949
1949
|
label: "View normal to plane",
|
|
1950
1950
|
icon: Q("viewNormal"),
|
|
@@ -1959,19 +1959,19 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1959
1959
|
objType: t.CCWorkCSys,
|
|
1960
1960
|
headerName: "Workcsys",
|
|
1961
1961
|
headerIcon: /* @__PURE__ */ X(Ta, { url: Va }),
|
|
1962
|
-
menuElements:
|
|
1962
|
+
menuElements: oe
|
|
1963
1963
|
},
|
|
1964
1964
|
{
|
|
1965
1965
|
objType: t.CCWorkCoordSystem,
|
|
1966
1966
|
headerName: "Workcsys",
|
|
1967
1967
|
headerIcon: /* @__PURE__ */ X(Ta, { url: Va }),
|
|
1968
|
-
menuElements:
|
|
1968
|
+
menuElements: oe
|
|
1969
1969
|
}
|
|
1970
1970
|
];
|
|
1971
|
-
return s ?
|
|
1971
|
+
return s ? se.map((e) => ({
|
|
1972
1972
|
...e,
|
|
1973
1973
|
menuElements: yo(e.menuElements)
|
|
1974
|
-
})) :
|
|
1974
|
+
})) : se;
|
|
1975
1975
|
}, [
|
|
1976
1976
|
o,
|
|
1977
1977
|
d,
|
|
@@ -1987,7 +1987,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
1987
1987
|
let r = new Y.Vector3();
|
|
1988
1988
|
return wo.intersectPlane(To, r), wo.direction.negate(), wo.intersectPlane(To, r), r;
|
|
1989
1989
|
}, Do = (e, n, r) => {
|
|
1990
|
-
let i =
|
|
1990
|
+
let i = k(e), o = i.structure.tree, s = o[n]?.children || [], c = i.api.structure.calculateGlobalTransformation(n), l = c.clone().invert(), u = [], d = [], f = [], p = [];
|
|
1991
1991
|
return s.forEach((e) => {
|
|
1992
1992
|
let n = o[e];
|
|
1993
1993
|
if (!n) return;
|
|
@@ -2045,7 +2045,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2045
2045
|
sketchMatrixInv: l
|
|
2046
2046
|
};
|
|
2047
2047
|
}, Oo = (e, n) => {
|
|
2048
|
-
let r =
|
|
2048
|
+
let r = k(e), i = r.structure.currentProduct, o = r.structure.tree, s = o[i || -1]?.class || "", c = a.base.isA(s, t.CCPart), l = [];
|
|
2049
2049
|
if (!c) return l;
|
|
2050
2050
|
let u = o[o[i].children?.find((e) => a.base.isA(o[e]?.class, t.CCSketchSet)) || -1];
|
|
2051
2051
|
return u && u.children?.forEach((t) => {
|
|
@@ -2053,7 +2053,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2053
2053
|
l.push(r);
|
|
2054
2054
|
}), l;
|
|
2055
2055
|
}, ko = (e, t) => {
|
|
2056
|
-
let n =
|
|
2056
|
+
let n = k(e), r = n.structure.currentProduct, i = n.structure.tree, a = n.geometry.config.product, o = i[t || r]?.solids || [], s = [];
|
|
2057
2057
|
return o.forEach((e) => {
|
|
2058
2058
|
let t = n.geometry.cache[e], r = a[e]?.meshes?.hidden;
|
|
2059
2059
|
t && !r && s.push(e);
|
|
@@ -2101,8 +2101,8 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2101
2101
|
vec2: n
|
|
2102
2102
|
};
|
|
2103
2103
|
}, Lo = new Y.Box3(), Ro = (e, t) => {
|
|
2104
|
-
let r =
|
|
2105
|
-
return i && !i.isSelectable(
|
|
2104
|
+
let r = k(e), i = r.selection.refs[r.selection.active || -1];
|
|
2105
|
+
return i && !i.isSelectable(O, n.BREP) ? [] : ko(e).map((e) => {
|
|
2106
2106
|
let n = r.geometry.cache[e];
|
|
2107
2107
|
Lo.set(n.box.min, n.box.max);
|
|
2108
2108
|
let i = Mo(Lo, t);
|
|
@@ -2113,13 +2113,13 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2113
2113
|
};
|
|
2114
2114
|
});
|
|
2115
2115
|
}, zo = (e) => {
|
|
2116
|
-
let n =
|
|
2116
|
+
let n = k(e), r = n.structure.currentInstance, i = n.structure.tree, o = n.geometry.config.product;
|
|
2117
2117
|
return a.base.getDescendants(e, r || -1).filter((e) => {
|
|
2118
2118
|
let n = i[e]?.members?.productId?.value;
|
|
2119
2119
|
return !o[e]?.meshes?.hidden && a.base.isA(i[e]?.class, t.IProductReference) && a.base.isA(i[n]?.class, t.CCPart);
|
|
2120
2120
|
});
|
|
2121
2121
|
}, Bo = new Y.Box3(), Vo = (e, t) => {
|
|
2122
|
-
let n =
|
|
2122
|
+
let n = k(e), r = n.structure.tree;
|
|
2123
2123
|
return zo(e).map((i) => {
|
|
2124
2124
|
let a = n.api.structure.calculateGlobalTransformation(i), o = r[i]?.members?.productId?.value, s = ko(e, o);
|
|
2125
2125
|
Lo.makeEmpty(), s.forEach((e) => {
|
|
@@ -2134,7 +2134,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2134
2134
|
};
|
|
2135
2135
|
});
|
|
2136
2136
|
}, Ho = (e, t) => {
|
|
2137
|
-
let n =
|
|
2137
|
+
let n = k(e), r = n.structure.currentProduct, i = (n.structure.tree[r || -1]?.instances || []).map((e) => ({
|
|
2138
2138
|
id: e,
|
|
2139
2139
|
instancesInfo: []
|
|
2140
2140
|
}));
|
|
@@ -2144,15 +2144,15 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2144
2144
|
}), i;
|
|
2145
2145
|
}, Uo = new Y.Vector3(), Wo = new Y.Vector3(), Go = new Y.Vector3(), Ko = new Y.Vector3(), qo = new Y.Vector3(), Jo = (e) => {
|
|
2146
2146
|
Uo.set(e.min.x, e.min.y, 0), Wo.set(e.max.x, e.min.y, 0), Go.set(e.min.x, e.max.y, 0), Ko.set(e.max.x, e.max.y, 0);
|
|
2147
|
-
}, $ = (e, t, n) => (qo.copy(t).sub(e),
|
|
2147
|
+
}, $ = (e, t, n) => (qo.copy(t).sub(e), _t.intersectLineLine({
|
|
2148
2148
|
start: e,
|
|
2149
2149
|
end: t,
|
|
2150
2150
|
dir: qo
|
|
2151
|
-
}, n)[1].length > 0), Yo = (e, t, n) => (qo.copy(t).sub(e),
|
|
2151
|
+
}, n)[1].length > 0), Yo = (e, t, n) => (qo.copy(t).sub(e), _t.intersectLineArc({
|
|
2152
2152
|
start: e,
|
|
2153
2153
|
end: t,
|
|
2154
2154
|
dir: qo
|
|
2155
|
-
}, n)[1].length > 0), Xo = (e, t, n) => (qo.copy(t).sub(e),
|
|
2155
|
+
}, n)[1].length > 0), Xo = (e, t, n) => (qo.copy(t).sub(e), _t.intersectLineCircle({
|
|
2156
2156
|
start: e,
|
|
2157
2157
|
end: t,
|
|
2158
2158
|
dir: qo
|
|
@@ -2213,7 +2213,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2213
2213
|
};
|
|
2214
2214
|
return $(Uo, Wo, p) || $(Uo, Wo, m) || $(Uo, Wo, h) || $(Uo, Wo, g) || $(Uo, Go, p) || $(Uo, Go, m) || $(Uo, Go, h) || $(Uo, Go, g) || $(Wo, Ko, p) || $(Wo, Ko, m) || $(Wo, Ko, h) || $(Wo, Ko, g) || $(Go, Ko, p) || $(Go, Ko, m) || $(Go, Ko, h) || $(Go, Ko, g);
|
|
2215
2215
|
}, cs = (e, t) => {
|
|
2216
|
-
let n =
|
|
2216
|
+
let n = k(e), r = n.structure.currentProduct, i = n.selection.refs[n.selection.active || -1];
|
|
2217
2217
|
if (i.maxLen > 0) return {
|
|
2218
2218
|
bbObjects: [],
|
|
2219
2219
|
points: []
|
|
@@ -2222,7 +2222,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2222
2222
|
return a.forEach((e) => {
|
|
2223
2223
|
let r = n.geometry.cache[e];
|
|
2224
2224
|
Object.values(r.map).forEach((e) => {
|
|
2225
|
-
if (!i.isSelectable(
|
|
2225
|
+
if (!i.isSelectable(O, e.type)) return;
|
|
2226
2226
|
let n = e.geometry;
|
|
2227
2227
|
n.boundingBox || n.computeBoundingBox();
|
|
2228
2228
|
let r = Mo(n.boundingBox, t), a = No(r), s = Io(r);
|
|
@@ -2232,7 +2232,7 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2232
2232
|
bb: a,
|
|
2233
2233
|
aabb: s
|
|
2234
2234
|
});
|
|
2235
|
-
}), i.isSelectable(
|
|
2235
|
+
}), i.isSelectable(O, "point") && r.points.forEach((e) => {
|
|
2236
2236
|
let n = e.geometry.clone().project(t).setZ(0);
|
|
2237
2237
|
s.push({
|
|
2238
2238
|
graphicId: e.graphicId,
|
|
@@ -2282,12 +2282,12 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2282
2282
|
/useGeometry/,
|
|
2283
2283
|
/useReference/,
|
|
2284
2284
|
/RefChange\d+/
|
|
2285
|
-
], hs = (e) => !ms.some((t) => t.test(e.toString())), gs =
|
|
2286
|
-
let n =
|
|
2285
|
+
], hs = (e) => !ms.some((t) => t.test(e.toString())), gs = D.forwardRef(({ enabled: e }, t) => {
|
|
2286
|
+
let n = A((e) => e.gl), r = D.useRef(document.createElement("div")), i = D.useCallback(() => {
|
|
2287
2287
|
let e = Math.min(a.current.clickPos.x, a.current.curPos.x), t = Math.max(a.current.clickPos.x, a.current.curPos.x), n = Math.min(a.current.clickPos.y, a.current.curPos.y), i = Math.max(a.current.clickPos.y, a.current.curPos.y);
|
|
2288
2288
|
r.current.style.left = `${e}px`, r.current.style.top = `${n}px`, r.current.style.width = `${t - e}px`, r.current.style.height = `${i - n}px`;
|
|
2289
2289
|
}, []);
|
|
2290
|
-
|
|
2290
|
+
D.useEffect(() => {
|
|
2291
2291
|
if (!e) return;
|
|
2292
2292
|
r.current.style.position = "fixed", r.current.style.pointerEvents = "none", r.current.style.border = "1px solid var(--rcad-geo-select)", r.current.style.borderRadius = "2px", r.current.style.background = "color-mix(in srgb, var(--rcad-geo-select) 9%, transparent)", i();
|
|
2293
2293
|
let t = r.current;
|
|
@@ -2299,12 +2299,12 @@ var wa = ({ drawingId: e, menuContent: t }) => {
|
|
|
2299
2299
|
i,
|
|
2300
2300
|
e
|
|
2301
2301
|
]);
|
|
2302
|
-
let a =
|
|
2302
|
+
let a = D.useRef({
|
|
2303
2303
|
clickPos: new Y.Vector2(),
|
|
2304
2304
|
curPos: new Y.Vector2(),
|
|
2305
2305
|
update: i
|
|
2306
2306
|
});
|
|
2307
|
-
return
|
|
2307
|
+
return D.useImperativeHandle(t, () => a.current, []), null;
|
|
2308
2308
|
});
|
|
2309
2309
|
gs.displayName = "SelectionRectangle";
|
|
2310
2310
|
//#endregion
|
|
@@ -2322,43 +2322,43 @@ var _s = class extends Y.Object3D {
|
|
|
2322
2322
|
t.push(n);
|
|
2323
2323
|
}
|
|
2324
2324
|
};
|
|
2325
|
-
|
|
2325
|
+
Ft({ RectangleSelectionTrigger: _s });
|
|
2326
2326
|
var vs = ({ drawingId: e }) => {
|
|
2327
|
-
let n =
|
|
2327
|
+
let n = A((e) => e.controls), [r, i] = D.useState(!1), o = D.useRef(0), s = D.useRef(null), c = D.useRef([]), l = D.useRef([]), u = D.useRef([]), d = D.useRef([]), f = D.useRef({
|
|
2328
2328
|
bbObjects: [],
|
|
2329
2329
|
points: []
|
|
2330
|
-
}), p =
|
|
2330
|
+
}), p = D.useRef(new Y.Vector3()), m = D.useRef(!0), h = D.useCallback((r) => {
|
|
2331
2331
|
if (!r.nativeEvent.shiftKey) return;
|
|
2332
|
-
let i =
|
|
2332
|
+
let i = k(e), h = i.structure.tree, g = i.selection.active, _ = g !== null, v = h[i.structure.currentProduct || -1]?.class || "", y = a.base.isA(v, t.CCPart);
|
|
2333
2333
|
if (_) {
|
|
2334
2334
|
let t = i.selection.refs[g];
|
|
2335
2335
|
if (m.current = hs(g), t.maxLen > 0 || !m.current) return;
|
|
2336
2336
|
f.current = cs(e, r.camera), d.current = Oo(e, r.camera), y ? c.current = Ro(e, r.camera) : u.current = Ho(e, r.camera);
|
|
2337
|
-
} else if (
|
|
2337
|
+
} else if (E.isSketchActive(e)) {
|
|
2338
2338
|
let t = i.plugin.refs[i.plugin.active.feature || -1]?.objectId;
|
|
2339
2339
|
if (!t) return;
|
|
2340
2340
|
d.current = [Do(e, t, r.camera)];
|
|
2341
2341
|
} else y ? c.current = Ro(e, r.camera) : l.current = Vo(e, r.camera);
|
|
2342
2342
|
p.current = r.unprojectedPoint.clone().project(r.camera), s.current.clickPos.set(r.clientX, r.clientY), s.current.curPos.set(r.clientX, r.clientY), o.current = 1, n.enabled = !1;
|
|
2343
|
-
}, [e, n]), g =
|
|
2344
|
-
let r =
|
|
2343
|
+
}, [e, n]), g = D.useCallback((n) => {
|
|
2344
|
+
let r = k(e);
|
|
2345
2345
|
if (o.current === 1 && new Y.Vector2(n.clientX, n.clientY).sub(s.current.clickPos).lengthSq() > 16 && (o.current = 2, i(!0), r.interaction.hovered)) {
|
|
2346
2346
|
let e = r.api.interaction.setHovered;
|
|
2347
2347
|
e(null);
|
|
2348
2348
|
}
|
|
2349
2349
|
if (o.current !== 2) return;
|
|
2350
2350
|
n.stopPropagation(), s.current.curPos.set(n.clientX, n.clientY), s.current.update();
|
|
2351
|
-
let h = p.current, g = n.unprojectedPoint.clone().project(n.camera), _ = g.x - h.x > 0, v = new Y.Vector2(Math.min(h.x, g.x), Math.min(h.y, g.y)), y = new Y.Vector2(Math.max(h.x, g.x), Math.max(h.y, g.y)), b = new Y.Box2(v, y), x = r.structure.currentProduct, S = r.structure.tree,
|
|
2352
|
-
if (
|
|
2353
|
-
let e = r.selection.refs[
|
|
2351
|
+
let h = p.current, g = n.unprojectedPoint.clone().project(n.camera), _ = g.x - h.x > 0, v = new Y.Vector2(Math.min(h.x, g.x), Math.min(h.y, g.y)), y = new Y.Vector2(Math.max(h.x, g.x), Math.max(h.y, g.y)), b = new Y.Box2(v, y), x = r.structure.currentProduct, S = r.structure.tree, C = r.selection.active, ee = C !== null, w = S[x || -1]?.class || "", te = a.base.isA(w, t.CCPart);
|
|
2352
|
+
if (ee) {
|
|
2353
|
+
let e = r.selection.refs[C];
|
|
2354
2354
|
if (e.maxLen > 0 || !m.current) return;
|
|
2355
2355
|
let t = [];
|
|
2356
|
-
|
|
2356
|
+
te ? (us(f.current.bbObjects, b, _, (e, n) => {
|
|
2357
2357
|
let i = r.geometry.cache[n].map[e];
|
|
2358
|
-
i && t.push(
|
|
2358
|
+
i && t.push(kt(x || -1, i));
|
|
2359
2359
|
}), ds(f.current.points, b, (e, n) => {
|
|
2360
2360
|
let i = r.geometry.cache[n].points.find((t) => t.graphicId === e);
|
|
2361
|
-
i && t.push(
|
|
2361
|
+
i && t.push(kt(x || -1, i));
|
|
2362
2362
|
}), ls(d.current, b, _, n.camera, (n) => {
|
|
2363
2363
|
e.isSelectable(Ye, { object: S[n] }) && t.push(st(x || -1, S[n]));
|
|
2364
2364
|
}), fs(c.current, b, _, (e) => {
|
|
@@ -2369,37 +2369,37 @@ var vs = ({ drawingId: e }) => {
|
|
|
2369
2369
|
type: n.type,
|
|
2370
2370
|
graphicId: n.graphicId
|
|
2371
2371
|
};
|
|
2372
|
-
t.push(
|
|
2372
|
+
t.push(kt(x || -1, e));
|
|
2373
2373
|
}
|
|
2374
2374
|
})) : ps(u.current, b, _, (n) => {
|
|
2375
2375
|
e.isSelectable(Ye, { object: S[n] }) && t.push(st(x || -1, S[n]));
|
|
2376
2376
|
});
|
|
2377
2377
|
let i = r.api.selection;
|
|
2378
2378
|
if (t.length !== e.items.length) {
|
|
2379
|
-
if (!i.areItemsSelected(t)) i.select(t,
|
|
2379
|
+
if (!i.areItemsSelected(t)) i.select(t, C, { forceDefault: !0 });
|
|
2380
2380
|
else {
|
|
2381
2381
|
let n = e.items.filter((e) => !t.find((t) => t.id === e.id && t.scope === e.scope));
|
|
2382
|
-
i.unselect(n,
|
|
2382
|
+
i.unselect(n, C, { forceDefault: !0 });
|
|
2383
2383
|
}
|
|
2384
2384
|
}
|
|
2385
2385
|
return;
|
|
2386
2386
|
}
|
|
2387
|
-
let
|
|
2388
|
-
|
|
2387
|
+
let ne = [], T = r.api.interaction.setSelected;
|
|
2388
|
+
E.isSketchActive(e) ? ls(d.current, b, _, n.camera, (e) => ne.push(At({
|
|
2389
2389
|
objectId: e,
|
|
2390
2390
|
prodRefId: x
|
|
2391
|
-
}))) :
|
|
2391
|
+
}))) : te ? fs(c.current, b, _, (e) => ne.push(At({
|
|
2392
2392
|
objectId: r.geometry.cache[e]?.container.ownerId || -1,
|
|
2393
2393
|
graphicId: e,
|
|
2394
2394
|
containerId: e,
|
|
2395
2395
|
prodRefId: x
|
|
2396
|
-
}))) : fs(l.current, b, _, (e) =>
|
|
2396
|
+
}))) : fs(l.current, b, _, (e) => ne.push(At({
|
|
2397
2397
|
objectId: e,
|
|
2398
2398
|
prodRefId: x
|
|
2399
|
-
}))),
|
|
2400
|
-
let
|
|
2401
|
-
(
|
|
2402
|
-
}, [e]), _ =
|
|
2399
|
+
}))), ne.sort((e, t) => e.uniqueIdent >= t.uniqueIdent ? 1 : -1);
|
|
2400
|
+
let re = r.interaction.selected;
|
|
2401
|
+
(ne.length !== re?.length || ne.some((e, t) => e.uniqueIdent !== re[t].uniqueIdent)) && T(ne);
|
|
2402
|
+
}, [e]), _ = D.useCallback((e) => {
|
|
2403
2403
|
o.current === 2 && i(!1), o.current = 0, n.enabled = !0;
|
|
2404
2404
|
}, [n]);
|
|
2405
2405
|
return /* @__PURE__ */ Z(kr, { children: [/* @__PURE__ */ X("rectangleSelectionTrigger", {
|
|
@@ -2421,7 +2421,7 @@ function bs(e) {
|
|
|
2421
2421
|
}
|
|
2422
2422
|
//#endregion
|
|
2423
2423
|
//#region src/postpro/pipeline/ScreenPass.ts
|
|
2424
|
-
var xs = new
|
|
2424
|
+
var xs = new Sn(), Ss = null;
|
|
2425
2425
|
function Cs(e) {
|
|
2426
2426
|
let t = Ss, n = [];
|
|
2427
2427
|
Ss = n;
|
|
@@ -2434,31 +2434,31 @@ function Cs(e) {
|
|
|
2434
2434
|
Ss = t;
|
|
2435
2435
|
}
|
|
2436
2436
|
}
|
|
2437
|
-
var ws = (e) => (Ss?.push(e), e), Ts = class extends
|
|
2437
|
+
var ws = (e) => (Ss?.push(e), e), Ts = class extends yn {
|
|
2438
2438
|
fragment;
|
|
2439
|
-
texel = W(new
|
|
2439
|
+
texel = W(new Sn());
|
|
2440
2440
|
target;
|
|
2441
2441
|
skip = null;
|
|
2442
|
-
material = new
|
|
2443
|
-
quad = new
|
|
2442
|
+
material = new nn();
|
|
2443
|
+
quad = new ln();
|
|
2444
2444
|
state;
|
|
2445
2445
|
textureNode;
|
|
2446
2446
|
scale;
|
|
2447
|
-
constructor(e, { scale: t = 1, type: n =
|
|
2448
|
-
super("vec4"), this.fragment = e, this.scale = t, this.updateBeforeType =
|
|
2447
|
+
constructor(e, { scale: t = 1, type: n = Ut, format: r, nearest: i = !1, name: a = "ScreenPass" } = {}) {
|
|
2448
|
+
super("vec4"), this.fragment = e, this.scale = t, this.updateBeforeType = rn.FRAME, this.target = new mn(1, 1, {
|
|
2449
2449
|
depthBuffer: !1,
|
|
2450
2450
|
type: n,
|
|
2451
2451
|
...r !== void 0 && { format: r }
|
|
2452
|
-
}), i && (this.target.texture.minFilter = this.target.texture.magFilter =
|
|
2452
|
+
}), i && (this.target.texture.minFilter = this.target.texture.magFilter = en), this.target.texture.name = a, this.material.name = a, this.textureNode = rr(this, this.target.texture), ws(this);
|
|
2453
2453
|
}
|
|
2454
2454
|
getTextureNode() {
|
|
2455
2455
|
return this.textureNode;
|
|
2456
2456
|
}
|
|
2457
2457
|
updateBefore({ renderer: e }) {
|
|
2458
2458
|
if (!e || this.skip?.()) return;
|
|
2459
|
-
this.state =
|
|
2459
|
+
this.state = hn.resetRendererState(e, this.state), e.setClearColor(this.state.clearColor, this.state.clearAlpha), e.getDrawingBufferSize(xs);
|
|
2460
2460
|
let t = Math.max(1, Math.round(xs.width * this.scale)), n = Math.max(1, Math.round(xs.height * this.scale));
|
|
2461
|
-
(this.target.width !== t || this.target.height !== n) && this.target.setSize(t, n), this.texel.value.set(1 / t, 1 / n), this.quad.material = this.material, this.quad.name = this.material.name, e.setRenderTarget(this.target), this.quad.render(e),
|
|
2461
|
+
(this.target.width !== t || this.target.height !== n) && this.target.setSize(t, n), this.texel.value.set(1 / t, 1 / n), this.quad.material = this.material, this.quad.name = this.material.name, e.setRenderTarget(this.target), this.quad.render(e), hn.restoreRendererState(e, this.state);
|
|
2462
2462
|
}
|
|
2463
2463
|
setup(e) {
|
|
2464
2464
|
let t = e.getSharedContext();
|
|
@@ -2468,78 +2468,83 @@ var ws = (e) => (Ss?.push(e), e), Ts = class extends _n {
|
|
|
2468
2468
|
this.target.dispose(), this.material.dispose(), super.dispose();
|
|
2469
2469
|
}
|
|
2470
2470
|
}, Es = class {
|
|
2471
|
-
projection = W(new
|
|
2472
|
-
projectionInverse = W(new
|
|
2473
|
-
size = W(new
|
|
2471
|
+
projection = W(new Yt());
|
|
2472
|
+
projectionInverse = W(new Yt());
|
|
2473
|
+
size = W(new Sn(1, 1));
|
|
2474
2474
|
ortho = W(1);
|
|
2475
2475
|
unitsPerPixel = W(1);
|
|
2476
|
-
zInv = W(new
|
|
2477
|
-
zOff = W(new
|
|
2476
|
+
zInv = W(new wn());
|
|
2477
|
+
zOff = W(new wn());
|
|
2478
2478
|
update(e, t, n) {
|
|
2479
2479
|
this.projection.value.copy(e.projectionMatrix), this.projectionInverse.value.copy(e.projectionMatrixInverse), this.size.value.set(t, n);
|
|
2480
2480
|
let r = e.projectionMatrix.elements, i = e.isOrthographicCamera === !0;
|
|
2481
2481
|
this.ortho.value = +!!i, this.unitsPerPixel.value = i ? 2 / (r[0] * t) : 2 / (r[5] * n), this.zInv.value.set(1 / r[0], 1 / r[5], r[8], r[9]), this.zOff.value.set(r[12], r[13], r[11], r[15]);
|
|
2482
2482
|
}
|
|
2483
2483
|
}, Ds = -0x56bc75e2d63100000, Os = (e, t, n) => {
|
|
2484
|
-
let r = t.x.mul(2).sub(1), i =
|
|
2484
|
+
let r = t.x.mul(2).sub(1), i = I(1).sub(t.y.mul(2)), a = e.zOff.z.mul(n).add(e.zOff.w), o = r.mul(a).sub(e.zInv.z.mul(n)).sub(e.zOff.x).mul(e.zInv.x), s = i.mul(a).sub(e.zInv.w.mul(n)).sub(e.zOff.y).mul(e.zInv.y);
|
|
2485
2485
|
return q(o, s, n);
|
|
2486
2486
|
}, ks = (e, t, n) => {
|
|
2487
2487
|
if (e.isZ) {
|
|
2488
2488
|
let r = e.texture.sample(n).r;
|
|
2489
2489
|
return {
|
|
2490
|
-
d:
|
|
2490
|
+
d: H(r.greaterThan(Ds / 10), I(0), I(1)),
|
|
2491
2491
|
p: Os(t, n, r)
|
|
2492
2492
|
};
|
|
2493
2493
|
}
|
|
2494
2494
|
let r = e.texture.sample(n).r;
|
|
2495
2495
|
return {
|
|
2496
2496
|
d: r,
|
|
2497
|
-
p:
|
|
2497
|
+
p: Un(n, r, t.projectionInverse)
|
|
2498
2498
|
};
|
|
2499
2499
|
}, As = (e, t) => {
|
|
2500
2500
|
let n = e.projection.mul(J(t, 1)), r = n.xy.div(n.w);
|
|
2501
|
-
return K(r.x.mul(.5).add(.5),
|
|
2501
|
+
return K(r.x.mul(.5).add(.5), I(.5).sub(r.y.mul(.5)));
|
|
2502
2502
|
};
|
|
2503
2503
|
function js(e, t) {
|
|
2504
|
-
return new Ts(() =>
|
|
2505
|
-
let n = e.sample(G()).r, r =
|
|
2504
|
+
return new Ts(() => j(() => {
|
|
2505
|
+
let n = e.sample(G()).r, r = H(n.lessThan(1), Un(G(), n, t.projectionInverse).z, I(Ds));
|
|
2506
2506
|
return J(r, 0, 0, 1);
|
|
2507
2507
|
})(), {
|
|
2508
|
-
type:
|
|
2509
|
-
format:
|
|
2508
|
+
type: Ht,
|
|
2509
|
+
format: fn,
|
|
2510
2510
|
nearest: !0,
|
|
2511
2511
|
name: "View z"
|
|
2512
2512
|
});
|
|
2513
2513
|
}
|
|
2514
|
-
var Ms = (e, t) => e.unitsPerPixel.mul(
|
|
2515
|
-
let t = e.div(
|
|
2516
|
-
return
|
|
2514
|
+
var Ms = (e, t) => e.unitsPerPixel.mul(H(e.ortho.equal(1), I(1), t.negate())), Ns = (e) => {
|
|
2515
|
+
let t = e.div(N(e.x).add(N(e.y)).add(N(e.z))), n = H(t.x.greaterThanEqual(0), I(1), I(-1)), r = H(t.y.greaterThanEqual(0), I(1), I(-1)), i = K(I(1).sub(N(t.y)).mul(n), I(1).sub(N(t.x)).mul(r));
|
|
2516
|
+
return H(t.z.greaterThanEqual(0), t.xy, i);
|
|
2517
2517
|
}, Ps = (e) => {
|
|
2518
|
-
let t = q(e.x, e.y,
|
|
2519
|
-
return t.x.addAssign(
|
|
2518
|
+
let t = q(e.x, e.y, I(1).sub(N(e.x)).sub(N(e.y))).toVar(), n = R(t.z.negate(), 0);
|
|
2519
|
+
return t.x.addAssign(H(t.x.greaterThanEqual(0), n.negate(), n)), t.y.addAssign(H(t.y.greaterThanEqual(0), n.negate(), n)), V(t);
|
|
2520
2520
|
}, Fs = [
|
|
2521
|
+
[.375, .125],
|
|
2522
|
+
[.875, .375],
|
|
2523
|
+
[.125, .625],
|
|
2524
|
+
[.625, .875]
|
|
2525
|
+
], Is = [
|
|
2521
2526
|
[0, 0],
|
|
2522
2527
|
[1, 0],
|
|
2523
2528
|
[0, 1],
|
|
2524
2529
|
[1, 1]
|
|
2525
2530
|
];
|
|
2526
|
-
function
|
|
2527
|
-
return new Ts((r) =>
|
|
2528
|
-
let i =
|
|
2529
|
-
|
|
2531
|
+
function Ls(e, t, n) {
|
|
2532
|
+
return new Ts((r) => j(() => {
|
|
2533
|
+
let i = L(G().div(r.texel)), a = I(0).toVar(), o = I(0).toVar(), s = q(0).toVar();
|
|
2534
|
+
Is.forEach(([e, r], c) => {
|
|
2530
2535
|
let l = t.sample(i.mul(2).add(K(e + .5, r + .5)).div(n.size)).xyz, u = c === 0 ? l.length().add(.01) : l.length(), d = u.greaterThan(a);
|
|
2531
|
-
a.assign(
|
|
2536
|
+
a.assign(H(d, u, a)), o.assign(H(d, I(c), o)), s.assign(H(d, l, s));
|
|
2532
2537
|
});
|
|
2533
|
-
let c = K(o.mod(2),
|
|
2534
|
-
return J(
|
|
2538
|
+
let c = K(o.mod(2), L(o.div(2))), { d: l, p: u } = ks(e, n, i.mul(2).add(c).add(.5).div(n.size)), d = s.length().greaterThan(.5);
|
|
2539
|
+
return J(H(d, Ns(V(s)), K(0)), H(l.lessThan(1), u.z, I(Ds)), o.add(H(d, I(0), I(4))));
|
|
2535
2540
|
})(), {
|
|
2536
2541
|
scale: .5,
|
|
2537
|
-
type:
|
|
2542
|
+
type: Ht,
|
|
2538
2543
|
nearest: !0,
|
|
2539
2544
|
name: "Surfaces at half"
|
|
2540
2545
|
});
|
|
2541
2546
|
}
|
|
2542
|
-
var
|
|
2547
|
+
var Rs = (e, t, n = 2) => {
|
|
2543
2548
|
let { depth: r, normal: i, half: a, view: o } = e;
|
|
2544
2549
|
if (n === 1) {
|
|
2545
2550
|
let e = t.add(.5).div(o.size), { d: n, p: a } = ks(r, o, e);
|
|
@@ -2551,18 +2556,18 @@ var Ls = (e, t, n = 2) => {
|
|
|
2551
2556
|
};
|
|
2552
2557
|
}
|
|
2553
2558
|
if (a) {
|
|
2554
|
-
let e = t.mul(n / 2), r = K(1).div(a.texel).sub(1), i = a.getTextureNode().load(
|
|
2559
|
+
let e = t.mul(n / 2), r = K(1).div(a.texel).sub(1), i = a.getTextureNode().load(Kn(z(R(e, K(0)), r))), s = i.w.lessThan(3.5), c = H(s, i.w, i.w.sub(4)), l = e.mul(2).add(K(c.mod(2), L(c.div(2)))).add(.5).div(o.size);
|
|
2555
2560
|
return {
|
|
2556
2561
|
at: l,
|
|
2557
|
-
d:
|
|
2562
|
+
d: H(i.z.lessThan(Ds / 10), I(1), I(0)),
|
|
2558
2563
|
p: Os(o, l, i.z),
|
|
2559
|
-
n:
|
|
2564
|
+
n: H(s, Ps(i.xy), q(0))
|
|
2560
2565
|
};
|
|
2561
2566
|
}
|
|
2562
|
-
let s =
|
|
2563
|
-
|
|
2567
|
+
let s = I(0).toVar(), c = q(0).toVar(), l = K(0).toVar();
|
|
2568
|
+
Is.forEach(([e, r], a) => {
|
|
2564
2569
|
let u = K(e, r).mul(n / 2), d = i.sample(t.mul(n).add(u).add(.5).div(o.size)).xyz, f = a === 0 ? d.length().add(.01) : d.length(), p = f.greaterThan(s);
|
|
2565
|
-
s.assign(
|
|
2570
|
+
s.assign(H(p, f, s)), c.assign(H(p, d, c)), l.assign(H(p, u, l));
|
|
2566
2571
|
});
|
|
2567
2572
|
let u = t.mul(n).add(l).add(.5).div(o.size), { d, p: f } = ks(r, o, u);
|
|
2568
2573
|
return {
|
|
@@ -2571,248 +2576,314 @@ var Ls = (e, t, n = 2) => {
|
|
|
2571
2576
|
p: f,
|
|
2572
2577
|
n: c
|
|
2573
2578
|
};
|
|
2574
|
-
},
|
|
2575
|
-
let o = F(
|
|
2576
|
-
return
|
|
2577
|
-
},
|
|
2579
|
+
}, zs = (e, t, n, r, i, a) => {
|
|
2580
|
+
let o = N(F(n.sub(e), t)).div(i.mul(2)), s = cr(R(F(r.div(R(r.length(), 1e-6)), t), 0), a);
|
|
2581
|
+
return H(r.length().greaterThan(.5), zn(o.negate()).mul(s), I(0));
|
|
2582
|
+
}, Bs = (e) => ({
|
|
2578
2583
|
texel: e.texel,
|
|
2579
2584
|
sample: (t) => e.getTextureNode().sample(t)
|
|
2580
2585
|
});
|
|
2581
|
-
function
|
|
2586
|
+
function Vs(e, t, { name: n, empty: r, factor: i = 2 }) {
|
|
2582
2587
|
let { view: a } = t;
|
|
2583
|
-
return new Ts((n) =>
|
|
2584
|
-
let o =
|
|
2585
|
-
return
|
|
2586
|
-
let r =
|
|
2588
|
+
return new Ts((n) => j(() => {
|
|
2589
|
+
let o = L(G().div(n.texel)), s = Rs(t, o, i), c = J(r).toVar();
|
|
2590
|
+
return M(s.n.length().greaterThan(.5), () => {
|
|
2591
|
+
let r = V(s.n), l = Ms(a, s.p.z), u = J(0).toVar(), d = I(0).toVar();
|
|
2587
2592
|
for (let a = -2; a < 2; a++) for (let c = -2; c < 2; c++) {
|
|
2588
|
-
let f = o.add(K(c, a)), p =
|
|
2593
|
+
let f = o.add(K(c, a)), p = Rs(t, f, i), m = zs(s.p, r, p.p, p.n, l, 8);
|
|
2589
2594
|
u.addAssign(e.sample(f.add(.5).mul(n.texel)).mul(m)), d.addAssign(m);
|
|
2590
2595
|
}
|
|
2591
|
-
c.assign(u.div(
|
|
2596
|
+
c.assign(u.div(R(d, 1e-4)));
|
|
2592
2597
|
}), c;
|
|
2593
2598
|
})(), {
|
|
2594
2599
|
scale: 1 / i,
|
|
2595
|
-
type:
|
|
2600
|
+
type: Ut,
|
|
2596
2601
|
name: n
|
|
2597
2602
|
});
|
|
2598
2603
|
}
|
|
2599
|
-
function
|
|
2600
|
-
let { depth: i, normal: a,
|
|
2601
|
-
return
|
|
2602
|
-
let
|
|
2603
|
-
return
|
|
2604
|
-
let i =
|
|
2605
|
-
for (let [n, o] of [
|
|
2604
|
+
function Hs(e, t, n, r = 2) {
|
|
2605
|
+
let { depth: i, normal: a, samples: o, view: s } = t;
|
|
2606
|
+
return j(() => {
|
|
2607
|
+
let c = L(G().mul(s.size)), l = c.add(.5).div(s.size), u = ks(i, s, l).p, d = a.sample(l).xyz, f = J(n).toVar();
|
|
2608
|
+
return M(d.length().greaterThan(.01), () => {
|
|
2609
|
+
let i = V(d), a = Ms(s, u.z), l = c.div(r).add(.5), p = L(l), m = l.sub(p), h = [
|
|
2606
2610
|
[0, 0],
|
|
2607
2611
|
[1, 0],
|
|
2608
2612
|
[0, 1],
|
|
2609
2613
|
[1, 1]
|
|
2610
|
-
]) {
|
|
2611
|
-
let
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2614
|
+
].map(([n, i]) => {
|
|
2615
|
+
let a = p.add(K(n, i)), o = Rs(t, a, r);
|
|
2616
|
+
return {
|
|
2617
|
+
p: o.p.toVar(),
|
|
2618
|
+
n: o.n.toVar(),
|
|
2619
|
+
value: e.getTextureNode().sample(a.add(.5).mul(e.texel)).toVar(),
|
|
2620
|
+
near: (n ? m.x : m.x.oneMinus()).mul(i ? m.y : m.y.oneMinus())
|
|
2621
|
+
};
|
|
2622
|
+
}), g = J(0).toVar(), _ = I(0).toVar(), v = J(n).toVar(), y = I(1e30).toVar(), b = J(0).toVar(), x = I(0).toVar(), S = I(1).toVar();
|
|
2623
|
+
for (let { p: e, n: t, value: n, near: r } of h) {
|
|
2624
|
+
let o = zs(u, i, e, t, a, 16), s = o.mul(r.add(.01));
|
|
2625
|
+
g.addAssign(n.mul(s)), _.addAssign(s), S.assign(z(S, o));
|
|
2626
|
+
let c = t.length().greaterThan(.5);
|
|
2627
|
+
b.addAssign(n.mul(H(c, r, I(0)))), x.addAssign(H(c, r, I(0)));
|
|
2628
|
+
let l = H(c, N(e.z.sub(u.z)), I(1e30));
|
|
2629
|
+
v.assign(H(l.lessThan(y), n, v)), y.assign(z(y, l));
|
|
2617
2630
|
}
|
|
2618
|
-
let
|
|
2619
|
-
|
|
2620
|
-
|
|
2631
|
+
let C = g.div(R(_, 1e-6)), ee = H(y.lessThan(1e29), v, n), w = d.length().lessThan(.985).and(x.greaterThan(1e-4));
|
|
2632
|
+
f.assign(H(w, b.div(R(x, 1e-6)), B(ee, C, U(.002, .05, _)))), M(S.lessThan(.5).or(d.length().lessThan(.985)), () => {
|
|
2633
|
+
let p = e.getTextureNode(), m = L(l.add(.5)), h = (n) => On({
|
|
2634
|
+
start: Gn(-1),
|
|
2635
|
+
end: Gn(1),
|
|
2636
|
+
condition: "<="
|
|
2637
|
+
}, {
|
|
2638
|
+
start: Gn(-1),
|
|
2639
|
+
end: Gn(1),
|
|
2640
|
+
condition: "<="
|
|
2641
|
+
}, ({ i, j: a }) => {
|
|
2642
|
+
let o = m.add(K(I(i), I(a))), s = Rs(t, o, r), c = N(o.sub(l));
|
|
2643
|
+
n({
|
|
2644
|
+
q: s.p.toVar(),
|
|
2645
|
+
m: s.n.toVar(),
|
|
2646
|
+
value: p.level(I(0)).sample(o.add(.5).mul(e.texel)).toVar(),
|
|
2647
|
+
near: R(I(1).sub(c.x.mul(.5)), 0).mul(R(I(1).sub(c.y.mul(.5)), 0))
|
|
2648
|
+
});
|
|
2649
|
+
});
|
|
2650
|
+
if (!o) {
|
|
2651
|
+
let e = J(0).toVar(), t = I(0).toVar(), r = J(n).toVar(), o = I(1e30).toVar(), s = J(0).toVar(), c = I(0).toVar();
|
|
2652
|
+
h(({ q: n, m: l, value: d, near: f }) => {
|
|
2653
|
+
let p = zs(u, i, n, l, a, 16).mul(f);
|
|
2654
|
+
e.addAssign(d.mul(p)), t.addAssign(p);
|
|
2655
|
+
let m = l.length().greaterThan(.5);
|
|
2656
|
+
s.addAssign(d.mul(H(m, f, I(0)))), c.addAssign(H(m, f, I(0)));
|
|
2657
|
+
let h = H(m, N(n.z.sub(u.z)), I(1e30));
|
|
2658
|
+
r.assign(H(h.lessThan(o), d, r)), o.assign(z(o, h));
|
|
2659
|
+
});
|
|
2660
|
+
let l = H(o.lessThan(1e29), r, n), p = d.length().lessThan(.985).and(c.greaterThan(1e-4));
|
|
2661
|
+
f.assign(H(p, s.div(R(c, 1e-6)), B(l, e.div(R(t, 1e-6)), U(.002, .05, t))));
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2664
|
+
let g = Fs.map(([e, t], r) => {
|
|
2665
|
+
let i = o.level(Gn(r)).load(Kn(c)).r.toVar(), a = Un(c.add(K(e, t)).div(s.size), i, s.projectionInverse).toVar();
|
|
2666
|
+
return {
|
|
2667
|
+
hit: i.lessThan(1),
|
|
2668
|
+
p: a,
|
|
2669
|
+
ray: H(s.ortho.equal(1), q(0, 0, 1), V(a.negate())).toVar(),
|
|
2670
|
+
size: Ms(s, a.z).mul(2).toVar(),
|
|
2671
|
+
sum: J(0).toVar(),
|
|
2672
|
+
weight: I(0).toVar(),
|
|
2673
|
+
nearest: J(n).toVar(),
|
|
2674
|
+
gap: I(1e30).toVar()
|
|
2675
|
+
};
|
|
2676
|
+
}), _ = U(.97, .995, d.length());
|
|
2677
|
+
h(({ q: e, m: t, value: n, near: r }) => {
|
|
2678
|
+
let a = t.length().greaterThan(.5), o = B(I(1), cr(R(F(t, i), 0), 8), _);
|
|
2679
|
+
for (let i of g) {
|
|
2680
|
+
let s = N(F(i.p.sub(e), t)).div(R(N(F(i.ray, t)), .1)), c = H(a, s.div(i.size), I(1e30)), l = H(a, zn(c.negate()).mul(o).mul(r), I(0));
|
|
2681
|
+
i.sum.addAssign(n.mul(l)), i.weight.addAssign(l), i.nearest.assign(H(c.lessThan(i.gap), n, i.nearest)), i.gap.assign(z(i.gap, c));
|
|
2682
|
+
}
|
|
2683
|
+
});
|
|
2684
|
+
let v = J(0).toVar(), y = I(0).toVar();
|
|
2685
|
+
for (let e of g) {
|
|
2686
|
+
let t = B(H(e.gap.lessThan(1e29), e.nearest, n), e.sum.div(R(e.weight, 1e-6)), U(.002, .05, e.weight));
|
|
2687
|
+
v.addAssign(H(e.hit, t, J(0))), y.addAssign(H(e.hit, I(1), I(0)));
|
|
2688
|
+
}
|
|
2689
|
+
f.assign(H(y.greaterThan(0), v.div(R(y, 1)), f));
|
|
2690
|
+
});
|
|
2691
|
+
}), f;
|
|
2621
2692
|
})();
|
|
2622
2693
|
}
|
|
2623
2694
|
//#endregion
|
|
2624
2695
|
//#region src/postpro/pipeline/ao.ts
|
|
2625
|
-
var
|
|
2626
|
-
let r = (n + .5) / e, i = .15 + .85 * (n * .7548777 % 1), a = Math.sqrt(1 - i * i), o = n *
|
|
2627
|
-
return new
|
|
2696
|
+
var Us = 2.399963, Ws = (e) => Array.from({ length: e }, (t, n) => {
|
|
2697
|
+
let r = (n + .5) / e, i = .15 + .85 * (n * .7548777 % 1), a = Math.sqrt(1 - i * i), o = n * Us;
|
|
2698
|
+
return new Cn(Math.cos(o) * a, Math.sin(o) * a, i).multiplyScalar(.1 + .9 * r * r);
|
|
2628
2699
|
});
|
|
2629
|
-
function
|
|
2630
|
-
let { depth: i, view: a } = e, o =
|
|
2631
|
-
return new Ts((n) =>
|
|
2632
|
-
let s =
|
|
2633
|
-
return
|
|
2634
|
-
let e =
|
|
2700
|
+
function Gs(e, t, { samples: n = 24, factor: r = 2 } = {}) {
|
|
2701
|
+
let { depth: i, view: a } = e, o = Ws(n);
|
|
2702
|
+
return new Ts((n) => j(() => {
|
|
2703
|
+
let s = L(G().div(n.texel)), { d: c, p: l, n: u } = Rs(e, s, r), d = I(1).toVar();
|
|
2704
|
+
return M(c.lessThan(1).and(u.length().greaterThan(.5)), () => {
|
|
2705
|
+
let e = V(u), n = Ms(a, l.z), r = z(t.radius, t.maxPixels.mul(n)), c = U(t.minPixels, t.minPixels.mul(2), r.div(n)), f = Xn(s, 4), p = f.x.add(f.y.mul(4)), m = p.mul(.618034).fract().mul(6.283185), h = p.mul(.7548777).fract().mul(.5).add(.75), g = H(N(e.z).lessThan(.9), q(0, 0, 1), q(1, 0, 0)), _ = V(In(g, e)), v = _.mul(m.cos()).add(In(e, _).mul(m.sin())), y = In(e, v), b = n.mul(.5).add(r.mul(.02)), x = I(0).toVar(), S = I(0).toVar();
|
|
2635
2706
|
for (let t of o) {
|
|
2636
|
-
let n = l.add(v.mul(t.x).add(y.mul(t.y)).add(e.mul(t.z)).mul(r.mul(h))), o = As(a, n), s =
|
|
2637
|
-
x.addAssign(
|
|
2707
|
+
let n = l.add(v.mul(t.x).add(y.mul(t.y)).add(e.mul(t.z)).mul(r.mul(h))), o = As(a, n), s = z(z(o.x, o.y), z(o.x.oneMinus(), o.y.oneMinus())).greaterThan(0), c = ks(i, a, o).p.z, u = U(0, 1, r.div(R(N(l.z.sub(c)), 1e-6)));
|
|
2708
|
+
x.addAssign(H(s.and(c.greaterThanEqual(n.z.add(b))), u, I(0))), S.addAssign(H(s, I(1), I(0)));
|
|
2638
2709
|
}
|
|
2639
|
-
d.assign(
|
|
2710
|
+
d.assign(I(1).sub(x.div(R(S, 1)).mul(c)));
|
|
2640
2711
|
}), J(d, 0, 0, 1);
|
|
2641
2712
|
})(), {
|
|
2642
2713
|
scale: 1 / r,
|
|
2643
|
-
type:
|
|
2714
|
+
type: Ut,
|
|
2644
2715
|
name: "AO"
|
|
2645
2716
|
});
|
|
2646
2717
|
}
|
|
2647
2718
|
//#endregion
|
|
2648
2719
|
//#region src/postpro/pipeline/bevel.ts
|
|
2649
|
-
var
|
|
2650
|
-
toWorld = W(new
|
|
2720
|
+
var Ks = new Cn(-.55, .75, 1).normalize(), qs = .04, Js = .05, Ys = new Cn(.2126, .7152, .0722), Xs = class {
|
|
2721
|
+
toWorld = W(new Yt());
|
|
2651
2722
|
update(e) {
|
|
2652
2723
|
this.toWorld.value.copy(e.matrixWorld);
|
|
2653
2724
|
}
|
|
2654
|
-
},
|
|
2655
|
-
let n = Math.sqrt((t + .5) /
|
|
2725
|
+
}, Zs = 2.399963, Qs = 12, $s = Array.from({ length: Qs }, (e, t) => {
|
|
2726
|
+
let n = Math.sqrt((t + .5) / Qs);
|
|
2656
2727
|
return {
|
|
2657
|
-
x: Math.cos(t *
|
|
2658
|
-
y: Math.sin(t *
|
|
2728
|
+
x: Math.cos(t * Zs) * n,
|
|
2729
|
+
y: Math.sin(t * Zs) * n,
|
|
2659
2730
|
r: n
|
|
2660
2731
|
};
|
|
2661
|
-
}),
|
|
2662
|
-
function
|
|
2663
|
-
let r = new Ts((n) =>
|
|
2664
|
-
let r =
|
|
2665
|
-
for (let t = 0; t <=
|
|
2666
|
-
let r = e.load(
|
|
2667
|
-
s.push(
|
|
2732
|
+
}), ec = 1 - Math.cos(1 * Math.PI / 180), tc = 1 - Math.cos(3 * Math.PI / 180), nc = (e) => R(I(1).sub(e.mul(e)), 0).sqrt(), rc = (e, t) => H(e.greaterThan(0).and(t.greaterThan(0)), e.mul(t).sub(nc(e).mul(nc(t))), I(-1)), ic = 4;
|
|
2733
|
+
function ac(e, t, n) {
|
|
2734
|
+
let r = new Ts((n) => j(() => {
|
|
2735
|
+
let r = L(G().div(n.texel)), i = t.size.mul(n.texel), a = L(r.mul(i)), o = Nn(r.add(1).mul(i)).sub(1), s = [];
|
|
2736
|
+
for (let t = 0; t <= ic; t++) for (let n = 0; n <= ic; n++) {
|
|
2737
|
+
let r = e.load(Kn(K(z(a.x.add(n), o.x), z(a.y.add(t), o.y)))).xyz;
|
|
2738
|
+
s.push(H(r.length().greaterThan(.5), V(r), q(0)).toVar());
|
|
2668
2739
|
}
|
|
2669
2740
|
let c = s.reduce((e, t) => e.add(t), q(0)), l = J(0, 0, 0, 1).toVar();
|
|
2670
|
-
return
|
|
2671
|
-
let e =
|
|
2741
|
+
return M(c.length().greaterThan(.001), () => {
|
|
2742
|
+
let e = V(c), t = s.reduce((t, n) => z(t, H(F(n, n).lessThan(.5), I(1), F(n, e))), I(1));
|
|
2672
2743
|
l.assign(J(e, t));
|
|
2673
2744
|
}), l;
|
|
2674
2745
|
})(), {
|
|
2675
|
-
scale: 1 /
|
|
2676
|
-
type:
|
|
2746
|
+
scale: 1 / ic,
|
|
2747
|
+
type: Ht,
|
|
2677
2748
|
nearest: !0,
|
|
2678
2749
|
name: "Bevel cones"
|
|
2679
2750
|
}).getTextureNode();
|
|
2680
|
-
return new Ts((e) =>
|
|
2681
|
-
let t =
|
|
2682
|
-
return
|
|
2683
|
-
start:
|
|
2751
|
+
return new Ts((e) => j(() => {
|
|
2752
|
+
let t = L(G().div(e.texel)), i = L(K(1).div(e.texel).add(.5)).sub(1), a = r.load(Kn(t)), o = a.w.toVar(), s = Gn(L(n.add(1).div(3.95))).add(1);
|
|
2753
|
+
return On({
|
|
2754
|
+
start: Gn(0).sub(s),
|
|
2684
2755
|
end: s,
|
|
2685
2756
|
condition: "<="
|
|
2686
2757
|
}, {
|
|
2687
|
-
start:
|
|
2758
|
+
start: Gn(0).sub(s),
|
|
2688
2759
|
end: s,
|
|
2689
2760
|
condition: "<="
|
|
2690
2761
|
}, ({ i: e, j: n }) => {
|
|
2691
|
-
let s = r.load(
|
|
2692
|
-
o.assign(
|
|
2762
|
+
let s = r.load(Kn(P(t.add(K(I(e), I(n))), K(0), i))), c = s.xyz.length();
|
|
2763
|
+
o.assign(H(c.greaterThan(.5), z(o, rc(F(s.xyz, a.xyz), s.w)), o));
|
|
2693
2764
|
}), J(a.xyz, o);
|
|
2694
2765
|
})(), {
|
|
2695
|
-
scale: 1 /
|
|
2696
|
-
type:
|
|
2766
|
+
scale: 1 / ic,
|
|
2767
|
+
type: Ht,
|
|
2697
2768
|
nearest: !0,
|
|
2698
2769
|
name: "Bevel cones widened"
|
|
2699
2770
|
});
|
|
2700
2771
|
}
|
|
2701
|
-
function
|
|
2702
|
-
let { width: l } = s, u =
|
|
2703
|
-
return
|
|
2704
|
-
let d = G(), f = t.sample(d), p = e.sample(d).toVar(), m = f.xyz.length().greaterThan(.5), h = H(
|
|
2705
|
-
|
|
2706
|
-
let e = Ms(a, g.z), n =
|
|
2707
|
-
for (let { x: t, y: a, r: f } of
|
|
2772
|
+
function oc(e, t, n, r, i, a, o, s, c) {
|
|
2773
|
+
let { width: l } = s, u = ac(t, a, l);
|
|
2774
|
+
return j(() => {
|
|
2775
|
+
let d = G(), f = t.sample(d), p = e.sample(d).toVar(), m = f.xyz.length().greaterThan(.5), h = V(H(m, f.xyz, q(0, 0, 1))), g = i(d).p, _ = H(a.ortho.equal(1), q(0, 0, 1), V(g.negate())), v = h.toVar(), y = I(0).toVar(), b = I(0).toVar(), x = u.getTextureNode().load(Kn(L(d.div(u.texel)))), S = rc(F(h, x.xyz), x.w).greaterThanEqual(1 - ec);
|
|
2776
|
+
M(m.and(S.not()), () => {
|
|
2777
|
+
let e = Ms(a, g.z), n = I(1).div(P(F(h, _), 1 / 3, 1)), r = h.toVar(), o = q(0).toVar(), s = q(0).toVar(), c = I(0).toVar(), u = I(0).toVar(), p = K(l).div(a.size), m = t.level(I(0));
|
|
2778
|
+
for (let { x: t, y: a, r: f } of $s) {
|
|
2708
2779
|
let h = K(t, a).mul(l), v = l.mul(f), y = (r) => {
|
|
2709
|
-
let o = d.add(K(t * r, a * r).mul(p)), s = m.sample(o).xyz, c = s.length(), l = i(o).z.sub(g.z).div(e), u = v.mul(v).add(l.mul(l)).sqrt(), f = v.mul(
|
|
2780
|
+
let o = d.add(K(t * r, a * r).mul(p)), s = m.sample(o).xyz, c = s.length(), l = i(o).z.sub(g.z).div(e), u = v.mul(v).add(l.mul(l)).sqrt(), f = v.mul(R(n, R(c, 1e-4).div(P(F(s, _), c.div(3), c)))), h = I(1).sub(U(f.mul(1.25).add(n), f.mul(2.5).add(n.mul(2)).add(2), u));
|
|
2710
2781
|
return {
|
|
2711
2782
|
s,
|
|
2712
|
-
w:
|
|
2783
|
+
w: H(c.greaterThan(.5), h, I(0))
|
|
2713
2784
|
};
|
|
2714
|
-
}, b = y(1), x = y(-1), S =
|
|
2785
|
+
}, b = y(1), x = y(-1), S = z(b.w, x.w);
|
|
2715
2786
|
r.addAssign(b.s.add(x.s).mul(S));
|
|
2716
|
-
let
|
|
2717
|
-
o.addAssign(
|
|
2787
|
+
let C = b.s.sub(x.s).mul(S);
|
|
2788
|
+
o.addAssign(C.mul(h.x)), s.addAssign(C.mul(h.y)), c.addAssign(S.mul(v.mul(v))), u.addAssign(S);
|
|
2718
2789
|
}
|
|
2719
|
-
v.assign(
|
|
2720
|
-
let x =
|
|
2721
|
-
b.assign(x.mul(
|
|
2722
|
-
let S =
|
|
2723
|
-
y.assign(
|
|
2790
|
+
v.assign(V(r));
|
|
2791
|
+
let x = I(1).sub(U(.98, .998, f.xyz.length().div(R(f.w, 1e-4))));
|
|
2792
|
+
b.assign(x.mul(U(.6 * Qs, .9 * Qs, u)));
|
|
2793
|
+
let S = I(1).div(R(c, 1)), C = R(N(o.mul(S)), N(s.mul(S)));
|
|
2794
|
+
y.assign(R(C.x, R(C.y, C.z)));
|
|
2724
2795
|
});
|
|
2725
|
-
let
|
|
2726
|
-
return
|
|
2727
|
-
let e = r.sample(d), t = e.b, i =
|
|
2728
|
-
let n =
|
|
2729
|
-
if (!g) return
|
|
2730
|
-
let
|
|
2796
|
+
let C = R(U(ec, tc, I(1).sub(F(v, h))), b);
|
|
2797
|
+
return M(C.greaterThan(0), () => {
|
|
2798
|
+
let e = r.sample(d), t = e.b, i = R(e.g.div(R(t, 1e-4)), .0525), a = n.sample(d), l = a.rgb.div(R(a.a, 1e-4)), u = q(Ks.x, Ks.y, Ks.z), f = V(u.add(_)), m = (e) => o.toWorld.mul(J(e, 0)).xyz, { environment: g } = c, x = l.mul(.95), S = B(q(qs), l, Js), ee = (e, t) => {
|
|
2799
|
+
let n = P(F(e, _), 0, 1), r = P(F(e, u), 0, 1), i = t.pow(4), a = P(F(e, f), 0, 1), o = P(F(_, f), 0, 1), d = S.add(q(1).sub(S).mul(o.mul(-5.55473).sub(6.98316).mul(o).exp2())), p = r.mul(i.add(I(1).sub(i).mul(n.mul(n))).sqrt()), h = n.mul(i.add(I(1).sub(i).mul(r.mul(r))).sqrt()), v = I(.5).div(R(p.add(h), 1e-6)), y = I(1).sub(a.mul(a).mul(I(1).sub(i))), b = i.div(y.mul(y)).mul(1 / Math.PI), C = d.mul(v.mul(b)), ee = x.add(C.mul(Math.PI)).mul(r.mul(s.key));
|
|
2800
|
+
if (!g) return ee;
|
|
2801
|
+
let w = En({
|
|
2731
2802
|
roughness: t,
|
|
2732
2803
|
dotNV: n
|
|
2733
|
-
}),
|
|
2734
|
-
return
|
|
2735
|
-
},
|
|
2736
|
-
p.rgb.assign(
|
|
2804
|
+
}), te = I(1).sub(w.x).sub(w.y), ne = (e, t) => e.mul(t.mul(te)).div(q(1).sub(t.mul(te))), T = q(w.x.mul(qs).add(w.y)), re = ne(T, q(.08571428571428572)), ie = l.mul(w.x).add(w.y), ae = ne(ie, l.mul(20 / 21).add(1 / 21)), oe = B(T, ie, Js), se = B(re, ae, Js), ce = ir(g, m(e), I(1)).rgb.mul(c.intensity), le = V(B(ur(_.negate(), e), e, t.pow(4))), ue = ir(g, m(le), t).rgb.mul(c.intensity), de = q(1).sub(T).sub(re);
|
|
2805
|
+
return ee.add(ue.mul(oe)).add(ce.mul(se.add(x.mul(de))));
|
|
2806
|
+
}, w = p.rgb, te = U(.95, 1, t.div(R(p.a, 1e-4))), ne = B(ee(h, i), w.div(R(p.a, 1e-4)), b.mul(te)), T = ee(v, z(i.add(y), 1)).sub(ne).mul(C.mul(t)), re = w.add(T), ie = q(Ys.x, Ys.y, Ys.z), ae = w.mul(R(F(re, ie), 0).div(R(F(w, ie), 1e-4)));
|
|
2807
|
+
p.rgb.assign(R(re, z(ae.mul(.5), w)));
|
|
2737
2808
|
}), p;
|
|
2738
2809
|
})();
|
|
2739
2810
|
}
|
|
2740
2811
|
//#endregion
|
|
2741
2812
|
//#region src/postpro/pipeline/bounce.ts
|
|
2742
|
-
var
|
|
2743
|
-
let r = (n + .5) / e * .96, i = Math.sqrt(r), a = n *
|
|
2744
|
-
return new
|
|
2813
|
+
var sc = 2.399963, cc = (e) => Array.from({ length: e }, (t, n) => {
|
|
2814
|
+
let r = (n + .5) / e * .96, i = Math.sqrt(r), a = n * sc, o = .25 + .75 * (n * .7548777 % 1);
|
|
2815
|
+
return new Cn(Math.cos(a) * i, Math.sin(a) * i, Math.sqrt(1 - r)).multiplyScalar(o);
|
|
2745
2816
|
});
|
|
2746
|
-
function
|
|
2747
|
-
let { depth: a, normal: o, view: s } = t, c =
|
|
2748
|
-
return new Ts((l) =>
|
|
2749
|
-
let u =
|
|
2750
|
-
return
|
|
2751
|
-
let t =
|
|
2817
|
+
function lc(e, t, n, { samples: r = 16, factor: i = 4 } = {}) {
|
|
2818
|
+
let { depth: a, normal: o, view: s } = t, c = cc(r);
|
|
2819
|
+
return new Ts((l) => j(() => {
|
|
2820
|
+
let u = L(G().div(l.texel)), { d, p: f, n: p } = Rs(t, u, i), m = J(0).toVar();
|
|
2821
|
+
return M(d.lessThan(1).and(p.length().greaterThan(.5)), () => {
|
|
2822
|
+
let t = V(p), i = Ms(s, f.z), l = z(n.radius, n.maxPixels.mul(i)), d = U(n.minPixels, n.minPixels.mul(2), l.div(i)), h = Xn(u, 4), g = h.x.add(h.y.mul(4)), _ = g.mul(.618034).fract().mul(6.283185), v = g.mul(.7548777).fract().mul(.5).add(.75), y = H(N(t.z).lessThan(.9), q(0, 0, 1), q(1, 0, 0)), b = V(In(y, t)), x = b.mul(_.cos()).add(In(t, b).mul(_.sin())), S = In(t, x), C = i.mul(.5).add(l.mul(.02)), ee = q(0).toVar();
|
|
2752
2823
|
for (let n of c) {
|
|
2753
|
-
let r = f.add(x.mul(n.x).add(S.mul(n.y)).add(t.mul(n.z)).mul(l.mul(v))), i = As(s, r), c =
|
|
2754
|
-
|
|
2824
|
+
let r = f.add(x.mul(n.x).add(S.mul(n.y)).add(t.mul(n.z)).mul(l.mul(v))), i = As(s, r), c = z(z(i.x, i.y), z(i.x.oneMinus(), i.y.oneMinus())).greaterThan(0), u = ks(a, s, i).p, d = o.sample(i).xyz, p = u.sub(f), m = c.and(u.z.greaterThanEqual(r.z.add(C))), h = I(1).sub(U(l, l.mul(2), p.length())), g = d.length().greaterThan(.5).and(F(d, p).lessThan(0));
|
|
2825
|
+
ee.addAssign(H(m.and(g), e.sample(i).rgb.mul(h), q(0)));
|
|
2755
2826
|
}
|
|
2756
|
-
m.assign(J(
|
|
2827
|
+
m.assign(J(ee.div(r).mul(d), 1));
|
|
2757
2828
|
}), m;
|
|
2758
2829
|
})(), {
|
|
2759
2830
|
scale: 1 / i,
|
|
2760
|
-
type:
|
|
2831
|
+
type: Ut,
|
|
2761
2832
|
name: "Bounce"
|
|
2762
2833
|
});
|
|
2763
2834
|
}
|
|
2764
2835
|
//#endregion
|
|
2765
2836
|
//#region src/postpro/pipeline/outlines.ts
|
|
2766
|
-
var
|
|
2837
|
+
var uc = {
|
|
2767
2838
|
hovered: 20,
|
|
2768
2839
|
selected: 21
|
|
2769
|
-
},
|
|
2770
|
-
function
|
|
2840
|
+
}, dc = (e, t) => 1 + e * 47 % 127 + (t ? 128 : 0), fc = 64, pc = 12, mc = 7;
|
|
2841
|
+
function hc(e, t) {
|
|
2771
2842
|
for (let e of [
|
|
2772
2843
|
0,
|
|
2773
2844
|
-1,
|
|
2774
2845
|
1
|
|
2775
2846
|
]) t(e);
|
|
2776
|
-
for (let n = 2; n <=
|
|
2847
|
+
for (let n = 2; n <= mc; n++) M(e.greaterThan(n - 1), () => {
|
|
2777
2848
|
t(-n), t(n);
|
|
2778
2849
|
});
|
|
2779
2850
|
}
|
|
2780
|
-
var
|
|
2781
|
-
function
|
|
2851
|
+
var gc = new Sn();
|
|
2852
|
+
function _c(e, t) {
|
|
2782
2853
|
for (let n = e; n; n = n.parent) {
|
|
2783
2854
|
if (!n.visible) return !1;
|
|
2784
2855
|
if (n === t) return !0;
|
|
2785
2856
|
}
|
|
2786
2857
|
return !1;
|
|
2787
2858
|
}
|
|
2788
|
-
var
|
|
2859
|
+
var vc = class extends yn {
|
|
2789
2860
|
scene;
|
|
2790
2861
|
camera;
|
|
2791
2862
|
layers;
|
|
2792
2863
|
shown;
|
|
2793
|
-
target = new
|
|
2794
|
-
type:
|
|
2795
|
-
format:
|
|
2864
|
+
target = new mn(1, 1, {
|
|
2865
|
+
type: xn,
|
|
2866
|
+
format: dn,
|
|
2796
2867
|
depthBuffer: !1,
|
|
2797
2868
|
samples: 4
|
|
2798
2869
|
});
|
|
2799
2870
|
textureNode;
|
|
2800
2871
|
state;
|
|
2801
2872
|
constructor(e, t, n, r, i) {
|
|
2802
|
-
super("vec4"), this.scene = e, this.camera = t, this.layers = n, this.shown = r, this.updateBeforeType =
|
|
2873
|
+
super("vec4"), this.scene = e, this.camera = t, this.layers = n, this.shown = r, this.updateBeforeType = rn.FRAME, this.target.texture.name = i, this.textureNode = rr(this, this.target.texture);
|
|
2803
2874
|
}
|
|
2804
2875
|
getTextureNode() {
|
|
2805
2876
|
return this.textureNode;
|
|
2806
2877
|
}
|
|
2807
2878
|
updateBefore({ renderer: e }) {
|
|
2808
2879
|
if (!e || !this.shown()) return;
|
|
2809
|
-
this.state =
|
|
2880
|
+
this.state = hn.resetRendererState(e, this.state), e.getDrawingBufferSize(gc), (this.target.width !== gc.width || this.target.height !== gc.height) && this.target.setSize(gc.width, gc.height);
|
|
2810
2881
|
let t = this.camera.layers.mask;
|
|
2811
2882
|
this.camera.layers.mask = this.layers.mask, e.setClearColor(0, 0), e.setRenderTarget(this.target);
|
|
2812
2883
|
try {
|
|
2813
2884
|
e.render(this.scene, this.camera);
|
|
2814
2885
|
} finally {
|
|
2815
|
-
this.camera.layers.mask = t,
|
|
2886
|
+
this.camera.layers.mask = t, hn.restoreRendererState(e, this.state);
|
|
2816
2887
|
}
|
|
2817
2888
|
}
|
|
2818
2889
|
setup() {
|
|
@@ -2821,24 +2892,24 @@ var _c = class extends _n {
|
|
|
2821
2892
|
dispose() {
|
|
2822
2893
|
this.target.dispose(), super.dispose();
|
|
2823
2894
|
}
|
|
2824
|
-
},
|
|
2895
|
+
}, yc = class {
|
|
2825
2896
|
layer;
|
|
2826
2897
|
pass;
|
|
2827
|
-
color = W(new
|
|
2828
|
-
alt = W(new
|
|
2898
|
+
color = W(new Cn());
|
|
2899
|
+
alt = W(new Cn());
|
|
2829
2900
|
on = W(0);
|
|
2830
|
-
proxy = new
|
|
2831
|
-
material = new
|
|
2901
|
+
proxy = new gn();
|
|
2902
|
+
material = new nn();
|
|
2832
2903
|
labels = /* @__PURE__ */ new WeakMap();
|
|
2833
2904
|
objects = [];
|
|
2834
2905
|
items = [];
|
|
2835
|
-
colors = [new
|
|
2906
|
+
colors = [new zt(), new zt()];
|
|
2836
2907
|
constructor(e, t) {
|
|
2837
2908
|
this.layer = t;
|
|
2838
2909
|
let n = this.labels, r = W(0).onObjectUpdate(({ object: e }) => e && n.get(e) || 0), i = this.material;
|
|
2839
|
-
i.name = `Outline labels (${t})`, i.colorNode = J(r.div(255), 1, 0, 1), i.side =
|
|
2840
|
-
let a = new
|
|
2841
|
-
a.set(t), this.pass = new
|
|
2910
|
+
i.name = `Outline labels (${t})`, i.colorNode = J(r.div(255), 1, 0, 1), i.side = Vt, i.forceSinglePass = !0, i.blending = tn, i.depthTest = !1, i.depthWrite = !1, this.proxy.overrideMaterial = i, this.proxy.matrixWorldAutoUpdate = !1;
|
|
2911
|
+
let a = new Kt();
|
|
2912
|
+
a.set(t), this.pass = new vc(this.proxy, e, a, () => this.on.value === 1, i.name);
|
|
2842
2913
|
}
|
|
2843
2914
|
setItems(e) {
|
|
2844
2915
|
for (let e of this.objects) e.layers.disable(this.layer);
|
|
@@ -2856,7 +2927,7 @@ var _c = class extends _n {
|
|
|
2856
2927
|
refresh(e) {
|
|
2857
2928
|
let t = this.proxy.children;
|
|
2858
2929
|
t.length = 0;
|
|
2859
|
-
for (let n of this.objects)
|
|
2930
|
+
for (let n of this.objects) _c(n, e) && t.push(n);
|
|
2860
2931
|
this.on.value = +(t.length > 0);
|
|
2861
2932
|
}
|
|
2862
2933
|
dispose() {
|
|
@@ -2864,7 +2935,7 @@ var _c = class extends _n {
|
|
|
2864
2935
|
this.objects = [], this.items = [], this.proxy.children.length = 0, this.on.value = 0, this.material.dispose(), this.pass.dispose();
|
|
2865
2936
|
}
|
|
2866
2937
|
updateLabels() {
|
|
2867
|
-
let [e, t] = this.colors, n = new
|
|
2938
|
+
let [e, t] = this.colors, n = new Cn(), r = (e, t) => 2 * Math.abs(e.r - t.r) + 2 * Math.abs(e.g - t.g) + 3 * Math.abs(e.b - t.b) < .5;
|
|
2868
2939
|
this.items.forEach((i, a) => {
|
|
2869
2940
|
let o = 0, s = 0;
|
|
2870
2941
|
for (let a of i) {
|
|
@@ -2874,37 +2945,37 @@ var _c = class extends _n {
|
|
|
2874
2945
|
let l = n.x + n.y + n.z;
|
|
2875
2946
|
r(e, c) && (o += l), r(t, c) && (s += l);
|
|
2876
2947
|
}
|
|
2877
|
-
let c =
|
|
2948
|
+
let c = dc(a, o > s);
|
|
2878
2949
|
for (let e of i) this.labels.set(e, c);
|
|
2879
2950
|
});
|
|
2880
2951
|
}
|
|
2881
2952
|
};
|
|
2882
|
-
function
|
|
2883
|
-
let n =
|
|
2884
|
-
return
|
|
2953
|
+
function bc(e, t) {
|
|
2954
|
+
let n = R(N(e.x), N(e.y)), r = z(N(e.x), N(e.y)), i = r.mul(.5).div(R(n, 1e-6)), a = n.add(r).mul(.5), o = (e) => _r(n.mul(r).mul(2).mul(e));
|
|
2955
|
+
return H(t.lessThan(i), a.sub(o(t)), H(t.lessThan(I(1).sub(i)), I(.5).sub(t).mul(n), o(I(1).sub(t)).sub(a)));
|
|
2885
2956
|
}
|
|
2886
|
-
var
|
|
2887
|
-
function
|
|
2888
|
-
let n =
|
|
2957
|
+
var xc = (e) => H(e.y.greaterThan(.5).and(e.x.div(e.y).greaterThan(127.5 / 255)), I(1), I(0)), Sc = (e, t) => K(fr(e.x.add(1).mul(63)).add(1).add(t.mul(128)).div(255), fr(e.y.add(1).mul(127.5)).div(255));
|
|
2958
|
+
function Cc(e, t) {
|
|
2959
|
+
let n = fr(e.mul(255)), r = vr(128, n);
|
|
2889
2960
|
return {
|
|
2890
2961
|
seed: n.greaterThan(.5),
|
|
2891
2962
|
alt: r,
|
|
2892
2963
|
e: K(n.sub(r.mul(128)).sub(1).div(63).sub(1), t.mul(2).sub(1))
|
|
2893
2964
|
};
|
|
2894
2965
|
}
|
|
2895
|
-
function
|
|
2896
|
-
let r = (r, i) => e.load(
|
|
2966
|
+
function wc(e, t, n) {
|
|
2967
|
+
let r = (r, i) => e.load(Kn(P(t.add(K(r, i)), K(0), n))).xy, i = [];
|
|
2897
2968
|
for (let e = -1; e <= 1; e++) for (let t = -1; t <= 1; t++) i.push(r(t, e).toVar());
|
|
2898
|
-
let a = 254.5 / 255, o = i.reduce((e, t) =>
|
|
2899
|
-
return
|
|
2900
|
-
|
|
2969
|
+
let a = 254.5 / 255, o = i.reduce((e, t) => z(e, t.y), I(1)).toVar(), s = i.reduce((e, t) => R(e, t.y), I(0)).toVar(), c = i.map(() => I(0).toVar()), l = I(0).toVar(), u = I(0).toVar(), d = K(0).toVar();
|
|
2970
|
+
return M(s.greaterThan(0), () => {
|
|
2971
|
+
M(o.lessThan(a), () => {
|
|
2901
2972
|
i.forEach((e, t) => c[t].assign(e.y));
|
|
2902
2973
|
let e = K(0).toVar();
|
|
2903
|
-
for (let t of i) e.assign(
|
|
2904
|
-
l.assign(
|
|
2974
|
+
for (let t of i) e.assign(H(t.y.greaterThan(e.y), t, e));
|
|
2975
|
+
l.assign(xc(e)), u.assign(1);
|
|
2905
2976
|
}).Else(() => {
|
|
2906
|
-
let e = i.reduce((e, t) =>
|
|
2907
|
-
|
|
2977
|
+
let e = i.reduce((e, t) => z(e, t.x), I(1)).toVar(), t = i.reduce((e, t) => R(e, t.x), I(0)).toVar();
|
|
2978
|
+
M(t.sub(e).greaterThan(.5 / 255), () => {
|
|
2908
2979
|
for (let [n, i] of [
|
|
2909
2980
|
[-2, 0],
|
|
2910
2981
|
[2, 0],
|
|
@@ -2912,19 +2983,19 @@ function Cc(e, t, n) {
|
|
|
2912
2983
|
[0, 2]
|
|
2913
2984
|
]) {
|
|
2914
2985
|
let o = r(n, i).toVar();
|
|
2915
|
-
e.assign(
|
|
2986
|
+
e.assign(H(o.y.greaterThan(a), z(e, o.x), e)), t.assign(H(o.y.greaterThan(a), R(t, o.x), t));
|
|
2916
2987
|
}
|
|
2917
|
-
i.forEach((n, r) => c[r].assign(
|
|
2988
|
+
i.forEach((n, r) => c[r].assign(P(n.x.sub(e).div(t.sub(e)), 0, 1))), l.assign(R(xc(K(e, 1)), xc(K(t, 1)))), u.assign(1);
|
|
2918
2989
|
});
|
|
2919
2990
|
});
|
|
2920
|
-
let e = c[4], t = e.greaterThan(.02).and(e.lessThan(.98)), n =
|
|
2921
|
-
|
|
2922
|
-
let t = (e, t, n) => e.add(t.mul(Math.SQRT2)).add(n), n = K(t(c[2], c[5], c[8]).sub(t(c[0], c[3], c[6])), t(c[6], c[7], c[8]).sub(t(c[0], c[1], c[2]))), r = n.div(
|
|
2923
|
-
d.assign(
|
|
2991
|
+
let e = c[4], t = e.greaterThan(.02).and(e.lessThan(.98)), n = R(R(N(c[1].sub(e)), N(c[3].sub(e))), R(N(c[5].sub(e)), N(c[7].sub(e))));
|
|
2992
|
+
M(u.equal(1).and(t.or(n.greaterThan(.98))), () => {
|
|
2993
|
+
let t = (e, t, n) => e.add(t.mul(Math.SQRT2)).add(n), n = K(t(c[2], c[5], c[8]).sub(t(c[0], c[3], c[6])), t(c[6], c[7], c[8]).sub(t(c[0], c[1], c[2]))), r = n.div(R(qn(n), 1e-6)).toVar(), i = r.mul(P(bc(r, e), -1, 1));
|
|
2994
|
+
d.assign(Sc(i, l));
|
|
2924
2995
|
});
|
|
2925
2996
|
}), d;
|
|
2926
2997
|
}
|
|
2927
|
-
var
|
|
2998
|
+
var Tc = class {
|
|
2928
2999
|
scene;
|
|
2929
3000
|
width = W(2);
|
|
2930
3001
|
groups;
|
|
@@ -2935,61 +3006,61 @@ var wc = class {
|
|
|
2935
3006
|
warm = !1;
|
|
2936
3007
|
constructor(e, t) {
|
|
2937
3008
|
this.scene = e, this.groups = {
|
|
2938
|
-
hovered: new
|
|
2939
|
-
selected: new
|
|
3009
|
+
hovered: new yc(t, uc.hovered),
|
|
3010
|
+
selected: new yc(t, uc.selected)
|
|
2940
3011
|
};
|
|
2941
3012
|
let { hovered: n, selected: r } = this.groups;
|
|
2942
|
-
this.edges = new Ts((e) =>
|
|
2943
|
-
let t =
|
|
3013
|
+
this.edges = new Ts((e) => j(() => {
|
|
3014
|
+
let t = L(G().div(e.texel)), i = K(1).div(e.texel).sub(1), a = (e) => {
|
|
2944
3015
|
let n = K(0).toVar();
|
|
2945
|
-
return
|
|
2946
|
-
n.assign(
|
|
3016
|
+
return M(e.on.equal(1), () => {
|
|
3017
|
+
n.assign(wc(e.pass.getTextureNode(), t, i));
|
|
2947
3018
|
}), n;
|
|
2948
3019
|
};
|
|
2949
3020
|
return J(a(n), a(r));
|
|
2950
3021
|
})(), {
|
|
2951
|
-
type:
|
|
3022
|
+
type: xn,
|
|
2952
3023
|
nearest: !0,
|
|
2953
3024
|
name: "Outline edges"
|
|
2954
3025
|
});
|
|
2955
3026
|
let i = this.edges;
|
|
2956
|
-
this.columns = new Ts((e) =>
|
|
2957
|
-
let t =
|
|
2958
|
-
let { seed: i, alt: a, e: o } =
|
|
2959
|
-
e.assign(
|
|
3027
|
+
this.columns = new Ts((e) => j(() => {
|
|
3028
|
+
let t = L(G().div(e.texel)), n = K(1).div(e.texel).sub(1), r = K(fc).toVar(), a = K(fc).toVar(), o = (e, t, n, r) => {
|
|
3029
|
+
let { seed: i, alt: a, e: o } = Cc(n, r), s = o.y.add(t);
|
|
3030
|
+
e.assign(H(i.and(N(s).lessThan(N(e.y))), K(o.x.add(a.mul(8)), s), e));
|
|
2960
3031
|
};
|
|
2961
|
-
return
|
|
2962
|
-
let s =
|
|
3032
|
+
return hc(this.pixels.mul(.5).add(.5), (e) => {
|
|
3033
|
+
let s = Kn(P(t.add(K(0, e)), K(0), n)), c = i.getTextureNode().load(s);
|
|
2963
3034
|
o(r, e, c.x, c.y), o(a, e, c.z, c.w);
|
|
2964
3035
|
}), J(r, a);
|
|
2965
3036
|
})(), {
|
|
2966
|
-
type:
|
|
3037
|
+
type: Ut,
|
|
2967
3038
|
nearest: !0,
|
|
2968
3039
|
name: "Outline columns"
|
|
2969
3040
|
}), this.columns.skip = () => this.warm ? (this.warm = !1, !1) : this.active.value === 0;
|
|
2970
3041
|
}
|
|
2971
3042
|
composite(e) {
|
|
2972
3043
|
let { hovered: t, selected: n } = this.groups, r = this.columns;
|
|
2973
|
-
return this.warm = !0,
|
|
3044
|
+
return this.warm = !0, j(() => {
|
|
2974
3045
|
let i = J(e).toVar(), a = J(0).toVar();
|
|
2975
|
-
|
|
2976
|
-
let e =
|
|
3046
|
+
M(this.active.equal(1), () => {
|
|
3047
|
+
let e = L(G().div(r.texel)), t = K(1).div(r.texel).sub(1), n = this.pixels.mul(.5).add(.5), i = I(4096).toVar(), o = I(4096).toVar(), s = I(0).toVar(), c = I(0).toVar(), l = (e, t, n, r, i) => {
|
|
2977
3048
|
let a = vr(4, t), o = t.sub(a.mul(8)).add(e), s = o.mul(o).add(n.mul(n));
|
|
2978
|
-
i.assign(
|
|
3049
|
+
i.assign(H(s.lessThan(r), a, i)), r.assign(z(r, s));
|
|
2979
3050
|
};
|
|
2980
|
-
|
|
2981
|
-
let a =
|
|
3051
|
+
hc(n, (n) => {
|
|
3052
|
+
let a = Kn(P(e.add(K(n, 0)), K(0), t)), u = r.getTextureNode().load(a);
|
|
2982
3053
|
l(n, u.x, u.y, i, s), l(n, u.z, u.w, o, c);
|
|
2983
3054
|
});
|
|
2984
|
-
let u = (e) =>
|
|
3055
|
+
let u = (e) => P(n.sub(_r(e)), 0, 1);
|
|
2985
3056
|
a.assign(J(u(i), u(o), s, c));
|
|
2986
3057
|
});
|
|
2987
|
-
let o =
|
|
2988
|
-
return l.add(i.mul(
|
|
3058
|
+
let o = B(t.color, t.alt, a.b), s = B(n.color, n.alt, a.a), c = J(o.mul(a.r), a.r), l = J(s.mul(a.g), a.g).add(c.mul(I(1).sub(a.g)));
|
|
3059
|
+
return l.add(i.mul(I(1).sub(l.a)));
|
|
2989
3060
|
})();
|
|
2990
3061
|
}
|
|
2991
3062
|
update(e) {
|
|
2992
|
-
this.pixels.value = Math.min(this.width.value * e,
|
|
3063
|
+
this.pixels.value = Math.min(this.width.value * e, pc);
|
|
2993
3064
|
let { hovered: t, selected: n } = this.groups;
|
|
2994
3065
|
t.refresh(this.scene), n.refresh(this.scene), this.active.value = +(t.on.value === 1 || n.on.value === 1);
|
|
2995
3066
|
}
|
|
@@ -3002,44 +3073,47 @@ var wc = class {
|
|
|
3002
3073
|
setColors(e, t) {
|
|
3003
3074
|
this.groups[e].setColors(t);
|
|
3004
3075
|
}
|
|
3005
|
-
},
|
|
3006
|
-
function
|
|
3076
|
+
}, Ec = 5;
|
|
3077
|
+
function Dc(e, t, n, r, { steps: i = 32, factor: a = 2 } = {}) {
|
|
3007
3078
|
let { depth: o, normal: s, view: c } = t;
|
|
3008
|
-
return new Ts((l) =>
|
|
3009
|
-
let u =
|
|
3010
|
-
return
|
|
3011
|
-
let t =
|
|
3079
|
+
return new Ts((l) => j(() => {
|
|
3080
|
+
let u = L(G().div(l.texel)), { at: d, d: f, p, n: m } = Rs(t, u, a), h = r.mirror.mul(n.sample(d).b), g = J(0).toVar();
|
|
3081
|
+
return M(f.lessThan(1).and(m.length().greaterThan(.5)).and(h.greaterThan(0)), () => {
|
|
3082
|
+
let t = V(m), n = Ms(c, p.z), a = H(c.ortho.equal(1), q(0, 0, -1), V(p)), l = ur(a, t), d = z(r.reach, r.maxPixels.mul(n)), f = (e) => p.add(l.mul(d.mul(e))), _ = Xn(u, 4), v = _.x.add(_.y.mul(4)).mul(.618034).fract(), y = I(0).toVar(), b = I(0).toVar(), x = I(0).toVar(), S = I(0).toVar();
|
|
3012
3083
|
for (let e = 0; e < i; e++) {
|
|
3013
|
-
let t =
|
|
3014
|
-
b.assign(
|
|
3084
|
+
let t = I(e).add(v).div(i), r = t.mul(t), a = f(r), s = As(c, a), l = z(z(s.x, s.y), z(s.x.oneMinus(), s.y.oneMinus())).greaterThan(0), u = ks(o, c, s).p.z.sub(a.z), p = d.mul((2 * e + 2) / (i * i) * 1.5).max(n.mul(4)), m = y.equal(0).and(l).and(u.greaterThan(n.mul(.5))).and(u.lessThan(p));
|
|
3085
|
+
b.assign(H(m, r, b)), x.assign(H(m, S, x)), y.assign(H(m, I(1), y)), S.assign(r);
|
|
3015
3086
|
}
|
|
3016
|
-
|
|
3087
|
+
M(y.equal(1), () => {
|
|
3017
3088
|
let n = x.toVar(), r = b.toVar();
|
|
3018
|
-
for (let e = 0; e <
|
|
3089
|
+
for (let e = 0; e < Ec; e++) {
|
|
3019
3090
|
let e = n.add(r).mul(.5), t = f(e), i = ks(o, c, As(c, t)).p.z.sub(t.z).greaterThan(0);
|
|
3020
|
-
r.assign(
|
|
3091
|
+
r.assign(H(i, e, r)), n.assign(H(i, n, e));
|
|
3021
3092
|
}
|
|
3022
|
-
let i = As(c, f(r)), u = s.sample(i).xyz, d = u.length().greaterThan(.5).and(
|
|
3093
|
+
let i = As(c, f(r)), u = s.sample(i).xyz, d = u.length().greaterThan(.5).and(F(u, l).lessThan(0)), p = U(0, .05, z(z(i.x, i.y), z(i.x.oneMinus(), i.y.oneMinus()))), m = r.oneMinus(), _ = F(a, t), v = I(1).sub(_.mul(_)), y = H(d, h.mul(v).mul(m.mul(m)).mul(p), I(0));
|
|
3023
3094
|
g.assign(J(e.sample(i).rgb.mul(y), y));
|
|
3024
3095
|
});
|
|
3025
3096
|
}), g;
|
|
3026
3097
|
})(), {
|
|
3027
3098
|
scale: 1 / a,
|
|
3028
|
-
type:
|
|
3099
|
+
type: Ut,
|
|
3029
3100
|
name: "Reflections"
|
|
3030
3101
|
});
|
|
3031
3102
|
}
|
|
3032
3103
|
//#endregion
|
|
3033
3104
|
//#region src/postpro/pipeline/StagePipeline.ts
|
|
3034
|
-
var
|
|
3105
|
+
var Oc = [
|
|
3035
3106
|
"isMeshLambertMaterial",
|
|
3036
3107
|
"isMeshPhongMaterial",
|
|
3037
3108
|
"isMeshStandardMaterial",
|
|
3038
3109
|
"isMeshToonMaterial"
|
|
3039
|
-
],
|
|
3110
|
+
], kc = (e) => {
|
|
3040
3111
|
let t = e.object, n = e.material;
|
|
3041
|
-
return !!t?.isMesh && !t.isLineSegments2 &&
|
|
3042
|
-
},
|
|
3112
|
+
return !!t?.isMesh && !t.isLineSegments2 && Oc.some((e) => n?.[e]);
|
|
3113
|
+
}, Ac = (e) => kc(e) && !e.material?.transparent, jc = j((e) => Ac(e) ? H(Vn, J(er, 1), J(0)) : J(0)), Mc = j((e) => Ac(e) ? H(Vn, J(Ln.rgb, 1), J(0)) : J(0)), Nc = j((e) => Ac(e) ? H(Vn, J(0, dr, 1, 1), J(0)) : J(+!kc(e), 0, 0, tr.a)), Pc = (e) => J(e.rgb.div(R(e.r, R(e.g, e.b)).add(1)), e.a), Fc = (e) => j(() => {
|
|
3114
|
+
let t = J(e).toVar(), n = t.rgb.div(R(t.a, 1e-4)), r = z(R(n.r, R(n.g, n.b)), .999);
|
|
3115
|
+
return J(n.div(I(1).sub(r)).mul(t.a), t.a);
|
|
3116
|
+
})(), Ic = {
|
|
3043
3117
|
flat: {
|
|
3044
3118
|
ao: {
|
|
3045
3119
|
reach: .1,
|
|
@@ -3065,7 +3139,7 @@ var Dc = [
|
|
|
3065
3139
|
maxPixels: 240,
|
|
3066
3140
|
strength: 1
|
|
3067
3141
|
},
|
|
3068
|
-
toneMapping:
|
|
3142
|
+
toneMapping: kn,
|
|
3069
3143
|
exposure: .8,
|
|
3070
3144
|
bevel: !0,
|
|
3071
3145
|
reflections: {
|
|
@@ -3074,7 +3148,7 @@ var Dc = [
|
|
|
3074
3148
|
mirror: .35
|
|
3075
3149
|
}
|
|
3076
3150
|
}
|
|
3077
|
-
},
|
|
3151
|
+
}, Lc = {
|
|
3078
3152
|
interactive: {
|
|
3079
3153
|
ao: {
|
|
3080
3154
|
samples: 24,
|
|
@@ -3103,14 +3177,14 @@ var Dc = [
|
|
|
3103
3177
|
factor: 1
|
|
3104
3178
|
}
|
|
3105
3179
|
}
|
|
3106
|
-
},
|
|
3180
|
+
}, Rc = class {
|
|
3107
3181
|
renderer;
|
|
3108
3182
|
scene;
|
|
3109
3183
|
camera;
|
|
3110
3184
|
outlines;
|
|
3111
3185
|
pipeline;
|
|
3112
3186
|
view = new Es();
|
|
3113
|
-
bevelView = new
|
|
3187
|
+
bevelView = new Xs();
|
|
3114
3188
|
bevel = {
|
|
3115
3189
|
width: W(6),
|
|
3116
3190
|
key: W(.5)
|
|
@@ -3127,7 +3201,7 @@ var Dc = [
|
|
|
3127
3201
|
maxPixels: W(64),
|
|
3128
3202
|
minPixels: W(4),
|
|
3129
3203
|
intensity: W(2.5),
|
|
3130
|
-
shade: W(new
|
|
3204
|
+
shade: W(new zt())
|
|
3131
3205
|
};
|
|
3132
3206
|
exposure = W(1);
|
|
3133
3207
|
bounce = {
|
|
@@ -3137,26 +3211,26 @@ var Dc = [
|
|
|
3137
3211
|
strength: W(1)
|
|
3138
3212
|
};
|
|
3139
3213
|
modelRadius = 100;
|
|
3140
|
-
size = new
|
|
3214
|
+
size = new Sn();
|
|
3141
3215
|
mode = null;
|
|
3142
3216
|
quality = "interactive";
|
|
3143
3217
|
dirty = !1;
|
|
3144
3218
|
built = [];
|
|
3145
3219
|
disposed = !1;
|
|
3146
|
-
frame = new
|
|
3147
|
-
type:
|
|
3220
|
+
frame = new mn(1, 1, {
|
|
3221
|
+
type: Ut,
|
|
3148
3222
|
depthBuffer: !1
|
|
3149
3223
|
});
|
|
3150
|
-
present = new
|
|
3151
|
-
presentMaterial = new
|
|
3152
|
-
blending:
|
|
3224
|
+
present = new ln();
|
|
3225
|
+
presentMaterial = new Zt({
|
|
3226
|
+
blending: tn,
|
|
3153
3227
|
depthTest: !1,
|
|
3154
3228
|
depthWrite: !1
|
|
3155
3229
|
});
|
|
3156
3230
|
constructor(e, t, n) {
|
|
3157
|
-
this.renderer = e, this.scene = t, this.camera = n, this.pipeline = new
|
|
3158
|
-
let r = yr(this.frame.texture, G()), i = r.rgb.div(
|
|
3159
|
-
this.presentMaterial.colorNode = J(
|
|
3231
|
+
this.renderer = e, this.scene = t, this.camera = n, this.pipeline = new pn(e), this.pipeline.outputColorTransform = !1, this.outlines = new Tc(t, n);
|
|
3232
|
+
let r = yr(this.frame.texture, G()), i = r.rgb.div(R(r.a, 1e-4)), a = mr(i).mul(r.a);
|
|
3233
|
+
this.presentMaterial.colorNode = J(pr(a), r.a), this.presentMaterial.name = "Stage frame", this.present.material = this.presentMaterial;
|
|
3160
3234
|
}
|
|
3161
3235
|
setEnvironment(e, t = 1) {
|
|
3162
3236
|
this.environmentIntensity.value = t, e !== this.environment && (this.environment = e, this.mode === "realistic" && (this.dirty = !0));
|
|
@@ -3168,66 +3242,67 @@ var Dc = [
|
|
|
3168
3242
|
e !== this.quality && (this.quality = e, this.dirty = !0);
|
|
3169
3243
|
}
|
|
3170
3244
|
setMode(e, t) {
|
|
3171
|
-
let n =
|
|
3245
|
+
let n = Ic[e];
|
|
3172
3246
|
this.exposure.value = n.exposure, this.bounce.strength.value = n.bounce?.strength ?? 0, this.reflect.mirror.value = n.reflections?.mirror ?? 0, this.ao.intensity.value = n.ao.intensity, this.ao.shade.value.setStyle(t ?? n.ao.shade), e !== this.mode && (this.mode = e, this.dirty = !0);
|
|
3173
3247
|
}
|
|
3174
3248
|
rebuild() {
|
|
3175
|
-
let e =
|
|
3249
|
+
let e = Ic[this.mode], { result: t, made: n } = Cs(() => this.build(e));
|
|
3176
3250
|
this.pipeline.outputNode = t, this.pipeline.needsUpdate = !0;
|
|
3177
3251
|
for (let e of this.built) e.dispose();
|
|
3178
3252
|
this.built = n, this.dirty = !1;
|
|
3179
3253
|
}
|
|
3180
3254
|
build(e) {
|
|
3181
|
-
let t =
|
|
3182
|
-
output:
|
|
3183
|
-
normal:
|
|
3184
|
-
albedo:
|
|
3185
|
-
finish:
|
|
3255
|
+
let t = Lc[this.quality], n = ws(nr(this.scene, this.camera, { samples: 4 })), r = e.bevel || !!e.reflections || !!e.bounce, i = !!e.toneMapping, a = i ? Pc(tr) : tr, o = $n(r ? {
|
|
3256
|
+
output: a,
|
|
3257
|
+
normal: jc(),
|
|
3258
|
+
albedo: Mc(),
|
|
3259
|
+
finish: Nc()
|
|
3186
3260
|
} : {
|
|
3187
|
-
output:
|
|
3188
|
-
normal:
|
|
3261
|
+
output: a,
|
|
3262
|
+
normal: jc()
|
|
3189
3263
|
});
|
|
3190
3264
|
for (let e of r ? [
|
|
3191
3265
|
"normal",
|
|
3192
3266
|
"albedo",
|
|
3193
3267
|
"finish"
|
|
3194
|
-
] : ["normal"])
|
|
3195
|
-
if (n.setMRT(
|
|
3196
|
-
let
|
|
3197
|
-
texture: js(
|
|
3268
|
+
] : ["normal"]) o.setBlendMode(e, new Rt(an));
|
|
3269
|
+
if (n.setMRT(o), r) for (let e of ["albedo", "finish"]) n.getTexture(e).type = xn;
|
|
3270
|
+
let s = n.getTextureNode("output"), c = i ? new Ts(() => Fc(s.sample(G())), { name: "Scene light" }).getTextureNode() : s, l = n.getTextureNode("normal"), u = r ? n.getTextureNode("albedo") : null, d = r ? n.getTextureNode("finish") : null, f = this.renderer.backend, p = f.isWebGPUBackend === !0 && this.renderer.hasFeature("float32-filterable"), m = n.getTextureNode("depth"), h = p ? {
|
|
3271
|
+
texture: js(m, this.view).getTextureNode(),
|
|
3198
3272
|
isZ: !0
|
|
3199
3273
|
} : {
|
|
3200
|
-
texture:
|
|
3274
|
+
texture: m,
|
|
3201
3275
|
isZ: !1
|
|
3202
|
-
},
|
|
3203
|
-
depth:
|
|
3204
|
-
normal:
|
|
3276
|
+
}, g = {
|
|
3277
|
+
depth: h,
|
|
3278
|
+
normal: l,
|
|
3205
3279
|
half: null,
|
|
3206
|
-
view: this.view
|
|
3280
|
+
view: this.view,
|
|
3281
|
+
samples: f.isWebGPUBackend ? m : null
|
|
3207
3282
|
};
|
|
3208
|
-
|
|
3209
|
-
let
|
|
3210
|
-
texel:
|
|
3211
|
-
sample: (e) => J(
|
|
3283
|
+
p && (g.half = Ls(h, l, this.view));
|
|
3284
|
+
let _ = Gs(g, this.ao, t.ao), v = e.reflections && d ? Dc(c, g, d, this.reflect, t.reflections) : null, y = v && t.reflections.factor === t.ao.factor, b = J(0, 0, 0, 1), x = Hs(Vs(y ? {
|
|
3285
|
+
texel: _.texel,
|
|
3286
|
+
sample: (e) => J(v.getTextureNode().sample(e).rgb, _.getTextureNode().sample(e).r)
|
|
3212
3287
|
} : {
|
|
3213
|
-
texel:
|
|
3214
|
-
sample: (e) => J(0, 0, 0,
|
|
3215
|
-
},
|
|
3288
|
+
texel: _.texel,
|
|
3289
|
+
sample: (e) => J(0, 0, 0, _.getTextureNode().sample(e).r)
|
|
3290
|
+
}, g, {
|
|
3216
3291
|
name: "AO blur",
|
|
3217
|
-
empty:
|
|
3292
|
+
empty: b,
|
|
3218
3293
|
factor: t.ao.factor
|
|
3219
|
-
}),
|
|
3220
|
-
|
|
3294
|
+
}), g, b, t.ao.factor), S = null;
|
|
3295
|
+
v && !y && (S = Hs(Vs(Bs(v), g, {
|
|
3221
3296
|
name: "Reflections blur",
|
|
3222
3297
|
empty: J(0),
|
|
3223
3298
|
factor: t.reflections.factor
|
|
3224
|
-
}),
|
|
3225
|
-
let
|
|
3299
|
+
}), g, J(0), t.reflections.factor).rgb);
|
|
3300
|
+
let C = e.bounce && u ? Hs(Vs(Bs(lc(c, g, this.bounce, t.bounce)), g, {
|
|
3226
3301
|
name: "Bounce blur",
|
|
3227
3302
|
empty: J(0),
|
|
3228
3303
|
factor: t.bounce.factor
|
|
3229
|
-
}),
|
|
3230
|
-
let { d: t, p: n } = ks(
|
|
3304
|
+
}), g, J(0), t.bounce.factor).rgb : null, ee = e.bevel && u && d ? oc(c, l, u, d, (e) => {
|
|
3305
|
+
let { d: t, p: n } = ks(h, this.view, e);
|
|
3231
3306
|
return {
|
|
3232
3307
|
d: t,
|
|
3233
3308
|
z: n.z,
|
|
@@ -3236,20 +3311,24 @@ var Dc = [
|
|
|
3236
3311
|
}, this.view, this.bevelView, this.bevel, {
|
|
3237
3312
|
environment: this.environment,
|
|
3238
3313
|
intensity: this.environmentIntensity
|
|
3239
|
-
}) :
|
|
3240
|
-
let e = J(
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3314
|
+
}) : c.sample(G()), w = j(() => {
|
|
3315
|
+
let e = J(ee).toVar(), t = J(x).toVar(), n = d ? d.sample(G()).b : l.sample(G()).a, r = cr(t.a, this.ao.intensity), i = P(n.div(R(e.a, 1e-4)), 0, 1), a = e.rgb.mul(B(this.ao.shade, q(1), B(I(1), r, i)));
|
|
3316
|
+
if (C && u) {
|
|
3317
|
+
let e = u.sample(G());
|
|
3318
|
+
a = a.add(e.rgb.div(R(e.a, 1e-4)).mul(C).mul(this.bounce.strength).mul(n));
|
|
3319
|
+
}
|
|
3320
|
+
return v && (a = a.add((y ? t.rgb : S).mul(n))), J(a, e.a);
|
|
3321
|
+
})(), te = e.toneMapping ? j(() => {
|
|
3322
|
+
let t = J(w).toVar(), n = t.a, r = t.rgb.div(R(n, 1e-4)), i = d ? P(d.sample(G()).r.div(R(n, 1e-4)), 0, 1) : I(0), a = e.toneMapping(r, this.exposure);
|
|
3323
|
+
return J(B(a, r, i).mul(n), n);
|
|
3324
|
+
})() : w;
|
|
3325
|
+
return this.outlines.composite(te);
|
|
3247
3326
|
}
|
|
3248
3327
|
render() {
|
|
3249
3328
|
if (this.disposed || !this.mode) return;
|
|
3250
3329
|
let { renderer: e } = this;
|
|
3251
3330
|
e._nodes?.nodeFrame?.update(), this.dirty && this.rebuild(), e.getDrawingBufferSize(this.size), (this.frame.width !== this.size.width || this.frame.height !== this.size.height) && this.frame.setSize(this.size.width, this.size.height), this.view.update(this.camera, this.size.width, this.size.height), this.bevelView.update(this.camera);
|
|
3252
|
-
let t = e.getPixelRatio(), n =
|
|
3331
|
+
let t = e.getPixelRatio(), n = Ic[this.mode];
|
|
3253
3332
|
this.ao.radius.value = n.ao.reach * this.modelRadius, this.ao.maxPixels.value = n.ao.maxPixels * t, this.ao.minPixels.value = 2 * t, this.bevel.width.value = 6 * t, n.bounce && (this.bounce.radius.value = n.bounce.reach * this.modelRadius, this.bounce.maxPixels.value = n.bounce.maxPixels * t, this.bounce.minPixels.value = 2 * t), n.reflections && (this.reflect.reach.value = n.reflections.reach * this.modelRadius, this.reflect.maxPixels.value = n.reflections.maxPixels * t), this.outlines.update(t);
|
|
3254
3333
|
let r = e.getRenderTarget();
|
|
3255
3334
|
e.setRenderTarget(this.frame), this.pipeline.render(), e.setRenderTarget(r);
|
|
@@ -3261,22 +3340,22 @@ var Dc = [
|
|
|
3261
3340
|
for (let e of this.built) e.dispose();
|
|
3262
3341
|
this.built = [], this.outlines.dispose(), this.pipeline.dispose(), this.frame.dispose(), this.presentMaterial.dispose();
|
|
3263
3342
|
}
|
|
3264
|
-
},
|
|
3265
|
-
function
|
|
3266
|
-
let e = new
|
|
3267
|
-
t.colorNode =
|
|
3268
|
-
let e =
|
|
3269
|
-
return
|
|
3270
|
-
})(), e.add(new
|
|
3343
|
+
}, zc = q(.6, .61, .64), Bc = q(.3, .3, .31), Vc = q(.24, .24, .23);
|
|
3344
|
+
function Hc() {
|
|
3345
|
+
let e = new gn(), t = new Zt({ side: Lt });
|
|
3346
|
+
t.colorNode = j(() => {
|
|
3347
|
+
let e = V(sr).z, t = B(Bc, zc, U(-.25, .9, e));
|
|
3348
|
+
return B(Vc, t, U(-.2, -.05, e));
|
|
3349
|
+
})(), e.add(new Xt(new _n(10, 64, 32), t));
|
|
3271
3350
|
let n = (t, n, r, i, a = [
|
|
3272
3351
|
0,
|
|
3273
3352
|
0,
|
|
3274
3353
|
1
|
|
3275
3354
|
]) => {
|
|
3276
|
-
let o = new
|
|
3277
|
-
o.colorNode = q(i, i,
|
|
3278
|
-
let s = new
|
|
3279
|
-
s.position.set(...t), s.up.set(a[0], a[1], a[2]), s.lookAt(new
|
|
3355
|
+
let o = new Zt({ side: Vt });
|
|
3356
|
+
o.colorNode = q(i, i, I(i * .98));
|
|
3357
|
+
let s = new Xt(new sn(n, r), o);
|
|
3358
|
+
s.position.set(...t), s.up.set(a[0], a[1], a[2]), s.lookAt(new Cn(0, 0, 0)), e.add(s);
|
|
3280
3359
|
};
|
|
3281
3360
|
return n([
|
|
3282
3361
|
-.15,
|
|
@@ -3306,32 +3385,32 @@ function zc() {
|
|
|
3306
3385
|
}
|
|
3307
3386
|
//#endregion
|
|
3308
3387
|
//#region src/postpro/PostPro.tsx
|
|
3309
|
-
var
|
|
3310
|
-
function
|
|
3311
|
-
let n =
|
|
3388
|
+
var Uc = (e) => e ? Object.values(e) : [];
|
|
3389
|
+
function Wc({ drawingId: e, width: t = 2 }) {
|
|
3390
|
+
let n = A((e) => e.gl), r = A((e) => e.scene), i = A((e) => e.camera), a = A((e) => e.invalidate), o = ui(), s = li(), c = D.useMemo(() => new Rc(n, r, i), [
|
|
3312
3391
|
n,
|
|
3313
3392
|
r,
|
|
3314
3393
|
i
|
|
3315
3394
|
]);
|
|
3316
|
-
|
|
3317
|
-
let l =
|
|
3318
|
-
|
|
3395
|
+
D.useEffect(() => bs(c), [c]);
|
|
3396
|
+
let l = xt() === "dark" ? "#08090b" : "#0f1320";
|
|
3397
|
+
D.useLayoutEffect(() => {
|
|
3319
3398
|
c.setMode(o, o === "flat" ? l : void 0), a();
|
|
3320
3399
|
}, [
|
|
3321
3400
|
c,
|
|
3322
3401
|
o,
|
|
3323
3402
|
l,
|
|
3324
3403
|
a
|
|
3325
|
-
]),
|
|
3404
|
+
]), D.useLayoutEffect(() => {
|
|
3326
3405
|
c.setQuality(s), a();
|
|
3327
3406
|
}, [
|
|
3328
3407
|
c,
|
|
3329
3408
|
s,
|
|
3330
3409
|
a
|
|
3331
|
-
]),
|
|
3332
|
-
let u =
|
|
3333
|
-
|
|
3334
|
-
let t = d == null ? null :
|
|
3410
|
+
]), Yc(c, o === "realistic"), Kc(o === "realistic");
|
|
3411
|
+
let u = vt(e), d = _(e, (e) => u === ue.Part ? e.structure.currentProduct : e.structure.root), f = _(e, (e) => e.graphic.containers);
|
|
3412
|
+
D.useLayoutEffect(() => {
|
|
3413
|
+
let t = d == null ? null : k(e).api.structure.calculateProductBounds(d);
|
|
3335
3414
|
c.setModelRadius(t && t.radius > 0 ? t.radius : 173), a();
|
|
3336
3415
|
}, [
|
|
3337
3416
|
c,
|
|
@@ -3340,8 +3419,8 @@ function Vc({ drawingId: e, width: t = 2 }) {
|
|
|
3340
3419
|
f,
|
|
3341
3420
|
a
|
|
3342
3421
|
]);
|
|
3343
|
-
let p = na((e) => e.outlinedMeshes.hovered), m = na((e) => e.outlinedMeshes.selected), h = _(e, (e) => e.selection.active !== null) || !1, g =
|
|
3344
|
-
return
|
|
3422
|
+
let p = na((e) => e.outlinedMeshes.hovered), m = na((e) => e.outlinedMeshes.selected), h = _(e, (e) => e.selection.active !== null) || !1, g = St();
|
|
3423
|
+
return D.useLayoutEffect(() => {
|
|
3345
3424
|
c.outlines.width.value = t, c.outlines.setColors("hovered", [g.hover, g.alt]), c.outlines.setColors("selected", [h ? g.pick : g.select, g.alt]), a();
|
|
3346
3425
|
}, [
|
|
3347
3426
|
c,
|
|
@@ -3349,45 +3428,45 @@ function Vc({ drawingId: e, width: t = 2 }) {
|
|
|
3349
3428
|
g,
|
|
3350
3429
|
h,
|
|
3351
3430
|
a
|
|
3352
|
-
]),
|
|
3353
|
-
c.outlines.set("hovered",
|
|
3431
|
+
]), D.useLayoutEffect(() => {
|
|
3432
|
+
c.outlines.set("hovered", Uc(p)), a();
|
|
3354
3433
|
}, [
|
|
3355
3434
|
c,
|
|
3356
3435
|
p,
|
|
3357
3436
|
a
|
|
3358
|
-
]),
|
|
3359
|
-
c.outlines.set("selected",
|
|
3437
|
+
]), D.useLayoutEffect(() => {
|
|
3438
|
+
c.outlines.set("selected", Uc(m)), a();
|
|
3360
3439
|
}, [
|
|
3361
3440
|
c,
|
|
3362
3441
|
m,
|
|
3363
3442
|
a
|
|
3364
|
-
]),
|
|
3443
|
+
]), It(() => {
|
|
3365
3444
|
ii(), Mi(), c.render();
|
|
3366
3445
|
}, 1), null;
|
|
3367
3446
|
}
|
|
3368
|
-
var
|
|
3369
|
-
function
|
|
3370
|
-
|
|
3371
|
-
e &&
|
|
3447
|
+
var Gc = null;
|
|
3448
|
+
function Kc(e) {
|
|
3449
|
+
D.useLayoutEffect(() => {
|
|
3450
|
+
e && Gc === null ? (Gc = ft().edges, gt({ edges: !1 })) : !e && Gc !== null && (gt({ edges: Gc }), Gc = null);
|
|
3372
3451
|
}, [e]);
|
|
3373
3452
|
}
|
|
3374
|
-
var
|
|
3375
|
-
function
|
|
3376
|
-
let t =
|
|
3453
|
+
var qc = /* @__PURE__ */ new WeakMap();
|
|
3454
|
+
function Jc(e) {
|
|
3455
|
+
let t = qc.get(e);
|
|
3377
3456
|
if (!t) {
|
|
3378
|
-
let n = new
|
|
3457
|
+
let n = new on(e), r = Hc();
|
|
3379
3458
|
t = n.fromScene(r, .04).texture, n.dispose(), r.traverse((e) => {
|
|
3380
3459
|
let t = e;
|
|
3381
3460
|
t.geometry?.dispose(), t.material?.dispose();
|
|
3382
|
-
}),
|
|
3461
|
+
}), qc.set(e, t);
|
|
3383
3462
|
}
|
|
3384
3463
|
return t;
|
|
3385
3464
|
}
|
|
3386
|
-
function
|
|
3387
|
-
let n =
|
|
3388
|
-
|
|
3465
|
+
function Yc(e, t) {
|
|
3466
|
+
let n = A((e) => e.gl), r = A((e) => e.scene), i = A((e) => e.invalidate);
|
|
3467
|
+
D.useLayoutEffect(() => {
|
|
3389
3468
|
if (!t) return;
|
|
3390
|
-
let a =
|
|
3469
|
+
let a = Jc(n), o = 1.2;
|
|
3391
3470
|
return r.environment = a, r.environmentIntensity = o, e.setEnvironment(a, o), i(), () => {
|
|
3392
3471
|
r.environment = null, r.environmentIntensity = 1, e.setEnvironment(null), i();
|
|
3393
3472
|
};
|
|
@@ -3401,39 +3480,39 @@ function Kc(e, t) {
|
|
|
3401
3480
|
}
|
|
3402
3481
|
//#endregion
|
|
3403
3482
|
//#region src/looks.ts
|
|
3404
|
-
var
|
|
3483
|
+
var Xc = xr((e) => ({
|
|
3405
3484
|
looks: {},
|
|
3406
3485
|
setLooks: (t) => e({ looks: t })
|
|
3407
|
-
})),
|
|
3486
|
+
})), Zc = (e) => Xc.getState().setLooks(e);
|
|
3408
3487
|
//#endregion
|
|
3409
3488
|
//#region src/postpro/looks.ts
|
|
3410
|
-
function
|
|
3489
|
+
function Qc() {
|
|
3411
3490
|
return `look:${this.userData.lookKey ?? ""}`;
|
|
3412
3491
|
}
|
|
3413
|
-
function
|
|
3414
|
-
e.userData.look = t, e.userData.lookKey = n, e.customProgramCacheKey =
|
|
3492
|
+
function $c(e, t, n) {
|
|
3493
|
+
e.userData.look = t, e.userData.lookKey = n, e.customProgramCacheKey = Qc;
|
|
3415
3494
|
let r = e;
|
|
3416
3495
|
r.specularIntensity = t?.specularIntensity ?? 1, r.specularColor = new Y.Color(t?.specularColor ?? "#ffffff"), e.userData.ownTransparent ??= e.transparent, e.transparent = (t?.transmission ?? 0) > 0 || e.userData.ownTransparent, e.needsUpdate = !0;
|
|
3417
3496
|
}
|
|
3418
|
-
function
|
|
3419
|
-
let t =
|
|
3420
|
-
return
|
|
3497
|
+
function el({ drawingId: e }) {
|
|
3498
|
+
let t = Xc((e) => e.looks), n = A((e) => e.scene), r = A((e) => e.invalidate), i = D.useRef(!1);
|
|
3499
|
+
return D.useEffect(() => r(), [t, r]), It(() => {
|
|
3421
3500
|
let a = Object.keys(t).length > 0;
|
|
3422
3501
|
if (!a && !i.current) return;
|
|
3423
|
-
let o =
|
|
3502
|
+
let o = k(e)?.structure.tree, s = !1;
|
|
3424
3503
|
n.traverse((e) => {
|
|
3425
3504
|
let n = e;
|
|
3426
3505
|
if (!n.isMesh || n.userData.containerId === void 0) return;
|
|
3427
3506
|
let r = n.material;
|
|
3428
3507
|
if (r?.name !== "buerli-body") return;
|
|
3429
3508
|
let i = n.userData.productId === void 0 ? void 0 : o?.[n.userData.productId]?.name, a = i === void 0 ? void 0 : t[i], c = a ? JSON.stringify(a) : "";
|
|
3430
|
-
(r.userData.lookKey ?? "") !== c && (
|
|
3509
|
+
(r.userData.lookKey ?? "") !== c && ($c(r, a, c), s = !0);
|
|
3431
3510
|
}), i.current = a, s && r();
|
|
3432
3511
|
}, -3), null;
|
|
3433
3512
|
}
|
|
3434
3513
|
//#endregion
|
|
3435
3514
|
//#region src/postpro/RenderModeButton.tsx
|
|
3436
|
-
var
|
|
3515
|
+
var tl = () => {
|
|
3437
3516
|
let e = ui() === "realistic";
|
|
3438
3517
|
return /* @__PURE__ */ X(jr, {
|
|
3439
3518
|
arrow: !1,
|
|
@@ -3445,13 +3524,13 @@ var Qc = () => {
|
|
|
3445
3524
|
"aria-label": "Realistic look",
|
|
3446
3525
|
"aria-pressed": e,
|
|
3447
3526
|
onClick: () => di(e ? "flat" : "realistic"),
|
|
3448
|
-
children: /* @__PURE__ */ X(
|
|
3527
|
+
children: /* @__PURE__ */ X(Se, {
|
|
3449
3528
|
name: "look",
|
|
3450
3529
|
size: 18
|
|
3451
3530
|
})
|
|
3452
3531
|
})
|
|
3453
3532
|
});
|
|
3454
|
-
},
|
|
3533
|
+
}, nl = 3, rl = .3 * Math.PI / 180, il = .0012, al = .01, ol = 40, sl = 800, cl = (e, t, n) => Math.min(n, Math.max(t, e)), ll = (e) => e.isOrthographicCamera === !0, ul = class extends Y.EventDispatcher {
|
|
3455
3534
|
object;
|
|
3456
3535
|
domElement = null;
|
|
3457
3536
|
enabled = !0;
|
|
@@ -3488,7 +3567,7 @@ var Qc = () => {
|
|
|
3488
3567
|
e && (e.style.touchAction = "", e.removeEventListener("pointerdown", this.onPointerDown), e.removeEventListener("pointermove", this.onPointerMove), e.removeEventListener("pointerup", this.onPointerUp), e.removeEventListener("pointercancel", this.onPointerUp), e.removeEventListener("mousedown", this.onMouseDown), e.removeEventListener("contextmenu", this.onContextMenu), e.removeEventListener("wheel", this.onWheel), this.pointers.clear(), this.gesture = "none", this.domElement = null);
|
|
3489
3568
|
}
|
|
3490
3569
|
update() {
|
|
3491
|
-
let e = this.object, t =
|
|
3570
|
+
let e = this.object, t = fl.set(0, 0, -1).applyQuaternion(e.quaternion), n = dl.subVectors(this.target, e.position).dot(t);
|
|
3492
3571
|
Number.isFinite(n) && this.target.copy(e.position).addScaledVector(t, n);
|
|
3493
3572
|
}
|
|
3494
3573
|
turnAbout(e, t) {
|
|
@@ -3498,28 +3577,28 @@ var Qc = () => {
|
|
|
3498
3577
|
turn(e, t) {
|
|
3499
3578
|
let n = Math.hypot(e, t);
|
|
3500
3579
|
if (!n) return;
|
|
3501
|
-
let r = this.object, i =
|
|
3502
|
-
this.turnAbout(this.pivot,
|
|
3580
|
+
let r = this.object, i = pl.set(1, 0, 0).applyQuaternion(r.quaternion), a = ml.set(0, 1, 0).applyQuaternion(r.quaternion), o = dl.set(0, 0, 0).addScaledVector(a, e).addScaledVector(i, t).normalize();
|
|
3581
|
+
this.turnAbout(this.pivot, _l.setFromAxisAngle(o, -n * rl * this.rotateSpeed));
|
|
3503
3582
|
}
|
|
3504
3583
|
roll(e, t) {
|
|
3505
|
-
let n = this.domElement.getBoundingClientRect(), r = n.left + n.width / 2, i = n.top + n.height / 2, a = Math.atan2(i - this.last.y, this.last.x - r), o = Math.atan2(i - t, e - r), s =
|
|
3506
|
-
this.turnAbout(this.target,
|
|
3584
|
+
let n = this.domElement.getBoundingClientRect(), r = n.left + n.width / 2, i = n.top + n.height / 2, a = Math.atan2(i - this.last.y, this.last.x - r), o = Math.atan2(i - t, e - r), s = hl.set(0, 0, 1).applyQuaternion(this.object.quaternion);
|
|
3585
|
+
this.turnAbout(this.target, _l.setFromAxisAngle(s, a - o));
|
|
3507
3586
|
}
|
|
3508
3587
|
pixel(e) {
|
|
3509
3588
|
let t = this.object;
|
|
3510
|
-
if (
|
|
3589
|
+
if (ll(t)) return {
|
|
3511
3590
|
x: (t.right - t.left) / t.zoom / e.width,
|
|
3512
3591
|
y: (t.top - t.bottom) / t.zoom / e.height
|
|
3513
3592
|
};
|
|
3514
|
-
let n = t, r = 2 *
|
|
3593
|
+
let n = t, r = 2 * dl.subVectors(this.target, t.position).length() * Math.tan(n.fov * Math.PI / 360) / n.zoom / e.height;
|
|
3515
3594
|
return {
|
|
3516
3595
|
x: r,
|
|
3517
3596
|
y: r
|
|
3518
3597
|
};
|
|
3519
3598
|
}
|
|
3520
3599
|
shift(e, t) {
|
|
3521
|
-
let n = this.object, r =
|
|
3522
|
-
|
|
3600
|
+
let n = this.object, r = pl.set(1, 0, 0).applyQuaternion(n.quaternion), i = ml.set(0, 1, 0).applyQuaternion(n.quaternion);
|
|
3601
|
+
dl.set(0, 0, 0).addScaledVector(r, e).addScaledVector(i, t), n.position.add(dl), this.target.add(dl);
|
|
3523
3602
|
}
|
|
3524
3603
|
move(e, t) {
|
|
3525
3604
|
let n = this.pixel(this.domElement.getBoundingClientRect());
|
|
@@ -3527,17 +3606,17 @@ var Qc = () => {
|
|
|
3527
3606
|
}
|
|
3528
3607
|
zoomAt(e, t, n) {
|
|
3529
3608
|
let r = this.object, i = this.domElement.getBoundingClientRect(), a = this.pixel(i), o = (e - i.left - i.width / 2) * a.x, s = (i.top + i.height / 2 - t) * a.y;
|
|
3530
|
-
if (
|
|
3531
|
-
let e =
|
|
3609
|
+
if (ll(r)) {
|
|
3610
|
+
let e = cl(r.zoom * n, this.minZoom, this.maxZoom), t = 1 - r.zoom / e;
|
|
3532
3611
|
r.zoom = e, r.updateProjectionMatrix(), this.shift(o * t, s * t);
|
|
3533
3612
|
} else {
|
|
3534
|
-
let e = 1 - 1 / n, t =
|
|
3613
|
+
let e = 1 - 1 / n, t = fl.set(0, 0, -1).applyQuaternion(r.quaternion), i = dl.subVectors(this.target, r.position).dot(t);
|
|
3535
3614
|
this.shift(o * e, s * e), r.position.addScaledVector(t, i * e);
|
|
3536
3615
|
}
|
|
3537
3616
|
}
|
|
3538
3617
|
ndc(e, t) {
|
|
3539
3618
|
let n = this.domElement.getBoundingClientRect();
|
|
3540
|
-
return
|
|
3619
|
+
return gl.set((e - n.left) / n.width * 2 - 1, -((t - n.top) / n.height) * 2 + 1);
|
|
3541
3620
|
}
|
|
3542
3621
|
changed() {
|
|
3543
3622
|
this.dispatchEvent({ type: "change" });
|
|
@@ -3550,9 +3629,9 @@ var Qc = () => {
|
|
|
3550
3629
|
if (e === "turn") {
|
|
3551
3630
|
let e = this.pick?.(this.ndc(this.last.x, this.last.y));
|
|
3552
3631
|
this.pivot.copy(e ?? this.center?.() ?? this.target);
|
|
3553
|
-
let t =
|
|
3554
|
-
if (e &&
|
|
3555
|
-
let n =
|
|
3632
|
+
let t = fl.set(0, 0, -1).applyQuaternion(this.object.quaternion);
|
|
3633
|
+
if (e && ll(this.object)) {
|
|
3634
|
+
let n = dl.subVectors(e, this.target).dot(t);
|
|
3556
3635
|
this.target.addScaledVector(t, n), this.object.position.addScaledVector(t, n);
|
|
3557
3636
|
}
|
|
3558
3637
|
}
|
|
@@ -3599,7 +3678,7 @@ var Qc = () => {
|
|
|
3599
3678
|
}
|
|
3600
3679
|
let n = e.clientX - this.last.x, r = e.clientY - this.last.y;
|
|
3601
3680
|
if (this.gesture === "pending") {
|
|
3602
|
-
if (Math.hypot(n, r) <
|
|
3681
|
+
if (Math.hypot(n, r) < nl) return;
|
|
3603
3682
|
if (this.wanted === "move" ? this.noPan : this.noRotate) return this.end();
|
|
3604
3683
|
this.begin(this.wanted, e.pointerId);
|
|
3605
3684
|
}
|
|
@@ -3652,25 +3731,25 @@ var Qc = () => {
|
|
|
3652
3731
|
onWheel = (e) => {
|
|
3653
3732
|
if (!this.enabled || this.noZoom) return;
|
|
3654
3733
|
e.preventDefault(), e.stopPropagation();
|
|
3655
|
-
let t = e.deltaY * (e.deltaMode === 1 ?
|
|
3734
|
+
let t = e.deltaY * (e.deltaMode === 1 ? ol : e.deltaMode === 2 ? sl : 1), n = e.ctrlKey ? cl(t, -30, 30) * al : t * il, r = Math.exp(-n * this.zoomSpeed);
|
|
3656
3735
|
this.dispatchEvent({ type: "start" }), this.zoomAt(e.clientX, e.clientY, r), this.changed(), this.dispatchEvent({ type: "end" });
|
|
3657
3736
|
};
|
|
3658
|
-
},
|
|
3737
|
+
}, dl = new Y.Vector3(), fl = new Y.Vector3(), pl = new Y.Vector3(), ml = new Y.Vector3(), hl = new Y.Vector3(), gl = new Y.Vector2(), _l = new Y.Quaternion(), vl = (e) => {
|
|
3659
3738
|
let t = e;
|
|
3660
3739
|
if (!t.isMesh && !t.isLine && !t.isPoints || t.userData?.onHUD) return !1;
|
|
3661
3740
|
let n = Array.isArray(t.material) ? t.material[0] : t.material;
|
|
3662
3741
|
if (!n || !n.visible || !n.colorWrite || n.opacity === 0) return !1;
|
|
3663
3742
|
for (let e = t; e; e = e.parent) if (!e.visible) return !1;
|
|
3664
3743
|
return !0;
|
|
3665
|
-
},
|
|
3666
|
-
let { invalidate: l, camera: u, gl: d, set: f, get: p, performance: m } =
|
|
3667
|
-
return
|
|
3744
|
+
}, yl = Tt.forwardRef(({ makeDefault: e, camera: t, regress: n, center: r, onChange: i, onStart: a, onEnd: o, ...s }, c) => {
|
|
3745
|
+
let { invalidate: l, camera: u, gl: d, set: f, get: p, performance: m } = A(), h = t || u, g = d.domElement, _ = Tt.useMemo(() => new ul(h), [h]);
|
|
3746
|
+
return It(() => {
|
|
3668
3747
|
_.enabled && _.update();
|
|
3669
|
-
}, -1),
|
|
3748
|
+
}, -1), Tt.useEffect(() => {
|
|
3670
3749
|
_.pick = (e) => {
|
|
3671
3750
|
let { raycaster: t, scene: n } = p();
|
|
3672
3751
|
t.setFromCamera(e, h);
|
|
3673
|
-
let r = t.intersectObjects(n.children, !0).find((e) =>
|
|
3752
|
+
let r = t.intersectObjects(n.children, !0).find((e) => vl(e.object));
|
|
3674
3753
|
return r ? r.point : null;
|
|
3675
3754
|
}, _.center = r ?? null;
|
|
3676
3755
|
}, [
|
|
@@ -3678,7 +3757,7 @@ var Qc = () => {
|
|
|
3678
3757
|
h,
|
|
3679
3758
|
p,
|
|
3680
3759
|
r
|
|
3681
|
-
]),
|
|
3760
|
+
]), Tt.useEffect(() => {
|
|
3682
3761
|
let e = (e) => {
|
|
3683
3762
|
l(), n && m.regress(), i && i(e);
|
|
3684
3763
|
};
|
|
@@ -3694,7 +3773,7 @@ var Qc = () => {
|
|
|
3694
3773
|
_,
|
|
3695
3774
|
l,
|
|
3696
3775
|
m
|
|
3697
|
-
]),
|
|
3776
|
+
]), Tt.useEffect(() => {
|
|
3698
3777
|
if (e) {
|
|
3699
3778
|
let e = p().controls;
|
|
3700
3779
|
return f({ controls: _ }), () => f({ controls: e });
|
|
@@ -3712,8 +3791,8 @@ var Qc = () => {
|
|
|
3712
3791
|
});
|
|
3713
3792
|
//#endregion
|
|
3714
3793
|
//#region src/components/canvas/Fit.tsx
|
|
3715
|
-
function
|
|
3716
|
-
let t =
|
|
3794
|
+
function bl({ drawingId: e }) {
|
|
3795
|
+
let t = Ct(e).length === 0, n = D.useMemo(() => {
|
|
3717
3796
|
let e = new Y.Vector3(-100, -100, -100), t = new Y.Vector3(100, 100, 100);
|
|
3718
3797
|
return new Y.Box3(e, t);
|
|
3719
3798
|
}, []);
|
|
@@ -3722,17 +3801,17 @@ function _l({ drawingId: e }) {
|
|
|
3722
3801
|
children: /* @__PURE__ */ X("bufferGeometry", { boundingBox: n })
|
|
3723
3802
|
}) : null;
|
|
3724
3803
|
}
|
|
3725
|
-
var
|
|
3804
|
+
var xl = 38 * Math.PI / 180, Sl = Math.atan(Math.SQRT1_2), Cl = new Y.Vector3(Math.sin(xl) * Math.cos(Sl), -Math.cos(xl) * Math.cos(Sl), Math.sin(Sl)), wl = {
|
|
3726
3805
|
center: new Y.Vector3(),
|
|
3727
3806
|
radius: 200,
|
|
3728
3807
|
min: new Y.Vector3(-100, -100, -100),
|
|
3729
3808
|
max: new Y.Vector3(100, 100, 100)
|
|
3730
|
-
},
|
|
3731
|
-
let t = Or(), n =
|
|
3732
|
-
return
|
|
3733
|
-
let r =
|
|
3734
|
-
o.radius === -1 && (o =
|
|
3735
|
-
let s = o.center, l = new Y.Vector3(0, 0, 1), u =
|
|
3809
|
+
}, Tl = ({ drawingId: e }) => {
|
|
3810
|
+
let t = Or(), n = vt(e), r = Ct(e), i = _(e, (e) => r.some((t) => e.graphic.containers[t] !== void 0)) || !1, a = yt(e), o = _(e, (e) => e.plugin.refs[e.plugin.active.feature || -1]?.objectId), s = _(e, (e) => e.structure.tree[o || -1]?.members?.planeReference?.value), c = 1.2;
|
|
3811
|
+
return D.useEffect(() => {
|
|
3812
|
+
let r = k(e), i = r.structure.currentProduct, a = r.structure.root, o = k(e).api.structure.calculateProductBounds(n === ue.Part ? i : a);
|
|
3813
|
+
o.radius === -1 && (o = wl);
|
|
3814
|
+
let s = o.center, l = new Y.Vector3(0, 0, 1), u = Cl.clone().multiplyScalar(o.radius * c * 4).add(s), d = new Y.Box3(o.min, o.max);
|
|
3736
3815
|
t?.refresh(d).moveTo(u).lookAt({
|
|
3737
3816
|
target: s,
|
|
3738
3817
|
up: l
|
|
@@ -3742,27 +3821,27 @@ var vl = 38 * Math.PI / 180, yl = Math.atan(Math.SQRT1_2), bl = new Y.Vector3(Ma
|
|
|
3742
3821
|
n,
|
|
3743
3822
|
t,
|
|
3744
3823
|
i
|
|
3745
|
-
]),
|
|
3824
|
+
]), D.useEffect(() => {
|
|
3746
3825
|
if (!a || !o || !s) return;
|
|
3747
|
-
let n =
|
|
3826
|
+
let n = E.getSketchFitInfo(e, o, c * 4);
|
|
3748
3827
|
if (!n) return;
|
|
3749
3828
|
let { globBox: r, position: i, target: l, up: u } = n;
|
|
3750
3829
|
t?.refresh(r).moveTo(i).lookAt({
|
|
3751
3830
|
target: l,
|
|
3752
3831
|
up: u
|
|
3753
3832
|
}).fit().clip();
|
|
3754
|
-
}, [a, s]),
|
|
3833
|
+
}, [a, s]), D.useEffect(() => {
|
|
3755
3834
|
a || t?.refresh().fit().clip();
|
|
3756
3835
|
}, [a]), null;
|
|
3757
|
-
},
|
|
3836
|
+
}, El = (e) => -e * e * e + 2 * e * e, Dl = ({ drawingId: e, children: t }) => /* @__PURE__ */ Z(Sr, {
|
|
3758
3837
|
maxDuration: 1,
|
|
3759
|
-
interpolateFunc:
|
|
3838
|
+
interpolateFunc: El,
|
|
3760
3839
|
children: [
|
|
3761
3840
|
t,
|
|
3762
|
-
/* @__PURE__ */ X(
|
|
3763
|
-
/* @__PURE__ */ X(
|
|
3841
|
+
/* @__PURE__ */ X(bl, { drawingId: e }),
|
|
3842
|
+
/* @__PURE__ */ X(Tl, { drawingId: e })
|
|
3764
3843
|
]
|
|
3765
|
-
}),
|
|
3844
|
+
}), Ol = [
|
|
3766
3845
|
"Fastened Origin",
|
|
3767
3846
|
"Fastened",
|
|
3768
3847
|
"Slider",
|
|
@@ -3772,19 +3851,19 @@ var vl = 38 * Math.PI / 180, yl = Math.atan(Math.SQRT1_2), bl = new Y.Vector3(Ma
|
|
|
3772
3851
|
"Parallel",
|
|
3773
3852
|
"LinearPattern",
|
|
3774
3853
|
"CircularPattern"
|
|
3775
|
-
],
|
|
3854
|
+
], kl = ({ drawingId: e }) => {
|
|
3776
3855
|
let t = _(e, (e) => !!e.structure.currentInstance) || !1, n = _(e, (e) => e.plugin.active.feature), r = _(e, (e) => e.plugin.refs[n || -1]?.name);
|
|
3777
|
-
return t && (!r || !
|
|
3856
|
+
return t && (!r || !Ol.some((e) => r === e)) ? /* @__PURE__ */ X(C, {
|
|
3778
3857
|
drawingId: e,
|
|
3779
|
-
displayMode:
|
|
3858
|
+
displayMode: ee.DisplayVisible
|
|
3780
3859
|
}) : null;
|
|
3781
|
-
},
|
|
3782
|
-
function
|
|
3783
|
-
let e =
|
|
3784
|
-
return
|
|
3860
|
+
}, Al = new Y.Vector3(-.55, .75, 1), jl = new Y.Vector3();
|
|
3861
|
+
function Ml() {
|
|
3862
|
+
let e = D.useRef(null), t = A((e) => e.controls), n = ui() === "realistic";
|
|
3863
|
+
return It(({ camera: n }) => {
|
|
3785
3864
|
if (!e.current) return;
|
|
3786
3865
|
let r = t?.target ?? e.current.target.position, i = Math.max(n.position.distanceTo(r), 1);
|
|
3787
|
-
|
|
3866
|
+
jl.copy(Al).normalize().multiplyScalar(i).applyQuaternion(n.quaternion), e.current.position.copy(r).add(jl), e.current.target.position.copy(r), e.current.target.updateMatrixWorld();
|
|
3788
3867
|
}, -2), /* @__PURE__ */ Z(kr, { children: [/* @__PURE__ */ X("ambientLight", { intensity: (n ? 0 : .68) * Math.PI }), /* @__PURE__ */ X("directionalLight", {
|
|
3789
3868
|
ref: e,
|
|
3790
3869
|
intensity: (n ? .5 : .42) * Math.PI
|
|
@@ -3792,8 +3871,8 @@ function kl() {
|
|
|
3792
3871
|
}
|
|
3793
3872
|
//#endregion
|
|
3794
3873
|
//#region src/components/canvas/RaycastFilter.ts
|
|
3795
|
-
var
|
|
3796
|
-
let { lineWidth: t = 4, pointSize: n = 6 } = e, { camera: r, raycaster: i, size: a } =
|
|
3874
|
+
var Nl = (e, t) => [...e].sort((e, t) => e.object.userData?.onHUD && !t.object.userData?.onHUD ? -1 : !e.object.userData?.onHUD && t.object.userData?.onHUD ? 1 : e.distance - t.distance), Pl = (e) => {
|
|
3875
|
+
let { lineWidth: t = 4, pointSize: n = 6 } = e, { camera: r, raycaster: i, size: a } = A(), o = D.useCallback(() => {
|
|
3797
3876
|
Object.assign(i.params.Line || {}, { threshold: f.calculateScaleFactor(r.position, t, r, a) }), Object.assign(i.params.Points || {}, { threshold: f.calculateScaleFactor(r.position, n, r, a) });
|
|
3798
3877
|
}, [
|
|
3799
3878
|
r,
|
|
@@ -3803,16 +3882,16 @@ var Al = (e, t) => [...e].sort((e, t) => e.object.userData?.onHUD && !t.object.u
|
|
|
3803
3882
|
i.params.Points,
|
|
3804
3883
|
a
|
|
3805
3884
|
]);
|
|
3806
|
-
return
|
|
3807
|
-
},
|
|
3885
|
+
return It(o), null;
|
|
3886
|
+
}, Fl = ({ drawingId: e }) => {
|
|
3808
3887
|
let t = _(e, (e) => e.cad.connection.active);
|
|
3809
|
-
return _(e, (e) => e.cad.connection.connected) || !t ? null : /* @__PURE__ */ X(
|
|
3888
|
+
return _(e, (e) => e.cad.connection.connected) || !t ? null : /* @__PURE__ */ X(Il, {
|
|
3810
3889
|
className: "rcad",
|
|
3811
3890
|
role: "alert",
|
|
3812
3891
|
"aria-live": "assertive",
|
|
3813
|
-
children: /* @__PURE__ */ Z(
|
|
3892
|
+
children: /* @__PURE__ */ Z(Ll, { children: [/* @__PURE__ */ Z(Rl, { children: [/* @__PURE__ */ X("i", { "aria-hidden": "true" }), " Disconnected"] }), /* @__PURE__ */ X("p", { children: "The engine cannot be reached. Check your network: the app is trying to connect again." })] })
|
|
3814
3893
|
});
|
|
3815
|
-
},
|
|
3894
|
+
}, Il = Et.div`
|
|
3816
3895
|
position: absolute;
|
|
3817
3896
|
inset: 0;
|
|
3818
3897
|
z-index: 100000;
|
|
@@ -3821,7 +3900,7 @@ var Al = (e, t) => [...e].sort((e, t) => e.object.userData?.onHUD && !t.object.u
|
|
|
3821
3900
|
padding: 24px;
|
|
3822
3901
|
background: color-mix(in srgb, var(--rcad-viewport) 72%, transparent);
|
|
3823
3902
|
backdrop-filter: blur(2px);
|
|
3824
|
-
`,
|
|
3903
|
+
`, Ll = Et.div`
|
|
3825
3904
|
width: min(360px, 100%);
|
|
3826
3905
|
padding: 16px 18px 18px;
|
|
3827
3906
|
border-radius: var(--rcad-r-window);
|
|
@@ -3833,7 +3912,7 @@ var Al = (e, t) => [...e].sort((e, t) => e.object.userData?.onHUD && !t.object.u
|
|
|
3833
3912
|
margin: 10px 0 0;
|
|
3834
3913
|
font: 500 12px/1.55 var(--rcad-font-mono);
|
|
3835
3914
|
}
|
|
3836
|
-
`,
|
|
3915
|
+
`, Rl = Et.div`
|
|
3837
3916
|
display: flex;
|
|
3838
3917
|
align-items: center;
|
|
3839
3918
|
gap: 8px;
|
|
@@ -3860,30 +3939,30 @@ var Al = (e, t) => [...e].sort((e, t) => e.object.userData?.onHUD && !t.object.u
|
|
|
3860
3939
|
animation: none;
|
|
3861
3940
|
}
|
|
3862
3941
|
}
|
|
3863
|
-
`,
|
|
3942
|
+
`, zl = (e, t) => {
|
|
3864
3943
|
if (t?.captionMap) {
|
|
3865
3944
|
let n = Object.keys(t.captionMap).find((n) => t.captionMap[n].stateName === e);
|
|
3866
3945
|
return n ? t.captionMap[n].caption : "undefined caption";
|
|
3867
3946
|
}
|
|
3868
3947
|
return "undefined caption";
|
|
3869
|
-
},
|
|
3948
|
+
}, Bl = (e, t) => {
|
|
3870
3949
|
if (t?.captionMap) {
|
|
3871
3950
|
let n = Object.keys(t.captionMap).find((n) => t.captionMap[n].stateName === e), r = n ? t.captionMap[n] : void 0;
|
|
3872
3951
|
return r && r.undoable ? r.undoable : !1;
|
|
3873
3952
|
}
|
|
3874
3953
|
return !1;
|
|
3875
|
-
},
|
|
3954
|
+
}, Vl = (e) => e.stack.filter((t) => Number.parseInt(t) <= e.current && Bl(t, e)), Hl = (t, n, r) => {
|
|
3876
3955
|
let i = r.indexOf(n.current.toString());
|
|
3877
3956
|
if (i > -1) {
|
|
3878
3957
|
let n = r.at(i - 1);
|
|
3879
3958
|
n && e.utils.undo(t, n);
|
|
3880
3959
|
} else e.utils.undo(t);
|
|
3881
|
-
},
|
|
3960
|
+
}, Ul = (e) => e.stack.filter((t) => Number.parseInt(t) > e.current && Bl(t, e)), Wl = (t, n) => {
|
|
3882
3961
|
n.length > 0 && t && e.utils.redo(t, n[0]);
|
|
3883
|
-
},
|
|
3962
|
+
}, Gl = (e, t) => /* @__PURE__ */ Z("span", {
|
|
3884
3963
|
className: "rcad-menu-tool",
|
|
3885
3964
|
children: [/* @__PURE__ */ X("span", { children: e }), /* @__PURE__ */ Z("code", { children: [".", t] })]
|
|
3886
|
-
}),
|
|
3965
|
+
}), Kl = {
|
|
3887
3966
|
ofb: "ClassCAD",
|
|
3888
3967
|
stp: "STEP",
|
|
3889
3968
|
stl: "STL",
|
|
@@ -3891,16 +3970,16 @@ var Al = (e, t) => [...e].sort((e, t) => e.object.userData?.onHUD && !t.object.u
|
|
|
3891
3970
|
obj: "OBJ",
|
|
3892
3971
|
usda: "USD",
|
|
3893
3972
|
smb: "SMLib"
|
|
3894
|
-
},
|
|
3973
|
+
}, ql = [
|
|
3895
3974
|
"ofb",
|
|
3896
3975
|
"stp",
|
|
3897
3976
|
"stl"
|
|
3898
3977
|
];
|
|
3899
|
-
function
|
|
3900
|
-
let n =
|
|
3978
|
+
function Jl(t) {
|
|
3979
|
+
let n = D.useRef(null), { saveFormats: r } = ht.useSessionConfig(), i = D.useCallback((n) => {
|
|
3901
3980
|
(async () => {
|
|
3902
3981
|
try {
|
|
3903
|
-
if (
|
|
3982
|
+
if (ht.getInviteFromUrl()) {
|
|
3904
3983
|
let e = o(t);
|
|
3905
3984
|
await e.v1.common.clear(), n === "Assembly" ? await e.v1.assembly.create({ name: "Assembly" }) : await e.v1.part.create({ name: "Part" });
|
|
3906
3985
|
return;
|
|
@@ -3913,17 +3992,17 @@ function Gl(t) {
|
|
|
3913
3992
|
break;
|
|
3914
3993
|
default: await o(i).v1.part.create({ name: "Part" });
|
|
3915
3994
|
}
|
|
3916
|
-
|
|
3995
|
+
Ot.getState().api.setActiveDrawing(i);
|
|
3917
3996
|
}
|
|
3918
|
-
r &&
|
|
3997
|
+
r && Ot.getState().api.removeDrawing(r);
|
|
3919
3998
|
} catch (e) {
|
|
3920
3999
|
console.error(e);
|
|
3921
4000
|
}
|
|
3922
4001
|
})();
|
|
3923
|
-
}, [t]), a =
|
|
4002
|
+
}, [t]), a = D.useCallback((e) => {
|
|
3924
4003
|
(async () => {
|
|
3925
4004
|
try {
|
|
3926
|
-
let n =
|
|
4005
|
+
let n = k(t).name || "drawing", r = n.lastIndexOf(".");
|
|
3927
4006
|
n = n.substring(0, r >= 0 ? r : n.length);
|
|
3928
4007
|
let i = (await o(t).v1.common.save({
|
|
3929
4008
|
format: e.toUpperCase(),
|
|
@@ -3938,22 +4017,22 @@ function Gl(t) {
|
|
|
3938
4017
|
}
|
|
3939
4018
|
})();
|
|
3940
4019
|
}, [t]);
|
|
3941
|
-
return
|
|
3942
|
-
let e = r ? [...
|
|
3943
|
-
caption:
|
|
4020
|
+
return D.useMemo(() => {
|
|
4021
|
+
let e = r ? [...ql.filter((e) => r.includes(e.toUpperCase())), ...r.map((e) => e.toLowerCase()).filter((e) => !ql.includes(e))] : ql, t = Object.fromEntries(e.map((e) => [e, {
|
|
4022
|
+
caption: Gl(Kl[e] ?? e.toUpperCase(), e),
|
|
3944
4023
|
callback: () => a(e)
|
|
3945
4024
|
}]));
|
|
3946
4025
|
return {
|
|
3947
4026
|
new: {
|
|
3948
4027
|
caption: "New",
|
|
3949
|
-
icon: /* @__PURE__ */ X(
|
|
4028
|
+
icon: /* @__PURE__ */ X(Se, {
|
|
3950
4029
|
name: "plus",
|
|
3951
4030
|
size: 16
|
|
3952
4031
|
}),
|
|
3953
4032
|
children: {
|
|
3954
4033
|
part: {
|
|
3955
4034
|
caption: "Part",
|
|
3956
|
-
icon: /* @__PURE__ */ X(
|
|
4035
|
+
icon: /* @__PURE__ */ X(Se, {
|
|
3957
4036
|
name: "part",
|
|
3958
4037
|
size: 16
|
|
3959
4038
|
}),
|
|
@@ -3961,7 +4040,7 @@ function Gl(t) {
|
|
|
3961
4040
|
},
|
|
3962
4041
|
assembly: {
|
|
3963
4042
|
caption: "Assembly",
|
|
3964
|
-
icon: /* @__PURE__ */ X(
|
|
4043
|
+
icon: /* @__PURE__ */ X(Se, {
|
|
3965
4044
|
name: "assembly",
|
|
3966
4045
|
size: 16
|
|
3967
4046
|
}),
|
|
@@ -3974,7 +4053,7 @@ function Gl(t) {
|
|
|
3974
4053
|
ref: n,
|
|
3975
4054
|
singleDrawingApp: !0
|
|
3976
4055
|
})] }),
|
|
3977
|
-
icon: /* @__PURE__ */ X(
|
|
4056
|
+
icon: /* @__PURE__ */ X(Se, {
|
|
3978
4057
|
name: "open",
|
|
3979
4058
|
size: 16
|
|
3980
4059
|
}),
|
|
@@ -3982,7 +4061,7 @@ function Gl(t) {
|
|
|
3982
4061
|
},
|
|
3983
4062
|
save: {
|
|
3984
4063
|
caption: "Save as",
|
|
3985
|
-
icon: /* @__PURE__ */ X(
|
|
4064
|
+
icon: /* @__PURE__ */ X(Se, {
|
|
3986
4065
|
name: "download",
|
|
3987
4066
|
size: 16
|
|
3988
4067
|
}),
|
|
@@ -3995,13 +4074,13 @@ function Gl(t) {
|
|
|
3995
4074
|
r
|
|
3996
4075
|
]);
|
|
3997
4076
|
}
|
|
3998
|
-
var
|
|
4077
|
+
var Yl = (t, n) => {
|
|
3999
4078
|
let r = [], i;
|
|
4000
4079
|
if (t && n) {
|
|
4001
|
-
i =
|
|
4080
|
+
i = Vl(n);
|
|
4002
4081
|
let a = i.slice(1);
|
|
4003
4082
|
r = a.length > 0 ? a.map((r) => ({
|
|
4004
|
-
label:
|
|
4083
|
+
label: zl(r, n),
|
|
4005
4084
|
stateId: r,
|
|
4006
4085
|
command: () => {
|
|
4007
4086
|
let n = i.indexOf(r), a = i.at(n === 0 ? 0 : n - 1);
|
|
@@ -4013,12 +4092,12 @@ var Kl = (t, n) => {
|
|
|
4013
4092
|
label: "Undo",
|
|
4014
4093
|
sub: [...r],
|
|
4015
4094
|
icon: "undo",
|
|
4016
|
-
command: () => t && n &&
|
|
4095
|
+
command: () => t && n && Hl(t, n, i)
|
|
4017
4096
|
};
|
|
4018
|
-
},
|
|
4097
|
+
}, Xl = (t, n) => {
|
|
4019
4098
|
let r = [], i;
|
|
4020
|
-
return t && n && (i =
|
|
4021
|
-
label:
|
|
4099
|
+
return t && n && (i = Ul(n), r = i.length > 0 ? i.map((r) => ({
|
|
4100
|
+
label: zl(r, n),
|
|
4022
4101
|
stateId: r,
|
|
4023
4102
|
command: () => {
|
|
4024
4103
|
let n = i.indexOf(r), a = i.at(n);
|
|
@@ -4028,10 +4107,10 @@ var Kl = (t, n) => {
|
|
|
4028
4107
|
label: "Redo",
|
|
4029
4108
|
sub: [...r],
|
|
4030
4109
|
icon: "redo",
|
|
4031
|
-
command: () => t &&
|
|
4110
|
+
command: () => t && Wl(t, i)
|
|
4032
4111
|
};
|
|
4033
|
-
},
|
|
4034
|
-
let n =
|
|
4112
|
+
}, Zl = (e) => `${e} is not available in WebAssembly for the moment. Coming soon.`, Ql = (e) => `${e} is not available in a view-only session.`, $l = ({ command: e, off: t }) => {
|
|
4113
|
+
let n = D.useCallback((t) => {
|
|
4035
4114
|
if (e.sub) {
|
|
4036
4115
|
let n = e.sub.findIndex((e) => e.stateId === t.key);
|
|
4037
4116
|
e.sub[n].command();
|
|
@@ -4058,7 +4137,7 @@ var Kl = (t, n) => {
|
|
|
4058
4137
|
"aria-label": e.label,
|
|
4059
4138
|
disabled: i,
|
|
4060
4139
|
onClick: e.command,
|
|
4061
|
-
children: e.icon && /* @__PURE__ */ X(
|
|
4140
|
+
children: e.icon && /* @__PURE__ */ X(Se, {
|
|
4062
4141
|
name: e.icon,
|
|
4063
4142
|
size: 18
|
|
4064
4143
|
})
|
|
@@ -4074,15 +4153,15 @@ var Kl = (t, n) => {
|
|
|
4074
4153
|
className: "rcad-caret",
|
|
4075
4154
|
"aria-label": `${e.label}: steps`,
|
|
4076
4155
|
disabled: i,
|
|
4077
|
-
children: /* @__PURE__ */ X(
|
|
4156
|
+
children: /* @__PURE__ */ X(Se, {
|
|
4078
4157
|
name: "caret",
|
|
4079
4158
|
size: 12
|
|
4080
4159
|
})
|
|
4081
4160
|
})
|
|
4082
4161
|
})]
|
|
4083
4162
|
});
|
|
4084
|
-
},
|
|
4085
|
-
let t =
|
|
4163
|
+
}, eu = ({ drawingId: e }) => {
|
|
4164
|
+
let t = Jl(e), n = Nr(), r = _(e, (e) => e.cad.states), i = D.useMemo(() => Yl(e, r), [e, r]), a = D.useMemo(() => Xl(e, r), [e, r]), o = Ir(e), s = n ? { save: t.save } : t, c = (e) => n ? Ql(e) : o ? Zl(e) : void 0;
|
|
4086
4165
|
return /* @__PURE__ */ Z(kr, { children: [
|
|
4087
4166
|
/* @__PURE__ */ X(Oe, {
|
|
4088
4167
|
items: s,
|
|
@@ -4092,34 +4171,34 @@ var Kl = (t, n) => {
|
|
|
4092
4171
|
type: "button",
|
|
4093
4172
|
className: "rcad-tool rcad-tool-text",
|
|
4094
4173
|
"aria-label": "File",
|
|
4095
|
-
children: [/* @__PURE__ */ X(
|
|
4174
|
+
children: [/* @__PURE__ */ X(Se, {
|
|
4096
4175
|
name: "menu",
|
|
4097
4176
|
size: 18
|
|
4098
4177
|
}), /* @__PURE__ */ X("span", { children: "File" })]
|
|
4099
4178
|
})
|
|
4100
4179
|
}),
|
|
4101
4180
|
/* @__PURE__ */ X("span", { className: "rcad-tools-sep" }),
|
|
4102
|
-
/* @__PURE__ */ X(
|
|
4181
|
+
/* @__PURE__ */ X($l, {
|
|
4103
4182
|
command: i,
|
|
4104
4183
|
off: c("Undo")
|
|
4105
4184
|
}),
|
|
4106
|
-
/* @__PURE__ */ X(
|
|
4185
|
+
/* @__PURE__ */ X($l, {
|
|
4107
4186
|
command: a,
|
|
4108
4187
|
off: c("Redo")
|
|
4109
4188
|
})
|
|
4110
4189
|
] });
|
|
4111
|
-
},
|
|
4112
|
-
let t = !!
|
|
4113
|
-
return
|
|
4190
|
+
}, tu = ({ drawingId: e }) => {
|
|
4191
|
+
let t = !!ht.getInviteFromUrl(), n = _(e, (e) => e.cad.connection.connected), r = D.useRef(!1), [i, a] = D.useState(!1);
|
|
4192
|
+
return D.useEffect(() => {
|
|
4114
4193
|
n ? r.current = !0 : r.current && a(!0);
|
|
4115
|
-
}, [n]), !t || !i ? null : /* @__PURE__ */ X(
|
|
4194
|
+
}, [n]), !t || !i ? null : /* @__PURE__ */ X(nu, {
|
|
4116
4195
|
className: "rcad",
|
|
4117
4196
|
role: "alert",
|
|
4118
4197
|
"aria-live": "assertive",
|
|
4119
|
-
children: /* @__PURE__ */ Z(
|
|
4120
|
-
/* @__PURE__ */ X(
|
|
4198
|
+
children: /* @__PURE__ */ Z(ru, { children: [
|
|
4199
|
+
/* @__PURE__ */ X(au, { children: "Session ended" }),
|
|
4121
4200
|
/* @__PURE__ */ X("p", { children: "The host ended the shared session, moved it, or your access was revoked." }),
|
|
4122
|
-
/* @__PURE__ */ Z(
|
|
4201
|
+
/* @__PURE__ */ Z(iu, { children: [/* @__PURE__ */ X("button", {
|
|
4123
4202
|
type: "button",
|
|
4124
4203
|
onClick: () => window.location.reload(),
|
|
4125
4204
|
children: "Join again"
|
|
@@ -4132,7 +4211,7 @@ var Kl = (t, n) => {
|
|
|
4132
4211
|
})] })
|
|
4133
4212
|
] })
|
|
4134
4213
|
});
|
|
4135
|
-
},
|
|
4214
|
+
}, nu = Et.div`
|
|
4136
4215
|
position: absolute;
|
|
4137
4216
|
inset: 0;
|
|
4138
4217
|
z-index: 100001;
|
|
@@ -4141,7 +4220,7 @@ var Kl = (t, n) => {
|
|
|
4141
4220
|
padding: 24px;
|
|
4142
4221
|
background: color-mix(in srgb, var(--rcad-viewport) 72%, transparent);
|
|
4143
4222
|
backdrop-filter: blur(2px);
|
|
4144
|
-
`,
|
|
4223
|
+
`, ru = Et.div`
|
|
4145
4224
|
width: min(360px, 100%);
|
|
4146
4225
|
padding: 16px 18px 18px;
|
|
4147
4226
|
border-radius: var(--rcad-r-window);
|
|
@@ -4172,31 +4251,31 @@ var Kl = (t, n) => {
|
|
|
4172
4251
|
outline: 2px solid var(--rcad-accent-line);
|
|
4173
4252
|
outline-offset: 2px;
|
|
4174
4253
|
}
|
|
4175
|
-
`,
|
|
4254
|
+
`, iu = Et.div`
|
|
4176
4255
|
display: flex;
|
|
4177
4256
|
gap: 8px;
|
|
4178
|
-
`,
|
|
4257
|
+
`, au = Et.div`
|
|
4179
4258
|
color: var(--rcad-toast-strong);
|
|
4180
4259
|
font: 600 10.5px/1 var(--rcad-font-mono);
|
|
4181
4260
|
letter-spacing: 0.14em;
|
|
4182
4261
|
text-transform: uppercase;
|
|
4183
|
-
`,
|
|
4184
|
-
let e = g((e) => e.drawing.active), t = _(e, (e) => e.cad.states), n = Nr(), r =
|
|
4185
|
-
n || Ir(e) || t &&
|
|
4262
|
+
`, ou = () => {
|
|
4263
|
+
let e = g((e) => e.drawing.active), t = _(e, (e) => e.cad.states), n = Nr(), r = D.useCallback(() => {
|
|
4264
|
+
n || Ir(e) || t && Hl(e, t, Vl(t));
|
|
4186
4265
|
}, [
|
|
4187
4266
|
e,
|
|
4188
4267
|
t,
|
|
4189
4268
|
n
|
|
4190
|
-
]), i =
|
|
4191
|
-
n || Ir(e) || t &&
|
|
4269
|
+
]), i = D.useCallback(() => {
|
|
4270
|
+
n || Ir(e) || t && Wl(e, Ul(t));
|
|
4192
4271
|
}, [
|
|
4193
4272
|
e,
|
|
4194
4273
|
t,
|
|
4195
4274
|
n
|
|
4196
4275
|
]);
|
|
4197
|
-
return
|
|
4198
|
-
},
|
|
4199
|
-
let o =
|
|
4276
|
+
return su(["z"], !0, !1, !1, void 0, r), su(["y"], !0, !1, !1, void 0, i), null;
|
|
4277
|
+
}, su = (e, t = !1, n = !1, r = !1, i, a) => {
|
|
4278
|
+
let o = D.useCallback((i) => {
|
|
4200
4279
|
(!t || i.ctrlKey) && (!n || i.shiftKey) && (!r || i.altKey) && e.indexOf(i.key) >= 0 && a && a(i.key);
|
|
4201
4280
|
}, [
|
|
4202
4281
|
t,
|
|
@@ -4204,7 +4283,7 @@ var Kl = (t, n) => {
|
|
|
4204
4283
|
r,
|
|
4205
4284
|
e,
|
|
4206
4285
|
a
|
|
4207
|
-
]), s =
|
|
4286
|
+
]), s = D.useCallback((a) => {
|
|
4208
4287
|
(!t || a.ctrlKey) && (!n || a.shiftKey) && (!r || a.altKey) && e.indexOf(a.key) >= 0 && i && i(a.key);
|
|
4209
4288
|
}, [
|
|
4210
4289
|
t,
|
|
@@ -4213,7 +4292,7 @@ var Kl = (t, n) => {
|
|
|
4213
4292
|
e,
|
|
4214
4293
|
i
|
|
4215
4294
|
]);
|
|
4216
|
-
return
|
|
4295
|
+
return D.useEffect(() => (a && window.addEventListener("keyup", o, !0), i && window.addEventListener("keydown", s, !0), () => {
|
|
4217
4296
|
a && window.removeEventListener("keyup", o, !0), i && window.removeEventListener("keydown", s, !0);
|
|
4218
4297
|
}), [
|
|
4219
4298
|
s,
|
|
@@ -4221,12 +4300,12 @@ var Kl = (t, n) => {
|
|
|
4221
4300
|
i,
|
|
4222
4301
|
a
|
|
4223
4302
|
]), null;
|
|
4224
|
-
},
|
|
4225
|
-
let e =
|
|
4226
|
-
return e ? /* @__PURE__ */ Z(
|
|
4303
|
+
}, cu = () => {
|
|
4304
|
+
let e = wt.useFollow();
|
|
4305
|
+
return e ? /* @__PURE__ */ Z(lu, {
|
|
4227
4306
|
role: "status",
|
|
4228
4307
|
children: [
|
|
4229
|
-
/* @__PURE__ */ X(
|
|
4308
|
+
/* @__PURE__ */ X(Se, {
|
|
4230
4309
|
name: "eye",
|
|
4231
4310
|
size: 14
|
|
4232
4311
|
}),
|
|
@@ -4235,15 +4314,15 @@ var Kl = (t, n) => {
|
|
|
4235
4314
|
type: "button",
|
|
4236
4315
|
"aria-label": "Back to your own view",
|
|
4237
4316
|
title: "Back to your own view",
|
|
4238
|
-
onClick:
|
|
4239
|
-
children: /* @__PURE__ */ X(
|
|
4317
|
+
onClick: wt.clearFollow,
|
|
4318
|
+
children: /* @__PURE__ */ X(Se, {
|
|
4240
4319
|
name: "close",
|
|
4241
4320
|
size: 12
|
|
4242
4321
|
})
|
|
4243
4322
|
})
|
|
4244
4323
|
]
|
|
4245
4324
|
}) : null;
|
|
4246
|
-
},
|
|
4325
|
+
}, lu = Et.div`
|
|
4247
4326
|
position: fixed;
|
|
4248
4327
|
bottom: calc(var(--rcad-status-h, 26px) + 14px);
|
|
4249
4328
|
left: 50%;
|
|
@@ -4284,13 +4363,13 @@ var Kl = (t, n) => {
|
|
|
4284
4363
|
outline: 2px solid var(--rcad-accent-line);
|
|
4285
4364
|
outline-offset: 2px;
|
|
4286
4365
|
}
|
|
4287
|
-
`,
|
|
4366
|
+
`, uu = () => /* @__PURE__ */ Z(du, {
|
|
4288
4367
|
role: "status",
|
|
4289
|
-
children: [/* @__PURE__ */ X(
|
|
4368
|
+
children: [/* @__PURE__ */ X(Se, {
|
|
4290
4369
|
name: "eye",
|
|
4291
4370
|
size: 14
|
|
4292
4371
|
}), /* @__PURE__ */ X("span", { children: "View only" })]
|
|
4293
|
-
}),
|
|
4372
|
+
}), du = Et.div`
|
|
4294
4373
|
position: fixed;
|
|
4295
4374
|
top: calc(var(--rcad-bar-h, 48px) + 12px);
|
|
4296
4375
|
left: 50%;
|
|
@@ -4310,9 +4389,9 @@ var Kl = (t, n) => {
|
|
|
4310
4389
|
transform: translateX(-50%);
|
|
4311
4390
|
pointer-events: none;
|
|
4312
4391
|
user-select: none;
|
|
4313
|
-
`, { useSessionClient:
|
|
4314
|
-
let e =
|
|
4315
|
-
return
|
|
4392
|
+
`, { useSessionClient: fu } = ht, { identityColors: pu, useCursors: mu, useFollow: hu } = wt, gu = 80, _u = () => {
|
|
4393
|
+
let e = fu(), t = A((e) => e.gl), n = A((e) => e.camera), r = A((e) => e.controls);
|
|
4394
|
+
return D.useEffect(() => {
|
|
4316
4395
|
if (!e) return;
|
|
4317
4396
|
let i = t.domElement, a = new Y.Vector3(), o = new Y.Vector3(), s = 0, c, l = null, u = 0, d = (t) => {
|
|
4318
4397
|
s = performance.now(), e.sendPresence("cursor", t);
|
|
@@ -4337,7 +4416,7 @@ var Kl = (t, n) => {
|
|
|
4337
4416
|
point: t,
|
|
4338
4417
|
active: !0,
|
|
4339
4418
|
buttons: u
|
|
4340
|
-
}, performance.now() - s >=
|
|
4419
|
+
}, performance.now() - s >= gu ? d(l) : (window.clearTimeout(c), c = window.setTimeout(() => l && d(l), gu)));
|
|
4341
4420
|
}, m = (e) => {
|
|
4342
4421
|
u = e.buttons;
|
|
4343
4422
|
let t = f(e) ?? l?.point;
|
|
@@ -4363,25 +4442,25 @@ var Kl = (t, n) => {
|
|
|
4363
4442
|
n,
|
|
4364
4443
|
r
|
|
4365
4444
|
]), null;
|
|
4366
|
-
},
|
|
4367
|
-
let e =
|
|
4445
|
+
}, vu = 180, yu = () => {
|
|
4446
|
+
let e = hu(), t = mu(), n = A((e) => e.invalidate), r = D.useRef(null), i = D.useRef({
|
|
4368
4447
|
pos: new Y.Vector3(),
|
|
4369
4448
|
init: !1
|
|
4370
|
-
}), a = e ? t[e.peerId] : void 0, o =
|
|
4371
|
-
return
|
|
4449
|
+
}), a = e ? t[e.peerId] : void 0, o = D.useMemo(() => a?.point ? new Y.Vector3(...a.point) : null, [a]), s = pu(e?.name || "unnamed"), c = !!(e && a?.active && o), l = !!((a?.buttons ?? 0) & 3), [u, d] = D.useState(!1), f = D.useRef(0);
|
|
4450
|
+
return D.useEffect(() => {
|
|
4372
4451
|
if (l) {
|
|
4373
4452
|
f.current = performance.now(), d(!0);
|
|
4374
4453
|
return;
|
|
4375
4454
|
}
|
|
4376
|
-
let e = performance.now() - f.current, t = Math.max(0,
|
|
4455
|
+
let e = performance.now() - f.current, t = Math.max(0, vu - e), n = window.setTimeout(() => d(!1), t);
|
|
4377
4456
|
return () => window.clearTimeout(n);
|
|
4378
|
-
}, [l]),
|
|
4457
|
+
}, [l]), D.useEffect(() => {
|
|
4379
4458
|
i.current.init = !1;
|
|
4380
|
-
}, [e?.peerId]),
|
|
4459
|
+
}, [e?.peerId]), D.useEffect(() => n(), [
|
|
4381
4460
|
o,
|
|
4382
4461
|
c,
|
|
4383
4462
|
n
|
|
4384
|
-
]),
|
|
4463
|
+
]), It((e, t) => {
|
|
4385
4464
|
if (!o || !r.current) return;
|
|
4386
4465
|
let a = i.current;
|
|
4387
4466
|
if (!a.init) a.pos.copy(o), a.init = !0;
|
|
@@ -4424,11 +4503,11 @@ var Kl = (t, n) => {
|
|
|
4424
4503
|
})
|
|
4425
4504
|
})
|
|
4426
4505
|
}) : null;
|
|
4427
|
-
}, { getInviteFromUrl:
|
|
4428
|
-
|
|
4429
|
-
let r = n.width / 2, i = n.height / 2, a =
|
|
4506
|
+
}, { getInviteFromUrl: bu, useSessionClient: xu } = ht, { identityColors: Su, getFollow: Cu, getModelRadius: wu, setFollow: Tu, setModelRadius: Eu, useFollow: Du, useModelRadius: Ou, useViewpoints: ku } = wt, Au = 1.6, ju = .55, Mu = .45, Nu = new Y.Vector3(), Pu = (e, t, n) => {
|
|
4507
|
+
Nu.setFromMatrixPosition(e.matrixWorld), Nu.project(t);
|
|
4508
|
+
let r = n.width / 2, i = n.height / 2, a = Nu.x * r + r, o = -(Nu.y * i) + i;
|
|
4430
4509
|
return [Math.min(Math.max(a, 56), n.width - 56), Math.min(Math.max(o, 44), n.height - 16)];
|
|
4431
|
-
},
|
|
4510
|
+
}, Fu = 200, Iu = (e) => {
|
|
4432
4511
|
let t = new Y.Vector3(...e.position ?? [
|
|
4433
4512
|
0,
|
|
4434
4513
|
0,
|
|
@@ -4444,7 +4523,7 @@ var Kl = (t, n) => {
|
|
|
4444
4523
|
]), i = t.clone().sub(n), a = i.length();
|
|
4445
4524
|
if (a >= 1e-9) {
|
|
4446
4525
|
i.divideScalar(a);
|
|
4447
|
-
let r =
|
|
4526
|
+
let r = wu(), o = r && r > 0 ? r * Au : e.height && e.height > 0 ? e.height * Mu : Math.min(a, 1e3);
|
|
4448
4527
|
t.copy(n).addScaledVector(i, o);
|
|
4449
4528
|
}
|
|
4450
4529
|
return {
|
|
@@ -4452,33 +4531,33 @@ var Kl = (t, n) => {
|
|
|
4452
4531
|
tgt: n,
|
|
4453
4532
|
up: r
|
|
4454
4533
|
};
|
|
4455
|
-
},
|
|
4456
|
-
let t =
|
|
4457
|
-
return
|
|
4458
|
-
let n =
|
|
4459
|
-
|
|
4534
|
+
}, Lu = ({ drawingId: e }) => {
|
|
4535
|
+
let t = vt(e), n = Ct(e), r = _(e, (e) => e.structure.currentProduct), i = _(e, (e) => e.structure.root);
|
|
4536
|
+
return D.useEffect(() => {
|
|
4537
|
+
let n = k(e)?.api.structure, a = t === ue.Part ? r : i, o = a == null ? null : n?.calculateProductBounds(a);
|
|
4538
|
+
Eu(o && o.radius > 0 ? o.radius : null);
|
|
4460
4539
|
}, [
|
|
4461
4540
|
e,
|
|
4462
4541
|
t,
|
|
4463
4542
|
r,
|
|
4464
4543
|
i,
|
|
4465
4544
|
n
|
|
4466
|
-
]),
|
|
4467
|
-
},
|
|
4545
|
+
]), D.useEffect(() => () => Eu(null), []), null;
|
|
4546
|
+
}, Ru = (e) => {
|
|
4468
4547
|
try {
|
|
4469
4548
|
let e = window.localStorage.getItem("buerligons.username");
|
|
4470
4549
|
if (e) return e;
|
|
4471
4550
|
} catch {}
|
|
4472
|
-
return
|
|
4473
|
-
},
|
|
4474
|
-
let e =
|
|
4551
|
+
return bu() ? e?.inviteName || "unnamed" : "Host";
|
|
4552
|
+
}, zu = () => {
|
|
4553
|
+
let e = xu(), t = A((e) => e.camera), n = A((e) => e.size), r = A((e) => e.controls), i = D.useRef({
|
|
4475
4554
|
at: 0,
|
|
4476
4555
|
hash: ""
|
|
4477
|
-
}), a =
|
|
4478
|
-
return
|
|
4479
|
-
if (!e ||
|
|
4556
|
+
}), a = D.useRef(void 0);
|
|
4557
|
+
return D.useEffect(() => () => window.clearTimeout(a.current), []), It(() => {
|
|
4558
|
+
if (!e || Cu()) return;
|
|
4480
4559
|
let o = r?.target ?? new Y.Vector3(), s = t.zoom ?? 1, c = {
|
|
4481
|
-
name:
|
|
4560
|
+
name: Ru(e),
|
|
4482
4561
|
position: [
|
|
4483
4562
|
t.position.x,
|
|
4484
4563
|
t.position.y,
|
|
@@ -4510,45 +4589,45 @@ var Kl = (t, n) => {
|
|
|
4510
4589
|
hash: l
|
|
4511
4590
|
}, e.sendPresence("view", c);
|
|
4512
4591
|
};
|
|
4513
|
-
u - i.current.at >=
|
|
4592
|
+
u - i.current.at >= Fu ? d() : (window.clearTimeout(a.current), a.current = window.setTimeout(d, Fu));
|
|
4514
4593
|
}), null;
|
|
4515
|
-
},
|
|
4516
|
-
let n =
|
|
4594
|
+
}, Bu = ({ peerId: e, data: t }) => {
|
|
4595
|
+
let n = A((e) => e.invalidate), r = D.useMemo(() => Su(t.name || "unnamed"), [t.name]), i = r.accent, { cam: a, helper: o } = D.useMemo(() => {
|
|
4517
4596
|
let e = new Y.PerspectiveCamera(35, 1.4, .01, 1), t = new Y.CameraHelper(e), n = new Y.Color(i);
|
|
4518
4597
|
return t.setColors(n, n, n, n, n), {
|
|
4519
4598
|
cam: e,
|
|
4520
4599
|
helper: t
|
|
4521
4600
|
};
|
|
4522
4601
|
}, [i]);
|
|
4523
|
-
|
|
4602
|
+
D.useEffect(() => () => {
|
|
4524
4603
|
o.dispose();
|
|
4525
4604
|
}, [o]);
|
|
4526
|
-
let s =
|
|
4605
|
+
let s = Ou(), c = D.useMemo(() => Iu(t), [t, s]), l = D.useRef({
|
|
4527
4606
|
pos: new Y.Vector3(),
|
|
4528
4607
|
tgt: new Y.Vector3(),
|
|
4529
4608
|
up: new Y.Vector3(0, 1, 0),
|
|
4530
4609
|
init: !1
|
|
4531
|
-
}), u =
|
|
4610
|
+
}), u = D.useRef(null), d = D.useCallback(() => {
|
|
4532
4611
|
let e = l.current;
|
|
4533
4612
|
a.position.copy(e.pos), a.up.copy(e.up), a.lookAt(e.tgt);
|
|
4534
|
-
let t = a.position.distanceTo(e.tgt), n =
|
|
4613
|
+
let t = a.position.distanceTo(e.tgt), n = wu(), r = n && n > 0 ? n * ju : Math.max(t * .22, .001);
|
|
4535
4614
|
a.near = Math.max(r * .08, 1e-4), a.far = Math.max(r, .001), a.updateProjectionMatrix(), a.updateMatrixWorld(!0), o.update(), o.updateMatrixWorld(!0);
|
|
4536
|
-
}, [a, o]), f =
|
|
4537
|
-
|
|
4538
|
-
}, [e, t.name]), p =
|
|
4615
|
+
}, [a, o]), f = D.useCallback(() => {
|
|
4616
|
+
Tu(e, t.name || "unnamed");
|
|
4617
|
+
}, [e, t.name]), p = D.useRef(new Y.Vector3()), m = D.useRef(new Y.Vector3()), h = D.useCallback((e) => {
|
|
4539
4618
|
let t = u.current;
|
|
4540
4619
|
if (!t) return;
|
|
4541
4620
|
let n = l.current, r = e.getWorldDirection(p.current), i = m.current.copy(n.pos).sub(e.position).dot(r);
|
|
4542
4621
|
t.position.copy(n.pos), i < 1 && t.position.addScaledVector(r, 1 - i), t.updateMatrixWorld(!0);
|
|
4543
4622
|
}, []);
|
|
4544
|
-
return
|
|
4623
|
+
return D.useEffect(() => {
|
|
4545
4624
|
let e = l.current;
|
|
4546
4625
|
e.init || (e.pos.copy(c.pos), e.tgt.copy(c.tgt), e.up.copy(c.up), e.init = !0, d()), n();
|
|
4547
4626
|
}, [
|
|
4548
4627
|
c,
|
|
4549
4628
|
d,
|
|
4550
4629
|
n
|
|
4551
|
-
]),
|
|
4630
|
+
]), It((e, t) => {
|
|
4552
4631
|
let r = l.current;
|
|
4553
4632
|
if (!r.init) return;
|
|
4554
4633
|
h(e.camera);
|
|
@@ -4564,7 +4643,7 @@ var Kl = (t, n) => {
|
|
|
4564
4643
|
0,
|
|
4565
4644
|
0
|
|
4566
4645
|
],
|
|
4567
|
-
calculatePosition:
|
|
4646
|
+
calculatePosition: Pu,
|
|
4568
4647
|
style: {
|
|
4569
4648
|
pointerEvents: "none",
|
|
4570
4649
|
userSelect: "none"
|
|
@@ -4589,19 +4668,19 @@ var Kl = (t, n) => {
|
|
|
4589
4668
|
})
|
|
4590
4669
|
})
|
|
4591
4670
|
})] });
|
|
4592
|
-
},
|
|
4593
|
-
let e =
|
|
4594
|
-
return
|
|
4671
|
+
}, Vu = () => {
|
|
4672
|
+
let e = A((e) => e.invalidate), t = ku(), n = Du();
|
|
4673
|
+
return D.useEffect(() => e(), [
|
|
4595
4674
|
t,
|
|
4596
4675
|
n,
|
|
4597
4676
|
e
|
|
4598
|
-
]), /* @__PURE__ */ X(kr, { children: Object.entries(t).filter(([e]) => e !== n?.peerId).map(([e, t]) => /* @__PURE__ */ X(
|
|
4677
|
+
]), /* @__PURE__ */ X(kr, { children: Object.entries(t).filter(([e]) => e !== n?.peerId).map(([e, t]) => /* @__PURE__ */ X(Bu, {
|
|
4599
4678
|
peerId: e,
|
|
4600
4679
|
data: t
|
|
4601
4680
|
}, e)) });
|
|
4602
|
-
},
|
|
4603
|
-
let e =
|
|
4604
|
-
return
|
|
4681
|
+
}, Hu = () => {
|
|
4682
|
+
let e = Du(), t = ku(), n = A((e) => e.camera), r = A((e) => e.size), i = A((e) => e.controls), a = A((e) => e.invalidate), o = D.useRef(null);
|
|
4683
|
+
return D.useEffect(() => {
|
|
4605
4684
|
e ? (o.current ||= {
|
|
4606
4685
|
pos: n.position.clone(),
|
|
4607
4686
|
up: n.up.clone(),
|
|
@@ -4613,24 +4692,24 @@ var Kl = (t, n) => {
|
|
|
4613
4692
|
n,
|
|
4614
4693
|
i,
|
|
4615
4694
|
a
|
|
4616
|
-
]),
|
|
4695
|
+
]), D.useEffect(() => {
|
|
4617
4696
|
e && a();
|
|
4618
4697
|
}, [
|
|
4619
4698
|
t,
|
|
4620
4699
|
e,
|
|
4621
4700
|
a
|
|
4622
|
-
]),
|
|
4701
|
+
]), It((o, s) => {
|
|
4623
4702
|
if (!e) return;
|
|
4624
4703
|
let c = t[e.peerId];
|
|
4625
4704
|
if (!c) return;
|
|
4626
|
-
let l =
|
|
4705
|
+
let l = Iu(c), u = c.height && c.height > 0 ? r.height / c.height : n.zoom, d = Math.max(l.pos.distanceTo(l.tgt) * .001, 1e-6);
|
|
4627
4706
|
if (n.position.distanceTo(l.pos) < d && (i?.target?.distanceTo(l.tgt) ?? 0) < d && Math.abs(n.zoom - u) < Math.max(u * .001, 1e-6)) return;
|
|
4628
4707
|
let f = 1 - Math.exp(-10 * Math.min(s, .1));
|
|
4629
4708
|
n.position.lerp(l.pos, f), n.up.lerp(l.up, f), n.up.lengthSq() < 1e-8 && n.up.copy(l.up), n.up.normalize(), n.zoom += (u - n.zoom) * f, i?.target?.lerp(l.tgt, f), n.lookAt(i?.target ?? l.tgt), n.updateProjectionMatrix(), a();
|
|
4630
4709
|
}), null;
|
|
4631
|
-
},
|
|
4632
|
-
let [t, n] =
|
|
4633
|
-
return
|
|
4710
|
+
}, Uu = 1e-6, Wu = new Y.Vector3(0, 0, 1), Gu = (e) => Math.abs(Math.abs(e.x + e.y + e.z) - 1) > Uu ? e.clone().cross(Wu).cross(e).normalize() : Math.abs(e.y + 1) < Uu ? new Y.Vector3(0, 0, 1) : Math.abs(e.y - 1) < Uu ? new Y.Vector3(0, 0, -1) : new Y.Vector3(0, 1, 0), Ku = "600 21px 'JetBrains Mono', 'RCad Mono', ui-monospace, monospace", qu = "700 19px 'JetBrains Mono', 'RCad Mono', ui-monospace, monospace", Ju = (e) => {
|
|
4711
|
+
let [t, n] = D.useState(!1);
|
|
4712
|
+
return D.useEffect(() => {
|
|
4634
4713
|
let t = !0, r = () => {
|
|
4635
4714
|
t && n(!0);
|
|
4636
4715
|
}, i = document.fonts;
|
|
@@ -4643,16 +4722,16 @@ var Kl = (t, n) => {
|
|
|
4643
4722
|
t = !1, window.clearTimeout(a);
|
|
4644
4723
|
};
|
|
4645
4724
|
}, [e]), t;
|
|
4646
|
-
},
|
|
4725
|
+
}, Yu = [
|
|
4647
4726
|
"Right",
|
|
4648
4727
|
"Left",
|
|
4649
4728
|
"Back",
|
|
4650
4729
|
"Front",
|
|
4651
4730
|
"Top",
|
|
4652
4731
|
"Bottom"
|
|
4653
|
-
],
|
|
4654
|
-
let t =
|
|
4655
|
-
return
|
|
4732
|
+
], Xu = ({ children: e }) => {
|
|
4733
|
+
let t = D.useRef(null);
|
|
4734
|
+
return D.useLayoutEffect(() => {
|
|
4656
4735
|
let e = t.current;
|
|
4657
4736
|
return () => e.traverse((e) => {
|
|
4658
4737
|
let t = e.material, n = Array.isArray(t) ? t : t ? [t] : [];
|
|
@@ -4662,7 +4741,7 @@ var Kl = (t, n) => {
|
|
|
4662
4741
|
ref: t,
|
|
4663
4742
|
children: e
|
|
4664
4743
|
});
|
|
4665
|
-
},
|
|
4744
|
+
}, Zu = {
|
|
4666
4745
|
light: {
|
|
4667
4746
|
face: "#dde0e7",
|
|
4668
4747
|
stroke: "#9aa1af",
|
|
@@ -4675,12 +4754,12 @@ var Kl = (t, n) => {
|
|
|
4675
4754
|
text: "#dcdee3",
|
|
4676
4755
|
hover: "#4b515d"
|
|
4677
4756
|
}
|
|
4678
|
-
},
|
|
4679
|
-
let e = Or(), t =
|
|
4757
|
+
}, Qu = () => {
|
|
4758
|
+
let e = Or(), t = xt(), n = St(), r = Ju(Ku), i = A((e) => e.camera), a = A((e) => e.invalidate), o = A((e) => e.controls), s = D.useCallback((t) => {
|
|
4680
4759
|
t.stopPropagation();
|
|
4681
4760
|
let n;
|
|
4682
4761
|
n = t.object.position.lengthSq() === 0 ? t.face?.normal || new Y.Vector3() : t.object.position.clone().normalize();
|
|
4683
|
-
let r =
|
|
4762
|
+
let r = Gu(n), s = o.target.clone(), c = i.position.distanceTo(s), l = s.clone().addScaledVector(n, c);
|
|
4684
4763
|
return e?.refresh().moveTo(l).lookAt({
|
|
4685
4764
|
target: s,
|
|
4686
4765
|
up: r
|
|
@@ -4695,7 +4774,7 @@ var Kl = (t, n) => {
|
|
|
4695
4774
|
renderPriority: 2,
|
|
4696
4775
|
alignment: "top-right",
|
|
4697
4776
|
margin: [76, 76],
|
|
4698
|
-
children: /* @__PURE__ */ X(
|
|
4777
|
+
children: /* @__PURE__ */ X(Xu, { children: /* @__PURE__ */ Z("group", {
|
|
4699
4778
|
scale: .74,
|
|
4700
4779
|
children: [/* @__PURE__ */ X("group", {
|
|
4701
4780
|
scale: 2.25,
|
|
@@ -4724,31 +4803,31 @@ var Kl = (t, n) => {
|
|
|
4724
4803
|
n.axisZ
|
|
4725
4804
|
],
|
|
4726
4805
|
labelColor: t === "dark" ? "#16181d" : "#ffffff",
|
|
4727
|
-
font:
|
|
4806
|
+
font: qu
|
|
4728
4807
|
})
|
|
4729
4808
|
}), /* @__PURE__ */ X(wr, {
|
|
4730
|
-
font:
|
|
4731
|
-
faces:
|
|
4732
|
-
color:
|
|
4733
|
-
textColor:
|
|
4734
|
-
strokeColor:
|
|
4735
|
-
hoverColor:
|
|
4809
|
+
font: Ku,
|
|
4810
|
+
faces: Yu,
|
|
4811
|
+
color: Zu[t].face,
|
|
4812
|
+
textColor: Zu[t].text,
|
|
4813
|
+
strokeColor: Zu[t].stroke,
|
|
4814
|
+
hoverColor: Zu[t].hover,
|
|
4736
4815
|
opacity: 1,
|
|
4737
4816
|
onClick: s
|
|
4738
4817
|
})]
|
|
4739
4818
|
}) }, c)
|
|
4740
4819
|
});
|
|
4741
|
-
},
|
|
4820
|
+
}, $u = {
|
|
4742
4821
|
position: [
|
|
4743
4822
|
0,
|
|
4744
4823
|
0,
|
|
4745
4824
|
10
|
|
4746
4825
|
],
|
|
4747
4826
|
zoom: 50
|
|
4748
|
-
},
|
|
4749
|
-
...
|
|
4750
|
-
filter:
|
|
4751
|
-
}),
|
|
4827
|
+
}, ed = (e) => ({
|
|
4828
|
+
...Pt(e),
|
|
4829
|
+
filter: Nl
|
|
4830
|
+
}), td = [1, 2], nd = ({ camera: e, controls: t, gl: n }) => ({
|
|
4752
4831
|
position: e.position.clone(),
|
|
4753
4832
|
quaternion: e.quaternion.clone(),
|
|
4754
4833
|
up: e.up.clone(),
|
|
@@ -4756,11 +4835,11 @@ var Kl = (t, n) => {
|
|
|
4756
4835
|
target: t?.target.clone() ?? null,
|
|
4757
4836
|
from: n.domElement
|
|
4758
4837
|
});
|
|
4759
|
-
function
|
|
4760
|
-
let t =
|
|
4761
|
-
return
|
|
4838
|
+
function rd({ view: e }) {
|
|
4839
|
+
let t = A((e) => e.controls), n = A((e) => e.invalidate), r = D.useRef(!1);
|
|
4840
|
+
return D.useEffect(() => {
|
|
4762
4841
|
r.current = !0, n();
|
|
4763
|
-
}, [t, n]),
|
|
4842
|
+
}, [t, n]), It((t) => {
|
|
4764
4843
|
if (!r.current) return;
|
|
4765
4844
|
r.current = !1;
|
|
4766
4845
|
let n = e.current;
|
|
@@ -4769,18 +4848,18 @@ function ed({ view: e }) {
|
|
|
4769
4848
|
a?.dispatchEvent({ type: "start" }), i.position.copy(n.position), i.quaternion.copy(n.quaternion), i.up.copy(n.up), i.zoom = n.zoom, i.updateProjectionMatrix(), i.updateMatrixWorld(), a && n.target && (a.target.copy(n.target), a.update()), a?.dispatchEvent({ type: "end" }), a && (e.current = null);
|
|
4770
4849
|
}), null;
|
|
4771
4850
|
}
|
|
4772
|
-
function
|
|
4773
|
-
let e =
|
|
4774
|
-
return
|
|
4851
|
+
function id() {
|
|
4852
|
+
let e = A((e) => e.setDpr);
|
|
4853
|
+
return D.useEffect(() => {
|
|
4775
4854
|
let t, n = () => {
|
|
4776
|
-
e(
|
|
4855
|
+
e(td), r();
|
|
4777
4856
|
}, r = () => {
|
|
4778
4857
|
t = matchMedia(`(resolution: ${devicePixelRatio}dppx)`), t.addEventListener("change", n, { once: !0 });
|
|
4779
4858
|
};
|
|
4780
4859
|
return r(), () => t.removeEventListener("change", n);
|
|
4781
4860
|
}, [e]), null;
|
|
4782
4861
|
}
|
|
4783
|
-
var
|
|
4862
|
+
var ad = class extends D.Component {
|
|
4784
4863
|
state = {
|
|
4785
4864
|
failed: !1,
|
|
4786
4865
|
error: void 0
|
|
@@ -4796,28 +4875,28 @@ var nd = class extends O.Component {
|
|
|
4796
4875
|
if (!this.props.unmade(this.state.error)) throw this.state.error;
|
|
4797
4876
|
return null;
|
|
4798
4877
|
}
|
|
4799
|
-
},
|
|
4800
|
-
let n =
|
|
4801
|
-
let e =
|
|
4802
|
-
e([]),
|
|
4878
|
+
}, od = D.memo(function({ children: e, drawingId: t }) {
|
|
4879
|
+
let n = D.useCallback(() => {
|
|
4880
|
+
let e = k(t).api.interaction.setSelected;
|
|
4881
|
+
e([]), k(t)?.api.selection?.unselectAll();
|
|
4803
4882
|
}, [t]);
|
|
4804
|
-
|
|
4883
|
+
D.useEffect(() => {
|
|
4805
4884
|
let e = (e) => e.key === "Escape" && n();
|
|
4806
4885
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
4807
4886
|
}, [n]);
|
|
4808
|
-
let [r, i] =
|
|
4809
|
-
|
|
4810
|
-
let d =
|
|
4887
|
+
let [r, i] = D.useState(0), a = D.useRef(null), o = D.useRef(null), s = D.useRef(null), c = D.useRef(void 0), l = D.useRef(!1), u = D.useRef(void 0);
|
|
4888
|
+
D.useEffect(() => () => clearTimeout(c.current), []);
|
|
4889
|
+
let d = D.useCallback((e) => {
|
|
4811
4890
|
a.current = e;
|
|
4812
|
-
}, []), f =
|
|
4813
|
-
c.current === void 0 && o.current === e && (l.current = !0, t ? (a.current && (s.current ??=
|
|
4891
|
+
}, []), f = D.useCallback((e) => e === u.current, []), p = D.useCallback((e, t) => {
|
|
4892
|
+
c.current === void 0 && o.current === e && (l.current = !0, t ? (a.current && (s.current ??= nd(a.current.get())), a.current = null, c.current = setTimeout(() => {
|
|
4814
4893
|
c.current = void 0, i((e) => e + 1);
|
|
4815
|
-
}, 300)) :
|
|
4894
|
+
}, 300)) : Mt({
|
|
4816
4895
|
type: "error",
|
|
4817
4896
|
text: "The graphics device was lost again and again. Load the page again to see the stage.",
|
|
4818
4897
|
duration: 0
|
|
4819
4898
|
}));
|
|
4820
|
-
}, []), m =
|
|
4899
|
+
}, []), m = D.useCallback(async (e) => {
|
|
4821
4900
|
try {
|
|
4822
4901
|
let t = await Vi(e, (t, n) => p(e.canvas, n));
|
|
4823
4902
|
return o.current = e.canvas, t;
|
|
@@ -4825,96 +4904,96 @@ var nd = class extends O.Component {
|
|
|
4825
4904
|
if (!(e instanceof Bi)) throw e;
|
|
4826
4905
|
u.current = e;
|
|
4827
4906
|
let t = l.current ? "The graphics device was lost, and no new one could be had. Load the page again to see the stage." : "The stage cannot be drawn: no graphics device could be had (WebGPU or WebGL2).";
|
|
4828
|
-
throw
|
|
4907
|
+
throw Mt({
|
|
4829
4908
|
type: "error",
|
|
4830
4909
|
text: t,
|
|
4831
4910
|
duration: 0
|
|
4832
4911
|
}), e;
|
|
4833
4912
|
}
|
|
4834
4913
|
}, [p]);
|
|
4835
|
-
return /* @__PURE__ */ X(
|
|
4914
|
+
return /* @__PURE__ */ X(ad, {
|
|
4836
4915
|
unmade: f,
|
|
4837
|
-
children: /* @__PURE__ */ Z(
|
|
4916
|
+
children: /* @__PURE__ */ Z(Nt, {
|
|
4838
4917
|
gl: m,
|
|
4839
4918
|
flat: !0,
|
|
4840
4919
|
orthographic: !0,
|
|
4841
4920
|
frameloop: "demand",
|
|
4842
|
-
dpr:
|
|
4843
|
-
events:
|
|
4844
|
-
camera:
|
|
4921
|
+
dpr: td,
|
|
4922
|
+
events: ed,
|
|
4923
|
+
camera: $u,
|
|
4845
4924
|
onCreated: d,
|
|
4846
4925
|
onPointerMissed: n,
|
|
4847
4926
|
children: [
|
|
4848
|
-
/* @__PURE__ */ X(
|
|
4849
|
-
/* @__PURE__ */ X(
|
|
4927
|
+
/* @__PURE__ */ X(xe, { drawingId: t }),
|
|
4928
|
+
/* @__PURE__ */ X(D.Suspense, {
|
|
4850
4929
|
fallback: null,
|
|
4851
4930
|
children: e
|
|
4852
4931
|
}),
|
|
4853
|
-
/* @__PURE__ */ X(
|
|
4854
|
-
/* @__PURE__ */ X(
|
|
4932
|
+
/* @__PURE__ */ X(rd, { view: s }),
|
|
4933
|
+
/* @__PURE__ */ X(id, {})
|
|
4855
4934
|
]
|
|
4856
4935
|
})
|
|
4857
4936
|
}, r);
|
|
4858
|
-
}),
|
|
4859
|
-
let t = _(e, (e) => e.structure.currentInstance), n = _(e, (e) => e.selection.active !== null) || !1, r =
|
|
4860
|
-
let t =
|
|
4937
|
+
}), sd = (e) => {
|
|
4938
|
+
let t = _(e, (e) => e.structure.currentInstance), n = _(e, (e) => e.selection.active !== null) || !1, r = yt(e), i = D.useCallback(() => {
|
|
4939
|
+
let t = k(e)?.api.interaction;
|
|
4861
4940
|
t?.setHovered(null), t?.setSelected([]);
|
|
4862
4941
|
}, [e]);
|
|
4863
|
-
|
|
4942
|
+
D.useEffect(() => {
|
|
4864
4943
|
(n || r) && i();
|
|
4865
4944
|
}, [
|
|
4866
4945
|
i,
|
|
4867
4946
|
n,
|
|
4868
4947
|
r
|
|
4869
|
-
]),
|
|
4948
|
+
]), D.useEffect(() => {
|
|
4870
4949
|
i();
|
|
4871
4950
|
}, [i, t]);
|
|
4872
|
-
},
|
|
4951
|
+
}, cd = ({ drawingId: e }) => {
|
|
4873
4952
|
let t = xo(e);
|
|
4874
4953
|
return /* @__PURE__ */ X(wa, {
|
|
4875
4954
|
drawingId: e,
|
|
4876
4955
|
menuContent: t
|
|
4877
4956
|
});
|
|
4878
|
-
},
|
|
4879
|
-
|
|
4957
|
+
}, ld = ({ defaultLook: e, menu: n, status: r, trail: i, themeSwitch: o, readOnly: s, children: c }) => {
|
|
4958
|
+
D.useLayoutEffect(() => {
|
|
4880
4959
|
e && fi(e);
|
|
4881
4960
|
}, [e]);
|
|
4882
|
-
let l = g((e) => e.drawing.active || ""), f = _(l, (e) => e.structure.currentInstance) || void 0, p = _(l, (e) => e.structure.currentProduct), m = _(l, (e) => p && e.structure.tree[p]?.class) || "", v = a.base.isA(m, t.CCPart), y = !!s ||
|
|
4883
|
-
|
|
4884
|
-
let b =
|
|
4885
|
-
let e =
|
|
4961
|
+
let l = g((e) => e.drawing.active || ""), f = _(l, (e) => e.structure.currentInstance) || void 0, p = _(l, (e) => e.structure.currentProduct), m = _(l, (e) => p && e.structure.tree[p]?.class) || "", v = a.base.isA(m, t.CCPart), y = !!s || ht.useSessionRole() === "view";
|
|
4962
|
+
sd(l);
|
|
4963
|
+
let b = D.useCallback(() => {
|
|
4964
|
+
let e = k(l)?.structure, t = v ? e?.currentProduct : e?.root;
|
|
4886
4965
|
if (!t) return null;
|
|
4887
|
-
let n =
|
|
4966
|
+
let n = k(l).api.structure.calculateProductBounds(t);
|
|
4888
4967
|
return n.radius > 0 ? n.center : null;
|
|
4889
4968
|
}, [l, v]);
|
|
4890
4969
|
return /* @__PURE__ */ Z(Mr.Provider, {
|
|
4891
4970
|
value: y,
|
|
4892
4971
|
children: [
|
|
4893
4972
|
/* @__PURE__ */ X(h, {}),
|
|
4894
|
-
/* @__PURE__ */ Z(
|
|
4973
|
+
/* @__PURE__ */ Z(le, {
|
|
4895
4974
|
drawingId: l,
|
|
4896
4975
|
readOnly: y,
|
|
4897
|
-
Menu: n === void 0 ? /* @__PURE__ */ X(
|
|
4976
|
+
Menu: n === void 0 ? /* @__PURE__ */ X(eu, { drawingId: l }) : n ?? void 0,
|
|
4898
4977
|
Trail: i,
|
|
4899
4978
|
Status: r,
|
|
4900
4979
|
themeSwitch: o,
|
|
4901
|
-
ViewOptions: /* @__PURE__ */ X(
|
|
4902
|
-
children: [/* @__PURE__ */ Z(
|
|
4980
|
+
ViewOptions: /* @__PURE__ */ X(tl, {}),
|
|
4981
|
+
children: [/* @__PURE__ */ Z(od, {
|
|
4903
4982
|
drawingId: l,
|
|
4904
4983
|
children: [
|
|
4905
|
-
/* @__PURE__ */ X(
|
|
4984
|
+
/* @__PURE__ */ X(yl, {
|
|
4906
4985
|
makeDefault: !0,
|
|
4907
4986
|
center: b
|
|
4908
4987
|
}),
|
|
4909
|
-
/* @__PURE__ */ X(
|
|
4988
|
+
/* @__PURE__ */ X(Ml, {}),
|
|
4910
4989
|
/* @__PURE__ */ X(Ge, {}),
|
|
4911
|
-
/* @__PURE__ */ X(
|
|
4912
|
-
/* @__PURE__ */ X(
|
|
4913
|
-
/* @__PURE__ */ X(
|
|
4914
|
-
/* @__PURE__ */ Z(
|
|
4990
|
+
/* @__PURE__ */ X(el, { drawingId: l }),
|
|
4991
|
+
/* @__PURE__ */ X(Pl, {}),
|
|
4992
|
+
/* @__PURE__ */ X(ve, { drawingId: l }),
|
|
4993
|
+
/* @__PURE__ */ Z(Dl, {
|
|
4915
4994
|
drawingId: l,
|
|
4916
4995
|
children: [
|
|
4917
|
-
/* @__PURE__ */ X(
|
|
4996
|
+
/* @__PURE__ */ X(Wc, { drawingId: l }),
|
|
4918
4997
|
/* @__PURE__ */ X(ta, {
|
|
4919
4998
|
drawingId: l,
|
|
4920
4999
|
children: /* @__PURE__ */ X(u, {
|
|
@@ -4925,32 +5004,32 @@ var nd = class extends O.Component {
|
|
|
4925
5004
|
})
|
|
4926
5005
|
}),
|
|
4927
5006
|
/* @__PURE__ */ X(Me, { drawingId: l }),
|
|
4928
|
-
/* @__PURE__ */ X(
|
|
4929
|
-
/* @__PURE__ */ X(
|
|
5007
|
+
/* @__PURE__ */ X(cd, { drawingId: l }),
|
|
5008
|
+
/* @__PURE__ */ X(Qu, {})
|
|
4930
5009
|
]
|
|
4931
5010
|
}),
|
|
4932
5011
|
/* @__PURE__ */ X(d, { drawingId: l }),
|
|
4933
|
-
/* @__PURE__ */ X(
|
|
5012
|
+
/* @__PURE__ */ X(kl, { drawingId: l }),
|
|
4934
5013
|
/* @__PURE__ */ X(fa, { drawingId: l }),
|
|
4935
5014
|
/* @__PURE__ */ X(vs, { drawingId: l }),
|
|
4936
|
-
/* @__PURE__ */ X(Iu, {}),
|
|
4937
|
-
/* @__PURE__ */ X(Ru, {}),
|
|
4938
5015
|
/* @__PURE__ */ X(zu, {}),
|
|
4939
|
-
/* @__PURE__ */ X(
|
|
4940
|
-
/* @__PURE__ */ X(
|
|
4941
|
-
/* @__PURE__ */ X(
|
|
5016
|
+
/* @__PURE__ */ X(Vu, {}),
|
|
5017
|
+
/* @__PURE__ */ X(Hu, {}),
|
|
5018
|
+
/* @__PURE__ */ X(Lu, { drawingId: l }),
|
|
5019
|
+
/* @__PURE__ */ X(_u, {}),
|
|
5020
|
+
/* @__PURE__ */ X(yu, {}),
|
|
4942
5021
|
c
|
|
4943
5022
|
]
|
|
4944
|
-
}), /* @__PURE__ */ X(
|
|
5023
|
+
}), /* @__PURE__ */ X(ou, {})]
|
|
4945
5024
|
}),
|
|
4946
|
-
/* @__PURE__ */ X(
|
|
4947
|
-
/* @__PURE__ */ X(
|
|
4948
|
-
y && /* @__PURE__ */ X(
|
|
4949
|
-
/* @__PURE__ */ X(
|
|
5025
|
+
/* @__PURE__ */ X(Fl, { drawingId: l }),
|
|
5026
|
+
/* @__PURE__ */ X(tu, { drawingId: l }),
|
|
5027
|
+
y && /* @__PURE__ */ X(uu, {}),
|
|
5028
|
+
/* @__PURE__ */ X(cu, {})
|
|
4950
5029
|
]
|
|
4951
5030
|
});
|
|
4952
|
-
},
|
|
4953
|
-
let a = g((e) => e.message), o = a.data?.text, s = a.data?.type, c =
|
|
5031
|
+
}, ud = ({ errorColor: e = "var(--rcad-accent)", successColor: t = "var(--rcad-green)", warningColor: n = "var(--rcad-orange)", infoColor: r = "var(--rcad-blue)", style: i }) => {
|
|
5032
|
+
let a = g((e) => e.message), o = a.data?.text, s = a.data?.type, c = D.useMemo(() => ({
|
|
4954
5033
|
error: e,
|
|
4955
5034
|
success: t,
|
|
4956
5035
|
warning: n,
|
|
@@ -4970,14 +5049,14 @@ var nd = class extends O.Component {
|
|
|
4970
5049
|
},
|
|
4971
5050
|
children: o
|
|
4972
5051
|
}) : null;
|
|
4973
|
-
},
|
|
4974
|
-
let n =
|
|
5052
|
+
}, dd = ({ themeSwitch: t = !0 }) => {
|
|
5053
|
+
let n = D.useRef(null), r = D.useCallback(async () => {
|
|
4975
5054
|
let t = await e.utils.connect();
|
|
4976
5055
|
t && await o(t).v1.part.create({ name: "Part" }).catch(console.info);
|
|
4977
|
-
}, []), i =
|
|
5056
|
+
}, []), i = D.useCallback(async () => {
|
|
4978
5057
|
let t = await e.utils.connect();
|
|
4979
5058
|
t && await o(t).v1.assembly.create({ name: "Assembly" }).catch(console.info);
|
|
4980
|
-
}, []), a =
|
|
5059
|
+
}, []), a = D.useCallback(() => {
|
|
4981
5060
|
n.current && n.current.click();
|
|
4982
5061
|
}, []), s = [
|
|
4983
5062
|
{
|
|
@@ -5002,7 +5081,7 @@ var nd = class extends O.Component {
|
|
|
5002
5081
|
run: a
|
|
5003
5082
|
}
|
|
5004
5083
|
];
|
|
5005
|
-
return /* @__PURE__ */ Z(
|
|
5084
|
+
return /* @__PURE__ */ Z(fd, {
|
|
5006
5085
|
className: "rcad",
|
|
5007
5086
|
"data-rcad-root": !0,
|
|
5008
5087
|
children: [
|
|
@@ -5017,22 +5096,22 @@ var nd = class extends O.Component {
|
|
|
5017
5096
|
"data-at": e,
|
|
5018
5097
|
"aria-hidden": "true"
|
|
5019
5098
|
}, e)),
|
|
5020
|
-
/* @__PURE__ */ Z(
|
|
5099
|
+
/* @__PURE__ */ Z(pd, { children: [/* @__PURE__ */ Z("span", { children: [
|
|
5021
5100
|
"Buerligons ",
|
|
5022
5101
|
/* @__PURE__ */ X("i", { children: "·" }),
|
|
5023
5102
|
" ",
|
|
5024
5103
|
/* @__PURE__ */ X("em", { children: "CAD in the browser" })
|
|
5025
5104
|
] }), t && /* @__PURE__ */ X(Ke, {})] }),
|
|
5026
|
-
/* @__PURE__ */ Z(
|
|
5027
|
-
/* @__PURE__ */ X(
|
|
5028
|
-
/* @__PURE__ */ X(
|
|
5029
|
-
/* @__PURE__ */ X(
|
|
5105
|
+
/* @__PURE__ */ Z(md, { children: [
|
|
5106
|
+
/* @__PURE__ */ X(hd, { children: "New drawing" }),
|
|
5107
|
+
/* @__PURE__ */ X(gd, { children: "Start with a part, an assembly, or a file." }),
|
|
5108
|
+
/* @__PURE__ */ X(_d, { children: s.map((e) => /* @__PURE__ */ X("li", { children: /* @__PURE__ */ Z("button", {
|
|
5030
5109
|
type: "button",
|
|
5031
5110
|
onClick: e.run,
|
|
5032
5111
|
children: [
|
|
5033
5112
|
/* @__PURE__ */ X("span", {
|
|
5034
5113
|
className: "tile",
|
|
5035
|
-
children: /* @__PURE__ */ X(
|
|
5114
|
+
children: /* @__PURE__ */ X(Se, {
|
|
5036
5115
|
name: e.icon,
|
|
5037
5116
|
size: 20
|
|
5038
5117
|
})
|
|
@@ -5042,14 +5121,14 @@ var nd = class extends O.Component {
|
|
|
5042
5121
|
children: e.name
|
|
5043
5122
|
}),
|
|
5044
5123
|
/* @__PURE__ */ X("code", { children: e.note }),
|
|
5045
|
-
/* @__PURE__ */ X(
|
|
5124
|
+
/* @__PURE__ */ X(Se, {
|
|
5046
5125
|
name: "chevronRight",
|
|
5047
5126
|
size: 14,
|
|
5048
5127
|
className: "go"
|
|
5049
5128
|
})
|
|
5050
5129
|
]
|
|
5051
5130
|
}) }, e.key)) }),
|
|
5052
|
-
/* @__PURE__ */ X(
|
|
5131
|
+
/* @__PURE__ */ X(vd, { children: /* @__PURE__ */ X(ud, {}) })
|
|
5053
5132
|
] }),
|
|
5054
5133
|
/* @__PURE__ */ X(Pe, {
|
|
5055
5134
|
ref: n,
|
|
@@ -5057,7 +5136,7 @@ var nd = class extends O.Component {
|
|
|
5057
5136
|
})
|
|
5058
5137
|
]
|
|
5059
5138
|
});
|
|
5060
|
-
},
|
|
5139
|
+
}, fd = Et.div`
|
|
5061
5140
|
position: relative;
|
|
5062
5141
|
display: grid;
|
|
5063
5142
|
width: 100%;
|
|
@@ -5068,7 +5147,7 @@ var nd = class extends O.Component {
|
|
|
5068
5147
|
background:
|
|
5069
5148
|
radial-gradient(circle, var(--rcad-line-2) 1px, transparent 1.4px) 0 0 / 28px 28px,
|
|
5070
5149
|
var(--rcad-viewport);
|
|
5071
|
-
`,
|
|
5150
|
+
`, pd = Et.header`
|
|
5072
5151
|
position: absolute;
|
|
5073
5152
|
top: 14px;
|
|
5074
5153
|
right: 16px;
|
|
@@ -5086,24 +5165,24 @@ var nd = class extends O.Component {
|
|
|
5086
5165
|
font-style: normal;
|
|
5087
5166
|
opacity: 0.5;
|
|
5088
5167
|
}
|
|
5089
|
-
`,
|
|
5168
|
+
`, md = Et.main`
|
|
5090
5169
|
width: min(440px, 100%);
|
|
5091
5170
|
padding: 22px 22px 14px;
|
|
5092
5171
|
border-radius: var(--rcad-r-window);
|
|
5093
5172
|
background: var(--rcad-panel);
|
|
5094
5173
|
box-shadow: var(--rcad-shadow-lg), var(--rcad-ring);
|
|
5095
|
-
`,
|
|
5174
|
+
`, hd = Et.div`
|
|
5096
5175
|
color: var(--rcad-accent);
|
|
5097
5176
|
font: 500 10.5px/1 var(--rcad-font-mono);
|
|
5098
5177
|
letter-spacing: 0.14em;
|
|
5099
5178
|
text-transform: uppercase;
|
|
5100
|
-
`,
|
|
5179
|
+
`, gd = Et.h1`
|
|
5101
5180
|
margin: 10px 0 18px;
|
|
5102
5181
|
color: var(--rcad-ink);
|
|
5103
5182
|
font: 600 16px/1.35 var(--rcad-font-mono);
|
|
5104
5183
|
letter-spacing: -0.01em;
|
|
5105
5184
|
text-wrap: balance;
|
|
5106
|
-
`,
|
|
5185
|
+
`, _d = Et.ul`
|
|
5107
5186
|
margin: 0 -8px;
|
|
5108
5187
|
padding: 0;
|
|
5109
5188
|
list-style: none;
|
|
@@ -5166,7 +5245,7 @@ var nd = class extends O.Component {
|
|
|
5166
5245
|
color: var(--rcad-accent);
|
|
5167
5246
|
transform: translateX(2px);
|
|
5168
5247
|
}
|
|
5169
|
-
`,
|
|
5248
|
+
`, vd = Et.div`
|
|
5170
5249
|
.buerli-simple-message {
|
|
5171
5250
|
margin-top: 12px;
|
|
5172
5251
|
padding-top: 12px;
|
|
@@ -5174,14 +5253,14 @@ var nd = class extends O.Component {
|
|
|
5174
5253
|
font: 500 11.5px/1.5 var(--rcad-font-mono);
|
|
5175
5254
|
word-break: break-word;
|
|
5176
5255
|
}
|
|
5177
|
-
`,
|
|
5178
|
-
|
|
5179
|
-
let { defaultLook: i } = r, a = g((e) => e.drawing.ids.length), o = g((e) => e.drawing.active || ""), s = !!
|
|
5180
|
-
|
|
5256
|
+
`, yd = ({ welcome: t = !0, share: n = !0, ...r }) => {
|
|
5257
|
+
D.useLayoutEffect(() => Gr(n), [n]);
|
|
5258
|
+
let { defaultLook: i } = r, a = g((e) => e.drawing.ids.length), o = g((e) => e.drawing.active || ""), s = !!ht.getInviteFromUrl();
|
|
5259
|
+
D.useLayoutEffect(() => {
|
|
5181
5260
|
i && fi(i);
|
|
5182
5261
|
}, [i]);
|
|
5183
|
-
let c =
|
|
5184
|
-
return
|
|
5262
|
+
let c = D.useRef(!1), [l, u] = D.useState(!1);
|
|
5263
|
+
return D.useEffect(() => {
|
|
5185
5264
|
s && a === 0 && !c.current && (c.current = !0, e.utils.connect().then((e) => u(!e), (e) => {
|
|
5186
5265
|
console.error("[buerligons] failed to join shared session", e), u(!0);
|
|
5187
5266
|
}));
|
|
@@ -5190,9 +5269,9 @@ var nd = class extends O.Component {
|
|
|
5190
5269
|
height: "100%",
|
|
5191
5270
|
width: "100%"
|
|
5192
5271
|
},
|
|
5193
|
-
children: a > 0 && o && !l ? /* @__PURE__ */ X(
|
|
5272
|
+
children: a > 0 && o && !l ? /* @__PURE__ */ X(ld, { ...r }) : s ? /* @__PURE__ */ X(bd, { refused: l }) : t ? /* @__PURE__ */ X(dd, { themeSwitch: r.themeSwitch }) : null
|
|
5194
5273
|
});
|
|
5195
|
-
},
|
|
5274
|
+
}, bd = ({ refused: e }) => /* @__PURE__ */ Z(xd, {
|
|
5196
5275
|
role: e ? "alert" : "status",
|
|
5197
5276
|
"data-refused": e || void 0,
|
|
5198
5277
|
children: [
|
|
@@ -5212,7 +5291,7 @@ var nd = class extends O.Component {
|
|
|
5212
5291
|
})
|
|
5213
5292
|
] }) : /* @__PURE__ */ Z("span", { children: [/* @__PURE__ */ X("i", { "aria-hidden": "true" }), " Joining the shared session"] })
|
|
5214
5293
|
]
|
|
5215
|
-
}),
|
|
5294
|
+
}), xd = Et.div`
|
|
5216
5295
|
display: grid;
|
|
5217
5296
|
place-content: center;
|
|
5218
5297
|
justify-items: center;
|
|
@@ -5282,21 +5361,21 @@ var nd = class extends O.Component {
|
|
|
5282
5361
|
outline: 2px solid var(--rcad-accent-line);
|
|
5283
5362
|
outline-offset: 2px;
|
|
5284
5363
|
}
|
|
5285
|
-
`,
|
|
5364
|
+
`, Sd = /* @__PURE__ */ new Set([
|
|
5286
5365
|
"v1.assembly.setCurrentInstance",
|
|
5287
5366
|
"v1.assembly.setCurrentProduct",
|
|
5288
5367
|
"v1.part.openFeature",
|
|
5289
5368
|
"v1.part.closeFeature",
|
|
5290
5369
|
"v1.part.operationMoveBefore",
|
|
5291
5370
|
"v1.part.operationMoveToEnd"
|
|
5292
|
-
]),
|
|
5371
|
+
]), Cd = (e) => {
|
|
5293
5372
|
let t = e.toLowerCase().split(".").pop() ?? "";
|
|
5294
5373
|
return t === "ofb" ? "OFB" : t === "stp" || t === "step" ? "STP" : t === "iwp" ? "IWP" : null;
|
|
5295
|
-
},
|
|
5374
|
+
}, wd = (e) => {
|
|
5296
5375
|
let t = atob(e), n = new Uint8Array(t.length);
|
|
5297
5376
|
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
5298
5377
|
return n;
|
|
5299
|
-
},
|
|
5378
|
+
}, Td = class {
|
|
5300
5379
|
status = {
|
|
5301
5380
|
state: "idle",
|
|
5302
5381
|
drawingId: null,
|
|
@@ -5329,12 +5408,12 @@ var nd = class extends O.Component {
|
|
|
5329
5408
|
try {
|
|
5330
5409
|
let i = await e.utils.connect(t?.name ?? n);
|
|
5331
5410
|
if (!i) throw Error("Drawing could not be created.");
|
|
5332
|
-
if (r = i,
|
|
5411
|
+
if (r = i, Ot.getState().api.setActiveDrawing(i), t?.format === "JSON") {
|
|
5333
5412
|
let e = await s(i).callSafeApiV("v1", "assembly", "importDefinition", {
|
|
5334
5413
|
data: t.data,
|
|
5335
5414
|
format: "JSON"
|
|
5336
5415
|
}, { undoable: !0 });
|
|
5337
|
-
if (e?.result === void 0 || e.result === null) throw Error(
|
|
5416
|
+
if (e?.result === void 0 || e.result === null) throw Error(kd(e?.messages) || "ClassCAD could not build the assembly from its definition.");
|
|
5338
5417
|
} else t ? await o(i).v1.common.load({
|
|
5339
5418
|
data: t.data,
|
|
5340
5419
|
format: t.format
|
|
@@ -5346,11 +5425,11 @@ var nd = class extends O.Component {
|
|
|
5346
5425
|
}), this.watchEdits(i), i;
|
|
5347
5426
|
} catch (e) {
|
|
5348
5427
|
if (r) try {
|
|
5349
|
-
|
|
5428
|
+
Ot.getState().api.removeDrawing(r);
|
|
5350
5429
|
} catch (e) {
|
|
5351
5430
|
console.warn("[buerligons/embed] removing the failed drawing failed", e);
|
|
5352
5431
|
}
|
|
5353
|
-
let t = e instanceof Error ? e : Error(
|
|
5432
|
+
let t = e instanceof Error ? e : Error(Od(e));
|
|
5354
5433
|
throw this.set({
|
|
5355
5434
|
state: "failed",
|
|
5356
5435
|
drawingId: null,
|
|
@@ -5374,7 +5453,7 @@ var nd = class extends O.Component {
|
|
|
5374
5453
|
encoding: "base64"
|
|
5375
5454
|
}))?.result?.content;
|
|
5376
5455
|
if (!n) throw Error("ClassCAD returned no content.");
|
|
5377
|
-
let r =
|
|
5456
|
+
let r = wd(n);
|
|
5378
5457
|
return this.set({
|
|
5379
5458
|
state: "ready",
|
|
5380
5459
|
drawingId: t,
|
|
@@ -5384,7 +5463,7 @@ var nd = class extends O.Component {
|
|
|
5384
5463
|
throw this.set({
|
|
5385
5464
|
...n,
|
|
5386
5465
|
state: "ready",
|
|
5387
|
-
error:
|
|
5466
|
+
error: Od(e)
|
|
5388
5467
|
}), e;
|
|
5389
5468
|
}
|
|
5390
5469
|
}
|
|
@@ -5399,7 +5478,7 @@ var nd = class extends O.Component {
|
|
|
5399
5478
|
});
|
|
5400
5479
|
try {
|
|
5401
5480
|
let n = await s(t).callSafeApiV("v1", "assembly", "exportDefinition", e, { undoable: !1 }), r = n?.result;
|
|
5402
|
-
if (!r?.json) throw Error(
|
|
5481
|
+
if (!r?.json) throw Error(kd(n?.messages) || "ClassCAD returned no assembly definition.");
|
|
5403
5482
|
return this.set({
|
|
5404
5483
|
state: "ready",
|
|
5405
5484
|
drawingId: t,
|
|
@@ -5409,12 +5488,12 @@ var nd = class extends O.Component {
|
|
|
5409
5488
|
throw this.set({
|
|
5410
5489
|
...n,
|
|
5411
5490
|
state: "ready",
|
|
5412
|
-
error:
|
|
5491
|
+
error: Od(e)
|
|
5413
5492
|
}), e;
|
|
5414
5493
|
}
|
|
5415
5494
|
}
|
|
5416
5495
|
currentState(e = this.status.drawingId) {
|
|
5417
|
-
return e ?
|
|
5496
|
+
return e ? Dd(k(e)?.cad?.states) : null;
|
|
5418
5497
|
}
|
|
5419
5498
|
isDirty() {
|
|
5420
5499
|
let { drawingId: e, savedState: t } = this.status;
|
|
@@ -5439,11 +5518,11 @@ var nd = class extends O.Component {
|
|
|
5439
5518
|
format: t,
|
|
5440
5519
|
encoding: "base64"
|
|
5441
5520
|
}), i = r?.result?.content;
|
|
5442
|
-
if (!i) throw Error(
|
|
5443
|
-
return
|
|
5521
|
+
if (!i) throw Error(kd(r?.messages) || "ClassCAD returned no content for the part.");
|
|
5522
|
+
return wd(i);
|
|
5444
5523
|
}
|
|
5445
5524
|
usersOf(e) {
|
|
5446
|
-
let n = this.status.drawingId ?
|
|
5525
|
+
let n = this.status.drawingId ? k(this.status.drawingId)?.structure : void 0;
|
|
5447
5526
|
if (!n) return [];
|
|
5448
5527
|
let { tree: r, root: i } = n;
|
|
5449
5528
|
return Object.values(r).filter((e) => e.id === i || a.base.isA(e.class, t.CCAssembly)).filter((n) => (n.children ?? []).some((n) => {
|
|
@@ -5456,9 +5535,9 @@ var nd = class extends O.Component {
|
|
|
5456
5535
|
}));
|
|
5457
5536
|
}
|
|
5458
5537
|
products() {
|
|
5459
|
-
let e = this.status.drawingId ?
|
|
5538
|
+
let e = this.status.drawingId ? k(this.status.drawingId)?.structure : void 0;
|
|
5460
5539
|
return e ? Object.values(e.tree).flatMap((t) => {
|
|
5461
|
-
let n =
|
|
5540
|
+
let n = Ed(t.class, t.id === e.root);
|
|
5462
5541
|
return n ? [{
|
|
5463
5542
|
id: t.id,
|
|
5464
5543
|
name: t.name,
|
|
@@ -5467,7 +5546,7 @@ var nd = class extends O.Component {
|
|
|
5467
5546
|
}) : [];
|
|
5468
5547
|
}
|
|
5469
5548
|
insertTarget() {
|
|
5470
|
-
let e = this.status.drawingId ?
|
|
5549
|
+
let e = this.status.drawingId ? k(this.status.drawingId)?.structure : void 0, n = e?.root ? e.tree[e.root] : void 0;
|
|
5471
5550
|
if (!e || !n) return null;
|
|
5472
5551
|
let r = e.currentProduct ? e.tree[e.currentProduct] : void 0;
|
|
5473
5552
|
return !r || r.id === n.id ? {
|
|
@@ -5494,7 +5573,7 @@ var nd = class extends O.Component {
|
|
|
5494
5573
|
url: e.url,
|
|
5495
5574
|
format: e.format
|
|
5496
5575
|
}, { undoable: !0 }), l = c?.result, u = typeof l == "object" ? l?.id : l;
|
|
5497
|
-
if (!u) throw Error(
|
|
5576
|
+
if (!u) throw Error(kd(c?.messages) || `ClassCAD could not load ${e.name}.`);
|
|
5498
5577
|
return o || await r.callSafeApiV("v1", "common", "setObjectName", {
|
|
5499
5578
|
id: u,
|
|
5500
5579
|
name: a
|
|
@@ -5510,7 +5589,7 @@ var nd = class extends O.Component {
|
|
|
5510
5589
|
let i = new Set(this.products().map((e) => e.name)), a = t;
|
|
5511
5590
|
for (let e = 2; i.has(a); e++) a = `${t}_${e}`;
|
|
5512
5591
|
let o = await s(n).callSafeApiV("v1", "assembly", e === "part" ? "partTemplate" : "assemblyTemplate", { name: a }, { undoable: !0 }), c = o?.result;
|
|
5513
|
-
if (!c) throw Error(
|
|
5592
|
+
if (!c) throw Error(kd(o?.messages) || `ClassCAD could not create ${a}.`);
|
|
5514
5593
|
return await this.addInstance(c, r), {
|
|
5515
5594
|
id: c,
|
|
5516
5595
|
name: a,
|
|
@@ -5524,7 +5603,7 @@ var nd = class extends O.Component {
|
|
|
5524
5603
|
productId: e,
|
|
5525
5604
|
ownerId: t.id
|
|
5526
5605
|
}, { undoable: !0 }), i = Array.isArray(r?.result) ? r.result[0] : r?.result;
|
|
5527
|
-
if (!i) throw Error(
|
|
5606
|
+
if (!i) throw Error(kd(r?.messages) || "ClassCAD could not create the instance.");
|
|
5528
5607
|
let a = this.edited.filter((n) => n.id !== e && n.id !== t.id);
|
|
5529
5608
|
return this.setEdited(t.root ? a : [...a, {
|
|
5530
5609
|
id: t.id,
|
|
@@ -5533,7 +5612,7 @@ var nd = class extends O.Component {
|
|
|
5533
5612
|
}]), i;
|
|
5534
5613
|
}
|
|
5535
5614
|
isImportedPart(e) {
|
|
5536
|
-
let n = this.status.drawingId ?
|
|
5615
|
+
let n = this.status.drawingId ? k(this.status.drawingId)?.structure.tree : void 0;
|
|
5537
5616
|
if (!n) return !1;
|
|
5538
5617
|
let r = [e];
|
|
5539
5618
|
for (let e of r) {
|
|
@@ -5573,13 +5652,13 @@ var nd = class extends O.Component {
|
|
|
5573
5652
|
}
|
|
5574
5653
|
watchEdits(e) {
|
|
5575
5654
|
this.unwatch?.(), this.setEdited([]);
|
|
5576
|
-
let t = new Set(Object.keys(
|
|
5577
|
-
this.unwatch =
|
|
5655
|
+
let t = new Set(Object.keys(k(e)?.cad?.states?.captionMap ?? {}));
|
|
5656
|
+
this.unwatch = Ot.subscribe((n) => {
|
|
5578
5657
|
let r = n.drawing.refs[e], i = r?.cad?.states?.captionMap;
|
|
5579
5658
|
if (!i) return;
|
|
5580
5659
|
let a = Object.keys(i), o = a.filter((e) => !t.has(e));
|
|
5581
|
-
if (!o.length || (t = new Set(a), o.every((e) =>
|
|
5582
|
-
let s = r.structure.tree[r.structure.currentProduct ?? -1], c = s &&
|
|
5660
|
+
if (!o.length || (t = new Set(a), o.every((e) => Sd.has(i[e]?.caption)))) return;
|
|
5661
|
+
let s = r.structure.tree[r.structure.currentProduct ?? -1], c = s && Ed(s.class, s.id === r.structure.root);
|
|
5583
5662
|
s && c && (this.edited.some((e) => e.id === s.id) || this.setEdited([...this.edited, {
|
|
5584
5663
|
id: s.id,
|
|
5585
5664
|
name: s.name,
|
|
@@ -5601,7 +5680,7 @@ var nd = class extends O.Component {
|
|
|
5601
5680
|
this.unwatch?.(), this.unwatch = null, this.setEdited([]);
|
|
5602
5681
|
let e = this.status.drawingId;
|
|
5603
5682
|
if (e) try {
|
|
5604
|
-
|
|
5683
|
+
Ot.getState().api.removeDrawing(e);
|
|
5605
5684
|
} catch (e) {
|
|
5606
5685
|
console.warn("[buerligons/embed] removing the drawing failed", e);
|
|
5607
5686
|
}
|
|
@@ -5614,27 +5693,27 @@ var nd = class extends O.Component {
|
|
|
5614
5693
|
set(e) {
|
|
5615
5694
|
this.status = e, this.listeners.forEach((t) => t(e));
|
|
5616
5695
|
}
|
|
5617
|
-
},
|
|
5696
|
+
}, Ed = (e, n) => e ? a.base.isA(e, t.CCPart) ? "part" : !n && a.base.isA(e, t.CCAssembly) ? "assembly" : null : null, Dd = (e) => e ? e.stack?.length ? typeof e.current == "number" ? e.current : null : -Object.values(e.captionMap ?? {}).filter((e) => !Sd.has(e?.caption ?? "")).length : null, Od = (e) => {
|
|
5618
5697
|
if (e instanceof Error) return e.message;
|
|
5619
5698
|
if (e && typeof e == "object") {
|
|
5620
|
-
let { messages: t, message: n } = e, r =
|
|
5699
|
+
let { messages: t, message: n } = e, r = kd(t) || (typeof n == "string" ? n : "");
|
|
5621
5700
|
if (r) return r;
|
|
5622
5701
|
}
|
|
5623
5702
|
return String(e);
|
|
5624
|
-
},
|
|
5625
|
-
let [t, n] =
|
|
5626
|
-
return
|
|
5627
|
-
},
|
|
5628
|
-
let t =
|
|
5703
|
+
}, kd = (e) => [...new Set((e ?? []).map((e) => e.message).filter((e) => !!e))].slice(0, 2).join(" | "), Ad = (e) => {
|
|
5704
|
+
let [t, n] = D.useState(e.getStatus());
|
|
5705
|
+
return D.useEffect(() => (n(e.getStatus()), e.subscribe(n)), [e]), t;
|
|
5706
|
+
}, jd = (e) => {
|
|
5707
|
+
let t = Ad(e), n = t.drawingId ?? "", r = _(n, (e) => Dd(e.cad.states));
|
|
5629
5708
|
return !!t.drawingId && t.savedState !== null && r != null && r !== t.savedState;
|
|
5630
|
-
},
|
|
5631
|
-
let [t, n] =
|
|
5632
|
-
return
|
|
5633
|
-
},
|
|
5634
|
-
let n =
|
|
5635
|
-
return
|
|
5709
|
+
}, Md = (e) => {
|
|
5710
|
+
let [t, n] = D.useState(e.getEditedParts());
|
|
5711
|
+
return D.useEffect(() => (n(e.getEditedParts()), e.subscribeEditedParts(n)), [e]), t;
|
|
5712
|
+
}, Nd = (e) => {
|
|
5713
|
+
let n = Ad(e).drawingId ?? "", r = _(n, (e) => e.structure.currentProduct), i = _(n, (e) => r ? e.structure.tree[r]?.class : void 0), o = _(n, (e) => r ? e.structure.tree[r]?.name : void 0), s = _(n, (e) => e.structure.root), c = _(n, (e) => e.structure.root ? e.structure.tree[e.structure.root]?.class : void 0);
|
|
5714
|
+
return D.useMemo(() => {
|
|
5636
5715
|
if (!r || !c || a.base.isA(c, t.CCPart)) return null;
|
|
5637
|
-
let e =
|
|
5716
|
+
let e = Ed(i, r === s);
|
|
5638
5717
|
return e ? {
|
|
5639
5718
|
id: r,
|
|
5640
5719
|
name: o ?? "",
|
|
@@ -5647,9 +5726,9 @@ var nd = class extends O.Component {
|
|
|
5647
5726
|
c,
|
|
5648
5727
|
s
|
|
5649
5728
|
]);
|
|
5650
|
-
},
|
|
5651
|
-
let n =
|
|
5652
|
-
|
|
5729
|
+
}, Pd = (e, t) => {
|
|
5730
|
+
let n = jd(e), r = Ad(e), { intervalMs: i, enabled: a = !0, onSnapshot: o, onError: s } = t, c = D.useRef(!1);
|
|
5731
|
+
D.useEffect(() => {
|
|
5653
5732
|
if (!a || !n || r.state !== "ready") return;
|
|
5654
5733
|
let t = window.setTimeout(async () => {
|
|
5655
5734
|
if (!c.current) {
|
|
@@ -5676,4 +5755,4 @@ var nd = class extends O.Component {
|
|
|
5676
5755
|
]);
|
|
5677
5756
|
};
|
|
5678
5757
|
//#endregion
|
|
5679
|
-
export {
|
|
5758
|
+
export { yd as Buerligons, Td as EditorController, pi as getRenderMode, Cd as loadFormatOf, fi as setDefaultRenderMode, Zc as setLooks, di as setRenderMode, Pd as useAutosave, Nd as useCurrentPart, Md as useEditedParts, jd as useEditorDirty, Ad as useEditorStatus, Xc as useLooks, ui as useRenderMode };
|