Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Tools): Tool Styles Check Property #874

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions packages/tools/src/stateManagement/annotation/config/ToolStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down