@@ -584,7 +584,7 @@ proc drawElementalLegend(
584584 ctx.fontsize = sideWidth* 1.5
585585 ctx.textAlign = LeftAlign
586586
587- const legendHexSize: float = (990 / (nDiv + 1 ) - 1 ).clamp (15 , 50 ) * scaling
587+ const legendHexSize: float = (distance / scaling ).clamp (15 , 50 ) * scaling
588588 let colorSchemeOKlab = findColorSchemeOKlab (len (elementList))
589589
590590 for (i, el) in elementList.pairs:
@@ -609,29 +609,31 @@ proc drawMarkerLegend(image: Image) =
609609 ctx.font = fontMain
610610 ctx.fontsize = sideWidth* 1.5
611611 ctx.textAlign = LeftAlign
612+ const legendMarker1Size: float = (distance/ 2 / scaling).clamp (15 , 50 ) * scaling
612613 if markerOverlay1:
613614 let position: float = 6.5
614615 ctx.fillStyle = rgba (0 , 0 , 0 , 255 )
615- ctx.fillPolygon (vec2 (325 * scaling, (170 + 100 * position).float * scaling), distance * 1.05 / 2 , sides = 24 )
616+ ctx.fillPolygon (vec2 (325 * scaling, (170 + 100 * position).float * scaling), legendMarker1Size * 1.05 , sides = 24 )
616617 ctx.fillStyle = rgba (200 , 200 , 0 , 255 )
617- ctx.fillPolygon (vec2 (325 * scaling, (170 + 100 * position).float * scaling), distance * 1 / 2 , sides = 24 )
618+ ctx.fillPolygon (vec2 (325 * scaling, (170 + 100 * position).float * scaling), legendMarker1Size , sides = 24 )
618619 ctx.fontsize = sideWidth
619620 ctx.fillText (
620621 marker1,
621622 vec2 (375 * scaling, (100 * position+ 190 ).float * scaling),
622623 )
623624
624625 if markerOverlay2:
626+ const legendMarker2Size: float = (distance/ 2 / scaling).clamp (15 , 50 ) * scaling
625627 let position: float = 7.5
626628 var baseSize: float
627629 if not markerOverlay1:
628630 baseSize = 1
629631 else :
630632 baseSize = 0.7
631633 ctx.fillStyle = rgba (0 , 0 , 0 , 255 )
632- ctx.fillPolygon (vec2 (325 * scaling, (170 + 100 * position).float * scaling), distance * (baseSize+ 0.05 )/ 2 , sides = 24 )
634+ ctx.fillPolygon (vec2 (325 * scaling, (170 + 100 * position).float * scaling), legendMarker2Size * (baseSize+ 0.05 ), sides = 24 )
633635 ctx.fillStyle = rgba (255 , 0 , 0 , 255 )
634- ctx.fillPolygon (vec2 (325 * scaling, (170 + 100 * position).float * scaling), distance * baseSize/ 2 , sides = 24 )
636+ ctx.fillPolygon (vec2 (325 * scaling, (170 + 100 * position).float * scaling), legendMarker2Size * baseSize, sides = 24 )
635637 ctx.fontsize = sideWidth
636638 ctx.fillText (
637639 marker2,
0 commit comments