2026-05-20-01-08-38 调整工具栏布局与平移步长

This commit is contained in:
2026-05-20 01:11:31 +08:00
parent 3e6b1e0d9f
commit 19bd706453
5 changed files with 209 additions and 6 deletions

View File

@@ -55,9 +55,9 @@ const poseStepConfig: Record<ModelPoseKey, { min: number; max: number; step: num
rotateX: { min: -180, max: 180, step: 1, minus: '-90°', plus: '+90°', quick: 90 },
rotateY: { min: -180, max: 180, step: 1, minus: '-90°', plus: '+90°', quick: 90 },
rotateZ: { min: -180, max: 180, step: 1, minus: '-90°', plus: '+90°', quick: 90 },
translateX: { min: -2, max: 2, step: 0.05, minus: '-X', plus: '+X' },
translateY: { min: -2, max: 2, step: 0.05, minus: '-Y', plus: '+Y' },
translateZ: { min: -2, max: 2, step: 0.05, minus: '-Z', plus: '+Z' },
translateX: { min: -2, max: 2, step: 0.005, minus: '-X', plus: '+X' },
translateY: { min: -2, max: 2, step: 0.005, minus: '-Y', plus: '+Y' },
translateZ: { min: -2, max: 2, step: 0.005, minus: '-Z', plus: '+Z' },
scale: { min: 0.5, max: 2, step: 0.05, minus: '-S', plus: '+S' },
};
@@ -78,6 +78,19 @@ function clamp(value: number, min: number, max: number) {
return Math.max(min, Math.min(max, value));
}
function getStepPrecision(step: number) {
if (step >= 1) {
return 0;
}
const text = step.toString();
if (text.includes('e-')) {
return Number(text.split('e-')[1] ?? 2);
}
return text.split('.')[1]?.length ?? 0;
}
function createDicomTexture(frame: string, width: number, height: number) {
const canvas = document.createElement('canvas');
canvas.width = width;
@@ -1944,7 +1957,7 @@ export default function ReverseWorkspace({ projectId }: { projectId: string }) {
</div>
<div className="min-h-[780px] lg:min-h-0 flex-1 grid grid-cols-1 lg:grid-cols-12 gap-6">
<div className="lg:col-span-7 min-h-0 flex flex-col gap-4">
<div className="lg:col-span-6 min-h-0 flex flex-col gap-4">
<div className="px-2 flex items-center justify-between shrink-0">
<h3 className="font-bold text-slate-700 flex items-center gap-2">
<Rotate3d size={18} className="text-blue-500" />
@@ -2029,7 +2042,7 @@ export default function ReverseWorkspace({ projectId }: { projectId: string }) {
</div>
</div>
<div className="lg:col-span-2 min-h-0 flex flex-col gap-4 overflow-hidden">
<div className="lg:col-span-3 min-h-0 flex flex-col gap-4 overflow-hidden">
<div className="px-2 shrink-0">
<h3 className="font-bold text-slate-700 flex items-center gap-2">
<Settings2 size={18} className="text-emerald-500" />
@@ -2191,7 +2204,7 @@ export default function ReverseWorkspace({ projectId }: { projectId: string }) {
>
+
</button>
<span className="text-right font-mono">{Number(item.value).toFixed(poseStepConfig[item.key].step < 1 ? 2 : 0)}</span>
<span className="text-right font-mono">{Number(item.value).toFixed(getStepPrecision(poseStepConfig[item.key].step))}</span>
{poseStepConfig[item.key].quick && (
<div className="col-start-2 col-span-3 grid grid-cols-2 gap-1">
<button