🚀 Auto-deploy: melhoria no snap e medição AR em 01/06/2026 01:00:37

This commit is contained in:
2026-06-01 01:00:37 +00:00
parent b47fb872b5
commit 0126d8d78c
3 changed files with 46 additions and 38 deletions
+7 -37
View File
@@ -731,6 +731,7 @@ function SmartSnapHandler() {
function HoverDetector() {
const { camera, scene, gl } = useThree();
const setHoverInfo = useModelStore((s) => s.setHoverInfo);
const setHoverIfcProps = useModelStore((s) => s.setHoverIfcProps);
const raycaster = useMemo(() => new THREE.Raycaster(), []);
const mouse = useMemo(() => new THREE.Vector2(), []);
const hoverTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
@@ -764,8 +765,8 @@ function HoverDetector() {
lastHitKey.current = '';
lastHitExpressId.current = 0;
setHoverInfo(null);
setHoverIfcProps(null);
clearTimers();
toast.dismiss('ifc-hover-info');
return;
}
@@ -778,40 +779,9 @@ function HoverDetector() {
const props = elementRoot?.userData?.properties;
if (props && (props.name || props.material || props.tag)) {
const infoLines: string[] = [];
if (props.tag || props.name) {
infoLines.push(`Peça: ${props.tag || props.name}`);
}
if (props.material) {
infoLines.push(`Material: ${props.material}`);
}
const lengthKey = Object.keys(props).find(k => {
const kl = k.toLowerCase();
return kl.includes('length') || kl.includes('comprimento') || kl.includes('lengthvalue');
});
if (lengthKey && props[lengthKey]) {
infoLines.push(`Comprimento: ${props[lengthKey]}`);
} else {
const commonLengthKeys = ['Length', 'Comprimento', 'LengthValue', 'height', 'comprimento'];
for (const key of commonLengthKeys) {
if (props[key]) {
infoLines.push(`Comprimento: ${props[key]}`);
break;
}
}
}
if (infoLines.length > 0) {
toast(infoLines.join(' | '), {
id: 'ifc-hover-info',
duration: 8000,
position: 'bottom-center',
});
}
setHoverIfcProps(props);
} else {
toast.dismiss('ifc-hover-info');
setHoverIfcProps(null);
}
}
@@ -879,8 +849,8 @@ function HoverDetector() {
lastHitKey.current = '';
lastHitExpressId.current = 0;
setHoverInfo(null);
setHoverIfcProps(null);
clearTimers();
toast.dismiss('ifc-hover-info');
};
gl.domElement.addEventListener('pointermove', onMove);
@@ -889,9 +859,9 @@ function HoverDetector() {
gl.domElement.removeEventListener('pointermove', onMove);
gl.domElement.removeEventListener('pointerleave', onLeave);
clearTimers();
toast.dismiss('ifc-hover-info');
setHoverIfcProps(null);
};
}, [camera, scene, gl, raycaster, mouse, setHoverInfo]);
}, [camera, scene, gl, raycaster, mouse, setHoverInfo, setHoverIfcProps]);
return null;
}