Skip to content

Commit 408aad2

Browse files
committed
fix: add half fill circle positioning
1 parent fc934d4 commit 408aad2

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

src/App.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@
4141
<ve-progress
4242
:size="600"
4343
half
44-
line-position="out"
45-
empty-line-position="out"
44+
:angle="0"
45+
line-position="out 50"
46+
empty-line-position="out 0"
4647
empty-color-fill="red"
4748
color-fill="green"
49+
empty-color="transparent"
4850
:progress="progress"
4951
:no-data="noData"
5052
>

src/components/Circle/HalfCircle.vue

+28-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@
88
}"
99
>
1010
<path
11-
:stroke-width="emptyThickness"
1211
:fill="computedEmptyColorFill"
12+
:d="emptyFillPath"
13+
:style="{
14+
transition: styles.transition,
15+
}"
16+
:class="{ 'ep-circle--nodata': !dataIsAvailable }"
17+
>
18+
</path>
19+
<path
20+
:stroke-width="emptyThickness"
21+
fill="transparent"
1322
:stroke="computedEmptyColor"
1423
class="ep-half-circle--empty"
1524
:d="emptyPath"
@@ -28,12 +37,13 @@
2837
</g>
2938
</fade-in-transition>
3039

40+
<path class="ep-half-circle--progress__fill" :d="fillPath" :fill="computedColorFill"> </path>
3141
<path
3242
:stroke-width="thickness"
3343
class="ep-half-circle--progress ep-circle--progress"
3444
:class="animationClass"
3545
:d="path"
36-
:fill="computedColorFill"
46+
fill="transparent"
3747
:stroke="computedColor"
3848
:stroke-dasharray="circumference"
3949
:stroke-linecap="options.line"
@@ -58,17 +68,33 @@ export default {
5868
path() {
5969
return ` M ${this.position}, ${this.options.size / 2} a ${this.radius},${this.radius} 0 1,1 ${this.radius * 2},0`;
6070
},
71+
fillPath() {
72+
return ` M ${this.fillPosition}, ${this.options.size / 2} a ${this.fillRadius},${this.fillRadius} 0 1,1 ${
73+
this.fillRadius * 2
74+
},0`;
75+
},
6176
emptyPath() {
6277
return ` M ${this.emptyPosition}, ${this.options.size / 2} a ${this.emptyRadius},${this.emptyRadius} 0 1,1 ${
6378
this.emptyRadius * 2
6479
},0`;
6580
},
81+
emptyFillPath() {
82+
return ` M ${this.emptyFillPosition}, ${this.options.size / 2} a ${this.emptyFillRadius},${
83+
this.emptyFillRadius
84+
} 0 1,1 ${this.emptyFillRadius * 2},0`;
85+
},
6686
position() {
6787
return this.options.size / 2 - this.radius;
6888
},
89+
fillPosition() {
90+
return this.options.size / 2 - this.fillRadius;
91+
},
6992
emptyPosition() {
7093
return this.options.size / 2 - this.emptyRadius;
7194
},
95+
emptyFillPosition() {
96+
return this.options.size / 2 - this.emptyFillRadius;
97+
},
7298
},
7399
};
74100
</script>

0 commit comments

Comments
 (0)