Skip to content
Snippets Groups Projects
Commit 6c89b1b6 authored by Thomas Frobieter's avatar Thomas Frobieter
Browse files

Paragraph-Type "Score": Fix current display-value calculation, switched from...

Paragraph-Type "Score": Fix current display-value calculation, switched from fixed percentage calculation to simple numbers, so users have the ability to also use relative numbers instead.
parent edab8a3b
No related branches found
No related tags found
No related merge requests found
......@@ -114,7 +114,7 @@
},
// Set default step function for all animate calls
step: (state, bar) => {
let value = Math.round(bar.value() * 100);
let value = Math.round(bar.value() * scoreMax);
bar.path.setAttribute('stroke', state.color);
bar.path.setAttribute('stroke-width', state.width);
bar.setText(`${scoreIconMarkup}<span class="score__progressbar-current">${value === 0 ? 0 : value}</span>${scoreDeviderMarkup + scorePrefixMarkup + scoreMaxValueMarkup + scoreSuffixMarkup}`);
......@@ -143,7 +143,7 @@
width: scoreStrokeWidth
},
step: (state, bar) => {
let value = Math.round(bar.value() * 100);
let value = Math.round(bar.value() * scoreMax);
bar.path.setAttribute('stroke', state.color);
bar.path.setAttribute('stroke-width', state.width);
bar.setText(`${scoreIconMarkup}<span class="score__progressbar-current">${value === 0 ? 0 : value}</span>${scoreDeviderMarkup + scorePrefixMarkup + scoreMaxValueMarkup + scoreSuffixMarkup}`);
......@@ -173,7 +173,7 @@
},
// Set default step function for all animate calls
step: function (state, circle) {
let value = Math.round(circle.value() * 100);
let value = Math.round(circle.value() * scoreMax);
circle.path.setAttribute('stroke', state.color);
circle.path.setAttribute('stroke-width', state.width);
circle.setText(`${scoreIconMarkup}<span class="score__progressbar-current">${value === 0 ? 0 : value}</span>${scoreDeviderMarkup + scorePrefixMarkup + scoreMaxValueMarkup + scoreSuffixMarkup}`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment