Browse Source

Fix on call to i`fontOptions.chooser()` in module Label (#3124)

Call on issue brought to light by #2990.

`ctx` should not be passed as a parameter to the call - not needed and not conform to documentation.
Also cleaned up the calling code to remove the double `fontOptions.chooser()` call.
gemini
wimrijnders 7 years ago
committed by yotamberk
parent
commit
be036db2d8
1 changed files with 5 additions and 9 deletions
  1. +5
    -9
      lib/network/modules/components/shared/Label.js

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

@ -778,18 +778,14 @@ class Label {
strokeWidth: this.fontOptions.strokeWidth,
strokeColor: this.fontOptions.strokeColor
};
if (mod === "normal") {
if (selected || hover) {
if ((this.fontOptions.chooser === true) && (this.elementOptions.labelHighlightBold)) {
if (selected || hover) {
if (mod === "normal" && (this.fontOptions.chooser === true) && (this.elementOptions.labelHighlightBold)) {
values.mod = 'bold';
} else if (typeof this.fontOptions.chooser === 'function') {
this.fontOptions.chooser(ctx, values, this.elementOptions.id, selected, hover);
} else {
if (typeof this.fontOptions.chooser === 'function') {
this.fontOptions.chooser(values, this.elementOptions.id, selected, hover);
}
}
} else {
if ((selected || hover) && (typeof this.fontOptions.chooser === 'function')) {
this.fontOptions.chooser(ctx, values, this.elementOptions.id, selected, hover);
}
}
ctx.font = (values.mod + " " + values.size + "px " + values.face).replace(/"/g, "");
values.font = ctx.font;

Loading…
Cancel
Save