Settle a line outline's width as the whole outline, half on each side

A solid line's outline.widthPx is the outline in all, half on each side and
inside the line's width, as Cesium draws it. The range ring's pulse fronts
pass their halo width whole again, so they keep main's look, and the
conformance check draw.lines.outline pins the width. The lines scene's
outlined line keeps its 2 px edge each side and its references are
re-recorded.
This commit is contained in:
Sameh Khamis committed 2026-11-10 08:59:36 -08:00
1 parent 94138d9698
commit 149f8aad4d
12 files changed
+94 -16

No files matched your search

+2 -1
View File
@@ -49,7 +49,8 @@ export const CONTEXT_RIM_HEIGHT_M = 2500;
* the FLIR, NVG and CRT styles. A bright core inside a dark halo keeps
* luminance contrast on light and dark ground alike, and luminance is what
* the monochrome styles keep. The core is the Context panel's blue; the halo
* is the map-card ink. Widths are screen pixels; `outlineWidth` is per side.
* is the map-card ink. Widths are screen pixels; `outlineWidth` is the
* halo's width in all, half on each side.
* It is drawn as an unpickable primitive, so clicks on its edge reach the
* contacts underneath.
* While the sonar pulses run, the ring dims to `restOpacity` and flashes
+4 -4
View File
@@ -189,8 +189,9 @@ function rgba(css) {
const faded = ([r, g, b, a], alpha) => [r, g, b, a * alpha];
/**
* A haloed line as the draw port draws it: `widthPx` wide, its outer
* `haloPx` on each side in the halo's colour, the rest in the core's.
* A haloed line as the draw port draws it: `widthPx` wide, an outer
* `haloPx` in all (half on each side) in the halo's colour, the rest in the
* core's.
* @returns {object} The line item.
*/
const haloedLine = (id, positions, { core, halo, widthPx, haloPx, show }) => ({
@@ -561,8 +562,7 @@ export function createRangeRing({
core: faded(core, state.alpha * level),
halo: faded(halo, state.alpha * level),
widthPx: pulse.width,
// The fronts' `outlineWidth` is both sides together.
haloPx: pulse.outlineWidth / 2,
haloPx: pulse.outlineWidth,
show: level > 0,
}),
);
+4 -3
View File
@@ -363,10 +363,10 @@ test('the ring core and halo contrast on light and dark ground', () => {
const ratio = (luminance(core) + 0.05) / (luminance(halo) + 0.05);
assert.ok(ratio >= 4.5, `core:halo contrast ${ratio.toFixed(2)}`);
assert.ok(core.alpha >= 0.9 && halo.alpha >= 0.7);
// A visible halo on each side of a core at least 2 px wide.
// A visible halo, half on each side, around a core at least 2 px wide.
const { width, outlineWidth } = AWARENESS_RANGE_RING_STYLE;
assert.ok(outlineWidth >= 1);
assert.ok(width - 2 * outlineWidth >= 2);
assert.ok(width - outlineWidth >= 2);
});
test('renderVisual draws the ring as a haloed line in an unpickable set, never an entity', (t) => {
@@ -1126,9 +1126,10 @@ test('the band is one flat unpickable ellipse at the rim, drawn anew each step a
assert.equal(core.show, true);
assert.equal(core.widthPx, AWARENESS_RANGE_PULSE.width);
assert.equal(halo.style.color.length, 4);
// The outline is the halo's width in all, half on each side.
assert.equal(
core.style.outline.widthPx,
AWARENESS_RANGE_PULSE.outlineWidth / 2,
AWARENESS_RANGE_PULSE.outlineWidth,
);
const pulse = awarenessPulseState(at, index);
const ground = Cesium.Cartesian3.fromDegrees(3, 27, 0);