Commit b93ad29
authored
fix(legend): draw proportional size ramps with the layer's marker (#1722)
* fix(legend): draw proportional size ramps with the layer's marker
A point layer with both a custom marker and proportional sizing was
described by two legends that each got half of it right: the Print Layout
legend drew the marker with no size ramp, and the on-map Legend panel drew
a size ramp of plain blue circles with a blank heading chip. Neither
matched what the map renders, and the ramp's symbols were drawn at roughly
half the size the map paints.
Three fixes:
- The on-map legend's `MarkerSwatch` wrapped `markerSvg` in a
`data:image/svg+xml,...` URL unconditionally, so a marker given as an
`https:` or `data:` URL (both documented inputs) re-encoded into a broken
source and rendered blank. The map's own `resolveSvgSource` handles all
three forms, so it moves to `@geolibre/core` next to `drawMarkerPath` and
both legends and the sprite baker now share it.
- Proportional size rows in both legends carry the layer's marker, and both
renderers draw it at the row's size. The map scales the marker sprite
through `icon-size`, so a circle there advertises a symbol the map never
draws. Line layers keep their stroke ramp.
- Legend symbols now read at the map's true sizes: the on-map cap rises
from a 12 px radius to 24 (the style editor's default maximum, so the
common ramp is 1:1 instead of half scale), and the print legend's swatch
column and row height grow when an entry carries sized symbols. Ramps
configured past the cap still scale down as one entry, keeping the map's
ratios.
Refs #1711
* refactor(print-layout): rename the shadowed swatch callback parameter
* Address CodeRabbit review feedback
- MarkerSwatch: draw the canvas fallback for a custom marker whose SVG
source does not resolve. The effect returned early for every "custom"
marker, so an unsupported scheme (pointMarkerSwatch only rejects EMPTY
markup, not an unresolvable one) rendered an empty canvas — the same
blank-chip failure this PR set out to fix, reached by another path.
Gating the early return on a resolved source lets drawMarkerPath trace
its documented default circle instead.
* Address Claude review feedback
- LegendSwatch: hoist the duplicated swatchScale call into one `scale`
local, matching how GeometrySwatch just above does it.
- print-layout: a proportional row whose custom SVG has not loaded now
falls back to the same circle the markerless ramp draws, instead of a
framed square per step. That was the one path where the "nested boxes
instead of one growing symbol" look survived the `boxed` flag. The
outline stays on both fallback shapes: a pale fallback color with no
outline would vanish against the legend box. Covered by a new test.1 parent 1887398 commit b93ad29
11 files changed
Lines changed: 534 additions & 92 deletions
File tree
- apps/geolibre-desktop/src
- components/legend
- lib
- packages
- core/src
- map/src
- tests
Lines changed: 72 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
20 | 29 | | |
21 | 30 | | |
22 | 31 | | |
| |||
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
114 | 126 | | |
115 | 127 | | |
116 | 128 | | |
117 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
118 | 137 | | |
119 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
120 | 149 | | |
121 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
122 | 162 | | |
123 | 163 | | |
124 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
125 | 169 | | |
126 | 170 | | |
127 | 171 | | |
128 | | - | |
129 | | - | |
130 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
131 | 175 | | |
132 | 176 | | |
133 | 177 | | |
134 | 178 | | |
135 | 179 | | |
136 | | - | |
| 180 | + | |
137 | 181 | | |
138 | | - | |
| 182 | + | |
139 | 183 | | |
140 | | - | |
| 184 | + | |
141 | 185 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
147 | 196 | | |
148 | 197 | | |
149 | 198 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 199 | + | |
156 | 200 | | |
157 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
158 | 206 | | |
159 | 207 | | |
160 | 208 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
931 | 931 | | |
932 | 932 | | |
933 | 933 | | |
934 | | - | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
935 | 940 | | |
936 | 941 | | |
937 | 942 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
| 460 | + | |
| 461 | + | |
460 | 462 | | |
461 | 463 | | |
462 | 464 | | |
463 | 465 | | |
464 | 466 | | |
465 | 467 | | |
466 | 468 | | |
| 469 | + | |
467 | 470 | | |
468 | 471 | | |
469 | 472 | | |
| |||
492 | 495 | | |
493 | 496 | | |
494 | 497 | | |
| 498 | + | |
| 499 | + | |
495 | 500 | | |
496 | 501 | | |
497 | 502 | | |
498 | 503 | | |
499 | 504 | | |
500 | 505 | | |
501 | 506 | | |
502 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
503 | 512 | | |
504 | 513 | | |
505 | 514 | | |
| |||
673 | 682 | | |
674 | 683 | | |
675 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
676 | 690 | | |
677 | 691 | | |
678 | 692 | | |
| |||
683 | 697 | | |
684 | 698 | | |
685 | 699 | | |
686 | | - | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
687 | 703 | | |
688 | 704 | | |
689 | 705 | | |
| |||
693 | 709 | | |
694 | 710 | | |
695 | 711 | | |
| 712 | + | |
696 | 713 | | |
697 | 714 | | |
698 | 715 | | |
| |||
715 | 732 | | |
716 | 733 | | |
717 | 734 | | |
| 735 | + | |
718 | 736 | | |
719 | 737 | | |
720 | 738 | | |
| |||
737 | 755 | | |
738 | 756 | | |
739 | 757 | | |
| 758 | + | |
740 | 759 | | |
741 | 760 | | |
742 | 761 | | |
| |||
751 | 770 | | |
752 | 771 | | |
753 | 772 | | |
754 | | - | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
755 | 781 | | |
756 | 782 | | |
757 | 783 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1935 | 1935 | | |
1936 | 1936 | | |
1937 | 1937 | | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
1938 | 1943 | | |
1939 | 1944 | | |
1940 | 1945 | | |
| |||
1944 | 1949 | | |
1945 | 1950 | | |
1946 | 1951 | | |
| 1952 | + | |
1947 | 1953 | | |
1948 | 1954 | | |
1949 | 1955 | | |
1950 | 1956 | | |
1951 | 1957 | | |
1952 | | - | |
1953 | | - | |
1954 | | - | |
1955 | | - | |
1956 | | - | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
1957 | 1964 | | |
1958 | 1965 | | |
1959 | | - | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
1960 | 1971 | | |
1961 | | - | |
1962 | 1972 | | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
1963 | 1981 | | |
1964 | 1982 | | |
1965 | 1983 | | |
| |||
1996 | 2014 | | |
1997 | 2015 | | |
1998 | 2016 | | |
1999 | | - | |
2000 | | - | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
2001 | 2027 | | |
2002 | 2028 | | |
2003 | 2029 | | |
| |||
2148 | 2174 | | |
2149 | 2175 | | |
2150 | 2176 | | |
2151 | | - | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
2152 | 2194 | | |
2153 | 2195 | | |
2154 | 2196 | | |
| |||
0 commit comments