Skip to content

Commit 7fda5cd

Browse files
committed
fix: apply loader gradient color correctly
1 parent 4e4250d commit 7fda5cd

File tree

5 files changed

+43
-4
lines changed

5 files changed

+43
-4
lines changed

src/App.vue

+26-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,32 @@
3838
<input type="checkbox" v-model="circles[3].loading" />
3939
</div>-->
4040
<div style="border: 1px solid red; display: inline-block">
41-
<ve-progress :progress="progress" :loading="loading" :thickness="10" :empty-thickness="20" line-mode="center">
41+
<ve-progress
42+
:progress="progress"
43+
:loading="loading"
44+
:thickness="10"
45+
:empty-thickness="20"
46+
line-mode="center"
47+
:color="{
48+
colors: [
49+
{ color: 'red', offset: '0' },
50+
{ color: 'green', offset: '50' },
51+
{ color: 'blue', offset: '100' },
52+
],
53+
}"
54+
:loader="{
55+
color: {
56+
colors: [
57+
{ color: 'yellow', offset: '0' },
58+
{ color: 'black', offset: '50' },
59+
{ color: 'blue', offset: '100' },
60+
],
61+
},
62+
thickness: 20,
63+
lineMode: 'in 10',
64+
opacity: '0.6',
65+
}"
66+
>
4267
</ve-progress>
4368
</div>
4469
<ve-progress

src/components/Circle/CircleContainer.vue

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
type="empty-fill"
1313
:id="options.id"
1414
/>
15+
<gradient v-if="isLoaderColorGradient" :color="options.loader.color" type="loader" :id="options.id" />
1516
</defs>
1617
<component :is="circleType" :options="options" :id="options.id" />
1718
</g>
@@ -51,6 +52,9 @@ export default {
5152
isEmptyColorFillGradient() {
5253
return Array.isArray(this.options.emptyColorFill.colors);
5354
},
55+
isLoaderColorGradient() {
56+
return Array.isArray(this.options.loader.color.colors);
57+
},
5458
},
5559
};
5660
</script>

src/components/Circle/CircleLoader.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
:cx="position"
77
:cy="position"
88
fill="transparent"
9-
:stroke="color"
9+
:stroke="loaderColor"
1010
:stroke-width="options.thickness"
1111
:stroke-linecap="options.line"
1212
:stroke-dasharray="circumference"
@@ -37,6 +37,11 @@ export default {
3737
opacity() {
3838
return this.options.opacity && this.options.opacity >= 0 ? this.options.opacity : 0.55;
3939
},
40+
loaderColor() {
41+
return Array.isArray(this.options.loader.color.colors)
42+
? `url(#ep-loader-gradient-${this.options.id})`
43+
: this.options.color;
44+
},
4045
},
4146
};
4247
</script>

src/components/Circle/HalfCircle.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</path>
4444
<fade-in-transition>
4545
<g v-if="isLoading">
46-
<half-circle-loader :options="options.loader" />
46+
<half-circle-loader :options="{ ...options, ...options.loader }" />
4747
</g>
4848
</fade-in-transition>
4949
<path

src/components/Circle/HalfCircleLoader.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class="ep-half-circle--loader animation__loading"
66
:d="path"
77
fill="transparent"
8-
:stroke="color"
8+
:stroke="halfLoaderColor"
99
:stroke-dasharray="circumference"
1010
:stroke-linecap="options.line"
1111
:style="{
@@ -46,6 +46,11 @@ export default {
4646
opacity() {
4747
return this.options.opacity && this.options.opacity >= 0 ? this.options.opacity : 0.55;
4848
},
49+
halfLoaderColor() {
50+
return Array.isArray(this.options.loader.color.colors)
51+
? `url(#ep-loader-gradient-${this.options.id})`
52+
: this.options.color;
53+
},
4954
},
5055
};
5156
</script>

0 commit comments

Comments
 (0)