Browse Source

Label.getFormattingValues() fix option fallback to main font for mod-fonts (#3054)

gemini
wimrijnders 7 years ago
committed by yotamberk
parent
commit
29e696aaad
1 changed files with 19 additions and 5 deletions
  1. +19
    -5
      lib/network/modules/components/shared/Label.js

+ 19
- 5
lib/network/modules/components/shared/Label.js View File

@ -717,12 +717,26 @@ class Label {
}
getFormattingValues(ctx, selected, hover, mod) {
var getValue = function(fontOptions, mod, option) {
if (mod === "normal") {
if (option === 'mod' ) return "";
return fontOptions[option];
}
if (fontOptions[mod][option]) {
return fontOptions[mod][option];
} else {
// Take from parent font option
return fontOptions[option];
}
};
let values = {
color: (mod === "normal") ? this.fontOptions.color : this.fontOptions[mod].color,
size: (mod === "normal") ? this.fontOptions.size : this.fontOptions[mod].size,
face: (mod === "normal") ? this.fontOptions.face : this.fontOptions[mod].face,
mod: (mod === "normal") ? "" : this.fontOptions[mod].mod,
vadjust: (mod === "normal") ? this.fontOptions.vadjust : this.fontOptions[mod].vadjust,
color : getValue(this.fontOptions, mod, 'color' ),
size : getValue(this.fontOptions, mod, 'size' ),
face : getValue(this.fontOptions, mod, 'face' ),
mod : getValue(this.fontOptions, mod, 'mod' ),
vadjust: getValue(this.fontOptions, mod, 'vadjust'),
strokeWidth: this.fontOptions.strokeWidth,
strokeColor: this.fontOptions.strokeColor
};

Loading…
Cancel
Save