diff --git a/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to .github/CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/SECURITY.md b/.github/SECURITY.md similarity index 100% rename from SECURITY.md rename to .github/SECURITY.md diff --git a/README.md b/README.md index 451df25..460f952 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ src/lib/ Small shared utilities public/assets/ Static image, icon, logo, and shape assets public/manifold.* Manifold runtime files used by geometry tooling docs/media/ README screenshots and future demo videos -.github/ Issue templates and pull request template +.github/ Issue templates, community health files, and pull request template ``` ## Local Data @@ -302,11 +302,11 @@ Good areas to help: - accessibility improvements - performance work for larger scenes -Before opening a pull request, read [CONTRIBUTING.md](CONTRIBUTING.md). +Before opening a pull request, read [.github/CONTRIBUTING.md](.github/CONTRIBUTING.md). ## Security -Please do not open public issues for security-sensitive reports. Read [SECURITY.md](SECURITY.md) for the reporting process. +Please do not open public issues for security-sensitive reports. Read [.github/SECURITY.md](.github/SECURITY.md) for the reporting process. ## License diff --git a/CHANGELOG.md b/docs/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to docs/CHANGELOG.md diff --git a/open-static.html b/open-static.html deleted file mode 100644 index 4a4fd59..0000000 --- a/open-static.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Open SketchForge - - - Open SketchForge - - diff --git a/src/components/SketchForgeEditor.tsx b/src/components/SketchForgeEditor.tsx index 33bb149..3f82b7c 100644 --- a/src/components/SketchForgeEditor.tsx +++ b/src/components/SketchForgeEditor.tsx @@ -166,6 +166,46 @@ function canonicalizeShape(shape: WorkplaneShape): WorkplaneShape { return next; } +function workplaneShapesEqual(a: WorkplaneShape, b: WorkplaneShape) { + return ( + a.id === b.id && + a.name === b.name && + a.kind === b.kind && + a.color === b.color && + a.hole === b.hole && + a.x === b.x && + a.z === b.z && + a.elevation === b.elevation && + a.size === b.size && + a.width === b.width && + a.depth === b.depth && + a.height === b.height && + a.rotation === b.rotation && + a.rotationX === b.rotationX && + a.rotationZ === b.rotationZ && + a.mirrorX === b.mirrorX && + a.mirrorY === b.mirrorY && + a.mirrorZ === b.mirrorZ && + a.radius === b.radius && + a.steps === b.steps && + a.sides === b.sides && + a.bevel === b.bevel && + a.segments === b.segments && + a.topRadius === b.topRadius && + a.baseRadius === b.baseRadius && + a.text === b.text && + a.font === b.font && + a.importedMesh === b.importedMesh && + a.imagePlate === b.imagePlate && + a.groupedShapes === b.groupedShapes && + a.groupedBaseWidth === b.groupedBaseWidth && + a.groupedBaseDepth === b.groupedBaseDepth && + a.groupedBaseHeight === b.groupedBaseHeight && + a.locked === b.locked && + a.hidden === b.hidden + ); +} + function serializeShapesForSync(shapes: WorkplaneShape[]) { return JSON.stringify(shapes.map(canonicalizeShape)); } @@ -4047,9 +4087,12 @@ export function SketchForgeEditor({ const fileInputRef = useRef(null); const booleanAutomationRunRef = useRef(null); const projectHydratingRef = useRef(false); + const projectInteractionActiveRef = useRef(false); + const pendingProjectShapesRef = useRef(null); const projectSyncTimerRef = useRef(null); const lastProjectShapesSyncRef = useRef(""); const projectSnapshotRunRef = useRef(0); + const [projectInteractionActive, setProjectInteractionActive] = useState(false); useEffect(() => { const applyTitles = () => { @@ -4115,6 +4158,9 @@ export function SketchForgeEditor({ if (!projectId || !onProjectSnapshot || typeof window === "undefined") { return; } + if (projectInteractionActive) { + return; + } const runId = projectSnapshotRunRef.current + 1; projectSnapshotRunRef.current = runId; @@ -4134,7 +4180,7 @@ export function SketchForgeEditor({ window.clearTimeout(firstTimer); window.clearTimeout(secondTimer); }; - }, [onProjectSnapshot, projectId, shapes]); + }, [onProjectSnapshot, projectId, projectInteractionActive, shapes]); useEffect(() => { if (selectedShapes.length < 2) { @@ -4157,6 +4203,14 @@ export function SketchForgeEditor({ if (!projectId || !onProjectShapesChange) { return; } + if (projectInteractionActiveRef.current) { + pendingProjectShapesRef.current = nextShapes.map(canonicalizeShape); + if (projectSyncTimerRef.current !== null) { + window.clearTimeout(projectSyncTimerRef.current); + projectSyncTimerRef.current = null; + } + return; + } const canonicalNext = nextShapes.map(canonicalizeShape); const serialized = projectShapesFingerprint(canonicalNext); if (lastProjectShapesSyncRef.current === serialized) { @@ -4174,6 +4228,21 @@ export function SketchForgeEditor({ [onProjectShapesChange, projectId], ); + useEffect(() => { + if (projectInteractionActive || !pendingProjectShapesRef.current) { + return; + } + const pendingShapes = pendingProjectShapesRef.current; + pendingProjectShapesRef.current = null; + const timer = window.setTimeout(() => syncProjectShapes(pendingShapes), 180); + return () => window.clearTimeout(timer); + }, [projectInteractionActive, syncProjectShapes]); + + const updateProjectInteractionActive = useCallback((active: boolean) => { + projectInteractionActiveRef.current = active; + setProjectInteractionActive((current) => (current === active ? current : active)); + }, []); + const commitShapes = useCallback( (next: WorkplaneShape[], nextSelection: string | string[] | null = selectedIds, message?: string) => { const canonicalNext = next.map(canonicalizeShape); @@ -4246,16 +4315,23 @@ export function SketchForgeEditor({ const updateShape = useCallback((id: string, patch: Partial) => { const cleanedPatch = cleanShapePatch(patch); - setShapes((current) => - current.map((shape) => { + setShapes((current) => { + let changed = false; + const next = current.map((shape) => { if (shape.id !== id) { return shape; } const patched = { ...shape, ...cleanedPatch }; - return canonicalizeShape("hole" in cleanedPatch ? withHoleMode(patched, Boolean(cleanedPatch.hole), cleanedPatch.color) : patched); - }), - ); + const canonical = canonicalizeShape("hole" in cleanedPatch ? withHoleMode(patched, Boolean(cleanedPatch.hole), cleanedPatch.color) : patched); + if (workplaneShapesEqual(shape, canonical)) { + return shape; + } + changed = true; + return canonical; + }); + return changed ? next : current; + }); }, []); const deleteSelected = useCallback(() => { @@ -5275,6 +5351,7 @@ export function SketchForgeEditor({ onMirrorSelection={mirrorSelectionAcross} onSelectShape={selectShape} onSetPlacementElevation={setPlacementWorkplane} + onInteractionActiveChange={updateProjectInteractionActive} onUpdateShape={updateShape} onWorkplaneModeChange={setWorkplaneMode} /> diff --git a/src/components/WorkplaneViewport.tsx b/src/components/WorkplaneViewport.tsx index 06e9f30..bbdf46e 100644 --- a/src/components/WorkplaneViewport.tsx +++ b/src/components/WorkplaneViewport.tsx @@ -121,6 +121,7 @@ type WorkplaneViewportProps = { onMirrorSelection: (axis: AlignAxis) => void; onSelectShape: (id: string | string[] | null, mode?: "replace" | "toggle") => void; onSetPlacementElevation: (elevation: number, source: "shape" | "base") => void; + onInteractionActiveChange?: (active: boolean) => void; onUpdateShape: (id: string, patch: Partial) => void; onWorkplaneModeChange: (active: boolean) => void; }; @@ -143,6 +144,7 @@ type ThreeState = { wasCameraMoving: boolean; lastOverlaySync: number; lastViewCubeSync: number; + rotationHandleSides: RotationHandleSides | null; disposeInteractionListeners: () => void; resize: () => void; }; @@ -190,6 +192,8 @@ type MarqueeState = { type TransformHandleKind = "scale" | "height" | "lift" | "rotate"; type RotationAxis = "x" | "y" | "z"; +type RotationHandleSide = "near" | "right" | "far" | "left"; +type RotationHandleSides = Record; type TransformDragState = { id: string; ids: string[]; @@ -210,6 +214,7 @@ type TransformDragState = { scalePlaneY: number; rotationAxisVector?: THREE.Vector3; rotationPivot?: THREE.Vector3; + rotationPlaneCenter?: THREE.Vector3; rotationStartVector?: THREE.Vector3; rotationScreenCenter?: { x: number; y: number }; rotationScreenSign?: number; @@ -234,6 +239,8 @@ type TransformOverlayState = { rotateHandles: Array<{ key: string; className: string; x: number; y: number; angle: number }>; dimensions: Record; rotationWheel: { x: number; y: number; radius: number } | null; + rotationWheels: Record; + rotationPlaneCenters: Record; rotationPlanes: Record; }; @@ -331,10 +338,6 @@ function isVerticalMeasureHandleKind(kind: TransformHandleKind) { return kind === "height" || kind === "lift"; } -function isHeightMeasureKey(key: string | null) { - return key === "top-height" || key === "bottom-height"; -} - function getElevationMeasureKey(overlay: TransformOverlayState | null) { return ( Object.values(overlay?.dimensions ?? {}) @@ -344,7 +347,13 @@ function getElevationMeasureKey(overlay: TransformOverlayState | null) { } function measureKeyForHandle(kind: TransformHandleKind, handleKey: string, overlay: TransformOverlayState | null) { - return isVerticalMeasureHandleKind(kind) ? (getElevationMeasureKey(overlay) ?? handleKey) : handleKey; + if (kind === "lift") { + return getElevationMeasureKey(overlay) ?? handleKey; + } + if (kind === "height") { + return null; + } + return handleKey; } function previewShapesForDrag(shapes: WorkplaneShape[], drag: DragState | null) { @@ -444,10 +453,10 @@ function unwrapRadians(value: number) { } function rotationAxisForHandle(handleKey: string): RotationAxis { - if (handleKey.endsWith("-x") || handleKey === "rotate-right") { + if (handleKey.endsWith("-x") || handleKey === "rotate-left") { return "x"; } - if (handleKey.endsWith("-z") || handleKey === "rotate-left") { + if (handleKey.endsWith("-z") || handleKey === "rotate-right") { return "z"; } return "y"; @@ -648,8 +657,10 @@ function boundsIntersectRect(bounds: NonNullable= rect.left && bounds.minX <= rect.right && bounds.maxY >= rect.top && bounds.minY <= rect.bottom; } -function rotationAxisVectorForFrame(handleKey: string, _frame: SelectionFrame) { - return rotationAxisVector(rotationAxisForHandle(handleKey)); +function rotationAxisVectorForFrame(handleKey: string, frame: SelectionFrame) { + const axis = rotationAxisForHandle(handleKey); + void frame; + return rotationAxisVector(axis); } function rayPointOnRotationPlane(state: ThreeState, clientX: number, clientY: number, pivot: THREE.Vector3, axis: THREE.Vector3) { @@ -671,6 +682,68 @@ function screenVectorAngle(from: { x: number; y: number }, to: { x: number; y: n return THREE.MathUtils.radToDeg(Math.atan2(to.y - from.y, to.x - from.x)); } +const ROTATION_HANDLE_SIDE_HYSTERESIS = 0.22; +const ROTATION_HANDLE_DOMINANCE_HYSTERESIS = 0.18; + +function signedRotationSide(value: number, previous: RotationHandleSide | undefined, positiveSide: RotationHandleSide, negativeSide: RotationHandleSide) { + if (previous === positiveSide && value > -ROTATION_HANDLE_SIDE_HYSTERESIS) { + return previous; + } + if (previous === negativeSide && value < ROTATION_HANDLE_SIDE_HYSTERESIS) { + return previous; + } + return value >= 0 ? positiveSide : negativeSide; +} + +function rotationSideScore(side: RotationHandleSide, viewX: number, viewZ: number) { + if (side === "right") { + return viewX; + } + if (side === "left") { + return -viewX; + } + if (side === "near") { + return viewZ; + } + return -viewZ; +} + +function dominantRotationSide(viewX: number, viewZ: number, previous: RotationHandleSide | undefined) { + const sides: RotationHandleSide[] = ["near", "right", "far", "left"]; + const best = sides.reduce( + (current, side) => { + const score = rotationSideScore(side, viewX, viewZ); + return score > current.score ? { side, score } : current; + }, + { side: "near" as RotationHandleSide, score: Number.NEGATIVE_INFINITY }, + ); + + if (previous && rotationSideScore(previous, viewX, viewZ) >= best.score - ROTATION_HANDLE_DOMINANCE_HYSTERESIS) { + return previous; + } + return best.side; +} + +function rotationHandleSidesForCamera(state: ThreeState, center: THREE.Vector3) { + const view = state.camera.position.clone().sub(center); + view.y = 0; + const length = view.length(); + if (length < 0.0001) { + return state.rotationHandleSides ?? { x: "right", y: "near", z: "near" }; + } + + const viewX = view.x / length; + const viewZ = view.z / length; + const previous = state.rotationHandleSides ?? undefined; + const next: RotationHandleSides = { + x: signedRotationSide(viewX, previous?.x, "right", "left"), + y: dominantRotationSide(viewX, viewZ, previous?.y), + z: signedRotationSide(viewZ, previous?.z, "near", "far"), + }; + state.rotationHandleSides = next; + return next; +} + function projectedWorldYForScreenY(state: ThreeState, shape: WorkplaneShape, targetScreenY: number, startWorldY: number) { let nextWorldY = startWorldY; for (let index = 0; index < 8; index += 1) { @@ -842,6 +915,7 @@ export function WorkplaneViewport({ onMirrorSelection, onSelectShape, onSetPlacementElevation, + onInteractionActiveChange, onUpdateShape, onWorkplaneModeChange, }: WorkplaneViewportProps) { @@ -1167,20 +1241,28 @@ export function WorkplaneViewport({ const yStart = handlesLowerSide ? yBounds.min : yBounds.max; const liftOffset = kind === "lift" ? Math.max(2, yBounds.height * 0.08) * (handlesLowerSide ? -1 : 1) : 0; const startWorldY = yStart + liftOffset; - const wheel = transformOverlayRef.current?.rotationWheel ?? undefined; + const overlay = transformOverlayRef.current; + const wheel = kind === "rotate" ? (overlay?.rotationWheels[rotationAxis] ?? overlay?.rotationWheel ?? undefined) : undefined; + const rotationPlaneCenterData = kind === "rotate" ? overlay?.rotationPlaneCenters[rotationAxis] : undefined; + const rotationPlaneCenter = rotationPlaneCenterData + ? new THREE.Vector3(rotationPlaneCenterData.x, rotationPlaneCenterData.y, rotationPlaneCenterData.z) + : frame.center.clone(); const rect = state?.renderer.domElement.getBoundingClientRect(); const localClientX = rect ? event.clientX - rect.left : event.clientX; const localClientY = rect ? event.clientY - rect.top : event.clientY; const axisVector = rotationAxisVectorForFrame(handleKey, frame); const pivot = frame.center.clone(); const rotationCenter = kind === "rotate" ? wheel ?? (state ? projectToScreen(pivot, state) : { x: localClientX, y: localClientY }) : undefined; - const rotationStartPoint = kind === "rotate" && state ? rayPointOnRotationPlane(state, event.clientX, event.clientY, pivot, axisVector) : null; - const rotationStartVector = rotationStartPoint ? rotationStartPoint.sub(pivot) : undefined; + const rotationStartPoint = kind === "rotate" && state ? rayPointOnRotationPlane(state, event.clientX, event.clientY, rotationPlaneCenter, axisVector) : null; + const rotationStartVector = rotationStartPoint ? rotationStartPoint.sub(rotationPlaneCenter) : undefined; event.preventDefault(); event.stopPropagation(); event.currentTarget.setPointerCapture(event.pointerId); setEditingRotation(null); setPinnedMeasureKey(measureKeyForHandle(kind, handleKey, transformOverlayRef.current)); + if (kind === "height") { + setHoverMeasureKey(null); + } setActiveRotationWheel(kind === "rotate"); setActiveTransformKind(kind); if (kind === "rotate") { @@ -1214,6 +1296,7 @@ export function WorkplaneViewport({ scalePlaneY: kind === "scale" ? yBounds.min : 0, rotationAxisVector: kind === "rotate" ? axisVector : undefined, rotationPivot: kind === "rotate" ? pivot : undefined, + rotationPlaneCenter: kind === "rotate" ? rotationPlaneCenter : undefined, rotationStartVector: kind === "rotate" ? rotationStartVector : undefined, rotationScreenCenter: rotationCenter, rotationScreenSign: kind === "rotate" && state ? rotationScreenSign(axisVector, state.camera) : 1, @@ -1241,8 +1324,9 @@ export function WorkplaneViewport({ if (state) { state.controls.enabled = false; } + onInteractionActiveChange?.(true); }, - [], + [onInteractionActiveChange], ); const updateTransform = useCallback( @@ -1351,10 +1435,11 @@ export function WorkplaneViewport({ const localClientY = clientY - rect.top; const axisVector = (transform.rotationAxisVector ?? rotationAxisVectorForFrame(transform.handleKey, transform.selectionFrame)).clone().normalize(); const pivot = transform.rotationPivot ?? transform.selectionFrame.center; - const currentPoint = rayPointOnRotationPlane(state, clientX, clientY, pivot, axisVector); + const planeCenter = transform.rotationPlaneCenter ?? pivot; + const currentPoint = rayPointOnRotationPlane(state, clientX, clientY, planeCenter, axisVector); const rawDelta = currentPoint && transform.rotationStartVector && transform.rotationStartVector.lengthSq() > 0.000001 - ? THREE.MathUtils.radToDeg(signedAngleAroundAxis(transform.rotationStartVector, currentPoint.sub(pivot), axisVector)) + ? THREE.MathUtils.radToDeg(signedAngleAroundAxis(transform.rotationStartVector, currentPoint.sub(planeCenter), axisVector)) : THREE.MathUtils.radToDeg(unwrapRadians(screenAngle(localClientX, localClientY, rotationCenter) - transform.startScreenAngle)) * (transform.rotationScreenSign ?? 1); const distance = transform.wheelCenter ? Math.hypot(localClientX - transform.wheelCenter.x, localClientY - transform.wheelCenter.y) : Number.POSITIVE_INFINITY; let delta: number; @@ -1407,8 +1492,11 @@ export function WorkplaneViewport({ if (event.currentTarget.hasPointerCapture(transform.pointerId)) { event.currentTarget.releasePointerCapture(transform.pointerId); } - if (isVerticalMeasureHandleKind(transform.kind)) { + if (transform.kind === "lift") { setPinnedMeasureKey(getElevationMeasureKey(transformOverlayRef.current)); + } else if (transform.kind === "height") { + setPinnedMeasureKey(null); + setHoverMeasureKey(null); } if (transform.kind === "lift" && transform.hasMoved) { suppressLiftEditAfterDrag(); @@ -1420,7 +1508,8 @@ export function WorkplaneViewport({ if (threeRef.current) { threeRef.current.controls.enabled = true; } - }, [suppressLiftEditAfterDrag]); + onInteractionActiveChange?.(false); + }, [onInteractionActiveChange, suppressLiftEditAfterDrag]); const beginDimensionEdit = useCallback((mark: DimensionMark) => { if (mark.axis === "height") { @@ -1633,19 +1722,27 @@ export function WorkplaneViewport({ const yStart = handlesLowerSide ? yBounds.min : yBounds.max; const liftOffset = handle.kind === "lift" ? Math.max(2, yBounds.height * 0.08) * (handlesLowerSide ? -1 : 1) : 0; const startWorldY = yStart + liftOffset; - const wheel = transformOverlayRef.current?.rotationWheel ?? undefined; + const overlay = transformOverlayRef.current; const rotationAxis = rotationAxisForHandle(handle.handleKey); + const wheel = handle.kind === "rotate" ? (overlay?.rotationWheels[rotationAxis] ?? overlay?.rotationWheel ?? undefined) : undefined; + const rotationPlaneCenterData = handle.kind === "rotate" ? overlay?.rotationPlaneCenters[rotationAxis] : undefined; + const rotationPlaneCenter = rotationPlaneCenterData + ? new THREE.Vector3(rotationPlaneCenterData.x, rotationPlaneCenterData.y, rotationPlaneCenterData.z) + : frame.center.clone(); const localClientX = event.clientX - rect.left; const localClientY = event.clientY - rect.top; const axisVector = rotationAxisVectorForFrame(handle.handleKey, frame); const pivot = frame.center.clone(); const rotationCenter = handle.kind === "rotate" ? wheel ?? projectToScreen(pivot, state) : undefined; - const rotationStartPoint = handle.kind === "rotate" ? rayPointOnRotationPlane(state, event.clientX, event.clientY, pivot, axisVector) : null; - const rotationStartVector = rotationStartPoint ? rotationStartPoint.sub(pivot) : undefined; + const rotationStartPoint = handle.kind === "rotate" ? rayPointOnRotationPlane(state, event.clientX, event.clientY, rotationPlaneCenter, axisVector) : null; + const rotationStartVector = rotationStartPoint ? rotationStartPoint.sub(rotationPlaneCenter) : undefined; event.preventDefault(); event.currentTarget.setPointerCapture(event.pointerId); setEditingRotation(null); setPinnedMeasureKey(measureKeyForHandle(handle.kind, handle.handleKey, transformOverlayRef.current)); + if (handle.kind === "height") { + setHoverMeasureKey(null); + } setActiveRotationWheel(handle.kind === "rotate"); setActiveTransformKind(handle.kind); if (handle.kind === "rotate") { @@ -1679,6 +1776,7 @@ export function WorkplaneViewport({ scalePlaneY: handle.kind === "scale" ? handle.planeY : 0, rotationAxisVector: handle.kind === "rotate" ? axisVector : undefined, rotationPivot: handle.kind === "rotate" ? pivot : undefined, + rotationPlaneCenter: handle.kind === "rotate" ? rotationPlaneCenter : undefined, rotationStartVector: handle.kind === "rotate" ? rotationStartVector : undefined, rotationScreenCenter: rotationCenter, rotationScreenSign: handle.kind === "rotate" ? rotationScreenSign(axisVector, state.camera) : 1, @@ -1702,6 +1800,7 @@ export function WorkplaneViewport({ setRotationReadout(null); } state.controls.enabled = false; + onInteractionActiveChange?.(true); return; } @@ -1723,6 +1822,7 @@ export function WorkplaneViewport({ }; setMarqueeFromState(marqueeRef.current); state.controls.enabled = false; + onInteractionActiveChange?.(true); return; } @@ -1787,8 +1887,20 @@ export function WorkplaneViewport({ items, }; state.controls.enabled = false; + onInteractionActiveChange?.(true); }, - [onAlignAnchorChange, onSelectShape, onSetPlacementElevation, onWorkplaneModeChange, pickShape, pickTransformHandle, setMarqueeFromState, toPlanePoint, toPlanePointAtY], + [ + onAlignAnchorChange, + onInteractionActiveChange, + onSelectShape, + onSetPlacementElevation, + onWorkplaneModeChange, + pickShape, + pickTransformHandle, + setMarqueeFromState, + toPlanePoint, + toPlanePointAtY, + ], ); const handlePointerMove = useCallback( @@ -1869,8 +1981,11 @@ export function WorkplaneViewport({ if (event.currentTarget.hasPointerCapture(transform.pointerId)) { event.currentTarget.releasePointerCapture(transform.pointerId); } - if (isVerticalMeasureHandleKind(transform.kind)) { + if (transform.kind === "lift") { setPinnedMeasureKey(getElevationMeasureKey(transformOverlayRef.current)); + } else if (transform.kind === "height") { + setPinnedMeasureKey(null); + setHoverMeasureKey(null); } if (transform.kind === "lift" && transform.hasMoved) { suppressLiftEditAfterDrag(); @@ -1882,6 +1997,7 @@ export function WorkplaneViewport({ if (state) { state.controls.enabled = true; } + onInteractionActiveChange?.(false); return; } @@ -1917,6 +2033,7 @@ export function WorkplaneViewport({ if (state) { state.controls.enabled = true; } + onInteractionActiveChange?.(false); return; } @@ -1943,8 +2060,9 @@ export function WorkplaneViewport({ if (state) { state.controls.enabled = true; } + onInteractionActiveChange?.(false); }, - [onSelectShape, onUpdateShape, setMarqueeFromState, shapesInMarquee, suppressLiftEditAfterDrag], + [onInteractionActiveChange, onSelectShape, onUpdateShape, setMarqueeFromState, shapesInMarquee, suppressLiftEditAfterDrag], ); const handleDrop = useCallback( @@ -2071,10 +2189,9 @@ export function WorkplaneViewport({ rotationReadout={rotationReadout} showRotationWheel={activeRotationWheel} hideDimensionMarks={ + activeTransformKind === "scale" || activeTransformKind === "height" || - activeTransformKind === "lift" || - editingDimension?.axis === "height" || - editingDimension?.axis === "elevation" + editingDimension?.axis === "height" } rotationWheelAxis={rotationWheelAxis} onBeginTransform={beginTransform} @@ -2453,10 +2570,10 @@ function TransformOverlay({ .filter((mark) => mark.axis === "elevation"); const elevationHandleKey = elevationMarks[0]?.handleKey; const rawMarks = measureKey ? (box.dimensions[measureKey] ?? []) : []; - const requestedHeightMeasurement = isHeightMeasureKey(measureKey) || rawMarks.some((mark) => mark.axis === "height"); + const requestedHeightMeasurement = rawMarks.some((mark) => mark.axis === "height"); const resolvedMeasureKey = requestedHeightMeasurement && elevationHandleKey ? elevationHandleKey : measureKey; const marks = resolvedMeasureKey ? (box.dimensions[resolvedMeasureKey] ?? []) : []; - const visibleMarks = (hideDimensionMarks || requestedHeightMeasurement ? elevationMarks : marks).filter( + const visibleMarks = (hideDimensionMarks ? [] : requestedHeightMeasurement ? elevationMarks : marks).filter( (mark) => mark.axis !== "height" && mark.key !== editingDimension?.key, ); const handleMeasureKey = (handle: TransformOverlayState["handles"][number]) => measureKeyForHandle(handle.kind, handle.key, box); @@ -2482,9 +2599,10 @@ function TransformOverlay({ y: Math.sin(activeRadians) * 92, }; const plane = box.rotationPlanes[rotationWheelAxis]; + const wheel = box.rotationWheels[rotationWheelAxis] ?? box.rotationWheel; return (