Skip to content

Commit d87ddfd

Browse files
committed
proper svg code for icons
1 parent abf3fa0 commit d87ddfd

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

vue/src/components/LegendIcon.vue

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,33 @@
66
xmlns="http://www.w3.org/2000/svg">
77
<circle v-if="shape === 'circle'"
88
cx="10" cy="10"
9-
:r="9 * attr.size"
9+
:r="attr.size * 10 - attr.strokeWidth / 2"
1010
:stroke="attr.strokeColor"
1111
:stroke-width="attr.strokeWidth"
1212
:stroke-opacity="attr.strokeOpacity"
1313
:fill="attr.fillColor"
1414
:fill-opacity="attr.fillOpacity"
1515
/>
1616
<rect v-else-if="shape === 'square'"
17-
:x="'calc(50% - ' + attr.size * 10 + ')'"
18-
:y="'calc(50% - ' + attr.size * 10 + ')'"
19-
:width="attr.size * 20"
20-
:height="attr.size * 20"
17+
:x="'0'"
18+
:y="'0'"
19+
:width="attr.size * 20 - attr.strokeWidth"
20+
:height="attr.size * 20 - attr.strokeWidth"
2121
:stroke-width="attr.strokeWidth"
2222
:stroke="attr.strokeColor"
2323
:stroke-opacity="attr.strokeOpacity"
2424
:fill="attr.fillColor"
2525
:fill-opacity="attr.fillOpacity"
26+
:transform="'translate('+
27+
( (20-(attr.size * 20 - attr.strokeWidth)) / 2) +
28+
' '+
29+
( (20-(attr.size * 20 - attr.strokeWidth)) / 2) +
30+
')'"
2631
/>
2732
<line v-else-if="shape === 'line'"
28-
x1="0" x2="100%"
29-
y1="50%"
30-
y2="50%"
33+
x1="0" x2="20"
34+
y1="10"
35+
y2="10"
3136
:stroke="attr.strokeColor"
3237
:stroke-width="attr.strokeWidth"
3338
:opacity="attr.strokeOpacity"

0 commit comments

Comments
 (0)