Skip to content

Commit

Permalink
progress arc placed in front of segments
Browse files Browse the repository at this point in the history
  • Loading branch information
vnau committed Dec 23, 2024
1 parent 137ceda commit f788bba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/lib/Gauge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
stroke-width: calc(var(--gauge-stroke) - 2px);
}

.gauge-indicator {
.gauge-pointer {
fill: white;
stroke: var(--stroke-color, lightgray);
stroke-width: 1px;
Expand Down
30 changes: 15 additions & 15 deletions src/lib/Gauge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,12 @@
{/if}
{/if}

<!-- Background Circle -->
<!-- Background arc -->
<path
class="gauge-background"
d={calcCurvePath(radius, borderAdjusted, startAngle, stopAngle)}
/>

<!-- Value Background -->
{#if value != undefined || $animatedValue != 0}
<path
class="gauge-progress"
d={calcCurvePath(
radius,
borderAdjusted,
startAngle,
scale($animatedValue, start, stop, startAngle, stopAngle)
)}
/>
{/if}

<!-- Segments -->
{#each segments as segment, index}
<g
Expand All @@ -185,10 +172,23 @@
</g>
{/each}

<!-- Progress arc -->
{#if value != undefined || $animatedValue != 0}
<path
class="gauge-progress"
d={calcCurvePath(
radius,
borderAdjusted,
startAngle,
scale($animatedValue, start, stop, startAngle, stopAngle)
)}
/>
{/if}

<!-- Handle -->
{#if value != undefined || $animatedValue != 0}
<circle
class="gauge-indicator"
class="gauge-pointer"
cx={handlePos.x}
cy={handlePos.y}
r={stroke / 2}
Expand Down

0 comments on commit f788bba

Please sign in to comment.