Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
Anchor inspector resize edits
This commit is contained in:
@@ -14,7 +14,7 @@ import gentilisBoldFontJson from "three/examples/fonts/gentilis_bold.typeface.js
|
|||||||
import helvetikerBoldFontJson from "three/examples/fonts/helvetiker_bold.typeface.json";
|
import helvetikerBoldFontJson from "three/examples/fonts/helvetiker_bold.typeface.json";
|
||||||
import optimerBoldFontJson from "three/examples/fonts/optimer_bold.typeface.json";
|
import optimerBoldFontJson from "three/examples/fonts/optimer_bold.typeface.json";
|
||||||
import { AlignOverlay, MirrorOverlay, type AlignOverlayState, type MirrorOverlayState } from "@/components/workplane/ActionOverlays";
|
import { AlignOverlay, MirrorOverlay, type AlignOverlayState, type MirrorOverlayState } from "@/components/workplane/ActionOverlays";
|
||||||
import { ShapeInspector, SnapGridControl } from "@/components/workplane/ShapeInspector";
|
import { ShapeInspector, SnapGridControl, type ShapeInspectorUpdateOptions } from "@/components/workplane/ShapeInspector";
|
||||||
import { WorkspaceSettingsModal } from "@/components/workplane/WorkspaceSettingsModal";
|
import { WorkspaceSettingsModal } from "@/components/workplane/WorkspaceSettingsModal";
|
||||||
import { DEFAULT_SNAP_GRID, DEFAULT_WORKPLANE_WORKSPACE, normalizeSnapGrid, normalizeWorkspaceSettings, workplaneSettingsFingerprint } from "@/lib/workplaneSettings";
|
import { DEFAULT_SNAP_GRID, DEFAULT_WORKPLANE_WORKSPACE, normalizeSnapGrid, normalizeWorkspaceSettings, workplaneSettingsFingerprint } from "@/lib/workplaneSettings";
|
||||||
import { cleanNearZero, cleanRotationDegrees, fallbackSolidColor, mirroredAxisCount, mirrorSign, proportionalResizeScale, resizedShapeSize, shapeDepth, shapeWidth } from "@/lib/workplaneShapes";
|
import { cleanNearZero, cleanRotationDegrees, fallbackSolidColor, mirroredAxisCount, mirrorSign, proportionalResizeScale, resizedShapeSize, shapeDepth, shapeWidth } from "@/lib/workplaneShapes";
|
||||||
@@ -212,6 +212,12 @@ type RotationHandleSide = "near" | "right" | "far" | "left";
|
|||||||
type RotationHandleSides = Record<RotationAxis, RotationHandleSide>;
|
type RotationHandleSides = Record<RotationAxis, RotationHandleSide>;
|
||||||
type ShapeUpdatePatch = Partial<WorkplaneShape> & { bakeTransform?: boolean };
|
type ShapeUpdatePatch = Partial<WorkplaneShape> & { bakeTransform?: boolean };
|
||||||
type ResizeSigns = { x: number; z: number };
|
type ResizeSigns = { x: number; z: number };
|
||||||
|
type ResizeAnchorMemory = {
|
||||||
|
shapeId: string;
|
||||||
|
handleKey: string;
|
||||||
|
signs: ResizeSigns;
|
||||||
|
pressedY: "top" | "bottom" | null;
|
||||||
|
};
|
||||||
type TransformDragState = {
|
type TransformDragState = {
|
||||||
id: string;
|
id: string;
|
||||||
ids: string[];
|
ids: string[];
|
||||||
@@ -710,7 +716,7 @@ function projectedWorldYForScreenY(state: ThreeState, shape: WorkplaneShape, tar
|
|||||||
return nextWorldY;
|
return nextWorldY;
|
||||||
}
|
}
|
||||||
|
|
||||||
function patchWithPreservedWorldBottom(shape: WorkplaneShape, patch: Partial<WorkplaneShape>) {
|
function patchWithPreservedWorldYEdge(shape: WorkplaneShape, patch: Partial<WorkplaneShape>, edge: "bottom" | "top") {
|
||||||
const startFrame = selectionFrameForShapes([shape], [shape.id]);
|
const startFrame = selectionFrameForShapes([shape], [shape.id]);
|
||||||
if (!startFrame) {
|
if (!startFrame) {
|
||||||
return patch;
|
return patch;
|
||||||
@@ -722,12 +728,57 @@ function patchWithPreservedWorldBottom(shape: WorkplaneShape, patch: Partial<Wor
|
|||||||
return patch;
|
return patch;
|
||||||
}
|
}
|
||||||
const draftBounds = selectionWorldYBounds(draftFrame);
|
const draftBounds = selectionWorldYBounds(draftFrame);
|
||||||
|
const delta = edge === "bottom" ? startBounds.min - draftBounds.min : startBounds.max - draftBounds.max;
|
||||||
return {
|
return {
|
||||||
...patch,
|
...patch,
|
||||||
elevation: cleanNearZero(clamp((draftShape.elevation ?? 0) + startBounds.min - draftBounds.min, MIN_ELEVATION, MAX_ELEVATION), 0.0005),
|
elevation: cleanNearZero(clamp((draftShape.elevation ?? 0) + delta, MIN_ELEVATION, MAX_ELEVATION), 0.0005),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function patchWithPreservedWorldBottom(shape: WorkplaneShape, patch: Partial<WorkplaneShape>) {
|
||||||
|
return patchWithPreservedWorldYEdge(shape, patch, "bottom");
|
||||||
|
}
|
||||||
|
|
||||||
|
function resizeSignsForDimension(signs: ResizeSigns, axis: "width" | "depth") {
|
||||||
|
return axis === "width" ? { x: signs.x, z: 0 } : { x: 0, z: signs.z };
|
||||||
|
}
|
||||||
|
|
||||||
|
function patchWithResizeAnchor(
|
||||||
|
shape: WorkplaneShape,
|
||||||
|
patch: Partial<WorkplaneShape>,
|
||||||
|
axis: ShapeInspectorUpdateOptions["resizeAxis"] | DimensionMark["axis"],
|
||||||
|
anchor: ResizeAnchorMemory | null,
|
||||||
|
) {
|
||||||
|
if (axis === "height") {
|
||||||
|
return patchWithPreservedWorldYEdge(shape, patch, anchor?.shapeId === shape.id && anchor.pressedY === "bottom" ? "top" : "bottom");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axis !== "width" && axis !== "depth") {
|
||||||
|
return patchWithPreservedWorldBottom(shape, patch);
|
||||||
|
}
|
||||||
|
if (!anchor || anchor.shapeId !== shape.id) {
|
||||||
|
return patchWithPreservedWorldBottom(shape, patch);
|
||||||
|
}
|
||||||
|
|
||||||
|
const signs = resizeSignsForDimension(anchor.signs, axis);
|
||||||
|
if (!signs.x && !signs.z) {
|
||||||
|
return patchWithPreservedWorldBottom(shape, patch);
|
||||||
|
}
|
||||||
|
|
||||||
|
const frame = selectionFrameForShapes([shape], [shape.id]);
|
||||||
|
if (!frame) {
|
||||||
|
return patchWithPreservedWorldBottom(shape, patch);
|
||||||
|
}
|
||||||
|
|
||||||
|
const width = Math.max(MIN_SHAPE_SIZE, patch.width ?? shapeWidth(shape));
|
||||||
|
const depth = Math.max(MIN_SHAPE_SIZE, patch.depth ?? shapeDepth(shape));
|
||||||
|
const center = resizeCenterFromAnchor(frame, resizeAnchorPointForFrame(frame, signs), signs, width, depth);
|
||||||
|
return patchWithPreservedWorldBottom(shape, {
|
||||||
|
...patch,
|
||||||
|
...resizedShapePatchFromFrame(shape, center, width, depth),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function resizeShapeFromFrameHandle(
|
function resizeShapeFromFrameHandle(
|
||||||
transform: TransformDragState,
|
transform: TransformDragState,
|
||||||
point: THREE.Vector3,
|
point: THREE.Vector3,
|
||||||
@@ -900,6 +951,7 @@ export function WorkplaneViewport({
|
|||||||
const dragRef = useRef<DragState | null>(null);
|
const dragRef = useRef<DragState | null>(null);
|
||||||
const marqueeRef = useRef<MarqueeState | null>(null);
|
const marqueeRef = useRef<MarqueeState | null>(null);
|
||||||
const transformRef = useRef<TransformDragState | null>(null);
|
const transformRef = useRef<TransformDragState | null>(null);
|
||||||
|
const lastResizeAnchorRef = useRef<ResizeAnchorMemory | null>(null);
|
||||||
const suppressNextLiftEditRef = useRef(false);
|
const suppressNextLiftEditRef = useRef(false);
|
||||||
const snapRef = useRef(snap);
|
const snapRef = useRef(snap);
|
||||||
const workspaceRef = useRef(workspace);
|
const workspaceRef = useRef(workspace);
|
||||||
@@ -927,6 +979,24 @@ export function WorkplaneViewport({
|
|||||||
const placementElevationRef = useRef(placementElevation);
|
const placementElevationRef = useRef(placementElevation);
|
||||||
const workplaneModeRef = useRef(workplaneMode);
|
const workplaneModeRef = useRef(workplaneMode);
|
||||||
|
|
||||||
|
const rememberResizeAnchor = useCallback((shapeId: string, kind: TransformHandleKind, handleKey: string) => {
|
||||||
|
if (kind === "scale") {
|
||||||
|
const signs = resizeSignsForHandle(handleKey);
|
||||||
|
if (signs.x || signs.z) {
|
||||||
|
lastResizeAnchorRef.current = { shapeId, handleKey, signs, pressedY: null };
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (kind === "height") {
|
||||||
|
lastResizeAnchorRef.current = {
|
||||||
|
shapeId,
|
||||||
|
handleKey,
|
||||||
|
signs: { x: 0, z: 0 },
|
||||||
|
pressedY: handleKey === "bottom-height" ? "bottom" : "top",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const nextKey = workspaceSettingsKey ?? null;
|
const nextKey = workspaceSettingsKey ?? null;
|
||||||
if (workspaceSettingsKeyRef.current !== nextKey) {
|
if (workspaceSettingsKeyRef.current !== nextKey) {
|
||||||
@@ -985,6 +1055,7 @@ export function WorkplaneViewport({
|
|||||||
const nextSelectedIdsKey = selectedIds.join("|");
|
const nextSelectedIdsKey = selectedIds.join("|");
|
||||||
if (nextSelectedIdsKey !== selectedIdsKeyRef.current) {
|
if (nextSelectedIdsKey !== selectedIdsKeyRef.current) {
|
||||||
selectedIdsKeyRef.current = nextSelectedIdsKey;
|
selectedIdsKeyRef.current = nextSelectedIdsKey;
|
||||||
|
lastResizeAnchorRef.current = null;
|
||||||
setHoverMeasureKey(null);
|
setHoverMeasureKey(null);
|
||||||
setPinnedMeasureKey(null);
|
setPinnedMeasureKey(null);
|
||||||
setEditingDimension(null);
|
setEditingDimension(null);
|
||||||
@@ -1256,6 +1327,7 @@ export function WorkplaneViewport({
|
|||||||
if (kind === "scale" && !scaleStartPoint) {
|
if (kind === "scale" && !scaleStartPoint) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
rememberResizeAnchor(shape.id, kind, resizeHandleKey);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.currentTarget.setPointerCapture(event.pointerId);
|
event.currentTarget.setPointerCapture(event.pointerId);
|
||||||
@@ -1335,7 +1407,7 @@ export function WorkplaneViewport({
|
|||||||
}
|
}
|
||||||
onInteractionActiveChange?.(true);
|
onInteractionActiveChange?.(true);
|
||||||
},
|
},
|
||||||
[onInteractionActiveChange, toRawPlanePoint],
|
[onInteractionActiveChange, rememberResizeAnchor, toRawPlanePoint],
|
||||||
);
|
);
|
||||||
|
|
||||||
const updateTransform = useCallback(
|
const updateTransform = useCallback(
|
||||||
@@ -1522,9 +1594,13 @@ export function WorkplaneViewport({
|
|||||||
}, [onInteractionActiveChange, onUpdateShape, suppressLiftEditAfterDrag]);
|
}, [onInteractionActiveChange, onUpdateShape, suppressLiftEditAfterDrag]);
|
||||||
|
|
||||||
const beginDimensionEdit = useCallback((mark: DimensionMark) => {
|
const beginDimensionEdit = useCallback((mark: DimensionMark) => {
|
||||||
|
const id = selectedIdsRef.current[0];
|
||||||
|
if (id && (mark.axis === "width" || mark.axis === "depth" || mark.axis === "height")) {
|
||||||
|
rememberResizeAnchor(id, mark.axis === "height" ? "height" : "scale", mark.handleKey);
|
||||||
|
}
|
||||||
setPinnedMeasureKey(mark.handleKey);
|
setPinnedMeasureKey(mark.handleKey);
|
||||||
setEditingDimension({ key: mark.key, axis: mark.axis, x: mark.labelX, y: mark.labelY, value: mark.label });
|
setEditingDimension({ key: mark.key, axis: mark.axis, x: mark.labelX, y: mark.labelY, value: mark.label });
|
||||||
}, []);
|
}, [rememberResizeAnchor]);
|
||||||
|
|
||||||
const beginLiftEdit = useCallback((handleKey: string, x: number, y: number) => {
|
const beginLiftEdit = useCallback((handleKey: string, x: number, y: number) => {
|
||||||
if (suppressNextLiftEditRef.current) {
|
if (suppressNextLiftEditRef.current) {
|
||||||
@@ -1585,11 +1661,11 @@ export function WorkplaneViewport({
|
|||||||
if (shape.kind === "cone") {
|
if (shape.kind === "cone") {
|
||||||
patch.baseRadius = nextValue / 2;
|
patch.baseRadius = nextValue / 2;
|
||||||
}
|
}
|
||||||
onUpdateShape(id, patchWithPreservedWorldBottom(shape, patch));
|
onUpdateShape(id, patchWithResizeAnchor(shape, patch, edit.axis, lastResizeAnchorRef.current));
|
||||||
} else if (edit.axis === "depth") {
|
} else if (edit.axis === "depth") {
|
||||||
onUpdateShape(id, patchWithPreservedWorldBottom(shape, { depth: nextValue, size: resizedShapeSize(shapeWidth(shape), nextValue) }));
|
onUpdateShape(id, patchWithResizeAnchor(shape, { depth: nextValue, size: resizedShapeSize(shapeWidth(shape), nextValue) }, edit.axis, lastResizeAnchorRef.current));
|
||||||
} else {
|
} else {
|
||||||
onUpdateShape(id, patchWithPreservedWorldBottom(shape, { height: nextValue }));
|
onUpdateShape(id, patchWithResizeAnchor(shape, { height: nextValue }, edit.axis, lastResizeAnchorRef.current));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setEditingDimension(null);
|
setEditingDimension(null);
|
||||||
@@ -1752,6 +1828,7 @@ export function WorkplaneViewport({
|
|||||||
const rotationCenter = handle.kind === "rotate" ? wheel ?? projectToScreen(pivot, state) : undefined;
|
const rotationCenter = handle.kind === "rotate" ? wheel ?? projectToScreen(pivot, state) : undefined;
|
||||||
const rotationStartPoint = handle.kind === "rotate" ? rayPointOnRotationPlane(state, event.clientX, event.clientY, rotationPlaneCenter, axisVector) : null;
|
const rotationStartPoint = handle.kind === "rotate" ? rayPointOnRotationPlane(state, event.clientX, event.clientY, rotationPlaneCenter, axisVector) : null;
|
||||||
const rotationStartVector = rotationStartPoint ? rotationStartPoint.sub(rotationPlaneCenter) : undefined;
|
const rotationStartVector = rotationStartPoint ? rotationStartPoint.sub(rotationPlaneCenter) : undefined;
|
||||||
|
rememberResizeAnchor(handle.id, handle.kind, resizeHandleKey);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.currentTarget.setPointerCapture(event.pointerId);
|
event.currentTarget.setPointerCapture(event.pointerId);
|
||||||
setEditingRotation(null);
|
setEditingRotation(null);
|
||||||
@@ -2088,7 +2165,7 @@ export function WorkplaneViewport({
|
|||||||
}
|
}
|
||||||
onInteractionActiveChange?.(false);
|
onInteractionActiveChange?.(false);
|
||||||
},
|
},
|
||||||
[onInteractionActiveChange, onSelectShape, onUpdateShape, setMarqueeFromState, shapesInMarquee, suppressLiftEditAfterDrag],
|
[onInteractionActiveChange, onSelectShape, onUpdateShape, rememberResizeAnchor, setMarqueeFromState, shapesInMarquee, suppressLiftEditAfterDrag],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleDrop = useCallback(
|
const handleDrop = useCallback(
|
||||||
@@ -2247,7 +2324,7 @@ export function WorkplaneViewport({
|
|||||||
shape={selectedShape}
|
shape={selectedShape}
|
||||||
snap={snap}
|
snap={snap}
|
||||||
snapOpen={snapOpen}
|
snapOpen={snapOpen}
|
||||||
onUpdate={(patch) => onUpdateShape(selectedShape.id, patch)}
|
onUpdate={(patch, options) => onUpdateShape(selectedShape.id, patchWithResizeAnchor(selectedShape, patch, options?.resizeAxis, lastResizeAnchorRef.current))}
|
||||||
onClose={() => onSelectShape(null)}
|
onClose={() => onSelectShape(null)}
|
||||||
onSnapChange={setSnap}
|
onSnapChange={setSnap}
|
||||||
onSnapOpenChange={setSnapOpen}
|
onSnapOpenChange={setSnapOpen}
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ type SelectPropertyConfig = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type ShapePropertyConfig = RangePropertyConfig | TextPropertyConfig | SelectPropertyConfig;
|
type ShapePropertyConfig = RangePropertyConfig | TextPropertyConfig | SelectPropertyConfig;
|
||||||
|
export type ShapeInspectorUpdateOptions = { resizeAxis?: "width" | "depth" | "height" };
|
||||||
|
type ShapeInspectorUpdate = (patch: Partial<WorkplaneShape>, options?: ShapeInspectorUpdateOptions) => void;
|
||||||
|
|
||||||
function clamp(value: number, min: number, max: number) {
|
function clamp(value: number, min: number, max: number) {
|
||||||
return Math.min(max, Math.max(min, value));
|
return Math.min(max, Math.max(min, value));
|
||||||
@@ -75,16 +77,17 @@ function formatPanelNumber(value: number) {
|
|||||||
return (Math.abs(value) < 0.005 ? 0 : value).toFixed(2);
|
return (Math.abs(value) < 0.005 ? 0 : value).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<WorkplaneShape>) => void): ShapePropertyConfig[] {
|
function getShapeProperties(shape: WorkplaneShape, onUpdate: ShapeInspectorUpdate): ShapePropertyConfig[] {
|
||||||
const width = shapeWidth(shape);
|
const width = shapeWidth(shape);
|
||||||
const depth = shapeDepth(shape);
|
const depth = shapeDepth(shape);
|
||||||
const setWidth = (value: number) => onUpdate({ width: value, size: resizedShapeSize(value, depth) });
|
const setWidth = (value: number) => onUpdate({ width: value, size: resizedShapeSize(value, depth) }, { resizeAxis: "width" });
|
||||||
const setDepth = (value: number) => onUpdate({ depth: value, size: resizedShapeSize(width, value) });
|
const setDepth = (value: number) => onUpdate({ depth: value, size: resizedShapeSize(width, value) }, { resizeAxis: "depth" });
|
||||||
const setConeWidth = (value: number) => onUpdate({ width: value, baseRadius: value / 2, size: resizedShapeSize(value, depth) });
|
const setConeWidth = (value: number) => onUpdate({ width: value, baseRadius: value / 2, size: resizedShapeSize(value, depth) }, { resizeAxis: "width" });
|
||||||
const setBaseRadius = (value: number) => {
|
const setBaseRadius = (value: number) => {
|
||||||
const diameter = value * 2;
|
const diameter = value * 2;
|
||||||
onUpdate({ baseRadius: value, width: diameter, size: resizedShapeSize(diameter, depth) });
|
onUpdate({ baseRadius: value, width: diameter, size: resizedShapeSize(diameter, depth) }, { resizeAxis: "width" });
|
||||||
};
|
};
|
||||||
|
const setHeight = (height: number) => onUpdate({ height }, { resizeAxis: "height" });
|
||||||
|
|
||||||
if (shape.kind === "box") {
|
if (shape.kind === "box") {
|
||||||
return [
|
return [
|
||||||
@@ -92,7 +95,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
{ label: "Steps", value: shape.steps ?? 10, min: 1, max: 64, step: 1, onChange: (steps) => onUpdate({ steps: Math.round(steps) }) },
|
{ label: "Steps", value: shape.steps ?? 10, min: 1, max: 64, step: 1, onChange: (steps) => onUpdate({ steps: Math.round(steps) }) },
|
||||||
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
||||||
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: setHeight },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +106,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
{ label: "Segments", value: shape.segments ?? 1, min: 1, max: 24, step: 1, onChange: (segments) => onUpdate({ segments: Math.round(segments) }) },
|
{ label: "Segments", value: shape.segments ?? 1, min: 1, max: 24, step: 1, onChange: (segments) => onUpdate({ segments: Math.round(segments) }) },
|
||||||
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
||||||
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: setHeight },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +115,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
{ label: "Steps", value: shape.steps ?? 24, min: 6, max: 64, step: 1, onChange: (steps) => onUpdate({ steps: Math.round(steps) }) },
|
{ label: "Steps", value: shape.steps ?? 24, min: 6, max: 64, step: 1, onChange: (steps) => onUpdate({ steps: Math.round(steps) }) },
|
||||||
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
||||||
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: setHeight },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +124,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
{ label: "Steps", value: shape.steps ?? 32, min: 6, max: 64, step: 1, onChange: (steps) => onUpdate({ steps: Math.round(steps) }) },
|
{ label: "Steps", value: shape.steps ?? 32, min: 6, max: 64, step: 1, onChange: (steps) => onUpdate({ steps: Math.round(steps) }) },
|
||||||
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
||||||
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: setHeight },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +134,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
{ label: "Base Radius", value: shape.baseRadius ?? width / 2, min: MIN_SHAPE_SIZE, max: 80, onChange: setBaseRadius },
|
{ label: "Base Radius", value: shape.baseRadius ?? width / 2, min: MIN_SHAPE_SIZE, max: 80, onChange: setBaseRadius },
|
||||||
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
||||||
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setConeWidth },
|
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setConeWidth },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: setHeight },
|
||||||
{ label: "Sides", value: shape.sides ?? 96, min: 3, max: 128, step: 1, onChange: (sides) => onUpdate({ sides: Math.round(sides) }) },
|
{ label: "Sides", value: shape.sides ?? 96, min: 3, max: 128, step: 1, onChange: (sides) => onUpdate({ sides: Math.round(sides) }) },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -141,7 +144,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
{ label: "Sides", value: shape.sides ?? 4, min: 3, max: 24, step: 1, onChange: (sides) => onUpdate({ sides: Math.round(sides) }) },
|
{ label: "Sides", value: shape.sides ?? 4, min: 3, max: 24, step: 1, onChange: (sides) => onUpdate({ sides: Math.round(sides) }) },
|
||||||
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
||||||
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: setHeight },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +153,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
{ label: "Sides", value: shape.sides ?? 64, min: 4, max: 128, step: 1, onChange: (sides) => onUpdate({ sides: Math.round(sides) }) },
|
{ label: "Sides", value: shape.sides ?? 64, min: 4, max: 128, step: 1, onChange: (sides) => onUpdate({ sides: Math.round(sides) }) },
|
||||||
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
||||||
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: setHeight },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +162,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
{ label: "Thickness", value: shape.bevel ?? 4, min: 0.5, max: 20, onChange: (bevel) => onUpdate({ bevel }) },
|
{ label: "Thickness", value: shape.bevel ?? 4, min: 0.5, max: 20, onChange: (bevel) => onUpdate({ bevel }) },
|
||||||
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
||||||
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: setHeight },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +179,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type: "select", label: "Font", value: shape.font ?? "Multilanguage", options: TEXT_FONT_OPTIONS, onChange: (font) => onUpdate({ font }) },
|
{ type: "select", label: "Font", value: shape.font ?? "Multilanguage", options: TEXT_FONT_OPTIONS, onChange: (font) => onUpdate({ font }) },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 40, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 40, onChange: setHeight },
|
||||||
{ label: "Bevel", value: shape.bevel ?? 0, min: 0, max: 8, onChange: (bevel) => onUpdate({ bevel }) },
|
{ label: "Bevel", value: shape.bevel ?? 0, min: 0, max: 8, onChange: (bevel) => onUpdate({ bevel }) },
|
||||||
{ label: "Segments", value: shape.segments ?? 0, min: 0, max: 24, step: 1, onChange: (segments) => onUpdate({ segments: Math.round(segments) }) },
|
{ label: "Segments", value: shape.segments ?? 0, min: 0, max: 24, step: 1, onChange: (segments) => onUpdate({ segments: Math.round(segments) }) },
|
||||||
];
|
];
|
||||||
@@ -185,7 +188,7 @@ function getShapeProperties(shape: WorkplaneShape, onUpdate: (patch: Partial<Wor
|
|||||||
return [
|
return [
|
||||||
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
{ label: "Length", value: depth, min: MIN_SHAPE_SIZE, max: 160, onChange: setDepth },
|
||||||
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
{ label: "Width", value: width, min: MIN_SHAPE_SIZE, max: 160, onChange: setWidth },
|
||||||
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: (height) => onUpdate({ height }) },
|
{ label: "Height", value: shape.height, min: MIN_SHAPE_SIZE, max: 160, onChange: setHeight },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +204,7 @@ export function ShapeInspector({
|
|||||||
shape: WorkplaneShape;
|
shape: WorkplaneShape;
|
||||||
snap: GridSize;
|
snap: GridSize;
|
||||||
snapOpen: boolean;
|
snapOpen: boolean;
|
||||||
onUpdate: (patch: Partial<WorkplaneShape>) => void;
|
onUpdate: ShapeInspectorUpdate;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onSnapChange: Dispatch<SetStateAction<GridSize>>;
|
onSnapChange: Dispatch<SetStateAction<GridSize>>;
|
||||||
onSnapOpenChange: Dispatch<SetStateAction<boolean>>;
|
onSnapOpenChange: Dispatch<SetStateAction<boolean>>;
|
||||||
|
|||||||
Reference in New Issue
Block a user