@gui-chat-plugin/brep 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +181 -2
- package/dist/core/definition.d.ts +24 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/mesh.d.ts +34 -0
- package/dist/core/packed.d.ts +4 -0
- package/dist/core/paths.d.ts +15 -0
- package/dist/core/plugin.d.ts +12 -0
- package/dist/core/types.d.ts +68 -0
- package/dist/errors-BANLyHzz.js +27 -0
- package/dist/errors-BgFaRg0j.cjs +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +136 -0
- package/dist/kernel/errors.d.ts +33 -0
- package/dist/kernel/index.d.ts +26 -0
- package/dist/kernel/load.d.ts +9 -0
- package/dist/kernel/output.d.ts +15 -0
- package/dist/kernel/record.d.ts +32 -0
- package/dist/kernel/report.d.ts +52 -0
- package/dist/kernel/script.d.ts +9 -0
- package/dist/kernel-75dHFfjx.js +565 -0
- package/dist/kernel-BA8zZi78.cjs +2 -0
- package/dist/lang/en.d.ts +3 -0
- package/dist/lang/index.d.ts +5 -0
- package/dist/lang/ja.d.ts +3 -0
- package/dist/lang/messages.d.ts +41 -0
- package/dist/mesh-Cmm66x_I.js +128 -0
- package/dist/mesh-DLZoiBza.cjs +1 -0
- package/dist/style.css +3 -0
- package/dist/vue/Preview.vue.d.ts +8 -0
- package/dist/vue/View.vue.d.ts +8 -0
- package/dist/vue/index.d.ts +23 -0
- package/dist/vue/scene.d.ts +24 -0
- package/dist/vue/split.d.ts +26 -0
- package/dist/vue.cjs +1 -0
- package/dist/vue.js +941 -0
- package/package.json +72 -4
package/dist/vue.js
ADDED
|
@@ -0,0 +1,941 @@
|
|
|
1
|
+
import { a as e, o as t, r as n, s as r, t as i } from "./mesh-Cmm66x_I.js";
|
|
2
|
+
import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, defineComponent as d, normalizeClass as ee, normalizeStyle as te, onMounted as ne, onUnmounted as re, openBlock as f, ref as p, renderList as m, toDisplayString as h, unref as g, vModelCheckbox as ie, watch as ae, withDirectives as oe, withModifiers as se } from "vue";
|
|
3
|
+
import * as _ from "three";
|
|
4
|
+
import { Controls as ce, MOUSE as v, MathUtils as le, Plane as y, Quaternion as b, Ray as x, Spherical as ue, TOUCH as S, Vector2 as C, Vector3 as w } from "three";
|
|
5
|
+
import { createUseT as de } from "gui-chat-protocol/vue";
|
|
6
|
+
// ../../node_modules/three/examples/jsm/controls/OrbitControls.js
|
|
7
|
+
var T = { type: "change" }, E = { type: "start" }, D = { type: "end" }, O = new x(), fe = new y(), k = Math.cos(70 * le.DEG2RAD), A = new w(), j = 2 * Math.PI, M = {
|
|
8
|
+
NONE: -1,
|
|
9
|
+
ROTATE: 0,
|
|
10
|
+
DOLLY: 1,
|
|
11
|
+
PAN: 2,
|
|
12
|
+
TOUCH_ROTATE: 3,
|
|
13
|
+
TOUCH_PAN: 4,
|
|
14
|
+
TOUCH_DOLLY_PAN: 5,
|
|
15
|
+
TOUCH_DOLLY_ROTATE: 6
|
|
16
|
+
}, N = 1e-6, pe = class extends ce {
|
|
17
|
+
constructor(e, t = null) {
|
|
18
|
+
super(e, t), this.state = M.NONE, this.target = new w(), this.cursor = new w(), this.minDistance = 0, this.maxDistance = Infinity, this.minZoom = 0, this.maxZoom = Infinity, this.minTargetRadius = 0, this.maxTargetRadius = Infinity, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -Infinity, this.maxAzimuthAngle = Infinity, this.enableDamping = !1, this.dampingFactor = .05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = {
|
|
19
|
+
LEFT: "ArrowLeft",
|
|
20
|
+
UP: "ArrowUp",
|
|
21
|
+
RIGHT: "ArrowRight",
|
|
22
|
+
BOTTOM: "ArrowDown"
|
|
23
|
+
}, this.mouseButtons = {
|
|
24
|
+
LEFT: v.ROTATE,
|
|
25
|
+
MIDDLE: v.DOLLY,
|
|
26
|
+
RIGHT: v.PAN
|
|
27
|
+
}, this.touches = {
|
|
28
|
+
ONE: S.ROTATE,
|
|
29
|
+
TWO: S.DOLLY_PAN
|
|
30
|
+
}, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new w(), this._lastQuaternion = new b(), this._lastTargetPosition = new w(), this._quat = new b().setFromUnitVectors(e.up, new w(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ue(), this._sphericalDelta = new ue(), this._scale = 1, this._panOffset = new w(), this._rotateStart = new C(), this._rotateEnd = new C(), this._rotateDelta = new C(), this._panStart = new C(), this._panEnd = new C(), this._panDelta = new C(), this._dollyStart = new C(), this._dollyEnd = new C(), this._dollyDelta = new C(), this._dollyDirection = new w(), this._mouse = new C(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = F.bind(this), this._onPointerDown = P.bind(this), this._onPointerUp = I.bind(this), this._onContextMenu = ge.bind(this), this._onMouseWheel = z.bind(this), this._onKeyDown = me.bind(this), this._onTouchStart = he.bind(this), this._onTouchMove = B.bind(this), this._onMouseDown = L.bind(this), this._onMouseMove = R.bind(this), this._interceptControlDown = _e.bind(this), this._interceptControlUp = V.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
31
|
+
}
|
|
32
|
+
set cursorStyle(e) {
|
|
33
|
+
this._cursorStyle = e, e === "grab" ? this.domElement.style.cursor = "grab" : this.domElement.style.cursor = "auto";
|
|
34
|
+
}
|
|
35
|
+
get cursorStyle() {
|
|
36
|
+
return this._cursorStyle;
|
|
37
|
+
}
|
|
38
|
+
connect(e) {
|
|
39
|
+
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.ownerDocument.addEventListener("keydown", this._interceptControlDown, {
|
|
40
|
+
passive: !0,
|
|
41
|
+
capture: !0
|
|
42
|
+
}), this.domElement.style.touchAction = "none";
|
|
43
|
+
}
|
|
44
|
+
disconnect() {
|
|
45
|
+
this.state = M.NONE, this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerUp), this.domElement.removeEventListener("wheel", this._onMouseWheel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.stopListenToKeyEvents(), this.domElement.ownerDocument.removeEventListener("keydown", this._interceptControlDown, { capture: !0 }), this.domElement.ownerDocument.removeEventListener("keyup", this._interceptControlUp, { capture: !0 }), this._controlActive = !1, this._pointers.length = 0, this._pointerPositions = {}, this.domElement.style.touchAction = "", this.domElement.style.cursor = "auto";
|
|
46
|
+
}
|
|
47
|
+
dispose() {
|
|
48
|
+
this.disconnect();
|
|
49
|
+
}
|
|
50
|
+
getPolarAngle() {
|
|
51
|
+
return this._spherical.phi;
|
|
52
|
+
}
|
|
53
|
+
getAzimuthalAngle() {
|
|
54
|
+
return this._spherical.theta;
|
|
55
|
+
}
|
|
56
|
+
getDistance() {
|
|
57
|
+
return this.object.position.distanceTo(this.target);
|
|
58
|
+
}
|
|
59
|
+
listenToKeyEvents(e) {
|
|
60
|
+
e.addEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = e;
|
|
61
|
+
}
|
|
62
|
+
stopListenToKeyEvents() {
|
|
63
|
+
this._domElementKeyEvents !== null && (this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = null);
|
|
64
|
+
}
|
|
65
|
+
saveState() {
|
|
66
|
+
this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
|
|
67
|
+
}
|
|
68
|
+
reset() {
|
|
69
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(T), this.update(), this.state = M.NONE;
|
|
70
|
+
}
|
|
71
|
+
pan(e, t) {
|
|
72
|
+
this._pan(e, t), this.update();
|
|
73
|
+
}
|
|
74
|
+
dollyIn(e) {
|
|
75
|
+
this._dollyIn(e), this.update();
|
|
76
|
+
}
|
|
77
|
+
dollyOut(e) {
|
|
78
|
+
this._dollyOut(e), this.update();
|
|
79
|
+
}
|
|
80
|
+
rotateLeft(e) {
|
|
81
|
+
this._rotateLeft(e), this.update();
|
|
82
|
+
}
|
|
83
|
+
rotateUp(e) {
|
|
84
|
+
this._rotateUp(e), this.update();
|
|
85
|
+
}
|
|
86
|
+
update(e = null) {
|
|
87
|
+
let t = this.object.position;
|
|
88
|
+
A.copy(t).sub(this.target), A.applyQuaternion(this._quat), this._spherical.setFromVector3(A), this.autoRotate && this.state === M.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
89
|
+
let n = this.minAzimuthAngle, r = this.maxAzimuthAngle;
|
|
90
|
+
isFinite(n) && isFinite(r) && (n < -Math.PI ? n += j : n > Math.PI && (n -= j), r < -Math.PI ? r += j : r > Math.PI && (r -= j), n <= r ? this._spherical.theta = Math.max(n, Math.min(r, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + r) / 2 ? Math.max(n, this._spherical.theta) : Math.min(r, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
91
|
+
let i = !1;
|
|
92
|
+
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera) this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
93
|
+
else {
|
|
94
|
+
let e = this._spherical.radius;
|
|
95
|
+
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), i = e != this._spherical.radius;
|
|
96
|
+
}
|
|
97
|
+
if (A.setFromSpherical(this._spherical), A.applyQuaternion(this._quatInverse), t.copy(this.target).add(A), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
|
|
98
|
+
let e = null;
|
|
99
|
+
if (this.object.isPerspectiveCamera) {
|
|
100
|
+
let t = A.length();
|
|
101
|
+
e = this._clampDistance(t * this._scale);
|
|
102
|
+
let n = t - e;
|
|
103
|
+
this.object.position.addScaledVector(this._dollyDirection, n), this.object.updateMatrixWorld(), i = !!n;
|
|
104
|
+
} else if (this.object.isOrthographicCamera) {
|
|
105
|
+
let t = new w(this._mouse.x, this._mouse.y, 0);
|
|
106
|
+
t.unproject(this.object);
|
|
107
|
+
let n = this.object.zoom;
|
|
108
|
+
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), i = n !== this.object.zoom;
|
|
109
|
+
let r = new w(this._mouse.x, this._mouse.y, 0);
|
|
110
|
+
r.unproject(this.object), this.object.position.sub(r).add(t), this.object.updateMatrixWorld(), e = A.length();
|
|
111
|
+
} else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
112
|
+
e !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position) : (O.origin.copy(this.object.position), O.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(O.direction)) < k ? this.object.lookAt(this.target) : (fe.setFromNormalAndCoplanarPoint(this.object.up, this.target), O.intersectPlane(fe, this.target))));
|
|
113
|
+
} else if (this.object.isOrthographicCamera) {
|
|
114
|
+
let e = this.object.zoom;
|
|
115
|
+
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), e !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
|
|
116
|
+
}
|
|
117
|
+
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > N || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > N || this._lastTargetPosition.distanceToSquared(this.target) > N ? (this.dispatchEvent(T), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
118
|
+
}
|
|
119
|
+
_getAutoRotationAngle(e) {
|
|
120
|
+
return e === null ? j / 60 / 60 * this.autoRotateSpeed : j / 60 * this.autoRotateSpeed * e;
|
|
121
|
+
}
|
|
122
|
+
_getZoomScale(e) {
|
|
123
|
+
let t = Math.abs(e * .01);
|
|
124
|
+
return .95 ** (this.zoomSpeed * t);
|
|
125
|
+
}
|
|
126
|
+
_rotateLeft(e) {
|
|
127
|
+
this._sphericalDelta.theta -= e;
|
|
128
|
+
}
|
|
129
|
+
_rotateUp(e) {
|
|
130
|
+
this._sphericalDelta.phi -= e;
|
|
131
|
+
}
|
|
132
|
+
_panLeft(e, t) {
|
|
133
|
+
A.setFromMatrixColumn(t, 0), A.multiplyScalar(-e), this._panOffset.add(A);
|
|
134
|
+
}
|
|
135
|
+
_panUp(e, t) {
|
|
136
|
+
this.screenSpacePanning === !0 ? A.setFromMatrixColumn(t, 1) : (A.setFromMatrixColumn(t, 0), A.crossVectors(this.object.up, A)), A.multiplyScalar(e), this._panOffset.add(A);
|
|
137
|
+
}
|
|
138
|
+
_pan(e, t) {
|
|
139
|
+
let n = this.domElement;
|
|
140
|
+
if (this.object.isPerspectiveCamera) {
|
|
141
|
+
let r = this.object.position;
|
|
142
|
+
A.copy(r).sub(this.target);
|
|
143
|
+
let i = A.length();
|
|
144
|
+
i *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * i / n.clientHeight, this.object.matrix), this._panUp(2 * t * i / n.clientHeight, this.object.matrix);
|
|
145
|
+
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / n.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / n.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
|
|
146
|
+
}
|
|
147
|
+
_dollyOut(e) {
|
|
148
|
+
this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
|
|
149
|
+
}
|
|
150
|
+
_dollyIn(e) {
|
|
151
|
+
this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale *= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
|
|
152
|
+
}
|
|
153
|
+
_updateZoomParameters(e, t) {
|
|
154
|
+
if (!this.zoomToCursor) return;
|
|
155
|
+
this._performCursorZoom = !0;
|
|
156
|
+
let n = this.domElement.getBoundingClientRect(), r = e - n.left, i = t - n.top, a = n.width, o = n.height;
|
|
157
|
+
this._mouse.x = r / a * 2 - 1, this._mouse.y = -(i / o) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
|
|
158
|
+
}
|
|
159
|
+
_clampDistance(e) {
|
|
160
|
+
return Math.max(this.minDistance, Math.min(this.maxDistance, e));
|
|
161
|
+
}
|
|
162
|
+
_handleMouseDownRotate(e) {
|
|
163
|
+
this._rotateStart.set(e.clientX, e.clientY);
|
|
164
|
+
}
|
|
165
|
+
_handleMouseDownDolly(e) {
|
|
166
|
+
this._updateZoomParameters(e.clientX, e.clientY), this._dollyStart.set(e.clientX, e.clientY);
|
|
167
|
+
}
|
|
168
|
+
_handleMouseDownPan(e) {
|
|
169
|
+
this._panStart.set(e.clientX, e.clientY);
|
|
170
|
+
}
|
|
171
|
+
_handleMouseMoveRotate(e) {
|
|
172
|
+
this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
173
|
+
let t = this.domElement;
|
|
174
|
+
this._rotateLeft(j * this._rotateDelta.x / t.clientHeight), this._rotateUp(j * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
|
|
175
|
+
}
|
|
176
|
+
_handleMouseMoveDolly(e) {
|
|
177
|
+
this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.zoomToCursor && (this._performCursorZoom = !0, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize()), this.update();
|
|
178
|
+
}
|
|
179
|
+
_handleMouseMovePan(e) {
|
|
180
|
+
this._panEnd.set(e.clientX, e.clientY), this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd), this.update();
|
|
181
|
+
}
|
|
182
|
+
_handleMouseWheel(e) {
|
|
183
|
+
this._updateZoomParameters(e.clientX, e.clientY), e.deltaY < 0 ? this._dollyIn(this._getZoomScale(e.deltaY)) : e.deltaY > 0 && this._dollyOut(this._getZoomScale(e.deltaY)), this.update();
|
|
184
|
+
}
|
|
185
|
+
_handleKeyDown(e) {
|
|
186
|
+
let t = !1;
|
|
187
|
+
switch (e.code) {
|
|
188
|
+
case this.keys.UP:
|
|
189
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(j * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
|
|
190
|
+
break;
|
|
191
|
+
case this.keys.BOTTOM:
|
|
192
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-j * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
|
|
193
|
+
break;
|
|
194
|
+
case this.keys.LEFT:
|
|
195
|
+
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(j * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
|
|
196
|
+
break;
|
|
197
|
+
case this.keys.RIGHT: e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-j * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
|
|
198
|
+
}
|
|
199
|
+
t && (e.preventDefault(), this.update());
|
|
200
|
+
}
|
|
201
|
+
_handleTouchStartRotate(e) {
|
|
202
|
+
if (this._pointers.length === 1) this._rotateStart.set(e.pageX, e.pageY);
|
|
203
|
+
else {
|
|
204
|
+
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
205
|
+
this._rotateStart.set(n, r);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
_handleTouchStartPan(e) {
|
|
209
|
+
if (this._pointers.length === 1) this._panStart.set(e.pageX, e.pageY);
|
|
210
|
+
else {
|
|
211
|
+
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
212
|
+
this._panStart.set(n, r);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
_handleTouchStartDolly(e) {
|
|
216
|
+
let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
|
|
217
|
+
this._dollyStart.set(0, i);
|
|
218
|
+
}
|
|
219
|
+
_handleTouchStartDollyPan(e) {
|
|
220
|
+
this.enableZoom && this._handleTouchStartDolly(e), this.enablePan && this._handleTouchStartPan(e);
|
|
221
|
+
}
|
|
222
|
+
_handleTouchStartDollyRotate(e) {
|
|
223
|
+
this.enableZoom && this._handleTouchStartDolly(e), this.enableRotate && this._handleTouchStartRotate(e);
|
|
224
|
+
}
|
|
225
|
+
_handleTouchMoveRotate(e) {
|
|
226
|
+
if (this._pointers.length == 1) this._rotateEnd.set(e.pageX, e.pageY);
|
|
227
|
+
else {
|
|
228
|
+
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
229
|
+
this._rotateEnd.set(n, r);
|
|
230
|
+
}
|
|
231
|
+
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
232
|
+
let t = this.domElement;
|
|
233
|
+
this._rotateLeft(j * this._rotateDelta.x / t.clientHeight), this._rotateUp(j * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
|
|
234
|
+
}
|
|
235
|
+
_handleTouchMovePan(e) {
|
|
236
|
+
if (this._pointers.length === 1) this._panEnd.set(e.pageX, e.pageY);
|
|
237
|
+
else {
|
|
238
|
+
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
239
|
+
this._panEnd.set(n, r);
|
|
240
|
+
}
|
|
241
|
+
this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
|
|
242
|
+
}
|
|
243
|
+
_handleTouchMoveDolly(e) {
|
|
244
|
+
let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
|
|
245
|
+
this._dollyEnd.set(0, i), this._dollyDelta.set(0, (this._dollyEnd.y / this._dollyStart.y) ** +this.zoomSpeed), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
|
|
246
|
+
let a = (e.pageX + t.x) * .5, o = (e.pageY + t.y) * .5;
|
|
247
|
+
this._updateZoomParameters(a, o);
|
|
248
|
+
}
|
|
249
|
+
_handleTouchMoveDollyPan(e) {
|
|
250
|
+
this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
|
|
251
|
+
}
|
|
252
|
+
_handleTouchMoveDollyRotate(e) {
|
|
253
|
+
this.enableZoom && this._handleTouchMoveDolly(e), this.enableRotate && this._handleTouchMoveRotate(e);
|
|
254
|
+
}
|
|
255
|
+
_addPointer(e) {
|
|
256
|
+
this._pointers.push(e.pointerId);
|
|
257
|
+
}
|
|
258
|
+
_removePointer(e) {
|
|
259
|
+
delete this._pointerPositions[e.pointerId];
|
|
260
|
+
for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) {
|
|
261
|
+
this._pointers.splice(t, 1);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
_isTrackingPointer(e) {
|
|
266
|
+
for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) return !0;
|
|
267
|
+
return !1;
|
|
268
|
+
}
|
|
269
|
+
_trackPointer(e) {
|
|
270
|
+
let t = this._pointerPositions[e.pointerId];
|
|
271
|
+
t === void 0 && (t = new C(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
|
|
272
|
+
}
|
|
273
|
+
_getSecondPointerPosition(e) {
|
|
274
|
+
let t = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
275
|
+
return this._pointerPositions[t];
|
|
276
|
+
}
|
|
277
|
+
_customWheelEvent(e) {
|
|
278
|
+
let t = e.deltaMode, n = {
|
|
279
|
+
clientX: e.clientX,
|
|
280
|
+
clientY: e.clientY,
|
|
281
|
+
deltaY: e.deltaY
|
|
282
|
+
};
|
|
283
|
+
switch (t) {
|
|
284
|
+
case 1:
|
|
285
|
+
n.deltaY *= 16;
|
|
286
|
+
break;
|
|
287
|
+
case 2: n.deltaY *= 100;
|
|
288
|
+
}
|
|
289
|
+
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
function P(e) {
|
|
293
|
+
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), this._isTrackingPointer(e) || (this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e), this._cursorStyle === "grab" && (this.domElement.style.cursor = "grabbing")));
|
|
294
|
+
}
|
|
295
|
+
function F(e) {
|
|
296
|
+
this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
|
|
297
|
+
}
|
|
298
|
+
function I(e) {
|
|
299
|
+
switch (this._removePointer(e), this._pointers.length) {
|
|
300
|
+
case 0:
|
|
301
|
+
this.domElement.releasePointerCapture(e.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(D), this.state = M.NONE, this._cursorStyle === "grab" && (this.domElement.style.cursor = "grab");
|
|
302
|
+
break;
|
|
303
|
+
case 1:
|
|
304
|
+
let t = this._pointers[0], n = this._pointerPositions[t];
|
|
305
|
+
this._onTouchStart({
|
|
306
|
+
pointerId: t,
|
|
307
|
+
pageX: n.x,
|
|
308
|
+
pageY: n.y
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function L(e) {
|
|
313
|
+
let t;
|
|
314
|
+
switch (e.button) {
|
|
315
|
+
case 0:
|
|
316
|
+
t = this.mouseButtons.LEFT;
|
|
317
|
+
break;
|
|
318
|
+
case 1:
|
|
319
|
+
t = this.mouseButtons.MIDDLE;
|
|
320
|
+
break;
|
|
321
|
+
case 2:
|
|
322
|
+
t = this.mouseButtons.RIGHT;
|
|
323
|
+
break;
|
|
324
|
+
default: t = -1;
|
|
325
|
+
}
|
|
326
|
+
switch (t) {
|
|
327
|
+
case v.DOLLY:
|
|
328
|
+
if (this.enableZoom === !1) return;
|
|
329
|
+
this._handleMouseDownDolly(e), this.state = M.DOLLY;
|
|
330
|
+
break;
|
|
331
|
+
case v.ROTATE:
|
|
332
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
333
|
+
if (this.enablePan === !1) return;
|
|
334
|
+
this._handleMouseDownPan(e), this.state = M.PAN;
|
|
335
|
+
} else {
|
|
336
|
+
if (this.enableRotate === !1) return;
|
|
337
|
+
this._handleMouseDownRotate(e), this.state = M.ROTATE;
|
|
338
|
+
}
|
|
339
|
+
break;
|
|
340
|
+
case v.PAN:
|
|
341
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
342
|
+
if (this.enableRotate === !1) return;
|
|
343
|
+
this._handleMouseDownRotate(e), this.state = M.ROTATE;
|
|
344
|
+
} else {
|
|
345
|
+
if (this.enablePan === !1) return;
|
|
346
|
+
this._handleMouseDownPan(e), this.state = M.PAN;
|
|
347
|
+
}
|
|
348
|
+
break;
|
|
349
|
+
default: this.state = M.NONE;
|
|
350
|
+
}
|
|
351
|
+
this.state !== M.NONE && this.dispatchEvent(E);
|
|
352
|
+
}
|
|
353
|
+
function R(e) {
|
|
354
|
+
switch (this.state) {
|
|
355
|
+
case M.ROTATE:
|
|
356
|
+
if (this.enableRotate === !1) return;
|
|
357
|
+
this._handleMouseMoveRotate(e);
|
|
358
|
+
break;
|
|
359
|
+
case M.DOLLY:
|
|
360
|
+
if (this.enableZoom === !1) return;
|
|
361
|
+
this._handleMouseMoveDolly(e);
|
|
362
|
+
break;
|
|
363
|
+
case M.PAN:
|
|
364
|
+
if (this.enablePan === !1) return;
|
|
365
|
+
this._handleMouseMovePan(e);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function z(e) {
|
|
369
|
+
this.enabled !== !1 && this.enableZoom !== !1 && this.state === M.NONE && (e.preventDefault(), this.dispatchEvent(E), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(D));
|
|
370
|
+
}
|
|
371
|
+
function me(e) {
|
|
372
|
+
this.enabled !== !1 && this._handleKeyDown(e);
|
|
373
|
+
}
|
|
374
|
+
function he(e) {
|
|
375
|
+
switch (this._trackPointer(e), this._pointers.length) {
|
|
376
|
+
case 1:
|
|
377
|
+
switch (this.touches.ONE) {
|
|
378
|
+
case S.ROTATE:
|
|
379
|
+
if (this.enableRotate === !1) {
|
|
380
|
+
this.state = M.NONE;
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
this._handleTouchStartRotate(e), this.state = M.TOUCH_ROTATE;
|
|
384
|
+
break;
|
|
385
|
+
case S.PAN:
|
|
386
|
+
if (this.enablePan === !1) {
|
|
387
|
+
this.state = M.NONE;
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
this._handleTouchStartPan(e), this.state = M.TOUCH_PAN;
|
|
391
|
+
break;
|
|
392
|
+
default: this.state = M.NONE;
|
|
393
|
+
}
|
|
394
|
+
break;
|
|
395
|
+
case 2:
|
|
396
|
+
switch (this.touches.TWO) {
|
|
397
|
+
case S.DOLLY_PAN:
|
|
398
|
+
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
399
|
+
this._handleTouchStartDollyPan(e), this.state = M.TOUCH_DOLLY_PAN;
|
|
400
|
+
break;
|
|
401
|
+
case S.DOLLY_ROTATE:
|
|
402
|
+
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
403
|
+
this._handleTouchStartDollyRotate(e), this.state = M.TOUCH_DOLLY_ROTATE;
|
|
404
|
+
break;
|
|
405
|
+
default: this.state = M.NONE;
|
|
406
|
+
}
|
|
407
|
+
break;
|
|
408
|
+
default: this.state = M.NONE;
|
|
409
|
+
}
|
|
410
|
+
this.state !== M.NONE && this.dispatchEvent(E);
|
|
411
|
+
}
|
|
412
|
+
function B(e) {
|
|
413
|
+
switch (this._trackPointer(e), this.state) {
|
|
414
|
+
case M.TOUCH_ROTATE:
|
|
415
|
+
if (this.enableRotate === !1) return;
|
|
416
|
+
this._handleTouchMoveRotate(e), this.update();
|
|
417
|
+
break;
|
|
418
|
+
case M.TOUCH_PAN:
|
|
419
|
+
if (this.enablePan === !1) return;
|
|
420
|
+
this._handleTouchMovePan(e), this.update();
|
|
421
|
+
break;
|
|
422
|
+
case M.TOUCH_DOLLY_PAN:
|
|
423
|
+
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
424
|
+
this._handleTouchMoveDollyPan(e), this.update();
|
|
425
|
+
break;
|
|
426
|
+
case M.TOUCH_DOLLY_ROTATE:
|
|
427
|
+
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
428
|
+
this._handleTouchMoveDollyRotate(e), this.update();
|
|
429
|
+
break;
|
|
430
|
+
default: this.state = M.NONE;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function ge(e) {
|
|
434
|
+
this.enabled !== !1 && e.preventDefault();
|
|
435
|
+
}
|
|
436
|
+
function _e(e) {
|
|
437
|
+
e.key === "Control" && (this._controlActive = !0, this.domElement.ownerDocument.addEventListener("keyup", this._interceptControlUp, {
|
|
438
|
+
passive: !0,
|
|
439
|
+
capture: !0
|
|
440
|
+
}));
|
|
441
|
+
}
|
|
442
|
+
function V(e) {
|
|
443
|
+
e.key === "Control" && (this._controlActive = !1, this.domElement.ownerDocument.removeEventListener("keyup", this._interceptControlUp, {
|
|
444
|
+
passive: !0,
|
|
445
|
+
capture: !0
|
|
446
|
+
}));
|
|
447
|
+
}
|
|
448
|
+
var ve = de({
|
|
449
|
+
en: {
|
|
450
|
+
untitled: "Solid model",
|
|
451
|
+
viewIso: "3D",
|
|
452
|
+
viewTop: "Top",
|
|
453
|
+
viewFront: "Front",
|
|
454
|
+
viewRight: "Right",
|
|
455
|
+
edges: "Edges",
|
|
456
|
+
noMesh: "This result has no model to show.",
|
|
457
|
+
noWebgl: "The 3D view is not available in this browser.",
|
|
458
|
+
size: "Size",
|
|
459
|
+
volume: "Volume",
|
|
460
|
+
surface: "Surface",
|
|
461
|
+
solids: "Solids",
|
|
462
|
+
faces: "Faces",
|
|
463
|
+
edgeKinds: "Edges",
|
|
464
|
+
parts: "Parts",
|
|
465
|
+
operations: "Operations",
|
|
466
|
+
line: "line",
|
|
467
|
+
selectedOf: "selected {selected} of {available}",
|
|
468
|
+
selected: "selected {selected}",
|
|
469
|
+
warnings: "Warnings",
|
|
470
|
+
files: "Files",
|
|
471
|
+
fileScript: "Script",
|
|
472
|
+
fileStep: "STEP",
|
|
473
|
+
fileStl: "STL",
|
|
474
|
+
fileDrawings: "Drawings",
|
|
475
|
+
download: "Download",
|
|
476
|
+
script: "Script",
|
|
477
|
+
copy: "Copy",
|
|
478
|
+
copied: "Copied",
|
|
479
|
+
resizeModel: "Resize the 3D view"
|
|
480
|
+
},
|
|
481
|
+
ja: {
|
|
482
|
+
untitled: "ソリッドモデル",
|
|
483
|
+
viewIso: "3D",
|
|
484
|
+
viewTop: "上面",
|
|
485
|
+
viewFront: "正面",
|
|
486
|
+
viewRight: "右側面",
|
|
487
|
+
edges: "稜線",
|
|
488
|
+
noMesh: "この結果には表示できるモデルがありません。",
|
|
489
|
+
noWebgl: "このブラウザでは3D表示を利用できません。",
|
|
490
|
+
size: "寸法",
|
|
491
|
+
volume: "体積",
|
|
492
|
+
surface: "表面積",
|
|
493
|
+
solids: "ソリッド数",
|
|
494
|
+
faces: "面",
|
|
495
|
+
edgeKinds: "稜線",
|
|
496
|
+
parts: "部品",
|
|
497
|
+
operations: "操作",
|
|
498
|
+
line: "行",
|
|
499
|
+
selectedOf: "{available} 中 {selected} を選択",
|
|
500
|
+
selected: "{selected} を選択",
|
|
501
|
+
warnings: "警告",
|
|
502
|
+
files: "ファイル",
|
|
503
|
+
fileScript: "スクリプト",
|
|
504
|
+
fileStep: "STEP",
|
|
505
|
+
fileStl: "STL",
|
|
506
|
+
fileDrawings: "図面",
|
|
507
|
+
download: "ダウンロード",
|
|
508
|
+
script: "スクリプト",
|
|
509
|
+
copy: "コピー",
|
|
510
|
+
copied: "コピーしました",
|
|
511
|
+
resizeModel: "3Dビューの高さを変更"
|
|
512
|
+
}
|
|
513
|
+
}), H = 12832988, U = 2042167;
|
|
514
|
+
function ye(e) {
|
|
515
|
+
let t = new _.BufferGeometry();
|
|
516
|
+
t.setAttribute("position", new _.BufferAttribute(e.positions, 3)), t.setAttribute("normal", new _.BufferAttribute(e.normals, 3)), t.setIndex(new _.BufferAttribute(e.indices, 1));
|
|
517
|
+
let n = new _.MeshStandardMaterial({
|
|
518
|
+
color: H,
|
|
519
|
+
metalness: .1,
|
|
520
|
+
roughness: .65,
|
|
521
|
+
side: _.DoubleSide,
|
|
522
|
+
polygonOffset: !0,
|
|
523
|
+
polygonOffsetFactor: 1,
|
|
524
|
+
polygonOffsetUnits: 1
|
|
525
|
+
}), r = new _.BufferGeometry();
|
|
526
|
+
r.setAttribute("position", new _.BufferAttribute(e.edges, 3));
|
|
527
|
+
let i = new _.LineBasicMaterial({ color: U });
|
|
528
|
+
return {
|
|
529
|
+
faces: new _.Mesh(t, n),
|
|
530
|
+
edges: new _.LineSegments(r, i),
|
|
531
|
+
dispose() {
|
|
532
|
+
t.dispose(), n.dispose(), r.dispose(), i.dispose();
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
var W = {
|
|
537
|
+
iso: [
|
|
538
|
+
1,
|
|
539
|
+
-1.2,
|
|
540
|
+
.9
|
|
541
|
+
],
|
|
542
|
+
top: [
|
|
543
|
+
0,
|
|
544
|
+
-.001,
|
|
545
|
+
1
|
|
546
|
+
],
|
|
547
|
+
front: [
|
|
548
|
+
0,
|
|
549
|
+
-1,
|
|
550
|
+
0
|
|
551
|
+
],
|
|
552
|
+
right: [
|
|
553
|
+
1,
|
|
554
|
+
0,
|
|
555
|
+
0
|
|
556
|
+
]
|
|
557
|
+
}, be = 1.02;
|
|
558
|
+
function xe(e, t, n, r, i) {
|
|
559
|
+
let a = [
|
|
560
|
+
(e[0] + t[0]) / 2,
|
|
561
|
+
(e[1] + t[1]) / 2,
|
|
562
|
+
(e[2] + t[2]) / 2
|
|
563
|
+
], o = Math.hypot(t[0] - e[0], t[1] - e[1], t[2] - e[2]) / 2 || 1, s = r * Math.PI / 360, c = Math.atan(Math.tan(s) * i), l = o * be / Math.sin(Math.min(s, c)), u = W[n], d = Math.hypot(...u);
|
|
564
|
+
return {
|
|
565
|
+
position: [
|
|
566
|
+
a[0] + u[0] / d * l,
|
|
567
|
+
a[1] + u[1] / d * l,
|
|
568
|
+
a[2] + u[2] / d * l
|
|
569
|
+
],
|
|
570
|
+
target: a,
|
|
571
|
+
distance: l,
|
|
572
|
+
radius: o
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
var G = .6;
|
|
576
|
+
function Se(e, t) {
|
|
577
|
+
if (!Number.isFinite(t) || t <= 0) return 0;
|
|
578
|
+
if (t < 168) return Math.round(t / 2);
|
|
579
|
+
let n = e === null || !Number.isFinite(e) ? t * G : e;
|
|
580
|
+
return Math.round(Math.min(Math.max(n, 96), t - 72));
|
|
581
|
+
}
|
|
582
|
+
var Ce = "@gui-chat-plugin/brep:modelHeight";
|
|
583
|
+
function we() {
|
|
584
|
+
try {
|
|
585
|
+
let e = globalThis.localStorage?.getItem(Ce);
|
|
586
|
+
if (!e) return null;
|
|
587
|
+
let t = Number(e);
|
|
588
|
+
return Number.isFinite(t) && t > 0 ? t : null;
|
|
589
|
+
} catch {
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function Te(e) {
|
|
594
|
+
try {
|
|
595
|
+
globalThis.localStorage?.setItem(Ce, String(Math.round(e)));
|
|
596
|
+
} catch {}
|
|
597
|
+
}
|
|
598
|
+
// src/vue/View.vue?vue&type=script&setup=true&lang.ts
|
|
599
|
+
var Ee = ["title"], De = {
|
|
600
|
+
class: "flex items-center gap-1",
|
|
601
|
+
"data-testid": "brep-toolbar"
|
|
602
|
+
}, Oe = [
|
|
603
|
+
"aria-pressed",
|
|
604
|
+
"data-testid",
|
|
605
|
+
"onClick"
|
|
606
|
+
], ke = { class: "ml-2 flex h-8 cursor-pointer items-center gap-1.5 text-[var(--brep-text-2)]" }, Ae = {
|
|
607
|
+
key: 0,
|
|
608
|
+
class: "absolute inset-0 flex items-center justify-center p-4 text-center text-[var(--brep-muted)]",
|
|
609
|
+
"data-testid": "brep-viewport-message"
|
|
610
|
+
}, je = [
|
|
611
|
+
"aria-label",
|
|
612
|
+
"aria-valuenow",
|
|
613
|
+
"aria-valuemax"
|
|
614
|
+
], Me = {
|
|
615
|
+
class: "brep-below",
|
|
616
|
+
"data-testid": "brep-below"
|
|
617
|
+
}, Ne = {
|
|
618
|
+
key: 0,
|
|
619
|
+
class: "p-3",
|
|
620
|
+
"data-testid": "brep-report"
|
|
621
|
+
}, Pe = {
|
|
622
|
+
key: 0,
|
|
623
|
+
class: "mb-3 rounded border border-[var(--brep-warn-border)] bg-[var(--brep-warn-bg)] p-2 text-[var(--brep-warn)]",
|
|
624
|
+
"data-testid": "brep-warnings"
|
|
625
|
+
}, Fe = { class: "font-semibold" }, Ie = { class: "mt-1 list-disc pl-4" }, Le = { class: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1" }, Re = { class: "text-[var(--brep-muted)]" }, ze = {
|
|
626
|
+
class: "tabular-nums",
|
|
627
|
+
"data-testid": "brep-size"
|
|
628
|
+
}, Be = { class: "text-[var(--brep-muted)]" }, Ve = { class: "tabular-nums" }, He = { class: "text-[var(--brep-muted)]" }, Ue = { class: "tabular-nums" }, We = { class: "text-[var(--brep-muted)]" }, Ge = { class: "tabular-nums" }, Ke = { class: "text-[var(--brep-muted)]" }, qe = { "data-testid": "brep-faces" }, Je = { class: "text-[var(--brep-muted)]" }, Ye = { class: "mt-4 font-semibold text-[var(--brep-strong)]" }, Xe = { class: "mt-1 space-y-0.5" }, Ze = { class: "mt-4 font-semibold text-[var(--brep-strong)]" }, Qe = {
|
|
629
|
+
class: "mt-1 space-y-1",
|
|
630
|
+
"data-testid": "brep-operations"
|
|
631
|
+
}, $e = {
|
|
632
|
+
key: 0,
|
|
633
|
+
class: "w-12 shrink-0 text-xs tabular-nums text-[var(--brep-faint)]"
|
|
634
|
+
}, et = { class: "font-mono text-[var(--brep-strong)]" }, tt = {
|
|
635
|
+
key: 1,
|
|
636
|
+
class: "text-[var(--brep-muted)]"
|
|
637
|
+
}, nt = {
|
|
638
|
+
key: 2,
|
|
639
|
+
class: "ml-auto tabular-nums text-[var(--brep-muted)]"
|
|
640
|
+
}, rt = { class: "mt-4 font-semibold text-[var(--brep-strong)]" }, it = {
|
|
641
|
+
class: "mt-1 flex flex-wrap gap-2",
|
|
642
|
+
"data-testid": "brep-files"
|
|
643
|
+
}, at = [
|
|
644
|
+
"title",
|
|
645
|
+
"data-testid",
|
|
646
|
+
"onClick"
|
|
647
|
+
], ot = {
|
|
648
|
+
key: 1,
|
|
649
|
+
class: "border-t border-[var(--brep-border)]",
|
|
650
|
+
"data-testid": "brep-script"
|
|
651
|
+
}, st = { class: "flex cursor-pointer items-center gap-2 px-3 py-2 text-[var(--brep-text-2)]" }, ct = { class: "mr-auto" }, lt = { class: "overflow-x-auto bg-[var(--brep-code)] px-3 py-2 font-mono text-xs leading-5 text-[var(--brep-text)]" }, ut = 35, K = /*#__PURE__*/ ((e, t) => {
|
|
652
|
+
let n = e.__vccOpts || e;
|
|
653
|
+
for (let [e, r] of t) n[e] = r;
|
|
654
|
+
return n;
|
|
655
|
+
})(/* @__PURE__ */ d({
|
|
656
|
+
__name: "View",
|
|
657
|
+
props: { selectedResult: {} },
|
|
658
|
+
setup(t) {
|
|
659
|
+
let r = t, d = ve(), ce = [
|
|
660
|
+
"iso",
|
|
661
|
+
"top",
|
|
662
|
+
"front",
|
|
663
|
+
"right"
|
|
664
|
+
], v = {
|
|
665
|
+
iso: "viewIso",
|
|
666
|
+
top: "viewTop",
|
|
667
|
+
front: "viewFront",
|
|
668
|
+
right: "viewRight"
|
|
669
|
+
}, le = o(() => r.selectedResult.title || d.value.untitled), y = o(() => r.selectedResult.data?.report), b = o(() => r.selectedResult.data?.script ?? ""), x = o(() => {
|
|
670
|
+
let e = r.selectedResult.data?.mesh;
|
|
671
|
+
return n(e) ? e : null;
|
|
672
|
+
}), ue = o(() => {
|
|
673
|
+
let e = r.selectedResult.data?.downloads, t = e?.name ?? "model", n = [];
|
|
674
|
+
return b.value && n.push({
|
|
675
|
+
kind: "script",
|
|
676
|
+
label: d.value.fileScript,
|
|
677
|
+
fileName: `${t}.replicad.js`,
|
|
678
|
+
type: "text/javascript",
|
|
679
|
+
content: { text: b.value }
|
|
680
|
+
}), e && n.push({
|
|
681
|
+
kind: "step",
|
|
682
|
+
label: d.value.fileStep,
|
|
683
|
+
fileName: `${t}.step`,
|
|
684
|
+
type: "model/step",
|
|
685
|
+
content: { packed: e.step }
|
|
686
|
+
}, {
|
|
687
|
+
kind: "stl",
|
|
688
|
+
label: d.value.fileStl,
|
|
689
|
+
fileName: `${t}.stl`,
|
|
690
|
+
type: "model/stl",
|
|
691
|
+
content: { packed: e.stl }
|
|
692
|
+
}, {
|
|
693
|
+
kind: "views",
|
|
694
|
+
label: d.value.fileDrawings,
|
|
695
|
+
fileName: `${t}.svg`,
|
|
696
|
+
type: "image/svg+xml",
|
|
697
|
+
content: { packed: e.views }
|
|
698
|
+
}), n;
|
|
699
|
+
});
|
|
700
|
+
async function S(t) {
|
|
701
|
+
let n;
|
|
702
|
+
try {
|
|
703
|
+
n = "text" in t.content ? t.content.text : await e(t.content.packed);
|
|
704
|
+
} catch {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
let r = URL.createObjectURL(new Blob([n], { type: t.type })), i = document.createElement("a");
|
|
708
|
+
i.href = r, i.download = t.fileName, i.click(), setTimeout(() => URL.revokeObjectURL(r), 1e4);
|
|
709
|
+
}
|
|
710
|
+
let C = (e) => Number.isFinite(e) ? e.toLocaleString("en-US") : "–", w = (e) => `${e > 0 ? "+" : e < 0 ? "−" : ""}${C(Math.abs(e))}`, de = (e) => Object.entries(e).sort(([, e], [, t]) => t - e).map(([e, t]) => `${t} ${e}`).join(", ");
|
|
711
|
+
function T(e) {
|
|
712
|
+
if (e.selected === void 0) return "";
|
|
713
|
+
let t = String(e.selected);
|
|
714
|
+
return e.count === 1 && e.available !== void 0 ? d.value.selectedOf.replace("{selected}", t).replace("{available}", String(e.available)) : d.value.selected.replace("{selected}", t);
|
|
715
|
+
}
|
|
716
|
+
let E = p(null), D, O = !1;
|
|
717
|
+
async function fe(e, t) {
|
|
718
|
+
try {
|
|
719
|
+
await navigator.clipboard.writeText(e);
|
|
720
|
+
} catch {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
O || (E.value = t, clearTimeout(D), D = setTimeout(() => E.value = null, 1500));
|
|
724
|
+
}
|
|
725
|
+
let k = p(null), A = p(null), j = p(null), M = p(we()), N = p(0), P = o(() => Se(M.value, N.value)), F = p(!1), I = null, L = null;
|
|
726
|
+
function R() {
|
|
727
|
+
k.value && (N.value = k.value.clientHeight - (A.value?.offsetHeight ?? 0) - (j.value?.offsetHeight ?? 0));
|
|
728
|
+
}
|
|
729
|
+
function z(e) {
|
|
730
|
+
M.value = Se(e, N.value), Te(M.value);
|
|
731
|
+
}
|
|
732
|
+
function me(e) {
|
|
733
|
+
e.button === 0 && (L = {
|
|
734
|
+
y: e.clientY,
|
|
735
|
+
height: P.value
|
|
736
|
+
}, F.value = !0, j.value?.setPointerCapture(e.pointerId), e.preventDefault());
|
|
737
|
+
}
|
|
738
|
+
function he(e) {
|
|
739
|
+
L && z(L.height + e.clientY - L.y);
|
|
740
|
+
}
|
|
741
|
+
function B() {
|
|
742
|
+
L = null, F.value = !1;
|
|
743
|
+
}
|
|
744
|
+
function ge(e) {
|
|
745
|
+
let t = {
|
|
746
|
+
ArrowUp: P.value - 24,
|
|
747
|
+
ArrowDown: P.value + 24,
|
|
748
|
+
Home: 0,
|
|
749
|
+
End: N.value
|
|
750
|
+
}[e.key];
|
|
751
|
+
t !== void 0 && (e.preventDefault(), z(t));
|
|
752
|
+
}
|
|
753
|
+
function _e() {
|
|
754
|
+
M.value = null;
|
|
755
|
+
try {
|
|
756
|
+
globalThis.localStorage?.removeItem(Ce);
|
|
757
|
+
} catch {}
|
|
758
|
+
}
|
|
759
|
+
let V = p(null), H = p(!0), U = p("iso"), W = p(!1), be = o(() => x.value ? W.value ? d.value.noWebgl : "" : d.value.noMesh), G = null, K = null, q = null, J = null, Y = null, X = null, Z = 0;
|
|
760
|
+
function Q() {
|
|
761
|
+
Z &&= (cancelAnimationFrame(Z), 0), G && K && q && G.render(K, q);
|
|
762
|
+
}
|
|
763
|
+
function dt() {
|
|
764
|
+
!Z && G && (Z = requestAnimationFrame(() => {
|
|
765
|
+
Z = 0, Q();
|
|
766
|
+
}));
|
|
767
|
+
}
|
|
768
|
+
function ft() {
|
|
769
|
+
let e = V.value;
|
|
770
|
+
if (!e || G) return;
|
|
771
|
+
try {
|
|
772
|
+
G = new _.WebGLRenderer({
|
|
773
|
+
antialias: !0,
|
|
774
|
+
alpha: !0
|
|
775
|
+
});
|
|
776
|
+
} catch {
|
|
777
|
+
W.value = !0;
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
G.setPixelRatio(window.devicePixelRatio), G.setClearColor(0, 0), e.appendChild(G.domElement), K = new _.Scene(), q = new _.PerspectiveCamera(ut, 1, .1, 1e3), q.up.set(0, 0, 1);
|
|
781
|
+
let t = new _.DirectionalLight(16777215, 1.5);
|
|
782
|
+
t.position.set(-.5, .8, 1), q.add(t), K.add(q), K.add(new _.HemisphereLight(16777215, 7831692, 2.2)), J = new pe(q, G.domElement), J.addEventListener("change", dt), J.addEventListener("start", () => U.value = null), X = new ResizeObserver(pt), X.observe(e), pt();
|
|
783
|
+
}
|
|
784
|
+
function pt() {
|
|
785
|
+
let e = V.value;
|
|
786
|
+
if (!e || !G || !q) return;
|
|
787
|
+
let t = e.clientWidth, n = e.clientHeight;
|
|
788
|
+
t !== 0 && n !== 0 && (G.setSize(t, n), q.aspect = t / n, q.updateProjectionMatrix(), U.value ? $(U.value) : Q());
|
|
789
|
+
}
|
|
790
|
+
function $(e) {
|
|
791
|
+
U.value = e;
|
|
792
|
+
let t = x.value;
|
|
793
|
+
if (!t || !q || !J) return;
|
|
794
|
+
let n = xe(t.min, t.max, e, ut, q.aspect);
|
|
795
|
+
q.position.set(...n.position), q.near = n.distance / 100, q.far = n.distance + n.radius * 10, q.updateProjectionMatrix(), J.target.set(...n.target), J.update(), Q();
|
|
796
|
+
}
|
|
797
|
+
function mt() {
|
|
798
|
+
if (!K) return;
|
|
799
|
+
Y &&= (K.remove(Y.faces, Y.edges), Y.dispose(), null);
|
|
800
|
+
let e = x.value;
|
|
801
|
+
e ? (Y = ye(i(e)), Y.edges.visible = H.value, K.add(Y.faces, Y.edges), $("iso")) : Q();
|
|
802
|
+
}
|
|
803
|
+
return ne(() => {
|
|
804
|
+
k.value && (I = new ResizeObserver(R), I.observe(k.value), A.value && I.observe(A.value)), R(), ft(), mt();
|
|
805
|
+
}), ae(x, mt), ae(H, (e) => {
|
|
806
|
+
Y && (Y.edges.visible = e), Q();
|
|
807
|
+
}), re(() => {
|
|
808
|
+
O = !0, clearTimeout(D), Z && cancelAnimationFrame(Z), X?.disconnect(), I?.disconnect(), J?.dispose(), Y?.dispose(), G && (G.dispose(), G.forceContextLoss(), G.domElement.remove()), G = null;
|
|
809
|
+
}), (e, t) => (f(), c("div", {
|
|
810
|
+
ref_key: "root",
|
|
811
|
+
ref: k,
|
|
812
|
+
class: "brep-view bg-[var(--brep-bg)] text-sm text-[var(--brep-text)]",
|
|
813
|
+
"data-testid": "brep-view"
|
|
814
|
+
}, [
|
|
815
|
+
l("div", {
|
|
816
|
+
ref_key: "header",
|
|
817
|
+
ref: A,
|
|
818
|
+
class: "brep-header flex-wrap items-center gap-2 border-b border-[var(--brep-border)] bg-[var(--brep-bg)] px-3 py-2"
|
|
819
|
+
}, [l("h1", {
|
|
820
|
+
class: "mr-auto min-w-0 truncate text-base font-semibold text-[var(--brep-strong)]",
|
|
821
|
+
title: le.value
|
|
822
|
+
}, h(le.value), 9, Ee), l("div", De, [(f(), c(a, null, m(ce, (e) => l("button", {
|
|
823
|
+
key: e,
|
|
824
|
+
type: "button",
|
|
825
|
+
class: ee(["h-8 rounded border px-2.5", e === U.value ? "border-[var(--brep-active)] bg-[var(--brep-active)] text-[var(--brep-on-active)]" : "border-[var(--brep-border-strong)] bg-[var(--brep-bg)] text-[var(--brep-text-2)] hover:bg-[var(--brep-hover)]"]),
|
|
826
|
+
"aria-pressed": e === U.value,
|
|
827
|
+
"data-testid": `brep-view-${e}`,
|
|
828
|
+
onClick: (t) => $(e)
|
|
829
|
+
}, h(g(d)[v[e]]), 11, Oe)), 64)), l("label", ke, [oe(l("input", {
|
|
830
|
+
"onUpdate:modelValue": t[0] ||= (e) => H.value = e,
|
|
831
|
+
type: "checkbox",
|
|
832
|
+
"data-testid": "brep-edges"
|
|
833
|
+
}, null, 512), [[ie, H.value]]), u(" " + h(g(d).edges), 1)])])], 512),
|
|
834
|
+
l("div", {
|
|
835
|
+
class: "brep-model brep-ground",
|
|
836
|
+
style: te({ height: `${P.value}px` }),
|
|
837
|
+
"data-testid": "brep-model"
|
|
838
|
+
}, [l("div", {
|
|
839
|
+
ref_key: "viewport",
|
|
840
|
+
ref: V,
|
|
841
|
+
class: "absolute inset-0",
|
|
842
|
+
"data-testid": "brep-viewport"
|
|
843
|
+
}, null, 512), be.value ? (f(), c("p", Ae, h(be.value), 1)) : s("", !0)], 4),
|
|
844
|
+
l("div", {
|
|
845
|
+
ref_key: "bar",
|
|
846
|
+
ref: j,
|
|
847
|
+
class: ee(["brep-bar", { "brep-bar-dragging": F.value }]),
|
|
848
|
+
role: "separator",
|
|
849
|
+
"aria-orientation": "horizontal",
|
|
850
|
+
tabindex: "0",
|
|
851
|
+
"aria-label": g(d).resizeModel,
|
|
852
|
+
"aria-valuenow": P.value,
|
|
853
|
+
"aria-valuemin": 0,
|
|
854
|
+
"aria-valuemax": Math.max(N.value, 0),
|
|
855
|
+
"data-testid": "brep-bar",
|
|
856
|
+
onPointerdown: me,
|
|
857
|
+
onPointermove: he,
|
|
858
|
+
onPointerup: B,
|
|
859
|
+
onPointercancel: B,
|
|
860
|
+
onKeydown: ge,
|
|
861
|
+
onDblclick: _e
|
|
862
|
+
}, [...t[2] ||= [l("span", { class: "brep-bar-grip" }, null, -1)]], 42, je),
|
|
863
|
+
l("div", Me, [y.value ? (f(), c("section", Ne, [
|
|
864
|
+
y.value.warnings.length ? (f(), c("div", Pe, [l("h2", Fe, h(g(d).warnings), 1), l("ul", Ie, [(f(!0), c(a, null, m(y.value.warnings, (e) => (f(), c("li", { key: e }, h(e), 1))), 128))])])) : s("", !0),
|
|
865
|
+
l("dl", Le, [
|
|
866
|
+
l("dt", Re, h(g(d).size), 1),
|
|
867
|
+
l("dd", ze, h(y.value.size.join(" × ")) + " mm ", 1),
|
|
868
|
+
l("dt", Be, h(g(d).volume), 1),
|
|
869
|
+
l("dd", Ve, h(C(y.value.volume)) + " mm³", 1),
|
|
870
|
+
l("dt", He, h(g(d).surface), 1),
|
|
871
|
+
l("dd", Ue, h(C(y.value.area)) + " mm²", 1),
|
|
872
|
+
l("dt", We, h(g(d).solids), 1),
|
|
873
|
+
l("dd", Ge, h(y.value.solids), 1),
|
|
874
|
+
l("dt", Ke, h(g(d).faces), 1),
|
|
875
|
+
l("dd", qe, h(de(y.value.faces)), 1),
|
|
876
|
+
l("dt", Je, h(g(d).edgeKinds), 1),
|
|
877
|
+
l("dd", null, h(de(y.value.edges)), 1)
|
|
878
|
+
]),
|
|
879
|
+
y.value.parts ? (f(), c(a, { key: 1 }, [l("h2", Ye, h(g(d).parts), 1), l("ul", Xe, [(f(!0), c(a, null, m(y.value.parts, (e, t) => (f(), c("li", {
|
|
880
|
+
key: t,
|
|
881
|
+
class: "tabular-nums"
|
|
882
|
+
}, h(e.name ?? t + 1) + ": " + h(e.size.join(" × ")) + " mm, " + h(C(e.volume)) + " mm³ ", 1))), 128))])], 64)) : s("", !0),
|
|
883
|
+
y.value.operations.length ? (f(), c(a, { key: 2 }, [l("h2", Ze, h(g(d).operations), 1), l("ol", Qe, [(f(!0), c(a, null, m(y.value.operations, (e, t) => (f(), c("li", {
|
|
884
|
+
key: t,
|
|
885
|
+
class: "flex flex-wrap items-baseline gap-x-2"
|
|
886
|
+
}, [
|
|
887
|
+
e.line === void 0 ? s("", !0) : (f(), c("span", $e, h(g(d).line) + " " + h(e.line), 1)),
|
|
888
|
+
l("code", et, h(e.op) + "(" + h(e.size ?? "") + ")" + h(e.count > 1 ? ` ×${e.count}` : ""), 1),
|
|
889
|
+
T(e) ? (f(), c("span", tt, h(T(e)), 1)) : s("", !0),
|
|
890
|
+
e.volumeChange === void 0 ? s("", !0) : (f(), c("span", nt, h(w(e.volumeChange)) + " mm³ ", 1))
|
|
891
|
+
]))), 128))])], 64)) : s("", !0),
|
|
892
|
+
l("h2", rt, h(g(d).files), 1),
|
|
893
|
+
l("ul", it, [(f(!0), c(a, null, m(ue.value, (e) => (f(), c("li", { key: e.kind }, [l("button", {
|
|
894
|
+
type: "button",
|
|
895
|
+
class: "rounded border border-[var(--brep-border-strong)] px-2.5 py-1 hover:bg-[var(--brep-hover)]",
|
|
896
|
+
title: e.fileName,
|
|
897
|
+
"data-testid": `brep-download-${e.kind}`,
|
|
898
|
+
onClick: (t) => S(e)
|
|
899
|
+
}, h(g(d).download) + " " + h(e.label), 9, at)]))), 128))])
|
|
900
|
+
])) : s("", !0), b.value ? (f(), c("details", ot, [l("summary", st, [l("span", ct, h(g(d).script), 1), l("button", {
|
|
901
|
+
type: "button",
|
|
902
|
+
class: "rounded border border-[var(--brep-border-strong)] px-1.5 py-0.5 text-xs hover:bg-[var(--brep-hover)]",
|
|
903
|
+
onClick: t[1] ||= se((e) => fe(b.value, "script"), ["prevent", "stop"])
|
|
904
|
+
}, h(E.value === "script" ? g(d).copied : g(d).copy), 1)]), l("pre", lt, [l("code", null, h(b.value), 1)])])) : s("", !0)])
|
|
905
|
+
], 512));
|
|
906
|
+
}
|
|
907
|
+
}), [["__scopeId", "data-v-ff3bd1d3"]]), q = {
|
|
908
|
+
class: "flex flex-col gap-0.5 rounded bg-slate-100 p-2 text-slate-800",
|
|
909
|
+
"data-testid": "brep-preview"
|
|
910
|
+
}, J = ["title"], Y = {
|
|
911
|
+
key: 0,
|
|
912
|
+
class: "text-xs tabular-nums text-slate-600"
|
|
913
|
+
}, X = {
|
|
914
|
+
key: 1,
|
|
915
|
+
class: "text-xs text-amber-700",
|
|
916
|
+
"data-testid": "brep-preview-warnings"
|
|
917
|
+
}, Z = /* @__PURE__ */ d({
|
|
918
|
+
__name: "Preview",
|
|
919
|
+
props: { result: {} },
|
|
920
|
+
setup(e) {
|
|
921
|
+
let t = e, n = ve(), r = o(() => t.result.title || n.value.untitled), i = o(() => t.result.data?.report);
|
|
922
|
+
return (e, t) => (f(), c("div", q, [
|
|
923
|
+
l("div", {
|
|
924
|
+
class: "truncate text-sm font-semibold",
|
|
925
|
+
title: r.value
|
|
926
|
+
}, h(r.value), 9, J),
|
|
927
|
+
i.value ? (f(), c("div", Y, h(i.value.size.join(" × ")) + " mm ", 1)) : s("", !0),
|
|
928
|
+
i.value?.warnings.length ? (f(), c("div", X, h(g(n).warnings) + ": " + h(i.value.warnings.length), 1)) : s("", !0)
|
|
929
|
+
]));
|
|
930
|
+
}
|
|
931
|
+
}), Q = `Use the ${r} tool for a part that will be made or that must fit: brackets, enclosures, flanges, jigs, anything with fillets, chamfers, holes to a size, or a STEP file to hand on. It builds a replicad script with a CAD kernel and returns a report to check the result against. For a model that is only looked at, use ShapeScript. Z is up and the user looks from -Y: put the side they should see first at -Y (a chair's seat front at -Y, its backrest at +Y).`, dt = {
|
|
932
|
+
toolDefinition: t,
|
|
933
|
+
execute: async () => ({ message: "presentBrep runs on the host's server (executePresentBrep from @gui-chat-plugin/brep), not in the page." }),
|
|
934
|
+
generatingMessage: "Building the solid model...",
|
|
935
|
+
waitingMessage: "Tell the user that the solid model is being built and will be shown shortly.",
|
|
936
|
+
isEnabled: () => !0,
|
|
937
|
+
viewComponent: K,
|
|
938
|
+
previewComponent: Z,
|
|
939
|
+
systemPrompt: Q
|
|
940
|
+
}, ft = { plugin: dt };
|
|
941
|
+
export { Z as Preview, Q as SYSTEM_PROMPT, t as TOOL_DEFINITION, r as TOOL_NAME, K as View, i as decodeMesh, ft as default, n as isBrepMesh, dt as plugin };
|