Skip to content

Commit 53eeefa

Browse files
committed
Fix - VueUiGizmo - Fix gauge proportion not exact
1 parent 288d1b9 commit 53eeefa

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/components/vue-ui-gizmo.vue

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,16 @@ const svg = computed(() => {
4848
return options[FINAL_CONFIG.value.type];
4949
});
5050
51-
const barBody = computed(() => {
52-
const x = 70 * (props.dataset / 100)
53-
return `M 5 10 L 5 10 C 5 13 7 15 10 15 L ${x} 15 C ${x + 3} 15 ${x + 5} 13 ${x + 5} 10 L ${x + 5} 10 C ${x + 5} 7 ${x + 3} 5 ${x} 5 L 10 5 C 7 5 5 7 5 10`
54-
})
55-
5651
const gaugeBody = computed(() => {
57-
const circumference = 35 * (2 + (props.dataset / 100 > 1 ? 0 : 1 - props.dataset / 100)) * Math.PI;
52+
const radius = 35;
53+
const circumference = 2 * Math.PI * radius;
54+
const dashoffset = circumference - (props.dataset / 100) * circumference;
55+
5856
return {
5957
dasharray: `${circumference} ${circumference}`,
60-
dashoffset: circumference - props.dataset / 100 * circumference,
61-
}
62-
})
58+
dashoffset: dashoffset
59+
};
60+
});
6361
6462
</script>
6563

0 commit comments

Comments
 (0)