Compare commits
No commits in common. "9b8c6788bf5131dec41c9c275281736fa45867d1" and "45790141df9632224076cc456cfd7f78ea5fc6d8" have entirely different histories.
9b8c6788bf
...
45790141df
|
|
@ -40,23 +40,17 @@ class FusionJumpToPointTool extends AnnotationDisplayTool {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const { element, currentPoints } = evt.detail || {}
|
const { element, currentPoints } = evt.detail || {}
|
||||||
if (!element || !currentPoints) return
|
const worldPoint = currentPoints?.world
|
||||||
|
if (!element || !worldPoint || worldPoint.length < 3) return
|
||||||
|
|
||||||
const enabledElement = getEnabledElement(element)
|
const enabledElement = getEnabledElement(element)
|
||||||
const { viewport, renderingEngine } = enabledElement || {}
|
const { viewport, renderingEngine } = enabledElement || {}
|
||||||
if (!viewport || !renderingEngine) return
|
if (!viewport || !renderingEngine) return
|
||||||
|
|
||||||
const sourceIsMip = this._isMipViewportId(viewport.id)
|
const selectedPoint = this._resolveSelectedPoint(viewport, worldPoint)
|
||||||
const interactionWorldPoint = this._getInteractionWorldPoint(viewport, currentPoints, !sourceIsMip)
|
|
||||||
if (!interactionWorldPoint || interactionWorldPoint.length < 3) return
|
|
||||||
const selectedPoint = sourceIsMip
|
|
||||||
? this._resolveSelectedPoint(viewport, interactionWorldPoint)
|
|
||||||
: interactionWorldPoint
|
|
||||||
if (!selectedPoint || selectedPoint.length < 3) return
|
if (!selectedPoint || selectedPoint.length < 3) return
|
||||||
|
|
||||||
this.setPoint(selectedPoint, viewport.id, renderingEngine.id, {
|
this.setPoint(selectedPoint, viewport.id, renderingEngine.id)
|
||||||
jumpToTargetViewports: sourceIsMip,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseDownCallback(evt) {
|
mouseDownCallback(evt) {
|
||||||
|
|
@ -76,14 +70,15 @@ class FusionJumpToPointTool extends AnnotationDisplayTool {
|
||||||
const { viewport, renderingEngine } = enabledElement || {}
|
const { viewport, renderingEngine } = enabledElement || {}
|
||||||
if (!viewport || !renderingEngine) return
|
if (!viewport || !renderingEngine) return
|
||||||
|
|
||||||
const sourceIsMip = this._isMipViewportId(viewport.id)
|
let worldPoint = currentPoints?.world
|
||||||
const worldPoint = this._getInteractionWorldPoint(viewport, currentPoints, !sourceIsMip)
|
if ((!worldPoint || worldPoint.length < 3) && currentPoints?.canvas && viewport.canvasToWorld) {
|
||||||
|
worldPoint = viewport.canvasToWorld(currentPoints.canvas)
|
||||||
|
}
|
||||||
if (!worldPoint || worldPoint.length < 3) return
|
if (!worldPoint || worldPoint.length < 3) return
|
||||||
|
|
||||||
const annotation = this._getViewportCrosshairAnnotation(viewport)
|
const annotation = this._getViewportCrosshairAnnotation(viewport)
|
||||||
const sourceViewportId = sourceIsMip
|
const sourceViewportId = this.dragSourceViewportId || annotation?.data?.sourceViewportId || viewport.id
|
||||||
? (this.dragSourceViewportId || annotation?.data?.sourceViewportId || viewport.id)
|
const sourceIsMip = this._isMipViewportId(viewport.id)
|
||||||
: viewport.id
|
|
||||||
this.setPoint(worldPoint, sourceViewportId, renderingEngine.id, {
|
this.setPoint(worldPoint, sourceViewportId, renderingEngine.id, {
|
||||||
jumpToTargetViewports: sourceIsMip,
|
jumpToTargetViewports: sourceIsMip,
|
||||||
})
|
})
|
||||||
|
|
@ -350,27 +345,6 @@ class FusionJumpToPointTool extends AnnotationDisplayTool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
_getInteractionWorldPoint(viewport, currentPoints, preferCanvasToWorld = false) {
|
|
||||||
const worldPoint = currentPoints?.world
|
|
||||||
const canvasPoint = currentPoints?.canvas
|
|
||||||
if (preferCanvasToWorld && canvasPoint && viewport?.canvasToWorld) {
|
|
||||||
const worldFromCanvas = viewport.canvasToWorld(canvasPoint)
|
|
||||||
if (worldFromCanvas && worldFromCanvas.length >= 3) {
|
|
||||||
return worldFromCanvas
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (worldPoint && worldPoint.length >= 3) {
|
|
||||||
return worldPoint
|
|
||||||
}
|
|
||||||
if (canvasPoint && viewport?.canvasToWorld) {
|
|
||||||
const worldFromCanvas = viewport.canvasToWorld(canvasPoint)
|
|
||||||
if (worldFromCanvas && worldFromCanvas.length >= 3) {
|
|
||||||
return worldFromCanvas
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
_dispatchPointEvent(worldPoint, sourceViewportId, crosshairAppearance) {
|
_dispatchPointEvent(worldPoint, sourceViewportId, crosshairAppearance) {
|
||||||
const { dispatchEventName } = this.configuration
|
const { dispatchEventName } = this.configuration
|
||||||
if (!dispatchEventName || typeof window === 'undefined') return
|
if (!dispatchEventName || typeof window === 'undefined') return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue