Skip to content

Commit

Permalink
feat: Issue 241 - add support for labelFontColor as update() parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
deezone committed Nov 17, 2019
1 parent 0bcafb4 commit 677c6a2
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1008,18 +1008,14 @@
JustGage.prototype.update = function (options, val) {
const obj = this;

// support options as array of key values
if (options instanceof Array) {
// options as an object of option/val values
if (options instanceof Object) {
for (var option in options) {
val = options[option];

console.log(`option: ${option}`);
console.log(`val: ${val}`);

updateProp(obj, option, val);
}

// support options as single option / val pair
// options as single option/val
} else {
updateProp(obj, options, val);
}
Expand All @@ -1044,6 +1040,18 @@
'fill': val
});
break;

case 'labelFontColor':
if (!isHexNumber(val)) {
console.log('* justgage: the updated labelFontColor value is not a valid hex value');
break;
}

obj.txtMax.attr({
"fill": val,
});
break;

default:
console.log(`* justgage: "${option}" is not a supported update setting`);
}
Expand All @@ -1063,7 +1071,6 @@
this.events = {}
};


/**
* Generate Shadow
*
Expand Down

0 comments on commit 677c6a2

Please sign in to comment.