From f2ec8863c3e2b18b2d0a75008a802608bad24cb7 Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 8 Nov 2023 14:17:17 +0000 Subject: [PATCH] add check property --- .../annotation/config/ToolStyle.ts | 51 ++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/packages/tools/src/stateManagement/annotation/config/ToolStyle.ts b/packages/tools/src/stateManagement/annotation/config/ToolStyle.ts index 526b23668e..e857a39155 100644 --- a/packages/tools/src/stateManagement/annotation/config/ToolStyle.ts +++ b/packages/tools/src/stateManagement/annotation/config/ToolStyle.ts @@ -193,56 +193,71 @@ class ToolStyle { toolName: string ) { if (annotationUID) { - const styles = this.getAnnotationToolStyles(annotationUID); + const annotationToolStyles = this.getAnnotationToolStyles(annotationUID); - if (styles) { + if (annotationToolStyles) { // check first in the toolSpecific styles - if (styles[property]) { - return styles[property]; + if (annotationToolStyles[property] !== undefined) { + return annotationToolStyles[property]; } } } if (viewportId) { - const styles = this.getViewportToolStyles(viewportId); + const viewportToolStyles = this.getViewportToolStyles(viewportId); - if (styles) { + if (viewportToolStyles) { // check if we have the viewportId specific style // check first in the toolSpecific styles - if (styles[toolName] && styles[toolName][property]) { - return styles[toolName][property]; + if ( + viewportToolStyles[toolName] && + viewportToolStyles[toolName][property] !== undefined + ) { + return viewportToolStyles[toolName][property]; } // check if we have the style in the viewport specific global viewportSpecificStyles - if (styles.global && styles.global[property]) { - return styles.global[property]; + if ( + viewportToolStyles.global && + viewportToolStyles.global[property] !== undefined + ) { + return viewportToolStyles.global[property]; } } } if (toolGroupId) { - const styles = this.getToolGroupToolStyles(toolGroupId); + const toolGroupToolStyles = this.getToolGroupToolStyles(toolGroupId); - if (styles) { + if (toolGroupToolStyles) { // check first in the toolSpecific styles - if (styles[toolName] && styles[toolName][property]) { - return styles[toolName][property]; + if ( + toolGroupToolStyles[toolName] && + toolGroupToolStyles[toolName][property] !== undefined + ) { + return toolGroupToolStyles[toolName][property]; } // check if we have the style in the toolGroup specific global styles - if (styles.global && styles.global[property]) { - return styles.global[property]; + if ( + toolGroupToolStyles.global && + toolGroupToolStyles.global[property] !== undefined + ) { + return toolGroupToolStyles.global[property]; } } } const globalStyles = this.getDefaultToolStyles(); - if (globalStyles[toolName] && globalStyles[toolName][property]) { + if ( + globalStyles[toolName] && + globalStyles[toolName][property] !== undefined + ) { return globalStyles[toolName][property]; } - if (globalStyles.global && globalStyles.global[property]) { + if (globalStyles.global && globalStyles.global[property] !== undefined) { return globalStyles.global[property]; } }