LT-115: Fixing hidden fortawesome icons for sub tools
This commit is contained in:
parent
9f66dd5823
commit
3f8350a79b
@ -7,13 +7,15 @@
|
|||||||
title="{{this.tooltipTitle}}">
|
title="{{this.tooltipTitle}}">
|
||||||
<div class="focus-holder" tabindex="1"></div>
|
<div class="focus-holder" tabindex="1"></div>
|
||||||
<div class="svgContainer">
|
<div class="svgContainer">
|
||||||
{{#if this.svgLink}}
|
{{#let svg=svgLink icon=iconClasses}}
|
||||||
<svg>
|
{{#if svg}}
|
||||||
<use xlink:href={{svgLink}}></use>
|
<svg>
|
||||||
</svg>
|
<use xlink:href={{svg}}></use>
|
||||||
{{else}}
|
</svg>
|
||||||
<i class={{iconClasses}}></i>
|
{{else}}
|
||||||
{{/if}}
|
<i class={{icon}}></i>
|
||||||
|
{{/if}}
|
||||||
|
{{/let}}
|
||||||
</div>
|
</div>
|
||||||
<div class="buttonLabel">
|
<div class="buttonLabel">
|
||||||
<span>{{this.title}}</span>
|
<span>{{this.title}}</span>
|
||||||
|
|||||||
@ -17,6 +17,20 @@ Template.toolbarSectionButton.onCreated(() => {
|
|||||||
// Check if the current tool or a sub tool is the active one
|
// Check if the current tool or a sub tool is the active one
|
||||||
return isCurrentTool || isSubTool;
|
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({
|
Template.toolbarSectionButton.helpers({
|
||||||
@ -29,17 +43,14 @@ Template.toolbarSectionButton.helpers({
|
|||||||
|
|
||||||
svgLink() {
|
svgLink() {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
const subTools = instance.data.subTools;
|
|
||||||
const defaultSvgLink = instance.data.svgLink;
|
|
||||||
const activeToolId = Session.get('ToolManagerActiveTool');
|
const activeToolId = Session.get('ToolManagerActiveTool');
|
||||||
const currentId = instance.data.id;
|
return instance.getActiveToolSubProperty('svgLink', activeToolId);
|
||||||
|
},
|
||||||
|
|
||||||
if (subTools && activeToolId !== currentId && instance.isActive(activeToolId)) {
|
iconClasses() {
|
||||||
const subTool = _.findWhere(subTools, { id: activeToolId });
|
const instance = Template.instance();
|
||||||
return subTool ? subTool.svgLink : defaultSvgLink;
|
const activeToolId = Session.get('ToolManagerActiveTool');
|
||||||
} else {
|
return instance.getActiveToolSubProperty('iconClasses', activeToolId);
|
||||||
return defaultSvgLink;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
disableButton() {
|
disableButton() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user