Changes
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -149,18 +149,20 @@ export function XRControllerMeasure() {
|
||||
snappedPoint = bestHoleCenter;
|
||||
snapKind = 'hole';
|
||||
} else if (snapEnabled) {
|
||||
// Try detecting a circular edge (hole) at hit
|
||||
const circle = detectCircularEdgeAtPoint(hit.object, hit.point, fakeCam, canvasSize, 60);
|
||||
// Try detecting a circular edge (hole) at hit — radius mais generoso
|
||||
const circle = detectCircularEdgeAtPoint(hit.object, hit.point, fakeCam, canvasSize, 90);
|
||||
if (circle) {
|
||||
snappedPoint = circle.center;
|
||||
snapKind = 'hole';
|
||||
hoverDetected = { kind: 'hole', value: circle.diameterMM, position: circle.center };
|
||||
} else {
|
||||
const snap = resolveSnap(hit.object, hit.point, fakeCam, canvasSize, 14, 18);
|
||||
// Snap mais "magnético": raios maiores de busca em pixels
|
||||
// vértice: 32px (antes 14), aresta: 48px (antes 18)
|
||||
const snap = resolveSnap(hit.object, hit.point, fakeCam, canvasSize, 32, 48);
|
||||
snappedPoint = snap.point;
|
||||
snapKind = snap.type;
|
||||
if (snap.type === 'edge') {
|
||||
const seg = findNearestEdgeSegment(hit.object, hit.point, fakeCam, canvasSize, 18);
|
||||
const seg = findNearestEdgeSegment(hit.object, hit.point, fakeCam, canvasSize, 48);
|
||||
if (seg) {
|
||||
const lenMM = seg.a.distanceTo(seg.b) * 1000;
|
||||
hoverDetected = { kind: 'edge', value: lenMM, position: seg.midpoint, endpoints: { a: seg.a, b: seg.b } };
|
||||
@@ -172,7 +174,9 @@ export function XRControllerMeasure() {
|
||||
snapKind = 'surface';
|
||||
}
|
||||
}
|
||||
// Cache for non-heavy frames so the laser + trigger still have a target
|
||||
// Cache for non-heavy frames so the laser + trigger still have a target.
|
||||
// Sticky: se conseguimos um snap "forte" (vertex/edge/hole), preservamos
|
||||
// ele entre frames leves para evitar cintilação.
|
||||
cachedSnappedPoint.current = snappedPoint ? snappedPoint.clone() : null;
|
||||
cachedSnapKind.current = snapKind;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user