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
release: SketchForge 1.0.8
This commit is contained in:
@@ -52,9 +52,12 @@ import {
|
||||
TransformOverlay,
|
||||
continuousSnappedWheelRotation,
|
||||
getElevationMeasureKey,
|
||||
isPointInsideTransformBounds,
|
||||
measureKeyForHandle,
|
||||
normalizedRotationPlaneBasis,
|
||||
rotationWheelDirectionSign,
|
||||
rotationPlaneDirectionSign,
|
||||
transformBoundsIntersectClipVolume,
|
||||
transformOverlayScreenPoint,
|
||||
ROTATION_WHEEL_SHIFT_SNAP_DEGREES,
|
||||
ROTATION_WHEEL_SNAP_DEGREES,
|
||||
snappedRotationDelta,
|
||||
@@ -279,6 +282,7 @@ type ThreeState = {
|
||||
workplanePreviewLayer: THREE.Group;
|
||||
shapeLayer: THREE.Group;
|
||||
helperLayer: THREE.Group;
|
||||
transformGuideLayer: THREE.Group;
|
||||
moveDimensionLayer: THREE.Group;
|
||||
modifierLayer: THREE.Group;
|
||||
shapeRecords: Map<string, ShapeRenderRecord>;
|
||||
@@ -825,6 +829,58 @@ function syncMoveDimensionWorldLines(
|
||||
state.needsRender = true;
|
||||
}
|
||||
|
||||
function syncTransformGuideWorldLines(
|
||||
state: ThreeState,
|
||||
segments: Array<readonly [THREE.Vector3, THREE.Vector3]> | null,
|
||||
theme: ResolvedAppTheme,
|
||||
) {
|
||||
const layer = state.transformGuideLayer;
|
||||
const signature = segments
|
||||
? [
|
||||
theme,
|
||||
...segments.flatMap(([start, end]) => [start.x, start.y, start.z, end.x, end.y, end.z]),
|
||||
].join(":")
|
||||
: "";
|
||||
if (layer.userData.transformGuideSignature === signature) {
|
||||
return;
|
||||
}
|
||||
|
||||
layer.userData.transformGuideSignature = signature;
|
||||
disposeChildren(layer);
|
||||
if (!segments || segments.length === 0) {
|
||||
state.needsRender = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const positions = segments.flatMap(([start, end]) => [start.x, start.y, start.z, end.x, end.y, end.z]);
|
||||
const geometry = new LineSegmentsGeometry();
|
||||
geometry.setPositions(positions);
|
||||
const material = new LineMaterial({
|
||||
color: theme === "dark" ? "#cfe1ea" : "#1f272e",
|
||||
linewidth: 1.15,
|
||||
worldUnits: false,
|
||||
dashed: true,
|
||||
dashSize: 0.625,
|
||||
gapSize: 0.625,
|
||||
transparent: true,
|
||||
opacity: theme === "dark" ? 0.86 : 0.72,
|
||||
depthTest: false,
|
||||
depthWrite: false,
|
||||
alphaToCoverage: false,
|
||||
});
|
||||
material.toneMapped = false;
|
||||
const rect = state.renderer.domElement.getBoundingClientRect();
|
||||
material.resolution.set(Math.max(1, rect.width), Math.max(1, rect.height));
|
||||
const lines = new LineSegments2(geometry, material);
|
||||
lines.computeLineDistances();
|
||||
lines.renderOrder = 999;
|
||||
lines.frustumCulled = false;
|
||||
setObjectRenderLayer(lines, RENDER_LAYER_HELPERS);
|
||||
freezeStaticObjectMatrices(lines);
|
||||
layer.add(lines);
|
||||
state.needsRender = true;
|
||||
}
|
||||
|
||||
function rulerShapeDimensions(object: THREE.Object3D) {
|
||||
const dimensions = object.userData.rulerDimensions as [number, number, number] | undefined;
|
||||
return dimensions ?? [1, 1, 1];
|
||||
@@ -2628,6 +2684,7 @@ export function WorkplaneViewport({
|
||||
Boolean(transformRef.current || dragRef.current),
|
||||
false,
|
||||
placementWorkplaneRef.current,
|
||||
resolvedThemeRef.current,
|
||||
);
|
||||
syncAlignOverlay(threeRef.current, alignReferenceShapesRef.current, selectedIdsRef.current, alignModeRef.current, alignAnchorIdRef.current, alignHandlesRef.current, alignOverlayRef, setAlignOverlay);
|
||||
syncMirrorOverlay(threeRef.current, mirrorReferenceShapesRef.current, selectedIdsRef.current, mirrorModeRef.current, mirrorOverlayRef, setMirrorOverlay);
|
||||
@@ -2688,6 +2745,7 @@ export function WorkplaneViewport({
|
||||
Boolean(transformRef.current || dragRef.current),
|
||||
false,
|
||||
placementWorkplaneRef.current,
|
||||
resolvedThemeRef.current,
|
||||
);
|
||||
syncAlignOverlay(threeRef.current, alignReferenceShapesRef.current, selectedIds, alignModeRef.current, alignAnchorIdRef.current, alignHandlesRef.current, alignOverlayRef, setAlignOverlay);
|
||||
syncMirrorOverlay(threeRef.current, mirrorReferenceShapesRef.current, selectedIds, mirrorModeRef.current, mirrorOverlayRef, setMirrorOverlay);
|
||||
@@ -2791,6 +2849,7 @@ export function WorkplaneViewport({
|
||||
Boolean(transformRef.current || dragRef.current),
|
||||
false,
|
||||
placementWorkplaneRef.current,
|
||||
resolvedThemeRef.current,
|
||||
);
|
||||
}
|
||||
setSelectionHelpersVisible(state, !workplaneMode && transformRef.current?.kind !== "rotate");
|
||||
@@ -2831,6 +2890,7 @@ export function WorkplaneViewport({
|
||||
Boolean(transformRef.current || dragRef.current),
|
||||
false,
|
||||
placementWorkplaneRef.current,
|
||||
resolvedThemeRef.current,
|
||||
);
|
||||
syncRulerOverlay(threeRef.current, rulerModelRef.current, rulerOverlayRef, setRulerOverlay, workspace.accuracy);
|
||||
syncMoveDimensionWorldLines(threeRef.current, moveDimensionSessionRef.current, resolvedTheme);
|
||||
@@ -2906,6 +2966,7 @@ export function WorkplaneViewport({
|
||||
Boolean(transformRef.current || dragRef.current),
|
||||
false,
|
||||
placementWorkplaneRef.current,
|
||||
resolvedThemeRef.current,
|
||||
);
|
||||
syncAlignOverlay(state, alignReferenceShapesRef.current, selectedIdsRef.current, alignModeRef.current, alignAnchorIdRef.current, alignHandlesRef.current, alignOverlayRef, setAlignOverlay);
|
||||
syncMirrorOverlay(state, mirrorReferenceShapesRef.current, selectedIdsRef.current, mirrorModeRef.current, mirrorOverlayRef, setMirrorOverlay);
|
||||
@@ -2952,6 +3013,7 @@ export function WorkplaneViewport({
|
||||
disposeChildren(state.shapeLayer);
|
||||
state.shapeRecords.clear();
|
||||
disposeChildren(state.helperLayer);
|
||||
disposeChildren(state.transformGuideLayer);
|
||||
disposeChildren(state.moveDimensionLayer);
|
||||
disposeChildren(state.modifierLayer);
|
||||
state.renderer.dispose();
|
||||
@@ -2969,6 +3031,25 @@ export function WorkplaneViewport({
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const state = threeRef.current;
|
||||
if (!state) {
|
||||
return;
|
||||
}
|
||||
const visible = !workplaneMode
|
||||
&& !alignMode
|
||||
&& !mirrorMode
|
||||
&& !rulerMode
|
||||
&& !rulerDeleteMode
|
||||
&& !rulerMoveMode
|
||||
&& !modifierActive
|
||||
&& activeTransformKind !== "rotate";
|
||||
if (state.transformGuideLayer.visible !== visible) {
|
||||
state.transformGuideLayer.visible = visible;
|
||||
state.needsRender = true;
|
||||
}
|
||||
}, [activeTransformKind, alignMode, mirrorMode, modifierActive, rulerDeleteMode, rulerMode, rulerMoveMode, workplaneMode]);
|
||||
|
||||
useEffect(() => {
|
||||
window.sketchforgePerf = {
|
||||
get: () => {
|
||||
@@ -3680,13 +3761,13 @@ export function WorkplaneViewport({
|
||||
);
|
||||
const rawPointerAngle = rotationPlanePointerAngle(transform.rotationPlaneView, localClientX, localClientY, rotationCenter);
|
||||
const wheelSnapDegrees = shiftKey ? ROTATION_WHEEL_SHIFT_SNAP_DEGREES : ROTATION_WHEEL_SNAP_DEGREES;
|
||||
const wheelScreenSign = rotationWheelDirectionSign(transform.rotationScreenSign ?? 1);
|
||||
const wheelDirectionSign = transform.rotationPlaneView?.directionSign ?? (transform.rotationAxis === "z" ? 1 : -1);
|
||||
const snappedWheel = insideSnapWheel
|
||||
? snappedWheelRotation(
|
||||
rawPointerAngle,
|
||||
transform.rotationStartPointerAngle
|
||||
?? rawPointerAngle - rawDelta * (transform.rotationScreenSign ?? 1),
|
||||
wheelScreenSign,
|
||||
?? rawPointerAngle - rawDelta * wheelDirectionSign,
|
||||
wheelDirectionSign,
|
||||
wheelSnapDegrees,
|
||||
)
|
||||
: null;
|
||||
@@ -4520,6 +4601,7 @@ export function WorkplaneViewport({
|
||||
true,
|
||||
true,
|
||||
placementWorkplaneRef.current,
|
||||
resolvedThemeRef.current,
|
||||
);
|
||||
syncCutPreviewOverlays(threeRef.current, previewShapes);
|
||||
syncMoveDimensionOverlay(
|
||||
@@ -5232,13 +5314,16 @@ function createThreeScene(host: HTMLDivElement): ThreeState {
|
||||
const helperLayer = new THREE.Group();
|
||||
helperLayer.name = "SelectionHelpers";
|
||||
helperLayer.layers.set(RENDER_LAYER_HELPERS);
|
||||
const transformGuideLayer = new THREE.Group();
|
||||
transformGuideLayer.name = "TransformGuides";
|
||||
transformGuideLayer.layers.set(RENDER_LAYER_HELPERS);
|
||||
const moveDimensionLayer = new THREE.Group();
|
||||
moveDimensionLayer.name = "MoveDimensions";
|
||||
moveDimensionLayer.layers.set(RENDER_LAYER_HELPERS);
|
||||
const modifierLayer = new THREE.Group();
|
||||
modifierLayer.name = "EdgeModifier";
|
||||
modifierLayer.layers.set(RENDER_LAYER_MODIFIERS);
|
||||
scene.add(workplaneLayer, workplanePreviewLayer, shapeLayer, helperLayer, moveDimensionLayer, modifierLayer);
|
||||
scene.add(workplaneLayer, workplanePreviewLayer, shapeLayer, helperLayer, transformGuideLayer, moveDimensionLayer, modifierLayer);
|
||||
|
||||
const raycaster = new THREE.Raycaster();
|
||||
raycaster.params.Line = { threshold: 1.15 };
|
||||
@@ -5251,13 +5336,15 @@ function createThreeScene(host: HTMLDivElement): ThreeState {
|
||||
const height = Math.max(1, host.clientHeight);
|
||||
renderer.setSize(width, height);
|
||||
updateCameraViewport(state.camera, width, height);
|
||||
state.moveDimensionLayer.traverse((child) => {
|
||||
const material = (child as THREE.Mesh).material;
|
||||
const materials = Array.isArray(material) ? material : material ? [material] : [];
|
||||
materials.forEach((candidate) => {
|
||||
if (candidate instanceof LineMaterial) {
|
||||
candidate.resolution.set(width, height);
|
||||
}
|
||||
[state.transformGuideLayer, state.moveDimensionLayer].forEach((layer) => {
|
||||
layer.traverse((child) => {
|
||||
const material = (child as THREE.Mesh).material;
|
||||
const materials = Array.isArray(material) ? material : material ? [material] : [];
|
||||
materials.forEach((candidate) => {
|
||||
if (candidate instanceof LineMaterial) {
|
||||
candidate.resolution.set(width, height);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
state.needsRender = true;
|
||||
@@ -5272,6 +5359,7 @@ function createThreeScene(host: HTMLDivElement): ThreeState {
|
||||
workplanePreviewLayer,
|
||||
shapeLayer,
|
||||
helperLayer,
|
||||
transformGuideLayer,
|
||||
moveDimensionLayer,
|
||||
modifierLayer,
|
||||
shapeRecords: new Map<string, ShapeRenderRecord>(),
|
||||
@@ -6317,8 +6405,10 @@ function syncTransformOverlay(
|
||||
keepVisibleDuringInteraction = false,
|
||||
updateDomImmediately = false,
|
||||
workplane: PlacementWorkplane = horizontalPlacementWorkplane(),
|
||||
theme: ResolvedAppTheme = "light",
|
||||
) {
|
||||
if (selectedIds.length < 1) {
|
||||
syncTransformGuideWorldLines(state, null, theme);
|
||||
if (overlayRef.current) {
|
||||
overlayRef.current = null;
|
||||
setOverlay(null);
|
||||
@@ -6329,6 +6419,7 @@ function syncTransformOverlay(
|
||||
const activeWorkplane = workplane;
|
||||
const frame = selectionFrameForShapes(shapes, selectedIds, activeWorkplane);
|
||||
if (!frame) {
|
||||
syncTransformGuideWorldLines(state, null, theme);
|
||||
if (overlayRef.current) {
|
||||
overlayRef.current = null;
|
||||
setOverlay(null);
|
||||
@@ -6342,38 +6433,26 @@ function syncTransformOverlay(
|
||||
// camera matrix can otherwise be one frame stale, making handles/lines trail.
|
||||
state.camera.updateMatrixWorld();
|
||||
const corners = selectionFrameCorners(frame);
|
||||
const projectedCorners = corners.map((corner) => {
|
||||
const cameraSpace = corner.clone().applyMatrix4(state.camera.matrixWorldInverse);
|
||||
const projected = corner.clone().project(state.camera);
|
||||
return { cameraSpace, projected };
|
||||
});
|
||||
const nearPlane = state.camera instanceof THREE.PerspectiveCamera ? state.camera.near : 0.1;
|
||||
const selectionRadius = Math.max(MIN_SHAPE_SIZE, Math.sqrt(frame.width ** 2 + frame.height ** 2 + frame.depth ** 2) / 2);
|
||||
const cameraDistance = state.camera.position.distanceTo(frame.center);
|
||||
// When zoomed into/through a selected object, the projected overlay can span
|
||||
// thousands of pixels even before any corner crosses the near plane. Hide it
|
||||
// at that depth instead of drawing misleading dashed lines across the scene.
|
||||
const cameraInsideSelection = cameraDistance < selectionRadius * 1.12;
|
||||
const projectionInvalid = projectedCorners.some(({ cameraSpace, projected }) => cameraSpace.z > -nearPlane * 1.5 || !Number.isFinite(projected.x) || !Number.isFinite(projected.y));
|
||||
const projectedSpanTooLarge = (() => {
|
||||
const xs = projectedCorners.map(({ projected }) => ((projected.x + 1) / 2) * rect.width);
|
||||
const ys = projectedCorners.map(({ projected }) => ((1 - projected.y) / 2) * rect.height);
|
||||
return Math.max(...xs) - Math.min(...xs) > rect.width * 4 || Math.max(...ys) - Math.min(...ys) > rect.height * 4;
|
||||
})();
|
||||
const overlayTooClose = projectionInvalid || (!keepVisibleDuringInteraction && (cameraInsideSelection || projectedSpanTooLarge));
|
||||
if (overlayTooClose) {
|
||||
const viewProjection = new THREE.Matrix4().multiplyMatrices(state.camera.projectionMatrix, state.camera.matrixWorldInverse);
|
||||
const selectionIntersectsView = transformBoundsIntersectClipVolume(corners.map((corner) => {
|
||||
const clip = new THREE.Vector4(corner.x, corner.y, corner.z, 1).applyMatrix4(viewProjection);
|
||||
return { x: clip.x, y: clip.y, z: clip.z, w: clip.w };
|
||||
}));
|
||||
if (!selectionIntersectsView && !keepVisibleDuringInteraction) {
|
||||
syncTransformGuideWorldLines(state, null, theme);
|
||||
if (overlayRef.current) {
|
||||
overlayRef.current = null;
|
||||
setOverlay(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const cameraDistance = state.camera.position.distanceTo(frame.center);
|
||||
const cameraInSelectionFrame = frameLocalPoint(frame, state.camera.position);
|
||||
const cameraInsideSelection = isPointInsideTransformBounds(cameraInSelectionFrame, frame.min, frame.max);
|
||||
const project = (point: THREE.Vector3) => {
|
||||
const projected = point.clone().project(state.camera);
|
||||
return {
|
||||
x: ((projected.x + 1) / 2) * rect.width,
|
||||
y: ((1 - projected.y) / 2) * rect.height,
|
||||
};
|
||||
const cameraSpace = point.clone().applyMatrix4(state.camera.matrixWorldInverse);
|
||||
const projected = cameraSpace.clone().applyMatrix4(state.camera.projectionMatrix);
|
||||
return transformOverlayScreenPoint(projected, cameraSpace.z, rect.width, rect.height);
|
||||
};
|
||||
|
||||
const xFootAxis = frame.xAxis.clone().normalize();
|
||||
@@ -6397,6 +6476,13 @@ function syncTransformOverlay(
|
||||
};
|
||||
const bottomCenterWorld = framePoint(frame, 0, footprintY, 0);
|
||||
const topCenterWorld = framePoint(frame, 0, oppositeY, 0);
|
||||
syncTransformGuideWorldLines(state, [
|
||||
[topCenterWorld, bottomCenterWorld],
|
||||
[footprintWorld.nearLeft, footprintWorld.nearRight],
|
||||
[footprintWorld.nearRight, footprintWorld.farRight],
|
||||
[footprintWorld.farRight, footprintWorld.farLeft],
|
||||
[footprintWorld.farLeft, footprintWorld.nearLeft],
|
||||
], theme);
|
||||
const lowerCenterWorld = framePoint(frame, 0, frame.min.y, 0);
|
||||
const upperCenterWorld = framePoint(frame, 0, frame.max.y, 0);
|
||||
const liftOffset = Math.max(2, frame.height * 0.08);
|
||||
@@ -6415,8 +6501,6 @@ function syncTransformOverlay(
|
||||
far: project(footprintWorld.far),
|
||||
left: project(footprintWorld.left),
|
||||
};
|
||||
const bottomCenterPoint = project(bottomCenterWorld);
|
||||
const topPoint = project(topCenterWorld);
|
||||
const heightPoint = project(showLowerHandles ? lowerCenterWorld : upperCenterWorld);
|
||||
const liftPoint = project(liftHandle);
|
||||
const liftBasePoint = project(showLowerHandles ? lowerCenterWorld : upperCenterWorld);
|
||||
@@ -6425,12 +6509,6 @@ function syncTransformOverlay(
|
||||
);
|
||||
const liftHandleAngle = liftTargetAngle - (showLowerHandles ? 90 : -90);
|
||||
const centerPoint = project(frame.center);
|
||||
const footprintGuides = [
|
||||
{ x1: bottom.nearLeft.x, y1: bottom.nearLeft.y, x2: bottom.nearRight.x, y2: bottom.nearRight.y },
|
||||
{ x1: bottom.nearRight.x, y1: bottom.nearRight.y, x2: bottom.farRight.x, y2: bottom.farRight.y },
|
||||
{ x1: bottom.farRight.x, y1: bottom.farRight.y, x2: bottom.farLeft.x, y2: bottom.farLeft.y },
|
||||
{ x1: bottom.farLeft.x, y1: bottom.farLeft.y, x2: bottom.nearLeft.x, y2: bottom.nearLeft.y },
|
||||
];
|
||||
const widthLabel = formatMeasure(frame.width, accuracy);
|
||||
const depthLabel = formatMeasure(frame.depth, accuracy);
|
||||
const heightLabel = formatMeasure(frame.height, accuracy);
|
||||
@@ -6508,9 +6586,12 @@ function syncTransformOverlay(
|
||||
}
|
||||
return framePoint(frame, 0, y, frame.min.z);
|
||||
};
|
||||
const rotateLeft = screenOffsetFromCenter(project(sidePoint(rotationSides.x, frame.max.y)), 24);
|
||||
const rotateRight = screenOffsetFromCenter(project(sidePoint(rotationSides.z, frame.max.y)), 28);
|
||||
const rotateBottomAnchor = screenOffsetFromCenter(project(sidePoint(rotationSides.y, footprintY)), 26);
|
||||
const rotateLeftSource = project(sidePoint(rotationSides.x, frame.max.y));
|
||||
const rotateRightSource = project(sidePoint(rotationSides.z, frame.max.y));
|
||||
const rotateBottomSource = project(sidePoint(rotationSides.y, footprintY));
|
||||
const rotateLeft = screenOffsetFromCenter(rotateLeftSource, 24);
|
||||
const rotateRight = screenOffsetFromCenter(rotateRightSource, 28);
|
||||
const rotateBottomAnchor = screenOffsetFromCenter(rotateBottomSource, 26);
|
||||
const rotateBottom = { ...rotateBottomAnchor, y: rotateBottomAnchor.y - 5 };
|
||||
const xFaceCenter = sidePoint(rotationSides.x, 0);
|
||||
const zFaceCenter = sidePoint(rotationSides.z, 0);
|
||||
@@ -6524,7 +6605,8 @@ function syncTransformOverlay(
|
||||
: { u: zFootAxis, v: xFootAxis.clone().multiplyScalar(-1) };
|
||||
const planeRadius = 154;
|
||||
const planeWorldStep = Math.max(0.1, cameraDistance * 0.01);
|
||||
const makePlaneView = (centerWorld: THREE.Vector3, uAxis: THREE.Vector3, vAxis: THREE.Vector3): RotationPlaneView => {
|
||||
const makePlaneView = (centerWorld: THREE.Vector3, uAxis: THREE.Vector3, vAxis: THREE.Vector3, axisVector: THREE.Vector3): RotationPlaneView => {
|
||||
const directionSign = rotationPlaneDirectionSign(axisVector, uAxis, vAxis);
|
||||
const screenCenter = project(centerWorld);
|
||||
const uOffset = uAxis.clone().multiplyScalar(planeWorldStep);
|
||||
const vOffset = vAxis.clone().multiplyScalar(planeWorldStep);
|
||||
@@ -6536,7 +6618,7 @@ function syncTransformOverlay(
|
||||
const dv = { x: (vEnd.x - vStart.x) / 2, y: (vEnd.y - vStart.y) / 2 };
|
||||
const longest = Math.max(Math.hypot(du.x, du.y), Math.hypot(dv.x, dv.y));
|
||||
if (!Number.isFinite(longest) || longest < 0.000001) {
|
||||
return { x: screenCenter.x, y: screenCenter.y, a: 1, b: 0, c: 0, d: 1 };
|
||||
return { x: screenCenter.x, y: screenCenter.y, a: 1, b: 0, c: 0, d: 1, directionSign };
|
||||
}
|
||||
const scale = planeRadius / longest / 100;
|
||||
return {
|
||||
@@ -6546,6 +6628,7 @@ function syncTransformOverlay(
|
||||
b: du.y * scale,
|
||||
c: dv.x * scale,
|
||||
d: dv.y * scale,
|
||||
directionSign,
|
||||
};
|
||||
};
|
||||
const makeWheel = (centerWorld: THREE.Vector3) => {
|
||||
@@ -6564,9 +6647,9 @@ function syncTransformOverlay(
|
||||
z: makeWorldPoint(zFaceCenter),
|
||||
};
|
||||
const rotationPlanes: Record<RotationAxis, RotationPlaneView> = {
|
||||
x: makePlaneView(xFaceCenter, zFootAxis, yFootAxis),
|
||||
y: makePlaneView(yFaceCenter, xFootAxis, zFootAxis),
|
||||
z: makePlaneView(zFaceCenter, xFootAxis, yFootAxis),
|
||||
x: makePlaneView(xFaceCenter, zFootAxis, yFootAxis, xFootAxis),
|
||||
y: makePlaneView(yFaceCenter, xFootAxis, zFootAxis, yFootAxis),
|
||||
z: makePlaneView(zFaceCenter, xFootAxis, yFootAxis, zFootAxis),
|
||||
};
|
||||
const makeCameraPlaneView = (uAxis: THREE.Vector3, vAxis: THREE.Vector3): RotationPlaneView => {
|
||||
const u = uAxis.clone().transformDirection(state.camera.matrixWorldInverse);
|
||||
@@ -6582,31 +6665,32 @@ function syncTransformOverlay(
|
||||
z: makeCameraPlaneView(xFootAxis, yFootAxis),
|
||||
};
|
||||
|
||||
const handles = [
|
||||
{ point: bottom.nearLeft, handle: { key: "near-left", className: "corner", kind: "scale" as const, x: bottom.nearLeft.x, y: bottom.nearLeft.y, title: "Resize" } },
|
||||
{ point: bottom.nearRight, handle: { key: "near-right", className: "corner", kind: "scale" as const, x: bottom.nearRight.x, y: bottom.nearRight.y, title: "Resize" } },
|
||||
{ point: bottom.farRight, handle: { key: "far-right", className: "corner", kind: "scale" as const, x: bottom.farRight.x, y: bottom.farRight.y, title: "Resize" } },
|
||||
{ point: bottom.farLeft, handle: { key: "far-left", className: "corner", kind: "scale" as const, x: bottom.farLeft.x, y: bottom.farLeft.y, title: "Resize" } },
|
||||
{ point: mid.near, handle: { key: "near-mid", className: "edge dark", kind: "scale" as const, x: mid.near.x, y: mid.near.y, title: "Resize" } },
|
||||
{ point: mid.right, handle: { key: "right-mid", className: "edge dark", kind: "scale" as const, x: mid.right.x, y: mid.right.y, title: "Resize" } },
|
||||
{ point: mid.far, handle: { key: "far-mid", className: "edge dark", kind: "scale" as const, x: mid.far.x, y: mid.far.y, title: "Resize" } },
|
||||
{ point: mid.left, handle: { key: "left-mid", className: "edge dark", kind: "scale" as const, x: mid.left.x, y: mid.left.y, title: "Resize" } },
|
||||
{ point: heightPoint, handle: { key: heightHandleKey, className: "height-top", kind: "height" as const, x: heightPoint.x, y: heightPoint.y, title: "Height" } },
|
||||
{ point: liftPoint, handle: { key: liftHandleKey, className: showLowerHandles ? "height-lift lower" : "height-lift", kind: "lift" as const, x: liftPoint.x, y: liftPoint.y, title: "Lift", angle: liftHandleAngle } },
|
||||
].filter(({ point }) => point.visible).map(({ handle }) => handle);
|
||||
const rotationChromeVisible = !cameraInsideSelection && centerPoint.visible;
|
||||
const rotateHandles = rotationChromeVisible ? [
|
||||
rotateLeftSource.visible ? { key: "rotate-left", className: "screen-left", x: rotateLeft.x, y: rotateLeft.y, plane: normalizedRotationPlaneBasis(rotationHandlePlanes.x, true) } : null,
|
||||
rotateRightSource.visible ? { key: "rotate-right", className: "screen-right", x: rotateRight.x, y: rotateRight.y, plane: normalizedRotationPlaneBasis(rotationHandlePlanes.z, true) } : null,
|
||||
rotateBottomSource.visible ? { key: "rotate-bottom", className: "screen-bottom", x: rotateBottom.x, y: rotateBottom.y, plane: normalizedRotationPlaneBasis(rotationHandlePlanes.y, true) } : null,
|
||||
].filter((handle): handle is NonNullable<typeof handle> => Boolean(handle)) : [];
|
||||
|
||||
const next = {
|
||||
id: frame.ids.join("|"),
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
guides: [
|
||||
{ x1: topPoint.x, y1: topPoint.y, x2: bottomCenterPoint.x, y2: bottomCenterPoint.y },
|
||||
...footprintGuides,
|
||||
],
|
||||
handles: [
|
||||
{ key: "near-left", className: "corner", kind: "scale" as const, x: bottom.nearLeft.x, y: bottom.nearLeft.y, title: "Resize" },
|
||||
{ key: "near-right", className: "corner", kind: "scale" as const, x: bottom.nearRight.x, y: bottom.nearRight.y, title: "Resize" },
|
||||
{ key: "far-right", className: "corner", kind: "scale" as const, x: bottom.farRight.x, y: bottom.farRight.y, title: "Resize" },
|
||||
{ key: "far-left", className: "corner", kind: "scale" as const, x: bottom.farLeft.x, y: bottom.farLeft.y, title: "Resize" },
|
||||
{ key: "near-mid", className: "edge dark", kind: "scale" as const, x: mid.near.x, y: mid.near.y, title: "Resize" },
|
||||
{ key: "right-mid", className: "edge dark", kind: "scale" as const, x: mid.right.x, y: mid.right.y, title: "Resize" },
|
||||
{ key: "far-mid", className: "edge dark", kind: "scale" as const, x: mid.far.x, y: mid.far.y, title: "Resize" },
|
||||
{ key: "left-mid", className: "edge dark", kind: "scale" as const, x: mid.left.x, y: mid.left.y, title: "Resize" },
|
||||
{ key: heightHandleKey, className: "height-top", kind: "height" as const, x: heightPoint.x, y: heightPoint.y, title: "Height" },
|
||||
{ key: liftHandleKey, className: showLowerHandles ? "height-lift lower" : "height-lift", kind: "lift" as const, x: liftPoint.x, y: liftPoint.y, title: "Lift", angle: liftHandleAngle },
|
||||
],
|
||||
rotateHandles: [
|
||||
{ key: "rotate-left", className: "screen-left", x: rotateLeft.x, y: rotateLeft.y, plane: normalizedRotationPlaneBasis(rotationHandlePlanes.x, true) },
|
||||
{ key: "rotate-right", className: "screen-right", x: rotateRight.x, y: rotateRight.y, plane: normalizedRotationPlaneBasis(rotationHandlePlanes.z, true) },
|
||||
{ key: "rotate-bottom", className: "screen-bottom", x: rotateBottom.x, y: rotateBottom.y, plane: normalizedRotationPlaneBasis(rotationHandlePlanes.y, true) },
|
||||
],
|
||||
guides: [],
|
||||
handles,
|
||||
rotateHandles,
|
||||
dimensions: dimensionMarks,
|
||||
rotationWheel: rotationWheels.y,
|
||||
rotationWheels,
|
||||
@@ -7151,7 +7235,7 @@ function sharedShapeMaterial(shape: WorkplaneShape) {
|
||||
transparent: Boolean(shape.hole),
|
||||
opacity: shape.hole ? (shape.importedMesh ? 0.34 : 0.52) : 1,
|
||||
roughness: shape.hole ? 0.88 : 0.57,
|
||||
side: shape.importedMesh?.sourceFormat === "json" || mirroredAxisCount(shape) % 2 === 1 ? "double" : "front",
|
||||
side: "double",
|
||||
});
|
||||
const cached = sharedShapeMaterialCache.get(key);
|
||||
if (cached) {
|
||||
@@ -7165,7 +7249,7 @@ function sharedShapeMaterial(shape: WorkplaneShape) {
|
||||
opacity: shape.hole ? (shape.importedMesh ? 0.34 : 0.52) : 1,
|
||||
roughness: shape.hole ? 0.88 : 0.57,
|
||||
metalness: 0.02,
|
||||
side: shape.importedMesh?.sourceFormat === "json" || mirroredAxisCount(shape) % 2 === 1 ? THREE.DoubleSide : THREE.FrontSide,
|
||||
side: THREE.DoubleSide,
|
||||
});
|
||||
material.userData.cached = true;
|
||||
material.userData.sharedShapeMaterialKey = key;
|
||||
|
||||
Reference in New Issue
Block a user