🚀 Auto-deploy: melhoria no snap e medição AR em 29/05/2026 20:32:41
This commit is contained in:
@@ -904,10 +904,16 @@ function CalibrationTab() {
|
||||
|
||||
const isCalibrating = xrCalibration.step !== 'idle' && xrCalibration.step !== 'done';
|
||||
const isDone = xrCalibration.step === 'done';
|
||||
const progress = isDone ? 1 : xrCalibration.progress;
|
||||
|
||||
const isCubeMode = xrCalibration.alignType === 'cube';
|
||||
const isVirtRealMode = xrCalibration.alignType === 'virt-real';
|
||||
|
||||
const onClickCalibrar = () => {
|
||||
if (isCalibrating || isDone) {
|
||||
const onClickCube = () => {
|
||||
if (isCalibrating && isCubeMode) {
|
||||
cancelXRCalibration();
|
||||
return;
|
||||
}
|
||||
if (isDone && isCubeMode) {
|
||||
cancelXRCalibration();
|
||||
return;
|
||||
}
|
||||
@@ -919,7 +925,27 @@ function CalibrationTab() {
|
||||
toast.error('Peça travada — destranque a peça para calibrar');
|
||||
return;
|
||||
}
|
||||
startXRCalibration(active.id);
|
||||
startXRCalibration(active.id, 'cube');
|
||||
};
|
||||
|
||||
const onClickVirtReal = () => {
|
||||
if (isCalibrating && isVirtRealMode) {
|
||||
cancelXRCalibration();
|
||||
return;
|
||||
}
|
||||
if (isDone && isVirtRealMode) {
|
||||
cancelXRCalibration();
|
||||
return;
|
||||
}
|
||||
if (!active) {
|
||||
toast.error('Selecione uma peça antes de calibrar');
|
||||
return;
|
||||
}
|
||||
if (active.locked) {
|
||||
toast.error('Peça travada — destranque a peça para calibrar');
|
||||
return;
|
||||
}
|
||||
startXRCalibration(active.id, 'virt-real');
|
||||
};
|
||||
|
||||
const onResetCalibration = () => {
|
||||
@@ -935,10 +961,54 @@ function CalibrationTab() {
|
||||
'await-model-2': '2/3 - Clique na face correspondente da peça',
|
||||
'await-cube-3': '3/3 (Verificar) - Clique em uma 3ª face do Cubo (opcional)',
|
||||
'await-model-3': '3/3 - Clique na face correspondente da peça',
|
||||
'await-real-1': '1/3 Real - Clique na 1ª superfície da peça REAL',
|
||||
'await-virtual-1': '1/3 Virtual - Clique na 1ª correspondente da peça VIRTUAL',
|
||||
'await-real-2': '2/3 Real - Clique na 2ª superfície da peça REAL',
|
||||
'await-virtual-2': '2/3 Virtual - Clique na 2ª correspondente da peça VIRTUAL',
|
||||
'await-real-3': '3/3 Real - Clique na 3ª superfície da peça REAL',
|
||||
'await-virtual-3': '3/3 Virtual - Clique na 3ª correspondente da peça VIRTUAL',
|
||||
'done': 'Calibração concluída com sucesso!',
|
||||
};
|
||||
|
||||
const currentHint = STEP_HINTS_AR[xrCalibration.step] ?? 'Clique em "Iniciar Calibrar" para alinhar o modelo';
|
||||
const currentHint = STEP_HINTS_AR[xrCalibration.step] ?? 'Selecione "Cubo" ou "Virt/Real" para calibrar o modelo';
|
||||
|
||||
// Configurações dinâmicas de estados de botão
|
||||
let cubeLabel = 'Cubo';
|
||||
let cubeActive = false;
|
||||
let cubeColor = '#3b82f6';
|
||||
|
||||
let vrLabel = 'Virt/Real';
|
||||
let vrActive = false;
|
||||
let vrColor = '#3b82f6';
|
||||
|
||||
if (isCalibrating) {
|
||||
if (isCubeMode) {
|
||||
cubeLabel = 'Cancelar';
|
||||
cubeActive = true;
|
||||
cubeColor = '#d97706';
|
||||
} else {
|
||||
cubeColor = '#475569';
|
||||
}
|
||||
|
||||
if (isVirtRealMode) {
|
||||
vrLabel = 'Cancelar';
|
||||
vrActive = true;
|
||||
vrColor = '#d97706';
|
||||
} else {
|
||||
vrColor = '#475569';
|
||||
}
|
||||
} else if (isDone) {
|
||||
if (isCubeMode) {
|
||||
cubeLabel = 'Concluído';
|
||||
cubeActive = true;
|
||||
cubeColor = '#22c55e';
|
||||
}
|
||||
if (isVirtRealMode) {
|
||||
vrLabel = 'Concluído';
|
||||
vrActive = true;
|
||||
vrColor = '#22c55e';
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<group>
|
||||
@@ -948,7 +1018,7 @@ function CalibrationTab() {
|
||||
</Text>
|
||||
|
||||
<Text position={[-0.24, 0.07, 0]} fontSize={0.008} color="#cbd5e1" anchorX="left" anchorY="top" maxWidth={0.28}>
|
||||
Alinhe os eixos intrínsecos do modelo 3D com a estrutura física correspondente no ambiente.
|
||||
Alinhe o modelo virtual 3D com a peça real usando o Cubo ou clique em 3 pontos de controle ("Virt/Real").
|
||||
</Text>
|
||||
|
||||
{/* Caixa de status do passo atual */}
|
||||
@@ -957,10 +1027,10 @@ function CalibrationTab() {
|
||||
<planeGeometry args={[0.26, 0.05]} />
|
||||
<meshBasicMaterial color="#111827" transparent opacity={0.65} />
|
||||
</mesh>
|
||||
<Text position={[0.01, 0, 0.001]} fontSize={0.0085} color={isDone ? '#22c55e' : isCalibrating ? '#f59e0b' : '#ffffff'} anchorX="left" anchorY="middle" maxWidth={0.24}>
|
||||
<Text position={[0.01, 0, 0.001]} fontSize={0.008} color={isDone ? '#22c55e' : isCalibrating ? '#f59e0b' : '#ffffff'} anchorX="left" anchorY="middle" maxWidth={0.24}>
|
||||
{currentHint}
|
||||
</Text>
|
||||
{isDone && Number.isFinite(xrCalibration.verifyErrorDeg) && (
|
||||
{isDone && Number.isFinite(xrCalibration.verifyErrorDeg) && isCubeMode && (
|
||||
<Text position={[0.01, -0.016, 0.001]} fontSize={0.007} color="#22c55e" anchorX="left" anchorY="middle">
|
||||
Erro residual calculado: {xrCalibration.verifyErrorDeg.toFixed(1)}°
|
||||
</Text>
|
||||
@@ -970,20 +1040,30 @@ function CalibrationTab() {
|
||||
{/* Botões na parte inferior esquerda */}
|
||||
<group position={[-0.24, -0.06, 0]}>
|
||||
<XR3DButton
|
||||
position={[0.06, 0, 0]}
|
||||
size={[0.11, 0.026]}
|
||||
label={isDone ? 'Concluído' : isCalibrating ? 'Cancelar' : 'Iniciar Calibrar'}
|
||||
active={isCalibrating || isDone}
|
||||
color={isDone ? '#22c55e' : isCalibrating ? '#d97706' : '#3b82f6'}
|
||||
onClick={onClickCalibrar}
|
||||
position={[0.045, 0, 0]}
|
||||
size={[0.08, 0.026]}
|
||||
label={cubeLabel}
|
||||
active={cubeActive}
|
||||
color={cubeColor}
|
||||
onClick={onClickCube}
|
||||
fontSize={0.008}
|
||||
/>
|
||||
|
||||
<XR3DButton
|
||||
position={[0.135, 0, 0]}
|
||||
size={[0.08, 0.026]}
|
||||
label={vrLabel}
|
||||
active={vrActive}
|
||||
color={vrColor}
|
||||
onClick={onClickVirtReal}
|
||||
fontSize={0.008}
|
||||
/>
|
||||
|
||||
{active?.calibrationQuat && !isCalibrating && (
|
||||
<XR3DButton
|
||||
position={[0.18, 0, 0]}
|
||||
size={[0.09, 0.026]}
|
||||
label="Remover Cal."
|
||||
position={[0.225, 0, 0]}
|
||||
size={[0.08, 0.026]}
|
||||
label="Limpar"
|
||||
color="#dc2626"
|
||||
onClick={onResetCalibration}
|
||||
fontSize={0.008}
|
||||
|
||||
Reference in New Issue
Block a user