fix icon scaling

This commit is contained in:
Mutasem 2021-10-27 15:16:34 +02:00
parent aaed1c4c26
commit 81565b5621

View file

@ -2,7 +2,7 @@
<div class="node-icon-wrapper" :style="iconStyleData"> <div class="node-icon-wrapper" :style="iconStyleData">
<div v-if="nodeIconData !== null" class="icon"> <div v-if="nodeIconData !== null" class="icon">
<img v-if="nodeIconData.type === 'file'" :src="nodeIconData.fileBuffer || nodeIconData.path" style="max-width: 100%; max-height: 100%;" /> <img v-if="nodeIconData.type === 'file'" :src="nodeIconData.fileBuffer || nodeIconData.path" style="max-width: 100%; max-height: 100%;" />
<font-awesome-icon v-else :icon="nodeIconData.icon || nodeIconData.path" /> <font-awesome-icon v-else :icon="nodeIconData.icon || nodeIconData.path" :style="fontStyleData" />
</div> </div>
<div v-else class="node-icon-placeholder"> <div v-else class="node-icon-placeholder">
{{nodeType !== null ? nodeType.displayName.charAt(0) : '?' }} {{nodeType !== null ? nodeType.displayName.charAt(0) : '?' }}
@ -44,6 +44,11 @@ export default Vue.extend({
'border-radius': this.circle ? '50%': '4px', 'border-radius': this.circle ? '50%': '4px',
}; };
}, },
fontStyleData (): object {
return {
'max-width': this.size + 'px',
};
},
isSvgIcon (): boolean { isSvgIcon (): boolean {
if (this.nodeIconData && this.nodeIconData.type === 'file' && this.nodeIconData.fileExtension === 'svg') { if (this.nodeIconData && this.nodeIconData.type === 'file' && this.nodeIconData.fileExtension === 'svg') {
return true; return true;