🚀 Auto-deploy: melhoria no snap e medição AR em 24/05/2026 02:00:33
This commit is contained in:
@@ -133,6 +133,7 @@ export interface MeasurePoint {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
modelId?: string;
|
||||
}
|
||||
|
||||
export interface Measurement {
|
||||
@@ -155,6 +156,7 @@ export interface HoverInfo {
|
||||
value: number; // mm (diameter or length)
|
||||
/** For edges: the two endpoints in world coords. */
|
||||
endpoints?: { a: MeasurePoint; b: MeasurePoint };
|
||||
modelId?: string;
|
||||
}
|
||||
|
||||
export interface ChecklistItem {
|
||||
@@ -564,7 +566,7 @@ export const useModelStore = create<ModelStore>((set, get) => ({
|
||||
const distanceWorldMM = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
const factor = state.scaleRatio?.factor ?? 1;
|
||||
const distanceMM = distanceWorldMM / factor;
|
||||
const modelId = state.activeModelId ?? undefined;
|
||||
const modelId = a.modelId ?? b.modelId ?? state.activeModelId ?? undefined;
|
||||
const aConv = modelId ? worldToModelLocal(modelId, a) : null;
|
||||
const bConv = modelId ? worldToModelLocal(modelId, b) : null;
|
||||
const attached = !!(aConv && bConv);
|
||||
@@ -602,7 +604,7 @@ export const useModelStore = create<ModelStore>((set, get) => ({
|
||||
return { measurements: state.measurements.slice(0, -1) };
|
||||
}),
|
||||
registerHoverMeasurement: (info) => set((state) => {
|
||||
const modelId = state.activeModelId ?? undefined;
|
||||
const modelId = info.modelId ?? state.activeModelId ?? undefined;
|
||||
const toLocal = (p: MeasurePoint): { point: MeasurePoint; attached: boolean } => {
|
||||
const conv = modelId ? worldToModelLocal(modelId, p) : null;
|
||||
return conv ? { point: conv, attached: true } : { point: p, attached: false };
|
||||
|
||||
Reference in New Issue
Block a user