fix(installation-demo): resolve playback focus type checks
This commit is contained in:
parent
3c97d2b774
commit
f035863350
@ -5,6 +5,7 @@ import type { ThreeDEngine } from '@/lib/3d/engine'
|
||||
import type { InstallationDemoShareSnapshot } from '@/lib/installation-demo-share-types'
|
||||
import type {
|
||||
InstallationDetailView,
|
||||
InstallationPartItem,
|
||||
InstallationPartRole,
|
||||
InstallationStepDraft,
|
||||
InstallationWorkbenchMode,
|
||||
@ -223,7 +224,7 @@ export function InstallationDemoShareViewerClient({
|
||||
return stepMaterialMarkerParts
|
||||
}
|
||||
|
||||
const filteredMarkerParts = stepMaterialItems.flatMap((item) => {
|
||||
const filteredMarkerParts: InstallationPartItem[] = stepMaterialItems.flatMap((item) => {
|
||||
if (!item.roles.includes('hardware')) {
|
||||
return item.markerParts
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ export default function InstallationDemoWorkbenchClient({
|
||||
return stepMaterialMarkerParts
|
||||
}
|
||||
|
||||
const filteredMarkerParts = stepMaterialItems.flatMap((item) => {
|
||||
const filteredMarkerParts: InstallationPartItem[] = stepMaterialItems.flatMap((item) => {
|
||||
if (!item.roles.includes('hardware')) {
|
||||
return item.markerParts
|
||||
}
|
||||
|
||||
@ -717,6 +717,15 @@ function resolveRepresentativeHardwareFocus(params: {
|
||||
}
|
||||
}
|
||||
|
||||
type HardwareFocusFrame = {
|
||||
nodeName: string
|
||||
center: THREE.Vector3
|
||||
maxDimension: number
|
||||
nearestContextPoint: THREE.Vector3 | null
|
||||
resolvedContextPoint: THREE.Vector3
|
||||
nearestDistance: number
|
||||
}
|
||||
|
||||
function selectHardwareFocusNodeNames(params: {
|
||||
engine: ThreeDEngine
|
||||
hardwareNodeNames: string[]
|
||||
@ -744,7 +753,7 @@ function selectHardwareFocusNodeNames(params: {
|
||||
: contextUnionBox.getCenter(new THREE.Vector3())
|
||||
|
||||
const focusFrames = params.hardwareNodeNames
|
||||
.map((nodeName) => {
|
||||
.map<HardwareFocusFrame | null>((nodeName) => {
|
||||
const box = resolveObjectBounds(params.engine, nodeName)
|
||||
if (!box) return null
|
||||
|
||||
@ -785,18 +794,7 @@ function selectHardwareFocusNodeNames(params: {
|
||||
nearestDistance,
|
||||
}
|
||||
})
|
||||
.filter(
|
||||
(
|
||||
item,
|
||||
): item is {
|
||||
nodeName: string
|
||||
center: THREE.Vector3
|
||||
maxDimension: number
|
||||
nearestContextPoint: THREE.Vector3 | null
|
||||
resolvedContextPoint: THREE.Vector3
|
||||
nearestDistance: number
|
||||
} => Boolean(item),
|
||||
)
|
||||
.filter((item): item is HardwareFocusFrame => item !== null)
|
||||
|
||||
if (focusFrames.length === 0) return []
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user