@gui-chat-plugin/brep 0.1.0 → 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 +10 -0
- package/dist/style.css +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +250 -247
- package/package.json +2 -2
package/dist/vue.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as e, o as t, r as n, s as r, t as i } from "./mesh-Cmm66x_I.js";
|
|
2
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
3
|
import * as _ from "three";
|
|
4
|
-
import { Controls as ce, MOUSE as v, MathUtils as
|
|
5
|
-
import { createUseT as
|
|
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
6
|
// ../../node_modules/three/examples/jsm/controls/OrbitControls.js
|
|
7
|
-
var
|
|
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
8
|
NONE: -1,
|
|
9
9
|
ROTATE: 0,
|
|
10
10
|
DOLLY: 1,
|
|
@@ -13,9 +13,9 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
13
13
|
TOUCH_PAN: 4,
|
|
14
14
|
TOUCH_DOLLY_PAN: 5,
|
|
15
15
|
TOUCH_DOLLY_ROTATE: 6
|
|
16
|
-
},
|
|
16
|
+
}, N = 1e-6, pe = class extends ce {
|
|
17
17
|
constructor(e, t = null) {
|
|
18
|
-
super(e, t), this.state =
|
|
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
19
|
LEFT: "ArrowLeft",
|
|
20
20
|
UP: "ArrowUp",
|
|
21
21
|
RIGHT: "ArrowRight",
|
|
@@ -25,9 +25,9 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
25
25
|
MIDDLE: v.DOLLY,
|
|
26
26
|
RIGHT: v.PAN
|
|
27
27
|
}, this.touches = {
|
|
28
|
-
ONE:
|
|
29
|
-
TWO:
|
|
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
|
|
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
31
|
}
|
|
32
32
|
set cursorStyle(e) {
|
|
33
33
|
this._cursorStyle = e, e === "grab" ? this.domElement.style.cursor = "grab" : this.domElement.style.cursor = "auto";
|
|
@@ -42,7 +42,7 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
42
42
|
}), this.domElement.style.touchAction = "none";
|
|
43
43
|
}
|
|
44
44
|
disconnect() {
|
|
45
|
-
this.state =
|
|
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
46
|
}
|
|
47
47
|
dispose() {
|
|
48
48
|
this.disconnect();
|
|
@@ -66,7 +66,7 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
66
66
|
this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
|
|
67
67
|
}
|
|
68
68
|
reset() {
|
|
69
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
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
70
|
}
|
|
71
71
|
pan(e, t) {
|
|
72
72
|
this._pan(e, t), this.update();
|
|
@@ -85,39 +85,39 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
85
85
|
}
|
|
86
86
|
update(e = null) {
|
|
87
87
|
let t = this.object.position;
|
|
88
|
-
|
|
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
89
|
let n = this.minAzimuthAngle, r = this.maxAzimuthAngle;
|
|
90
|
-
isFinite(n) && isFinite(r) && (n < -Math.PI ? n +=
|
|
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
91
|
let i = !1;
|
|
92
92
|
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera) this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
93
93
|
else {
|
|
94
94
|
let e = this._spherical.radius;
|
|
95
95
|
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), i = e != this._spherical.radius;
|
|
96
96
|
}
|
|
97
|
-
if (
|
|
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
98
|
let e = null;
|
|
99
99
|
if (this.object.isPerspectiveCamera) {
|
|
100
|
-
let t =
|
|
100
|
+
let t = A.length();
|
|
101
101
|
e = this._clampDistance(t * this._scale);
|
|
102
102
|
let n = t - e;
|
|
103
103
|
this.object.position.addScaledVector(this._dollyDirection, n), this.object.updateMatrixWorld(), i = !!n;
|
|
104
104
|
} else if (this.object.isOrthographicCamera) {
|
|
105
|
-
let t = new
|
|
105
|
+
let t = new w(this._mouse.x, this._mouse.y, 0);
|
|
106
106
|
t.unproject(this.object);
|
|
107
107
|
let n = this.object.zoom;
|
|
108
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
|
|
110
|
-
r.unproject(this.object), this.object.position.sub(r).add(t), this.object.updateMatrixWorld(), e =
|
|
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
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) : (
|
|
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
113
|
} else if (this.object.isOrthographicCamera) {
|
|
114
114
|
let e = this.object.zoom;
|
|
115
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
116
|
}
|
|
117
|
-
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) >
|
|
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
118
|
}
|
|
119
119
|
_getAutoRotationAngle(e) {
|
|
120
|
-
return e === null ?
|
|
120
|
+
return e === null ? j / 60 / 60 * this.autoRotateSpeed : j / 60 * this.autoRotateSpeed * e;
|
|
121
121
|
}
|
|
122
122
|
_getZoomScale(e) {
|
|
123
123
|
let t = Math.abs(e * .01);
|
|
@@ -130,17 +130,17 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
130
130
|
this._sphericalDelta.phi -= e;
|
|
131
131
|
}
|
|
132
132
|
_panLeft(e, t) {
|
|
133
|
-
|
|
133
|
+
A.setFromMatrixColumn(t, 0), A.multiplyScalar(-e), this._panOffset.add(A);
|
|
134
134
|
}
|
|
135
135
|
_panUp(e, t) {
|
|
136
|
-
this.screenSpacePanning === !0 ?
|
|
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
137
|
}
|
|
138
138
|
_pan(e, t) {
|
|
139
139
|
let n = this.domElement;
|
|
140
140
|
if (this.object.isPerspectiveCamera) {
|
|
141
141
|
let r = this.object.position;
|
|
142
|
-
|
|
143
|
-
let i =
|
|
142
|
+
A.copy(r).sub(this.target);
|
|
143
|
+
let i = A.length();
|
|
144
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
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
146
|
}
|
|
@@ -171,7 +171,7 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
171
171
|
_handleMouseMoveRotate(e) {
|
|
172
172
|
this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
173
173
|
let t = this.domElement;
|
|
174
|
-
this._rotateLeft(
|
|
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
175
|
}
|
|
176
176
|
_handleMouseMoveDolly(e) {
|
|
177
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();
|
|
@@ -186,15 +186,15 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
186
186
|
let t = !1;
|
|
187
187
|
switch (e.code) {
|
|
188
188
|
case this.keys.UP:
|
|
189
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(
|
|
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
190
|
break;
|
|
191
191
|
case this.keys.BOTTOM:
|
|
192
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-
|
|
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
193
|
break;
|
|
194
194
|
case this.keys.LEFT:
|
|
195
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(
|
|
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
196
|
break;
|
|
197
|
-
case this.keys.RIGHT: e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-
|
|
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
198
|
}
|
|
199
199
|
t && (e.preventDefault(), this.update());
|
|
200
200
|
}
|
|
@@ -230,7 +230,7 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
230
230
|
}
|
|
231
231
|
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
232
232
|
let t = this.domElement;
|
|
233
|
-
this._rotateLeft(
|
|
233
|
+
this._rotateLeft(j * this._rotateDelta.x / t.clientHeight), this._rotateUp(j * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
|
|
234
234
|
}
|
|
235
235
|
_handleTouchMovePan(e) {
|
|
236
236
|
if (this._pointers.length === 1) this._panEnd.set(e.pageX, e.pageY);
|
|
@@ -268,7 +268,7 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
268
268
|
}
|
|
269
269
|
_trackPointer(e) {
|
|
270
270
|
let t = this._pointerPositions[e.pointerId];
|
|
271
|
-
t === void 0 && (t = new
|
|
271
|
+
t === void 0 && (t = new C(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
|
|
272
272
|
}
|
|
273
273
|
_getSecondPointerPosition(e) {
|
|
274
274
|
let t = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
@@ -289,16 +289,16 @@ var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new
|
|
|
289
289
|
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
|
-
function
|
|
292
|
+
function P(e) {
|
|
293
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
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function F(e) {
|
|
296
296
|
this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function I(e) {
|
|
299
299
|
switch (this._removePointer(e), this._pointers.length) {
|
|
300
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(
|
|
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
302
|
break;
|
|
303
303
|
case 1:
|
|
304
304
|
let t = this._pointers[0], n = this._pointerPositions[t];
|
|
@@ -309,7 +309,7 @@ function L(e) {
|
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function L(e) {
|
|
313
313
|
let t;
|
|
314
314
|
switch (e.button) {
|
|
315
315
|
case 0:
|
|
@@ -326,126 +326,126 @@ function R(e) {
|
|
|
326
326
|
switch (t) {
|
|
327
327
|
case v.DOLLY:
|
|
328
328
|
if (this.enableZoom === !1) return;
|
|
329
|
-
this._handleMouseDownDolly(e), this.state =
|
|
329
|
+
this._handleMouseDownDolly(e), this.state = M.DOLLY;
|
|
330
330
|
break;
|
|
331
331
|
case v.ROTATE:
|
|
332
332
|
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
333
333
|
if (this.enablePan === !1) return;
|
|
334
|
-
this._handleMouseDownPan(e), this.state =
|
|
334
|
+
this._handleMouseDownPan(e), this.state = M.PAN;
|
|
335
335
|
} else {
|
|
336
336
|
if (this.enableRotate === !1) return;
|
|
337
|
-
this._handleMouseDownRotate(e), this.state =
|
|
337
|
+
this._handleMouseDownRotate(e), this.state = M.ROTATE;
|
|
338
338
|
}
|
|
339
339
|
break;
|
|
340
340
|
case v.PAN:
|
|
341
341
|
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
342
342
|
if (this.enableRotate === !1) return;
|
|
343
|
-
this._handleMouseDownRotate(e), this.state =
|
|
343
|
+
this._handleMouseDownRotate(e), this.state = M.ROTATE;
|
|
344
344
|
} else {
|
|
345
345
|
if (this.enablePan === !1) return;
|
|
346
|
-
this._handleMouseDownPan(e), this.state =
|
|
346
|
+
this._handleMouseDownPan(e), this.state = M.PAN;
|
|
347
347
|
}
|
|
348
348
|
break;
|
|
349
|
-
default: this.state =
|
|
349
|
+
default: this.state = M.NONE;
|
|
350
350
|
}
|
|
351
|
-
this.state !==
|
|
351
|
+
this.state !== M.NONE && this.dispatchEvent(E);
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function R(e) {
|
|
354
354
|
switch (this.state) {
|
|
355
|
-
case
|
|
355
|
+
case M.ROTATE:
|
|
356
356
|
if (this.enableRotate === !1) return;
|
|
357
357
|
this._handleMouseMoveRotate(e);
|
|
358
358
|
break;
|
|
359
|
-
case
|
|
359
|
+
case M.DOLLY:
|
|
360
360
|
if (this.enableZoom === !1) return;
|
|
361
361
|
this._handleMouseMoveDolly(e);
|
|
362
362
|
break;
|
|
363
|
-
case
|
|
363
|
+
case M.PAN:
|
|
364
364
|
if (this.enablePan === !1) return;
|
|
365
365
|
this._handleMouseMovePan(e);
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
this.enabled !== !1 && this.enableZoom !== !1 && this.state ===
|
|
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
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function me(e) {
|
|
372
372
|
this.enabled !== !1 && this._handleKeyDown(e);
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function he(e) {
|
|
375
375
|
switch (this._trackPointer(e), this._pointers.length) {
|
|
376
376
|
case 1:
|
|
377
377
|
switch (this.touches.ONE) {
|
|
378
|
-
case
|
|
378
|
+
case S.ROTATE:
|
|
379
379
|
if (this.enableRotate === !1) {
|
|
380
|
-
this.state =
|
|
380
|
+
this.state = M.NONE;
|
|
381
381
|
break;
|
|
382
382
|
}
|
|
383
|
-
this._handleTouchStartRotate(e), this.state =
|
|
383
|
+
this._handleTouchStartRotate(e), this.state = M.TOUCH_ROTATE;
|
|
384
384
|
break;
|
|
385
|
-
case
|
|
385
|
+
case S.PAN:
|
|
386
386
|
if (this.enablePan === !1) {
|
|
387
|
-
this.state =
|
|
387
|
+
this.state = M.NONE;
|
|
388
388
|
break;
|
|
389
389
|
}
|
|
390
|
-
this._handleTouchStartPan(e), this.state =
|
|
390
|
+
this._handleTouchStartPan(e), this.state = M.TOUCH_PAN;
|
|
391
391
|
break;
|
|
392
|
-
default: this.state =
|
|
392
|
+
default: this.state = M.NONE;
|
|
393
393
|
}
|
|
394
394
|
break;
|
|
395
395
|
case 2:
|
|
396
396
|
switch (this.touches.TWO) {
|
|
397
|
-
case
|
|
397
|
+
case S.DOLLY_PAN:
|
|
398
398
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
399
|
-
this._handleTouchStartDollyPan(e), this.state =
|
|
399
|
+
this._handleTouchStartDollyPan(e), this.state = M.TOUCH_DOLLY_PAN;
|
|
400
400
|
break;
|
|
401
|
-
case
|
|
401
|
+
case S.DOLLY_ROTATE:
|
|
402
402
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
403
|
-
this._handleTouchStartDollyRotate(e), this.state =
|
|
403
|
+
this._handleTouchStartDollyRotate(e), this.state = M.TOUCH_DOLLY_ROTATE;
|
|
404
404
|
break;
|
|
405
|
-
default: this.state =
|
|
405
|
+
default: this.state = M.NONE;
|
|
406
406
|
}
|
|
407
407
|
break;
|
|
408
|
-
default: this.state =
|
|
408
|
+
default: this.state = M.NONE;
|
|
409
409
|
}
|
|
410
|
-
this.state !==
|
|
410
|
+
this.state !== M.NONE && this.dispatchEvent(E);
|
|
411
411
|
}
|
|
412
|
-
function
|
|
412
|
+
function B(e) {
|
|
413
413
|
switch (this._trackPointer(e), this.state) {
|
|
414
|
-
case
|
|
414
|
+
case M.TOUCH_ROTATE:
|
|
415
415
|
if (this.enableRotate === !1) return;
|
|
416
416
|
this._handleTouchMoveRotate(e), this.update();
|
|
417
417
|
break;
|
|
418
|
-
case
|
|
418
|
+
case M.TOUCH_PAN:
|
|
419
419
|
if (this.enablePan === !1) return;
|
|
420
420
|
this._handleTouchMovePan(e), this.update();
|
|
421
421
|
break;
|
|
422
|
-
case
|
|
422
|
+
case M.TOUCH_DOLLY_PAN:
|
|
423
423
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
424
424
|
this._handleTouchMoveDollyPan(e), this.update();
|
|
425
425
|
break;
|
|
426
|
-
case
|
|
426
|
+
case M.TOUCH_DOLLY_ROTATE:
|
|
427
427
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
428
428
|
this._handleTouchMoveDollyRotate(e), this.update();
|
|
429
429
|
break;
|
|
430
|
-
default: this.state =
|
|
430
|
+
default: this.state = M.NONE;
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function ge(e) {
|
|
434
434
|
this.enabled !== !1 && e.preventDefault();
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function _e(e) {
|
|
437
437
|
e.key === "Control" && (this._controlActive = !0, this.domElement.ownerDocument.addEventListener("keyup", this._interceptControlUp, {
|
|
438
438
|
passive: !0,
|
|
439
439
|
capture: !0
|
|
440
440
|
}));
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function V(e) {
|
|
443
443
|
e.key === "Control" && (this._controlActive = !1, this.domElement.ownerDocument.removeEventListener("keyup", this._interceptControlUp, {
|
|
444
444
|
passive: !0,
|
|
445
445
|
capture: !0
|
|
446
446
|
}));
|
|
447
447
|
}
|
|
448
|
-
var
|
|
448
|
+
var ve = de({
|
|
449
449
|
en: {
|
|
450
450
|
untitled: "Solid model",
|
|
451
451
|
viewIso: "3D",
|
|
@@ -510,12 +510,12 @@ var _e = ue({
|
|
|
510
510
|
copied: "コピーしました",
|
|
511
511
|
resizeModel: "3Dビューの高さを変更"
|
|
512
512
|
}
|
|
513
|
-
}),
|
|
514
|
-
function
|
|
513
|
+
}), H = 12832988, U = 2042167;
|
|
514
|
+
function ye(e) {
|
|
515
515
|
let t = new _.BufferGeometry();
|
|
516
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
517
|
let n = new _.MeshStandardMaterial({
|
|
518
|
-
color:
|
|
518
|
+
color: H,
|
|
519
519
|
metalness: .1,
|
|
520
520
|
roughness: .65,
|
|
521
521
|
side: _.DoubleSide,
|
|
@@ -524,7 +524,7 @@ function ve(e) {
|
|
|
524
524
|
polygonOffsetUnits: 1
|
|
525
525
|
}), r = new _.BufferGeometry();
|
|
526
526
|
r.setAttribute("position", new _.BufferAttribute(e.edges, 3));
|
|
527
|
-
let i = new _.LineBasicMaterial({ color:
|
|
527
|
+
let i = new _.LineBasicMaterial({ color: U });
|
|
528
528
|
return {
|
|
529
529
|
faces: new _.Mesh(t, n),
|
|
530
530
|
edges: new _.LineSegments(r, i),
|
|
@@ -533,7 +533,7 @@ function ve(e) {
|
|
|
533
533
|
}
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
|
-
var
|
|
536
|
+
var W = {
|
|
537
537
|
iso: [
|
|
538
538
|
1,
|
|
539
539
|
-1.2,
|
|
@@ -554,13 +554,13 @@ var G = {
|
|
|
554
554
|
0,
|
|
555
555
|
0
|
|
556
556
|
]
|
|
557
|
-
},
|
|
558
|
-
function
|
|
557
|
+
}, be = 1.02;
|
|
558
|
+
function xe(e, t, n, r, i) {
|
|
559
559
|
let a = [
|
|
560
560
|
(e[0] + t[0]) / 2,
|
|
561
561
|
(e[1] + t[1]) / 2,
|
|
562
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 *
|
|
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
564
|
return {
|
|
565
565
|
position: [
|
|
566
566
|
a[0] + u[0] / d * l,
|
|
@@ -572,17 +572,17 @@ function be(e, t, n, r, i) {
|
|
|
572
572
|
radius: o
|
|
573
573
|
};
|
|
574
574
|
}
|
|
575
|
-
var
|
|
576
|
-
function
|
|
575
|
+
var G = .6;
|
|
576
|
+
function Se(e, t) {
|
|
577
577
|
if (!Number.isFinite(t) || t <= 0) return 0;
|
|
578
578
|
if (t < 168) return Math.round(t / 2);
|
|
579
|
-
let n = e === null || !Number.isFinite(e) ? t *
|
|
579
|
+
let n = e === null || !Number.isFinite(e) ? t * G : e;
|
|
580
580
|
return Math.round(Math.min(Math.max(n, 96), t - 72));
|
|
581
581
|
}
|
|
582
|
-
var
|
|
583
|
-
function
|
|
582
|
+
var Ce = "@gui-chat-plugin/brep:modelHeight";
|
|
583
|
+
function we() {
|
|
584
584
|
try {
|
|
585
|
-
let e = globalThis.localStorage?.getItem(
|
|
585
|
+
let e = globalThis.localStorage?.getItem(Ce);
|
|
586
586
|
if (!e) return null;
|
|
587
587
|
let t = Number(e);
|
|
588
588
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
@@ -590,65 +590,65 @@ function Ce() {
|
|
|
590
590
|
return null;
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function Te(e) {
|
|
594
594
|
try {
|
|
595
|
-
globalThis.localStorage?.setItem(
|
|
595
|
+
globalThis.localStorage?.setItem(Ce, String(Math.round(e)));
|
|
596
596
|
} catch {}
|
|
597
597
|
}
|
|
598
598
|
// src/vue/View.vue?vue&type=script&setup=true&lang.ts
|
|
599
|
-
var
|
|
599
|
+
var Ee = ["title"], De = {
|
|
600
600
|
class: "flex items-center gap-1",
|
|
601
601
|
"data-testid": "brep-toolbar"
|
|
602
|
-
},
|
|
602
|
+
}, Oe = [
|
|
603
603
|
"aria-pressed",
|
|
604
604
|
"data-testid",
|
|
605
605
|
"onClick"
|
|
606
|
-
],
|
|
606
|
+
], ke = { class: "ml-2 flex h-8 cursor-pointer items-center gap-1.5 text-[var(--brep-text-2)]" }, Ae = {
|
|
607
607
|
key: 0,
|
|
608
|
-
class: "absolute inset-0 flex items-center justify-center p-4 text-center text-
|
|
608
|
+
class: "absolute inset-0 flex items-center justify-center p-4 text-center text-[var(--brep-muted)]",
|
|
609
609
|
"data-testid": "brep-viewport-message"
|
|
610
|
-
},
|
|
610
|
+
}, je = [
|
|
611
611
|
"aria-label",
|
|
612
612
|
"aria-valuenow",
|
|
613
613
|
"aria-valuemax"
|
|
614
|
-
],
|
|
614
|
+
], Me = {
|
|
615
615
|
class: "brep-below",
|
|
616
616
|
"data-testid": "brep-below"
|
|
617
|
-
},
|
|
617
|
+
}, Ne = {
|
|
618
618
|
key: 0,
|
|
619
619
|
class: "p-3",
|
|
620
620
|
"data-testid": "brep-report"
|
|
621
|
-
},
|
|
621
|
+
}, Pe = {
|
|
622
622
|
key: 0,
|
|
623
|
-
class: "mb-3 rounded border border-
|
|
623
|
+
class: "mb-3 rounded border border-[var(--brep-warn-border)] bg-[var(--brep-warn-bg)] p-2 text-[var(--brep-warn)]",
|
|
624
624
|
"data-testid": "brep-warnings"
|
|
625
|
-
},
|
|
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
626
|
class: "tabular-nums",
|
|
627
627
|
"data-testid": "brep-size"
|
|
628
|
-
},
|
|
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
629
|
class: "mt-1 space-y-1",
|
|
630
630
|
"data-testid": "brep-operations"
|
|
631
|
-
},
|
|
631
|
+
}, $e = {
|
|
632
632
|
key: 0,
|
|
633
|
-
class: "w-12 shrink-0 text-xs tabular-nums text-
|
|
634
|
-
},
|
|
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
635
|
key: 1,
|
|
636
|
-
class: "text-
|
|
637
|
-
},
|
|
636
|
+
class: "text-[var(--brep-muted)]"
|
|
637
|
+
}, nt = {
|
|
638
638
|
key: 2,
|
|
639
|
-
class: "ml-auto tabular-nums text-
|
|
640
|
-
},
|
|
639
|
+
class: "ml-auto tabular-nums text-[var(--brep-muted)]"
|
|
640
|
+
}, rt = { class: "mt-4 font-semibold text-[var(--brep-strong)]" }, it = {
|
|
641
641
|
class: "mt-1 flex flex-wrap gap-2",
|
|
642
642
|
"data-testid": "brep-files"
|
|
643
|
-
},
|
|
643
|
+
}, at = [
|
|
644
644
|
"title",
|
|
645
645
|
"data-testid",
|
|
646
646
|
"onClick"
|
|
647
|
-
],
|
|
647
|
+
], ot = {
|
|
648
648
|
key: 1,
|
|
649
|
-
class: "border-t border-
|
|
649
|
+
class: "border-t border-[var(--brep-border)]",
|
|
650
650
|
"data-testid": "brep-script"
|
|
651
|
-
},
|
|
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
652
|
let n = e.__vccOpts || e;
|
|
653
653
|
for (let [e, r] of t) n[e] = r;
|
|
654
654
|
return n;
|
|
@@ -656,7 +656,7 @@ var Te = ["title"], Ee = {
|
|
|
656
656
|
__name: "View",
|
|
657
657
|
props: { selectedResult: {} },
|
|
658
658
|
setup(t) {
|
|
659
|
-
let r = t, d =
|
|
659
|
+
let r = t, d = ve(), ce = [
|
|
660
660
|
"iso",
|
|
661
661
|
"top",
|
|
662
662
|
"front",
|
|
@@ -666,17 +666,17 @@ var Te = ["title"], Ee = {
|
|
|
666
666
|
top: "viewTop",
|
|
667
667
|
front: "viewFront",
|
|
668
668
|
right: "viewRight"
|
|
669
|
-
},
|
|
669
|
+
}, le = o(() => r.selectedResult.title || d.value.untitled), y = o(() => r.selectedResult.data?.report), b = o(() => r.selectedResult.data?.script ?? ""), x = o(() => {
|
|
670
670
|
let e = r.selectedResult.data?.mesh;
|
|
671
671
|
return n(e) ? e : null;
|
|
672
|
-
}),
|
|
672
|
+
}), ue = o(() => {
|
|
673
673
|
let e = r.selectedResult.data?.downloads, t = e?.name ?? "model", n = [];
|
|
674
|
-
return
|
|
674
|
+
return b.value && n.push({
|
|
675
675
|
kind: "script",
|
|
676
676
|
label: d.value.fileScript,
|
|
677
677
|
fileName: `${t}.replicad.js`,
|
|
678
678
|
type: "text/javascript",
|
|
679
|
-
content: { text:
|
|
679
|
+
content: { text: b.value }
|
|
680
680
|
}), e && n.push({
|
|
681
681
|
kind: "step",
|
|
682
682
|
label: d.value.fileStep,
|
|
@@ -697,7 +697,7 @@ var Te = ["title"], Ee = {
|
|
|
697
697
|
content: { packed: e.views }
|
|
698
698
|
}), n;
|
|
699
699
|
});
|
|
700
|
-
async function
|
|
700
|
+
async function S(t) {
|
|
701
701
|
let n;
|
|
702
702
|
try {
|
|
703
703
|
n = "text" in t.content ? t.content.text : await e(t.content.packed);
|
|
@@ -707,232 +707,235 @@ var Te = ["title"], Ee = {
|
|
|
707
707
|
let r = URL.createObjectURL(new Blob([n], { type: t.type })), i = document.createElement("a");
|
|
708
708
|
i.href = r, i.download = t.fileName, i.click(), setTimeout(() => URL.revokeObjectURL(r), 1e4);
|
|
709
709
|
}
|
|
710
|
-
let
|
|
711
|
-
function
|
|
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
712
|
if (e.selected === void 0) return "";
|
|
713
713
|
let t = String(e.selected);
|
|
714
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
715
|
}
|
|
716
|
-
let
|
|
717
|
-
async function
|
|
716
|
+
let E = p(null), D, O = !1;
|
|
717
|
+
async function fe(e, t) {
|
|
718
718
|
try {
|
|
719
719
|
await navigator.clipboard.writeText(e);
|
|
720
720
|
} catch {
|
|
721
721
|
return;
|
|
722
722
|
}
|
|
723
|
-
|
|
723
|
+
O || (E.value = t, clearTimeout(D), D = setTimeout(() => E.value = null, 1500));
|
|
724
724
|
}
|
|
725
|
-
let
|
|
726
|
-
function
|
|
727
|
-
|
|
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
728
|
}
|
|
729
|
-
function
|
|
730
|
-
|
|
729
|
+
function z(e) {
|
|
730
|
+
M.value = Se(e, N.value), Te(M.value);
|
|
731
731
|
}
|
|
732
|
-
function
|
|
733
|
-
e.button === 0 && (
|
|
732
|
+
function me(e) {
|
|
733
|
+
e.button === 0 && (L = {
|
|
734
734
|
y: e.clientY,
|
|
735
|
-
height:
|
|
736
|
-
},
|
|
735
|
+
height: P.value
|
|
736
|
+
}, F.value = !0, j.value?.setPointerCapture(e.pointerId), e.preventDefault());
|
|
737
737
|
}
|
|
738
|
-
function
|
|
739
|
-
|
|
738
|
+
function he(e) {
|
|
739
|
+
L && z(L.height + e.clientY - L.y);
|
|
740
740
|
}
|
|
741
|
-
function
|
|
742
|
-
|
|
741
|
+
function B() {
|
|
742
|
+
L = null, F.value = !1;
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function ge(e) {
|
|
745
745
|
let t = {
|
|
746
|
-
ArrowUp:
|
|
747
|
-
ArrowDown:
|
|
746
|
+
ArrowUp: P.value - 24,
|
|
747
|
+
ArrowDown: P.value + 24,
|
|
748
748
|
Home: 0,
|
|
749
|
-
End:
|
|
749
|
+
End: N.value
|
|
750
750
|
}[e.key];
|
|
751
|
-
t !== void 0 && (e.preventDefault(),
|
|
751
|
+
t !== void 0 && (e.preventDefault(), z(t));
|
|
752
752
|
}
|
|
753
|
-
function
|
|
754
|
-
|
|
753
|
+
function _e() {
|
|
754
|
+
M.value = null;
|
|
755
755
|
try {
|
|
756
|
-
globalThis.localStorage?.removeItem(
|
|
756
|
+
globalThis.localStorage?.removeItem(Ce);
|
|
757
757
|
} catch {}
|
|
758
758
|
}
|
|
759
|
-
let
|
|
760
|
-
function
|
|
761
|
-
|
|
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
762
|
}
|
|
763
763
|
function dt() {
|
|
764
|
-
!
|
|
765
|
-
|
|
764
|
+
!Z && G && (Z = requestAnimationFrame(() => {
|
|
765
|
+
Z = 0, Q();
|
|
766
766
|
}));
|
|
767
767
|
}
|
|
768
768
|
function ft() {
|
|
769
|
-
let e =
|
|
770
|
-
if (!e ||
|
|
769
|
+
let e = V.value;
|
|
770
|
+
if (!e || G) return;
|
|
771
771
|
try {
|
|
772
|
-
|
|
772
|
+
G = new _.WebGLRenderer({
|
|
773
|
+
antialias: !0,
|
|
774
|
+
alpha: !0
|
|
775
|
+
});
|
|
773
776
|
} catch {
|
|
774
|
-
|
|
777
|
+
W.value = !0;
|
|
775
778
|
return;
|
|
776
779
|
}
|
|
777
|
-
|
|
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);
|
|
778
781
|
let t = new _.DirectionalLight(16777215, 1.5);
|
|
779
|
-
t.position.set(-.5, .8, 1),
|
|
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();
|
|
780
783
|
}
|
|
781
784
|
function pt() {
|
|
782
|
-
let e =
|
|
783
|
-
if (!e || !
|
|
785
|
+
let e = V.value;
|
|
786
|
+
if (!e || !G || !q) return;
|
|
784
787
|
let t = e.clientWidth, n = e.clientHeight;
|
|
785
|
-
t !== 0 && n !== 0 && (
|
|
788
|
+
t !== 0 && n !== 0 && (G.setSize(t, n), q.aspect = t / n, q.updateProjectionMatrix(), U.value ? $(U.value) : Q());
|
|
786
789
|
}
|
|
787
|
-
function
|
|
788
|
-
|
|
789
|
-
let t =
|
|
790
|
-
if (!t || !
|
|
791
|
-
let n =
|
|
792
|
-
|
|
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();
|
|
793
796
|
}
|
|
794
|
-
function
|
|
795
|
-
if (!
|
|
796
|
-
|
|
797
|
-
let e =
|
|
798
|
-
e ? (
|
|
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();
|
|
799
802
|
}
|
|
800
803
|
return ne(() => {
|
|
801
|
-
|
|
802
|
-
}), ae(
|
|
803
|
-
|
|
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();
|
|
804
807
|
}), re(() => {
|
|
805
|
-
|
|
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;
|
|
806
809
|
}), (e, t) => (f(), c("div", {
|
|
807
810
|
ref_key: "root",
|
|
808
|
-
ref:
|
|
809
|
-
class: "brep-view bg-
|
|
811
|
+
ref: k,
|
|
812
|
+
class: "brep-view bg-[var(--brep-bg)] text-sm text-[var(--brep-text)]",
|
|
810
813
|
"data-testid": "brep-view"
|
|
811
814
|
}, [
|
|
812
815
|
l("div", {
|
|
813
816
|
ref_key: "header",
|
|
814
|
-
ref:
|
|
815
|
-
class: "brep-header flex-wrap items-center gap-2 border-b border-
|
|
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"
|
|
816
819
|
}, [l("h1", {
|
|
817
|
-
class: "mr-auto min-w-0 truncate text-base font-semibold text-
|
|
818
|
-
title:
|
|
819
|
-
}, h(
|
|
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", {
|
|
820
823
|
key: e,
|
|
821
824
|
type: "button",
|
|
822
|
-
class: ee(["h-8 rounded border px-2.5", e ===
|
|
823
|
-
"aria-pressed": e ===
|
|
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,
|
|
824
827
|
"data-testid": `brep-view-${e}`,
|
|
825
|
-
onClick: (t) =>
|
|
826
|
-
}, h(g(d)[v[e]]), 11,
|
|
827
|
-
"onUpdate:modelValue": t[0] ||= (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,
|
|
828
831
|
type: "checkbox",
|
|
829
832
|
"data-testid": "brep-edges"
|
|
830
|
-
}, null, 512), [[ie,
|
|
833
|
+
}, null, 512), [[ie, H.value]]), u(" " + h(g(d).edges), 1)])])], 512),
|
|
831
834
|
l("div", {
|
|
832
|
-
class: "brep-model
|
|
833
|
-
style: te({ height: `${
|
|
835
|
+
class: "brep-model brep-ground",
|
|
836
|
+
style: te({ height: `${P.value}px` }),
|
|
834
837
|
"data-testid": "brep-model"
|
|
835
838
|
}, [l("div", {
|
|
836
839
|
ref_key: "viewport",
|
|
837
|
-
ref:
|
|
840
|
+
ref: V,
|
|
838
841
|
class: "absolute inset-0",
|
|
839
842
|
"data-testid": "brep-viewport"
|
|
840
|
-
}, null, 512),
|
|
843
|
+
}, null, 512), be.value ? (f(), c("p", Ae, h(be.value), 1)) : s("", !0)], 4),
|
|
841
844
|
l("div", {
|
|
842
845
|
ref_key: "bar",
|
|
843
|
-
ref:
|
|
844
|
-
class: ee(["brep-bar", { "brep-bar-dragging":
|
|
846
|
+
ref: j,
|
|
847
|
+
class: ee(["brep-bar", { "brep-bar-dragging": F.value }]),
|
|
845
848
|
role: "separator",
|
|
846
849
|
"aria-orientation": "horizontal",
|
|
847
850
|
tabindex: "0",
|
|
848
851
|
"aria-label": g(d).resizeModel,
|
|
849
|
-
"aria-valuenow":
|
|
852
|
+
"aria-valuenow": P.value,
|
|
850
853
|
"aria-valuemin": 0,
|
|
851
|
-
"aria-valuemax": Math.max(
|
|
854
|
+
"aria-valuemax": Math.max(N.value, 0),
|
|
852
855
|
"data-testid": "brep-bar",
|
|
853
|
-
onPointerdown:
|
|
854
|
-
onPointermove:
|
|
855
|
-
onPointerup:
|
|
856
|
-
onPointercancel:
|
|
857
|
-
onKeydown:
|
|
858
|
-
onDblclick:
|
|
859
|
-
}, [...t[2] ||= [l("span", { class: "brep-bar-grip" }, null, -1)]], 42,
|
|
860
|
-
l("div",
|
|
861
|
-
|
|
862
|
-
l("dl",
|
|
863
|
-
l("dt",
|
|
864
|
-
l("dd",
|
|
865
|
-
l("dt",
|
|
866
|
-
l("dd",
|
|
867
|
-
l("dt",
|
|
868
|
-
l("dd",
|
|
869
|
-
l("dt",
|
|
870
|
-
l("dd",
|
|
871
|
-
l("dt",
|
|
872
|
-
l("dd",
|
|
873
|
-
l("dt",
|
|
874
|
-
l("dd", null, h(
|
|
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)
|
|
875
878
|
]),
|
|
876
|
-
|
|
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", {
|
|
877
880
|
key: t,
|
|
878
881
|
class: "tabular-nums"
|
|
879
|
-
}, h(e.name ?? t + 1) + ": " + h(e.size.join(" × ")) + " mm, " + h(
|
|
880
|
-
|
|
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", {
|
|
881
884
|
key: t,
|
|
882
885
|
class: "flex flex-wrap items-baseline gap-x-2"
|
|
883
886
|
}, [
|
|
884
|
-
e.line === void 0 ? s("", !0) : (f(), c("span",
|
|
885
|
-
l("code",
|
|
886
|
-
|
|
887
|
-
e.volumeChange === void 0 ? s("", !0) : (f(), c("span",
|
|
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))
|
|
888
891
|
]))), 128))])], 64)) : s("", !0),
|
|
889
|
-
l("h2",
|
|
890
|
-
l("ul",
|
|
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", {
|
|
891
894
|
type: "button",
|
|
892
|
-
class: "rounded border border-
|
|
895
|
+
class: "rounded border border-[var(--brep-border-strong)] px-2.5 py-1 hover:bg-[var(--brep-hover)]",
|
|
893
896
|
title: e.fileName,
|
|
894
897
|
"data-testid": `brep-download-${e.kind}`,
|
|
895
|
-
onClick: (t) =>
|
|
896
|
-
}, h(g(d).download) + " " + h(e.label), 9,
|
|
897
|
-
])) : s("", !0),
|
|
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", {
|
|
898
901
|
type: "button",
|
|
899
|
-
class: "rounded border border-
|
|
900
|
-
onClick: t[1] ||= se((e) =>
|
|
901
|
-
}, h(
|
|
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)])
|
|
902
905
|
], 512));
|
|
903
906
|
}
|
|
904
|
-
}), [["__scopeId", "data-v-
|
|
907
|
+
}), [["__scopeId", "data-v-ff3bd1d3"]]), q = {
|
|
905
908
|
class: "flex flex-col gap-0.5 rounded bg-slate-100 p-2 text-slate-800",
|
|
906
909
|
"data-testid": "brep-preview"
|
|
907
|
-
},
|
|
910
|
+
}, J = ["title"], Y = {
|
|
908
911
|
key: 0,
|
|
909
912
|
class: "text-xs tabular-nums text-slate-600"
|
|
910
|
-
},
|
|
913
|
+
}, X = {
|
|
911
914
|
key: 1,
|
|
912
915
|
class: "text-xs text-amber-700",
|
|
913
916
|
"data-testid": "brep-preview-warnings"
|
|
914
|
-
},
|
|
917
|
+
}, Z = /* @__PURE__ */ d({
|
|
915
918
|
__name: "Preview",
|
|
916
919
|
props: { result: {} },
|
|
917
920
|
setup(e) {
|
|
918
|
-
let t = e, n =
|
|
919
|
-
return (e, t) => (f(), c("div",
|
|
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, [
|
|
920
923
|
l("div", {
|
|
921
924
|
class: "truncate text-sm font-semibold",
|
|
922
925
|
title: r.value
|
|
923
|
-
}, h(r.value), 9,
|
|
924
|
-
i.value ? (f(), c("div",
|
|
925
|
-
i.value?.warnings.length ? (f(), c("div",
|
|
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)
|
|
926
929
|
]));
|
|
927
930
|
}
|
|
928
|
-
}),
|
|
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 = {
|
|
929
932
|
toolDefinition: t,
|
|
930
933
|
execute: async () => ({ message: "presentBrep runs on the host's server (executePresentBrep from @gui-chat-plugin/brep), not in the page." }),
|
|
931
934
|
generatingMessage: "Building the solid model...",
|
|
932
935
|
waitingMessage: "Tell the user that the solid model is being built and will be shown shortly.",
|
|
933
936
|
isEnabled: () => !0,
|
|
934
|
-
viewComponent:
|
|
935
|
-
previewComponent:
|
|
936
|
-
systemPrompt:
|
|
937
|
+
viewComponent: K,
|
|
938
|
+
previewComponent: Z,
|
|
939
|
+
systemPrompt: Q
|
|
937
940
|
}, ft = { plugin: dt };
|
|
938
|
-
export {
|
|
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 };
|