添加日志
parent
09144f2b98
commit
aa6a226ce1
|
|
@ -194,9 +194,7 @@ class FusionJumpToPointTool extends AnnotationDisplayTool {
|
|||
if (!viewport?.element) return false
|
||||
|
||||
const annotations = getAnnotations(this.getToolName(), viewport.element) || []
|
||||
const crosshairAnnotation = annotations.find((item) =>
|
||||
item?.data?.type === 'fusion-jump-crosshair' && item?.data?.viewportId === viewport.id
|
||||
)
|
||||
const crosshairAnnotation = this._findViewportCrosshairAnnotationFromList(annotations, viewport.id)
|
||||
if (!crosshairAnnotation) return false
|
||||
|
||||
const worldPoint = crosshairAnnotation.data?.handles?.points?.[0]
|
||||
|
|
@ -323,9 +321,20 @@ class FusionJumpToPointTool extends AnnotationDisplayTool {
|
|||
_getViewportCrosshairAnnotation(viewport) {
|
||||
if (!viewport?.element) return null
|
||||
const annotations = getAnnotations(this.getToolName(), viewport.element) || []
|
||||
return annotations.find((item) =>
|
||||
item?.data?.type === 'fusion-jump-crosshair' && item?.data?.viewportId === viewport.id
|
||||
) || null
|
||||
return this._findViewportCrosshairAnnotationFromList(annotations, viewport.id)
|
||||
}
|
||||
|
||||
_findViewportCrosshairAnnotationFromList(annotations, viewportId) {
|
||||
if (!Array.isArray(annotations) || !viewportId) return null
|
||||
for (let i = 0; i < annotations.length; i++) {
|
||||
const item = annotations[i]
|
||||
const data = item && item.data
|
||||
if (!data) continue
|
||||
if (data.type === 'fusion-jump-crosshair' && data.viewportId === viewportId) {
|
||||
return item
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
_tryStartDrag(evt) {
|
||||
|
|
@ -521,8 +530,13 @@ class FusionJumpToPointTool extends AnnotationDisplayTool {
|
|||
|
||||
_getReferenceLineColor(viewportId, fallbackColor) {
|
||||
if (typeof this.configuration.getReferenceLineColor === 'function') {
|
||||
const color = this.configuration.getReferenceLineColor(viewportId)
|
||||
if (color) return color
|
||||
try {
|
||||
const safeViewportId = viewportId || ''
|
||||
const color = this.configuration.getReferenceLineColor(safeViewportId)
|
||||
if (color) return color
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
return fallbackColor || '#6fb9ff'
|
||||
}
|
||||
|
|
@ -538,7 +552,11 @@ class FusionJumpToPointTool extends AnnotationDisplayTool {
|
|||
const centerHoleSize = Number.isFinite(appearance.centerHoleSize) ? appearance.centerHoleSize : 8
|
||||
let color = appearance.color
|
||||
if (!color && typeof this.configuration.getReferenceLineColor === 'function') {
|
||||
color = this.configuration.getReferenceLineColor(sourceViewportId)
|
||||
try {
|
||||
color = this.configuration.getReferenceLineColor(sourceViewportId || '')
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue