🚀 Auto-deploy: melhoria no snap e medição AR em 30/05/2026 10:56:12
This commit is contained in:
@@ -422,7 +422,7 @@ function computeWorldPerPixel(
|
|||||||
worldPos: THREE.Vector3,
|
worldPos: THREE.Vector3,
|
||||||
): number {
|
): number {
|
||||||
const ortho = camera as THREE.OrthographicCamera;
|
const ortho = camera as THREE.OrthographicCamera;
|
||||||
if ((ortho as any).isOrthographicCamera) {
|
if ('isOrthographicCamera' in ortho) {
|
||||||
const visibleHeight = (ortho.top - ortho.bottom) / (ortho.zoom || 1);
|
const visibleHeight = (ortho.top - ortho.bottom) / (ortho.zoom || 1);
|
||||||
return visibleHeight / Math.max(1, size.height);
|
return visibleHeight / Math.max(1, size.height);
|
||||||
}
|
}
|
||||||
@@ -1176,7 +1176,7 @@ function SectionClippingApplier() {
|
|||||||
mat.needsUpdate = true;
|
mat.needsUpdate = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [enabled.x, enabled.y, enabled.z, invert.x, invert.y, invert.z, level.x, level.y, level.z, planes]);
|
}, [enabled.x, enabled.y, enabled.z, invert, invert.x, invert.y, invert.z, level, level.x, level.y, level.z, planes]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1335,7 +1335,7 @@ function WalkControls() {
|
|||||||
const setWalkMode = useModelStore(s => s.setWalkMode);
|
const setWalkMode = useModelStore(s => s.setWalkMode);
|
||||||
const gridY = useModelStore(s => s.gridY);
|
const gridY = useModelStore(s => s.gridY);
|
||||||
const { camera } = useThree();
|
const { camera } = useThree();
|
||||||
const controlsRef = useRef<any>(null);
|
const controlsRef = useRef<{ lock: () => void } | null>(null);
|
||||||
const keys = useRef({ w: false, a: false, s: false, d: false, shift: false });
|
const keys = useRef({ w: false, a: false, s: false, d: false, shift: false });
|
||||||
const initialized = useRef(false);
|
const initialized = useRef(false);
|
||||||
|
|
||||||
@@ -1354,7 +1354,7 @@ function WalkControls() {
|
|||||||
if (walkMode) {
|
if (walkMode) {
|
||||||
// Small timeout to allow canvas to render and be clickable
|
// Small timeout to allow canvas to render and be clickable
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
try { controlsRef.current?.lock(); } catch (e) {}
|
try { controlsRef.current?.lock(); } catch (e) { /* ignore */ }
|
||||||
}, 100);
|
}, 100);
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}
|
}
|
||||||
@@ -1503,7 +1503,7 @@ export function ModelViewerCanvas({ url }: ModelViewerProps) {
|
|||||||
minZoom={5}
|
minZoom={5}
|
||||||
maxZoom={5000}
|
maxZoom={5000}
|
||||||
enabled={!positionMode && !walkMode}
|
enabled={!positionMode && !walkMode}
|
||||||
ref={(c: any) => {
|
ref={(c: unknown) => {
|
||||||
mainControlsRef.current = c;
|
mainControlsRef.current = c;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ function loadCameraMode(): 'ortho' | 'persp' {
|
|||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(CAMERA_MODE_KEY);
|
const raw = localStorage.getItem(CAMERA_MODE_KEY);
|
||||||
if (raw === 'persp' || raw === 'ortho') return raw;
|
if (raw === 'persp' || raw === 'ortho') return raw;
|
||||||
} catch {}
|
} catch (e) { /* ignore */ }
|
||||||
return 'ortho';
|
return 'ortho';
|
||||||
}
|
}
|
||||||
function saveCameraMode(m: 'ortho' | 'persp') {
|
function saveCameraMode(m: 'ortho' | 'persp') {
|
||||||
try { localStorage.setItem(CAMERA_MODE_KEY, m); } catch {}
|
try { localStorage.setItem(CAMERA_MODE_KEY, m); } catch (e) { /* ignore */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface XRFeatureFlags {
|
export interface XRFeatureFlags {
|
||||||
@@ -38,11 +38,11 @@ function loadXRFeatures(): XRFeatureFlags {
|
|||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(XRFEAT_KEY);
|
const raw = localStorage.getItem(XRFEAT_KEY);
|
||||||
if (raw) return { ...DEFAULT_XR_FEATURES, ...JSON.parse(raw) };
|
if (raw) return { ...DEFAULT_XR_FEATURES, ...JSON.parse(raw) };
|
||||||
} catch {}
|
} catch (e) { /* ignore */ }
|
||||||
return { ...DEFAULT_XR_FEATURES };
|
return { ...DEFAULT_XR_FEATURES };
|
||||||
}
|
}
|
||||||
function saveXRFeatures(f: XRFeatureFlags) {
|
function saveXRFeatures(f: XRFeatureFlags) {
|
||||||
try { localStorage.setItem(XRFEAT_KEY, JSON.stringify(f)); } catch {}
|
try { localStorage.setItem(XRFEAT_KEY, JSON.stringify(f)); } catch (e) { /* ignore */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StoredPlacement { fineTuning: FineTuning; calibrationQuat?: [number, number, number, number] | null; }
|
interface StoredPlacement { fineTuning: FineTuning; calibrationQuat?: [number, number, number, number] | null; }
|
||||||
@@ -50,7 +50,7 @@ function loadPlacements(): Record<string, StoredPlacement> {
|
|||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(PLACEMENT_KEY);
|
const raw = localStorage.getItem(PLACEMENT_KEY);
|
||||||
if (raw) return JSON.parse(raw);
|
if (raw) return JSON.parse(raw);
|
||||||
} catch {}
|
} catch (e) { /* ignore */ }
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
function savePlacement(fileName: string, fineTuning: FineTuning, calibrationQuat?: [number, number, number, number] | null) {
|
function savePlacement(fileName: string, fineTuning: FineTuning, calibrationQuat?: [number, number, number, number] | null) {
|
||||||
@@ -62,7 +62,7 @@ function savePlacement(fileName: string, fineTuning: FineTuning, calibrationQuat
|
|||||||
calibrationQuat: calibrationQuat === undefined ? prev.calibrationQuat ?? null : calibrationQuat,
|
calibrationQuat: calibrationQuat === undefined ? prev.calibrationQuat ?? null : calibrationQuat,
|
||||||
};
|
};
|
||||||
localStorage.setItem(PLACEMENT_KEY, JSON.stringify(all));
|
localStorage.setItem(PLACEMENT_KEY, JSON.stringify(all));
|
||||||
} catch {}
|
} catch (e) { /* ignore */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Visibility (selection-based hide/isolate) persistence ────────────
|
// ── Visibility (selection-based hide/isolate) persistence ────────────
|
||||||
@@ -72,7 +72,7 @@ function loadVisibilityMap(): Record<string, StoredVisibility> {
|
|||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(VISIBILITY_KEY);
|
const raw = localStorage.getItem(VISIBILITY_KEY);
|
||||||
if (raw) return JSON.parse(raw);
|
if (raw) return JSON.parse(raw);
|
||||||
} catch {}
|
} catch (e) { /* ignore */ }
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
function saveVisibility(fileName: string, hidden: Set<string>, isolated: Set<string> | null) {
|
function saveVisibility(fileName: string, hidden: Set<string>, isolated: Set<string> | null) {
|
||||||
@@ -80,7 +80,7 @@ function saveVisibility(fileName: string, hidden: Set<string>, isolated: Set<str
|
|||||||
const all = loadVisibilityMap();
|
const all = loadVisibilityMap();
|
||||||
all[fileName] = { hidden: [...hidden], isolated: isolated ? [...isolated] : null };
|
all[fileName] = { hidden: [...hidden], isolated: isolated ? [...isolated] : null };
|
||||||
localStorage.setItem(VISIBILITY_KEY, JSON.stringify(all));
|
localStorage.setItem(VISIBILITY_KEY, JSON.stringify(all));
|
||||||
} catch {}
|
} catch (e) { /* ignore */ }
|
||||||
}
|
}
|
||||||
function loadVisibility(fileName: string): { hidden: Set<string>; isolated: Set<string> | null } {
|
function loadVisibility(fileName: string): { hidden: Set<string>; isolated: Set<string> | null } {
|
||||||
const v = loadVisibilityMap()[fileName];
|
const v = loadVisibilityMap()[fileName];
|
||||||
|
|||||||
Reference in New Issue
Block a user