feat: Customizable line styles#361
Conversation
c39fed2 to
3bcc53b
Compare
3bcc53b to
1a2d8a5
Compare
|
This PR contains a lot of change and is stacked on another PR. |
1a2d8a5 to
7c7763f
Compare
|
Hi @panaaj, Thanks for taking in some of the changes proposed in this PR. Given the partial integration and that the underlying PR #363 was already merged, I rebased and cleaned up the remaining changes:
Btw, you have editing rights on this PR in case you want to adapt it before merging. |
The upstream formatLineDashArray() split the SVG string char-by-char, which works for single-digit values but would break for any entry ≥ 10 (e.g. '12 4' → [1, 2, 4] instead of [12, 4]). Replace with a DASH_PATTERNS lookup table (exported from util.ts; might also be moved somewhere else if better suited) that maps named patterns directly to number arrays, removing the fragile parsing. lineDashMap in AppFacade now derives SVG strings from the same table. Also tightens LineStyleConfig.dash from string to LineStyleDash.
Otherwise, thick line segments bleed into the gaps
Add LineStyleConfig (color/weight/dash) for three route-related lines: - activeRoute — the currently-navigated route (was hardcoded blue/4/solid) - activeSegment — the active route leg (XTE reference track) - defaultRoute — all other displayed routes (was hardcoded green/2/dashed) - destination — vessel-to-next-waypoint bearing line (was hardcoded orange/2/solid)
Replace the upstream plain \`length: number\` with \`lineLength: ILineLengthDef\` supporting three unit kinds: - 'time' — minutes at current SOG (original COG behaviour) - 'distance' — nautical miles (original heading behaviour) - 'pixels' — fixed screen pixels at current map resolution
Add selfTrailStyle and aisTrackStyle settings (color, weight, dash pattern) for the self vessel trail and AIS target tracks, using the existing linestyle-select component.
7c7763f to
3210ce5
Compare
|
Thanks for sticking with this, @daniel-freiermuth — and for rebasing onto #363 once it landed. The dash-style lookup table is a genuinely good catch: the old A few things before this can move, mostly about scope. Per the project's "one logical change per PR" guideline this is currently doing five distinct things at once, and two of them are bigger than the "line styles" framing suggests:
So my suggestion would be to split this into focused PRs:
The trail/AIS-track styling is the piece I'd hold until the Tracks API firms up, as @panaaj noted. Two more things:
Heads-up as well: we've got CodeRabbit running on the repo now, so when you open the split PRs you'll get an automated line-level review on each one too. Thanks again — this is useful work; I just want it landing in pieces we can each review and revert independently. |
|
@daniel-freiermuth Nudge. Is this something you want to pursue merging? Or would you like to close it? |
This PR builts on top of #363
Depending on the background map and the screen and sunlight angle, the default line style can be hard to see. This PR proposes making the line and track styles customizable.
Heading in bright red, COG line thin dotted in black

Track style menu:

Vessel line style menu
