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