diff --git a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.html b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.html
index 6e6e01441..4899fed77 100644
--- a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.html
+++ b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.html
@@ -7,13 +7,15 @@
title="{{this.tooltipTitle}}">
- {{#if this.svgLink}}
-
- {{else}}
-
- {{/if}}
+ {{#let svg=svgLink icon=iconClasses}}
+ {{#if svg}}
+
+ {{else}}
+
+ {{/if}}
+ {{/let}}
{{this.title}}
diff --git a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.js b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.js
index b015269ab..a565356f3 100644
--- a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.js
+++ b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.js
@@ -17,6 +17,20 @@ Template.toolbarSectionButton.onCreated(() => {
// Check if the current tool or a sub tool is the active one
return isCurrentTool || isSubTool;
};
+
+ instance.getActiveToolSubProperty = (propertyName, activeToolId) => {
+ const instance = Template.instance();
+ const subTools = instance.data.subTools;
+ const defaultProperty = instance.data[propertyName];
+ const currentId = instance.data.id;
+
+ if (subTools && activeToolId !== currentId && instance.isActive(activeToolId)) {
+ const subTool = _.findWhere(subTools, { id: activeToolId });
+ return subTool ? subTool[propertyName] : defaultProperty;
+ } else {
+ return defaultProperty;
+ }
+ };
});
Template.toolbarSectionButton.helpers({
@@ -29,17 +43,14 @@ Template.toolbarSectionButton.helpers({
svgLink() {
const instance = Template.instance();
- const subTools = instance.data.subTools;
- const defaultSvgLink = instance.data.svgLink;
const activeToolId = Session.get('ToolManagerActiveTool');
- const currentId = instance.data.id;
+ return instance.getActiveToolSubProperty('svgLink', activeToolId);
+ },
- if (subTools && activeToolId !== currentId && instance.isActive(activeToolId)) {
- const subTool = _.findWhere(subTools, { id: activeToolId });
- return subTool ? subTool.svgLink : defaultSvgLink;
- } else {
- return defaultSvgLink;
- }
+ iconClasses() {
+ const instance = Template.instance();
+ const activeToolId = Session.get('ToolManagerActiveTool');
+ return instance.getActiveToolSubProperty('iconClasses', activeToolId);
},
disableButton() {