diff --git a/src/stores/useModelStore.ts b/src/stores/useModelStore.ts index 6596eb3..a7e1a41 100644 --- a/src/stores/useModelStore.ts +++ b/src/stores/useModelStore.ts @@ -561,7 +561,7 @@ export const useModelStore = create((set, get) => ({ const points = [...state.measurePoints, p]; if (points.length === 2) { const [a, b] = points; - const modelId = state.activeModelId ?? undefined; + const modelId = (a.modelId && a.modelId === b.modelId ? a.modelId : state.activeModelId) ?? undefined; const aConv = modelId ? worldToModelLocal(modelId, a) : null; const bConv = modelId ? worldToModelLocal(modelId, b) : null; const attached = !!(aConv && bConv); @@ -603,7 +603,7 @@ export const useModelStore = create((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 modelScale = modelId ? getModelWorldScaleFactor(modelId) : 1; const toLocal = (p: MeasurePoint): { point: MeasurePoint; attached: boolean } => { const conv = modelId ? worldToModelLocal(modelId, p) : null;