@floless/app 0.174.0 → 0.175.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/autostart.mjs +117 -10
- package/dist/floless-server.cjs +2 -2
- package/dist/pdf-engine/floless_pdf/__init__.py +53 -0
- package/dist/pdf-engine/floless_pdf/backend_pdfium.py +823 -0
- package/dist/pdf-engine/floless_pdf/backend_pymupdf.py +245 -0
- package/dist/pdf-engine/floless_pdf/geometry.py +115 -0
- package/dist/pdf-engine/floless_pdf/images.py +75 -0
- package/dist/pdf-engine/floless_pdf/pages.py +136 -0
- package/dist/pdf-engine/floless_pdf/textrules.py +200 -0
- package/dist/schemas/steel.model.v2.schema.json +45 -1
- package/dist/skills/floless-app-approval/SKILL.md +28 -3
- package/dist/skills/floless-app-knowledge/SKILL.md +3 -2
- package/dist/skills/floless-app-sketches/SKILL.md +71 -0
- package/dist/skills/floless-app-sketches/references/steel-plate.md +15 -0
- package/dist/skills/floless-app-steel-model/SKILL.md +14 -1
- package/dist/skills/floless-app-steel-model/references/elements.md +90 -23
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +18 -7
- package/dist/skills/floless-app-tweak-contract/SKILL.md +3 -2
- package/dist/web/agents.js +1 -1
- package/dist/web/app.css +120 -15
- package/dist/web/app.js +89 -38
- package/dist/web/aware-hold.js +10 -0
- package/dist/web/aware.js +405 -51
- package/dist/web/boot-watchdog.js +249 -0
- package/dist/web/card-details.js +88 -0
- package/dist/web/chat.css +29 -0
- package/dist/web/chat.js +430 -128
- package/dist/web/commands-connection-design.js +23 -0
- package/dist/web/commands-revit.js +3 -0
- package/dist/web/commands-shell.js +226 -10
- package/dist/web/commands-steel.js +95 -5
- package/dist/web/commands-tekla-parser.js +21 -1
- package/dist/web/connection-design-editor.html +71 -0
- package/dist/web/connection-design-editor.js +794 -61
- package/dist/web/connection-design-handles.js +9 -3
- package/dist/web/element-approval.js +74 -0
- package/dist/web/element-context.js +76 -6
- package/dist/web/element-geometry.js +8 -2
- package/dist/web/element-holds.js +68 -5
- package/dist/web/element-type-actions.js +22 -3
- package/dist/web/element-types.js +12 -5
- package/dist/web/element-words.js +15 -11
- package/dist/web/grid-place.js +51 -0
- package/dist/web/guide.js +2 -0
- package/dist/web/index.html +13 -16
- package/dist/web/instructor.js +5 -2
- package/dist/web/missed-routines.js +6 -1
- package/dist/web/model-change-findings.js +147 -32
- package/dist/web/model-change-review.js +435 -32
- package/dist/web/model-clash-check.css +100 -0
- package/dist/web/model-clash-check.js +681 -0
- package/dist/web/model-clip-box.js +204 -0
- package/dist/web/model-clip-list.js +153 -3
- package/dist/web/model-clip-session.js +3 -3
- package/dist/web/model-clip-three-overlay.js +135 -25
- package/dist/web/model-editor.css +2 -0
- package/dist/web/model-elements.js +273 -18
- package/dist/web/model-fit-checks.js +354 -0
- package/dist/web/model-spatial-panel.js +9 -3
- package/dist/web/model-spatial-tools.js +12 -3
- package/dist/web/model-tekla-selection.js +74 -0
- package/dist/web/model-view-query.js +70 -14
- package/dist/web/model-viewport-revit-adapter.js +8 -7
- package/dist/web/model-viewport-toolbar.js +8 -4
- package/dist/web/pages.js +78 -1
- package/dist/web/project-history.js +31 -1
- package/dist/web/revit-editor.css +34 -1
- package/dist/web/revit-editor.js +176 -55
- package/dist/web/run-history.js +8 -0
- package/dist/web/sketch-editor.js +141 -2
- package/dist/web/sketches.js +192 -6
- package/dist/web/start-place.js +46 -0
- package/dist/web/steel-3d-core.js +70 -0
- package/dist/web/steel-3d-view.js +288 -47
- package/dist/web/steel-change-review.css +29 -0
- package/dist/web/steel-custom-connection.js +6 -0
- package/dist/web/steel-editor.html +532 -33
- package/dist/web/steel-filter.html +8 -3
- package/dist/web/steel-model-checks.css +76 -0
- package/dist/web/steel-model-commands.js +1 -1
- package/dist/web/steel-model-v2-commands.js +17 -0
- package/dist/web/steel-view-generation.js +6 -2
- package/dist/web/teams.js +259 -19
- package/dist/web/tekla-editor.html +1 -0
- package/dist/web/terminal-requests.js +6 -0
- package/dist/web/vendor/connection-engine.js +890 -89
- package/dist/web/workspaces.js +630 -48
- package/package.json +4 -1
- package/preferences-file.mjs +27 -0
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
/* Provider-neutral Three.js clipping overlay and handle-drag lifecycle. */
|
|
2
2
|
|
|
3
3
|
import { FT_TO_MM } from './steel-units.js';
|
|
4
|
+
import {
|
|
5
|
+
clipAngleStep, clipBoxCenter, clipBoxEdgePoints, clipBoxFaceAnchor, clipBoxFaceNormal, clipBoxGimbalRing, clipBoxRotation,
|
|
6
|
+
moveClipBoxFace, rotateClipBox, snapClipAngle,
|
|
7
|
+
} from './model-clip-box.js';
|
|
4
8
|
|
|
5
9
|
export const MODEL_CLIP_PLANE_HALF_SIZE_MM = FT_TO_MM;
|
|
6
10
|
export const MODEL_CLIP_HANDLE_HIT_PX = 16;
|
|
7
11
|
export const MODEL_CLIP_MIN_EXTENT_MM = 1;
|
|
12
|
+
/** Screen radius of the clip box's rotation arcs — inside the face handles, like the Profile Position roll arc. */
|
|
13
|
+
export const MODEL_CLIP_ROTATE_ARC_PX = 64;
|
|
14
|
+
/** The rotation arcs take the Profile Position gizmo's axis colours and its amber hover — no new hue. */
|
|
15
|
+
export const MODEL_CLIP_ROTATE_COLORS = Object.freeze({ x: 0xef4444, y: 0x22c55e, z: 0x3b82f6, hot: 0xfbbf24 });
|
|
16
|
+
export const MODEL_CLIP_EDGE_ON_TEXT = 'View is edge-on — orbit, or type the angle in the Clips list';
|
|
17
|
+
const ROTATE_ARC_ORDER = Object.freeze(['z', 'y', 'x']); // pick order: on an exact tie (gimbal lock at Y = ±90°) the Z arc wins
|
|
18
|
+
const ARC_SAMPLES = 24;
|
|
8
19
|
|
|
9
20
|
const FACE_AXES = Object.freeze([
|
|
10
21
|
Object.freeze({ axis: 'x', sign: 1 }), Object.freeze({ axis: 'x', sign: -1 }),
|
|
@@ -33,11 +44,31 @@ export function modelClipPlaneCorners(point, normal, halfSizeMm = MODEL_CLIP_PLA
|
|
|
33
44
|
return [[1, 1], [-1, 1], [-1, -1], [1, -1]].map(([du, dv]) => point.map((value, axis) => value + halfSizeMm * (du * u[axis] + dv * v[axis])));
|
|
34
45
|
}
|
|
35
46
|
|
|
47
|
+
/** The twelve outline edges of a (possibly rotated) clip box — see model-clip-box.js for the rotation. */
|
|
36
48
|
export function modelClipBoxEdgePoints(box) {
|
|
37
49
|
if (!box || !finite3(box.min) || !finite3(box.max)) throw new TypeError('Box edges need finite minimum and maximum points.');
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
return clipBoxEdgePoints(box);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The flat `{ min, max, rotationDeg? }` geometry of a clip, whether it nests its bounds under `.box` or not. */
|
|
54
|
+
const boxGeometry = (clip) => {
|
|
55
|
+
const box = clip?.box || clip;
|
|
56
|
+
const rotationDeg = box?.rotationDeg ?? clip?.rotationDeg;
|
|
57
|
+
return rotationDeg ? { min: box?.min, max: box?.max, rotationDeg } : { min: box?.min, max: box?.max };
|
|
58
|
+
};
|
|
59
|
+
const writeBoxGeometry = (clip, geometry) => {
|
|
60
|
+
const target = clip.box || clip;
|
|
61
|
+
target.min = [...geometry.min]; target.max = [...geometry.max];
|
|
62
|
+
if (geometry.rotationDeg) { target.rotationDeg = [...geometry.rotationDeg]; if (clip.box) delete clip.rotationDeg; }
|
|
63
|
+
else { delete target.rotationDeg; delete clip.rotationDeg; }
|
|
64
|
+
return clip;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** Return the canonical clip produced by turning a box to `angleDeg` about one gimbal axis. */
|
|
68
|
+
export function rotateModelClipHandle(clip, axis, angleDeg) {
|
|
69
|
+
const next = cloneData(clip); const geometry = boxGeometry(next);
|
|
70
|
+
if (!finite3(geometry.min) || !finite3(geometry.max)) throw new TypeError('A clip box needs finite bounds to turn.');
|
|
71
|
+
return writeBoxGeometry(next, rotateClipBox(geometry, axis, angleDeg));
|
|
41
72
|
}
|
|
42
73
|
|
|
43
74
|
/** Parameter on `linePoint + t * lineDirection` nearest to a ray. */
|
|
@@ -58,13 +89,12 @@ export function moveModelClipHandle(clip, handle, deltaMm, minimumExtentMm = MOD
|
|
|
58
89
|
next[pointKey] = addScaled(point, normal, deltaMm);
|
|
59
90
|
return next;
|
|
60
91
|
}
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
92
|
+
const geometry = boxGeometry(next); const index = AXIS_INDEX[handle.axis];
|
|
93
|
+
if (!finite3(geometry.min) || !finite3(geometry.max) || index === undefined || ![-1, 1].includes(handle.sign)) {
|
|
63
94
|
throw new TypeError('A clip box handle needs finite bounds, axis, and sign.');
|
|
64
95
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return next;
|
|
96
|
+
// Along the box's OWN axis on a rotated box; the opposite face stays where it was (model-clip-box.js).
|
|
97
|
+
return writeBoxGeometry(next, moveClipBoxFace(geometry, handle.axis, handle.sign, deltaMm, minimumExtentMm));
|
|
68
98
|
}
|
|
69
99
|
|
|
70
100
|
/**
|
|
@@ -77,7 +107,8 @@ export function createModelClipThreeOverlay({
|
|
|
77
107
|
renderToCanonicalPoint = (point) => point, getClips, getSelectedClipIds = null, isClipSelected = null,
|
|
78
108
|
preview = () => {}, update = () => {}, commit = () => {}, cancel = () => {}, readout = () => {},
|
|
79
109
|
formatDistance = (valueMm) => String(Math.round(valueMm)), setCursor = (value) => { canvas.style.cursor = value; },
|
|
80
|
-
isPlacementArmed = () => false,
|
|
110
|
+
isPlacementArmed = () => false, gesture = () => {},
|
|
111
|
+
rotateArcPx = MODEL_CLIP_ROTATE_ARC_PX,
|
|
81
112
|
planeHalfSizeMm = MODEL_CLIP_PLANE_HALF_SIZE_MM, minimumExtentMm = MODEL_CLIP_MIN_EXTENT_MM,
|
|
82
113
|
hitTolerancePx = MODEL_CLIP_HANDLE_HIT_PX, dragThresholdPx = 5,
|
|
83
114
|
planeColor = 0x3b82f6, boxColor = 0x93c5fd, hoverColor = 0xbfdbfe,
|
|
@@ -111,7 +142,7 @@ export function createModelClipThreeOverlay({
|
|
|
111
142
|
};
|
|
112
143
|
const clear = () => {
|
|
113
144
|
for (const child of [...root.children]) { root.remove(child); disposeObject(child); }
|
|
114
|
-
hitObjects.length = 0;
|
|
145
|
+
hitObjects.length = 0; arcObjects.length = 0;
|
|
115
146
|
};
|
|
116
147
|
const material = (color, transparent = false, opacity = 1) => {
|
|
117
148
|
const value = new THREE.MeshBasicMaterial({ color, transparent, opacity, side: THREE.DoubleSide, depthTest: false, depthWrite: false });
|
|
@@ -123,6 +154,23 @@ export function createModelClipThreeOverlay({
|
|
|
123
154
|
object.renderOrder = 996; root.add(object); return object;
|
|
124
155
|
};
|
|
125
156
|
const handleKey = (handle) => `${handle.clipId}:${handle.kind}:${handle.axis || ''}:${handle.sign || ''}`;
|
|
157
|
+
const arcObjects = [];
|
|
158
|
+
const reportGesture = (value) => { try { gesture(value); } catch (_) { /* guidance cannot break a drag */ } };
|
|
159
|
+
// One quarter-arc rotation handle per gimbal axis, drawn in that ring's OWN plane from e1 to e2
|
|
160
|
+
// (e1 × e2 = the axis it turns about), centred on the box and a fixed number of pixels in radius.
|
|
161
|
+
const addRotateArc = (clip, geometry, axis) => {
|
|
162
|
+
const ring = clipBoxGimbalRing(geometry, axis); const centerCanonical = clipBoxCenter(geometry);
|
|
163
|
+
const center = toRenderPoint(centerCanonical);
|
|
164
|
+
const e1 = toRenderDirection(ring.e1, centerCanonical); const e2 = toRenderDirection(ring.e2, centerCanonical);
|
|
165
|
+
const unitPoints = [];
|
|
166
|
+
for (let i = 0; i <= ARC_SAMPLES; i++) { const t = (i / ARC_SAMPLES) * Math.PI / 2; unitPoints.push(e1.clone().multiplyScalar(Math.cos(t)).addScaledVector(e2, Math.sin(t))); }
|
|
167
|
+
const color = MODEL_CLIP_ROTATE_COLORS[axis];
|
|
168
|
+
const arc = new THREE.Line(new THREE.BufferGeometry().setFromPoints(unitPoints), new THREE.LineBasicMaterial({ color, depthTest: false, depthWrite: false, transparent: true, opacity: .95 }));
|
|
169
|
+
arc.position.copy(center); arc.renderOrder = 999; root.add(arc);
|
|
170
|
+
const descriptor = Object.freeze({ clipId: clip.id, kind: 'box-rotate', axis });
|
|
171
|
+
const data = { descriptor, center, unitPoints, arc, color, axis };
|
|
172
|
+
arcObjects.push(data); arc.userData.modelClipRotateHandle = data;
|
|
173
|
+
};
|
|
126
174
|
const addHandle = (clip, anchorCanonical, normalCanonical, handle, color) => {
|
|
127
175
|
const anchor = toRenderPoint(anchorCanonical); const normal = toRenderDirection(normalCanonical, anchorCanonical);
|
|
128
176
|
const disc = new THREE.Mesh(new THREE.CircleGeometry(1, 32), material(color, true, 0.32));
|
|
@@ -135,14 +183,13 @@ export function createModelClipThreeOverlay({
|
|
|
135
183
|
const data = { descriptor, anchorCanonical: [...anchorCanonical], anchor, normal, disc, stem, cone, color };
|
|
136
184
|
hitObjects.push(data); disc.userData.modelClipHandle = data; cone.userData.modelClipHandle = data;
|
|
137
185
|
};
|
|
138
|
-
const renderBox = (clip,
|
|
139
|
-
|
|
140
|
-
|
|
186
|
+
const renderBox = (clip, { rotatable = false } = {}) => {
|
|
187
|
+
const geometry = boxGeometry(clip);
|
|
188
|
+
line(modelClipBoxEdgePoints(geometry).map(toRenderPoint), boxColor);
|
|
141
189
|
for (const face of FACE_AXES) {
|
|
142
|
-
|
|
143
|
-
const normal = [0, 0, 0]; normal[axis] = face.sign;
|
|
144
|
-
addHandle(clip, anchor, normal, { kind: 'box', axis: face.axis, sign: face.sign }, boxColor);
|
|
190
|
+
addHandle(clip, clipBoxFaceAnchor(geometry, face.axis, face.sign), clipBoxFaceNormal(geometry, face.axis, face.sign), { kind: 'box', axis: face.axis, sign: face.sign }, boxColor);
|
|
145
191
|
}
|
|
192
|
+
if (rotatable) for (const axis of ROTATE_ARC_ORDER) addRotateArc(clip, geometry, axis);
|
|
146
193
|
};
|
|
147
194
|
const renderPlane = (clip) => {
|
|
148
195
|
const point = planePoint(clip); const normal = normalized(planeNormal(clip)); if (!finite3(point) || !normal) return;
|
|
@@ -164,13 +211,17 @@ export function createModelClipThreeOverlay({
|
|
|
164
211
|
data.stem.geometry.setFromPoints([data.anchor, arrowPoint]);
|
|
165
212
|
data.cone.position.copy(arrowPoint); data.cone.scale.setScalar(worldPerPixel(arrowPoint) * 11);
|
|
166
213
|
}
|
|
214
|
+
for (const data of arcObjects) data.arc.scale.setScalar(worldPerPixel(data.center) * rotateArcPx);
|
|
167
215
|
};
|
|
168
216
|
const render = () => {
|
|
169
217
|
if (disposed) return; const retainedHover = hoveredKey; hoveredKey = null; clear();
|
|
170
|
-
for
|
|
171
|
-
|
|
218
|
+
// The rotation arcs show for ONE selected box at a time — the same rule the Clips list's rotation
|
|
219
|
+
// fields follow — so several selected boxes never stack three arcs each on the view.
|
|
220
|
+
const selectedClips = clips().filter((clip) => selected(clip));
|
|
221
|
+
const onlyBox = selectedClips.length === 1 && selectedClips[0].kind === 'box' ? selectedClips[0].id : null;
|
|
222
|
+
for (const original of selectedClips) {
|
|
172
223
|
const clip = overrides.get(original.id) || original;
|
|
173
|
-
if (clip.kind === 'box') { const box = clip.box || clip; if (finite3(box.min) && finite3(box.max)) renderBox(clip,
|
|
224
|
+
if (clip.kind === 'box') { const box = clip.box || clip; if (finite3(box.min) && finite3(box.max)) renderBox(clip, { rotatable: clip.id === onlyBox }); }
|
|
174
225
|
else if (clip.kind === 'plane') renderPlane(clip);
|
|
175
226
|
}
|
|
176
227
|
resize();
|
|
@@ -179,10 +230,13 @@ export function createModelClipThreeOverlay({
|
|
|
179
230
|
const handlesScreen = () => {
|
|
180
231
|
if (disposed) return [];
|
|
181
232
|
const activeCamera = getCamera(); const rect = canvas.getBoundingClientRect(); activeCamera?.updateMatrixWorld?.();
|
|
182
|
-
|
|
233
|
+
const arcPoints = arcObjects.flatMap((data) => data.unitPoints.filter((_, index) => index % 2 === 0).map((unit) => ({
|
|
234
|
+
...data.descriptor, part: 'arc', point: data.center.clone().addScaledVector(unit, data.arc.scale.x || 1),
|
|
235
|
+
})));
|
|
236
|
+
return [...hitObjects.flatMap((data) => [
|
|
183
237
|
{ ...data.descriptor, part: 'disc', point: data.disc.position },
|
|
184
238
|
{ ...data.descriptor, part: 'arrow', point: data.cone.position },
|
|
185
|
-
]).map(({ point, ...entry }) => {
|
|
239
|
+
]), ...arcPoints].map(({ point, ...entry }) => {
|
|
186
240
|
const projected = point.clone().project(activeCamera);
|
|
187
241
|
return { ...entry, x: rect.left + (projected.x * .5 + .5) * rect.width, y: rect.top + (-projected.y * .5 + .5) * rect.height, behind: projected.z > 1 };
|
|
188
242
|
});
|
|
@@ -204,7 +258,11 @@ export function createModelClipThreeOverlay({
|
|
|
204
258
|
data.disc.material.color.setHex(color); data.disc.material.opacity = on ? .58 : .32;
|
|
205
259
|
data.stem.material.color.setHex(color); data.cone.material.color.setHex(color);
|
|
206
260
|
}
|
|
207
|
-
|
|
261
|
+
for (const data of arcObjects) {
|
|
262
|
+
const on = hoveredKey === handleKey(data.descriptor);
|
|
263
|
+
data.arc.material.color.setHex(on ? MODEL_CLIP_ROTATE_COLORS.hot : data.color); data.arc.material.opacity = on ? 1 : .95;
|
|
264
|
+
}
|
|
265
|
+
if (handle) setCursor(handle.kind === 'box-rotate' ? 'grab' : 'move'); else if (releaseCursor) setCursor('default');
|
|
208
266
|
return !!handle;
|
|
209
267
|
};
|
|
210
268
|
const eventRay = (event) => {
|
|
@@ -223,7 +281,13 @@ export function createModelClipThreeOverlay({
|
|
|
223
281
|
const movedCanonical = toCanonicalPoint(movedRender);
|
|
224
282
|
return dot(movedCanonical.map((value, axis) => value - drag.anchorCanonical[axis]), drag.axisCanonical);
|
|
225
283
|
};
|
|
284
|
+
const formatAngle = (deg, free) => `${free ? (Math.round(deg * 10) / 10).toFixed(1) : String(Math.round(deg))}°`;
|
|
226
285
|
const makeReadout = (clip, deltaMm) => {
|
|
286
|
+
if (drag.handle.kind === 'box-rotate') {
|
|
287
|
+
const angleDeg = clipBoxRotation(boxGeometry(clip))[AXIS_INDEX[drag.handle.axis]];
|
|
288
|
+
const text = drag.edgeOn ? MODEL_CLIP_EDGE_ON_TEXT : formatAngle(angleDeg, drag.free);
|
|
289
|
+
return Object.freeze({ valueMm: null, angleDeg, text, type: drag.edgeOn ? '' : drag.handle.axis.toUpperCase(), deltaMm: 0, extentMm: null });
|
|
290
|
+
}
|
|
227
291
|
if (drag.handle.kind === 'plane') return Object.freeze({ valueMm: deltaMm, text: String(formatDistance(deltaMm, { kind: 'plane-offset', handle: drag.handle })), type: '⟂', deltaMm, extentMm: null });
|
|
228
292
|
const box = clip.box || clip; const extentMm = box.max[AXIS_INDEX[drag.handle.axis]] - box.min[AXIS_INDEX[drag.handle.axis]];
|
|
229
293
|
return Object.freeze({ valueMm: extentMm, text: String(formatDistance(extentMm, { kind: 'box-extent', handle: drag.handle })), type: drag.handle.axis.toUpperCase(), deltaMm, extentMm });
|
|
@@ -232,14 +296,51 @@ export function createModelClipThreeOverlay({
|
|
|
232
296
|
clipId: drag.clipId, clip: cloneData(clip), previous: cloneData(drag.previous), handle: drag.handle,
|
|
233
297
|
deltaMm: drag.deltaMm, readout: drag.lastReadout, event, ...(reason ? { reason } : {}),
|
|
234
298
|
});
|
|
299
|
+
// The pointer's angle (degrees) about the frozen ring, measured in CANONICAL space so a provider whose
|
|
300
|
+
// render frame mirrors an axis still turns the box the way the arc shows. null when edge-on.
|
|
301
|
+
const ringAngle = (event) => {
|
|
302
|
+
const ray = eventRay(event); const normal = drag.ringAxisRender; const denominator = normal.dot(ray.direction);
|
|
303
|
+
if (Math.abs(denominator) < 1e-6) return null;
|
|
304
|
+
const t = normal.dot(drag.centerRender.clone().sub(ray.origin)) / denominator;
|
|
305
|
+
const hit = ray.origin.clone().addScaledVector(ray.direction, t);
|
|
306
|
+
const hitCanonical = toCanonicalPoint(hit); const d = hitCanonical.map((value, axis) => value - drag.centerCanonical[axis]);
|
|
307
|
+
const u = dot(d, drag.ring.e1), v = dot(d, drag.ring.e2);
|
|
308
|
+
if (Math.hypot(u, v) < 1e-9) return null;
|
|
309
|
+
return Math.atan2(v, u) * 180 / Math.PI;
|
|
310
|
+
};
|
|
311
|
+
const beginRotate = (event, handle, clip) => {
|
|
312
|
+
const geometry = boxGeometry(clip); const ring = clipBoxGimbalRing(geometry, handle.axis);
|
|
313
|
+
const centerCanonical = clipBoxCenter(geometry);
|
|
314
|
+
drag = { pointerId: event.pointerId, clipId: handle.clipId, handle: Object.freeze({ kind: 'box-rotate', axis: handle.axis }), previous: cloneData(clip),
|
|
315
|
+
ring, centerCanonical, centerRender: toRenderPoint(centerCanonical), ringAxisRender: toRenderDirection(ring.axis, centerCanonical),
|
|
316
|
+
startAngleDeg: clipBoxRotation(geometry)[AXIS_INDEX[handle.axis]], sweptDeg: 0, prevPointerDeg: null, lastAngleDeg: clipBoxRotation(geometry)[AXIS_INDEX[handle.axis]],
|
|
317
|
+
downX: event.clientX, downY: event.clientY, moved: false, deltaMm: 0, lastReadout: null, free: false, edgeOn: false };
|
|
318
|
+
drag.prevPointerDeg = ringAngle(event);
|
|
319
|
+
paintHover(null); setCursor('grabbing'); canvas.setPointerCapture?.(event.pointerId);
|
|
320
|
+
reportGesture(Object.freeze({ phase: 'begin', kind: 'box-rotate', axis: handle.axis, clipId: handle.clipId })); return true;
|
|
321
|
+
};
|
|
322
|
+
const moveRotate = (event) => {
|
|
323
|
+
drag.free = event.shiftKey === true;
|
|
324
|
+
const pointer = ringAngle(event);
|
|
325
|
+
// Edge-on, the pointer gives no angle: hold the last measured one (never re-snap the start angle,
|
|
326
|
+
// which would turn a typed 17 degrees to 15 while the readout says nothing can be measured).
|
|
327
|
+
if (pointer === null) { drag.edgeOn = true; return rotateModelClipHandle(drag.previous, drag.handle.axis, drag.lastAngleDeg); }
|
|
328
|
+
drag.edgeOn = false;
|
|
329
|
+
if (drag.prevPointerDeg === null) drag.prevPointerDeg = pointer;
|
|
330
|
+
drag.sweptDeg += clipAngleStep(drag.prevPointerDeg, pointer); drag.prevPointerDeg = pointer;
|
|
331
|
+
drag.lastAngleDeg = snapClipAngle(drag.startAngleDeg + drag.sweptDeg, drag.free);
|
|
332
|
+
return rotateModelClipHandle(drag.previous, drag.handle.axis, drag.lastAngleDeg);
|
|
333
|
+
};
|
|
235
334
|
const begin = (event) => {
|
|
236
335
|
if (event.button !== 0 || drag) return false;
|
|
237
336
|
const handle = pickHandle(event.clientX, event.clientY); if (!handle) return false;
|
|
238
337
|
const clip = currentClip(handle.clipId); if (!clip) return false;
|
|
338
|
+
if (handle.kind === 'box-rotate') return beginRotate(event, handle, clip);
|
|
239
339
|
const anchorCanonical = handle.kind === 'plane'
|
|
240
340
|
? [...planePoint(clip)]
|
|
241
|
-
: (()
|
|
242
|
-
|
|
341
|
+
: clipBoxFaceAnchor(boxGeometry(clip), handle.axis, handle.sign);
|
|
342
|
+
// A box face slides along the box's OWN +axis (the world axis while the box is unrotated).
|
|
343
|
+
const axisCanonical = handle.kind === 'plane' ? normalized(planeNormal(clip)) : clipBoxFaceNormal(boxGeometry(clip), handle.axis, 1);
|
|
243
344
|
if (!axisCanonical) return false;
|
|
244
345
|
const anchorRender = toRenderPoint(anchorCanonical); const axisRender = toRenderDirection(axisCanonical, anchorCanonical);
|
|
245
346
|
const ray = eventRay(event); const t0 = modelClipClosestLineParameter(anchorRender.toArray(), axisRender.toArray(), ray.origin.toArray(), ray.direction.toArray());
|
|
@@ -251,6 +352,11 @@ export function createModelClipThreeOverlay({
|
|
|
251
352
|
if (event.buttons != null && event.buttons !== 1) return false;
|
|
252
353
|
if (!drag.moved && Math.hypot(event.clientX - drag.downX, event.clientY - drag.downY) <= dragThresholdPx) return true;
|
|
253
354
|
drag.moved = true;
|
|
355
|
+
if (drag.handle.kind === 'box-rotate') {
|
|
356
|
+
const next = moveRotate(event); drag.lastReadout = makeReadout(next, 0); overrides.set(drag.clipId, next);
|
|
357
|
+
const value = payload(next, event); preview(value); update(value); readout(value); render();
|
|
358
|
+
reportGesture(Object.freeze({ phase: 'update', kind: 'box-rotate', axis: drag.handle.axis, clipId: drag.clipId, angleDeg: drag.lastReadout.angleDeg })); return true;
|
|
359
|
+
}
|
|
254
360
|
const deltaMm = dragDeltaMm(event); const next = moveModelClipHandle(drag.previous, drag.handle, deltaMm, minimumExtentMm);
|
|
255
361
|
drag.deltaMm = deltaMm; drag.lastReadout = makeReadout(next, deltaMm); overrides.set(drag.clipId, next);
|
|
256
362
|
const value = payload(next, event); preview(value); update(value); readout(value); render(); return true;
|
|
@@ -260,6 +366,7 @@ export function createModelClipThreeOverlay({
|
|
|
260
366
|
const active = drag; const clip = overrides.get(active.clipId) || active.previous; const value = payload(clip, event);
|
|
261
367
|
canvas.releasePointerCapture?.(active.pointerId); overrides.delete(active.clipId); drag = null;
|
|
262
368
|
if (active.moved) commit(value);
|
|
369
|
+
if (active.handle.kind === 'box-rotate') reportGesture(null);
|
|
263
370
|
setCursor('default'); render(); return true;
|
|
264
371
|
};
|
|
265
372
|
const restore = (reason, event = null) => {
|
|
@@ -268,6 +375,7 @@ export function createModelClipThreeOverlay({
|
|
|
268
375
|
overrides.set(active.clipId, active.previous); const value = payload(active.previous, event, reason);
|
|
269
376
|
if (active.moved) { preview(value); update(value); }
|
|
270
377
|
cancel(value); readout(Object.freeze({ ...value, hidden: true }));
|
|
378
|
+
if (active.handle.kind === 'box-rotate') reportGesture(null);
|
|
271
379
|
canvas.releasePointerCapture?.(active.pointerId); overrides.delete(active.clipId); drag = null; setCursor('default'); render(); return true;
|
|
272
380
|
};
|
|
273
381
|
const inputPlugin = Object.freeze({
|
|
@@ -291,5 +399,7 @@ export function createModelClipThreeOverlay({
|
|
|
291
399
|
const dispose = () => { if (disposed) return; restore('dispose'); paintHover(null); clear(); overlayScene.remove(root); disposed = true; };
|
|
292
400
|
|
|
293
401
|
render();
|
|
294
|
-
|
|
402
|
+
const activeGesture = () => (drag ? Object.freeze({ kind: drag.handle.kind, axis: drag.handle.axis ?? null, clipId: drag.clipId, moved: drag.moved }) : null);
|
|
403
|
+
return Object.freeze({ inputPlugin: () => inputPlugin, render, resize, handlesScreen, activeGesture, dispose });
|
|
404
|
+
|
|
295
405
|
}
|
|
@@ -118,6 +118,8 @@
|
|
|
118
118
|
.model-view-cube-status{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
119
119
|
|
|
120
120
|
.model-clip-list{border-top:1px solid var(--line);margin-top:8px;padding-top:4px}.model-clip-list-header{height:30px;display:flex;align-items:center;gap:7px;padding:0 5px;color:var(--text)}.model-clip-list-header strong{font-size:11px;text-transform:uppercase;letter-spacing:.08em}.model-clip-count{min-width:18px;height:18px;display:grid;place-items:center;border-radius:9px;background:var(--btn);color:var(--muted);font-size:10px}.model-clip-enable-all{width:24px;min-width:24px;min-height:24px;padding:0;border:0;background:transparent;color:var(--muted);box-shadow:none}.model-clip-enable-all[data-state="on"]{color:var(--brand,#60a5fa)}.model-clip-enable-all[data-state="mixed"]{color:#64748b}.model-clip-clear{margin-left:auto}.model-clip-list-rows{display:grid;align-content:start;gap:2px}.model-clip-row{min-height:30px;display:grid;grid-template-columns:24px minmax(0,1fr) 24px;align-items:center;gap:4px;border-radius:5px;padding:2px 3px}.model-clip-row:hover,.model-clip-row.is-selected{background:var(--accent-soft)}.model-clip-row.is-selected{outline:1px solid color-mix(in srgb,var(--brand,#3b82f6) 58%,transparent)}.model-clip-row button{min-width:0;min-height:24px;padding:2px 5px;border:0;background:transparent;color:var(--muted);box-shadow:none}.model-clip-row button:hover{background:var(--btn-hover);color:var(--text)}.model-clip-enable{width:22px;border:1px solid var(--line)!important;color:var(--brand,#60a5fa)!important}.model-clip-enable[aria-pressed="false"]{color:transparent!important}.model-clip-label{text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)!important}.model-clip-remove{font-size:16px;line-height:1}.model-clip-rename{width:100%;min-width:0;height:25px;border:1px solid var(--brand,#3b82f6);border-radius:4px;background:var(--bg,#020817);color:var(--text);padding:2px 6px;font:inherit;outline:none}.model-clip-list-empty{padding:10px 7px 12px;color:var(--muted);font-size:11px;line-height:1.45}.model-clip-drag-readout{position:fixed;z-index:60;pointer-events:none;padding:5px 9px;border:1px solid var(--line);border-radius:5px;background:var(--panel);color:var(--text);box-shadow:0 3px 10px var(--model-shadow,rgba(0,0,0,.45));font:11px var(--mono,monospace)}
|
|
121
|
+
/* The Clips list rotation strip (web/model-clip-list.js): one selected box, X/Y/Z angle fields + Reset rotation. Text inputs (inputmode=decimal), so no native spinner can leak; the field look is .model-clip-rename at rest. */
|
|
122
|
+
.model-clip-rotation{border-top:1px solid var(--line);margin-top:6px;padding:6px 5px 4px;display:grid;gap:6px}.model-clip-rotation-head{display:flex;align-items:center;gap:7px;min-height:22px;color:var(--text)}.model-clip-rotation-head strong{font-size:11px;text-transform:uppercase;letter-spacing:.08em}.model-clip-rotation-unit{color:var(--muted);font-size:11px}.model-clip-rotation-reset{margin-left:auto;min-height:22px;padding:2px 7px;border:0;border-radius:4px;background:transparent;color:var(--muted);box-shadow:none;font:inherit;font-size:11px;cursor:pointer}.model-clip-rotation-reset:hover{background:var(--btn-hover);color:var(--text)}.model-clip-rotation-reset:focus-visible,.model-clip-rotation-input:focus-visible{outline:2px solid var(--brand,#3b82f6);outline-offset:1px}.model-clip-rotation-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.model-clip-rotation-field{display:flex;align-items:center;gap:4px;min-width:0;color:var(--muted);font-size:11px}.model-clip-rotation-axis{width:10px;flex:none;text-align:center;font-weight:600}.model-clip-rotation-input{width:100%;min-width:0;height:25px;border:1px solid var(--line);border-radius:4px;background:var(--bg,#020817);color:var(--text);padding:2px 6px;font:11px var(--mono,monospace);text-align:right;outline:none}.model-clip-rotation-input:focus{border-color:var(--brand,#3b82f6)}.model-clip-rotation-input[aria-invalid="true"]{border-color:var(--err,var(--danger,#fb7185))}.model-clip-rotation-degree{flex:none;color:var(--muted)}.model-clip-rotation-error{color:var(--err,var(--danger,#fb7185));font-size:11px;line-height:1.4}
|
|
121
123
|
|
|
122
124
|
/* Inspector seam, stub and grip are shared with master Steel. */
|
|
123
125
|
.model-inspector-resizer{flex:none;width:11px;cursor:col-resize;background:transparent;position:relative;z-index:6;touch-action:none;align-self:stretch}
|