Draw outlined draped lines with their outline; relay pinches for an early Ctrl+wheel

A draped solid line with an outline went into a colour batch and lost its
edge; it now draws by its own outline material. A camera controller that
binds Ctrl+wheel before the controls are made relays trackpad pinches from
the start, not only after the binding is set again. A raster shell image
zero pixels wide is left to the material, as before.
This commit is contained in:
Sameh Khamis committed 2026-11-10 09:46:11 -08:00
1 parent 8ca657e63f
commit d5e3968caa
5 files changed
+59 -3

No files matched your search

+2
View File
@@ -250,6 +250,8 @@ export function createCesiumControls({
relayPinches(value.includes('ctrlWheel'));
},
};
// A controller that already binds Ctrl+wheel relays pinches from the start.
relayPinches(controls.zoomInputs.includes('ctrlWheel'));
return {
controls,
+18
View File
@@ -157,6 +157,24 @@ test('ctrlWheel relays trackpad pinches while it is bound, and not after', () =>
assert.deepEqual(relays, ['on', 'off', 'on', 'off'], 'none after dispose');
});
test('a controller that already binds Ctrl+wheel relays pinches from the start', () => {
const scene = sceneWithController();
const c = scene.screenSpaceCameraController;
c.zoomEventTypes = [WHEEL, { eventType: WHEEL, modifier: CTRL }];
const relays = [];
const { dispose } = createCesiumControls({
scene,
widget: { container: {} },
pinchRelay: () => {
relays.push('on');
return () => relays.push('off');
},
});
assert.deepEqual(relays, ['on']);
dispose();
assert.deepEqual(relays, ['on', 'off']);
});
test('suspend shares the scene’s holds with other users', () => {
const scene = sceneWithController();
const c = scene.screenSpaceCameraController;
+6 -2
View File
@@ -1944,8 +1944,12 @@ export function createCesiumDraw({
});
}
/** Whether a draped line draws in a batch of solid ones. */
const batchable = (item) => item.style.kind === 'solid' && !revealed(item);
/**
* Whether a draped line draws in a batch of solid ones: a batch draws
* colours only, so an outlined line draws by its own material.
*/
const batchable = (item) =>
item.style.kind === 'solid' && !item.style.outline && !revealed(item);
/**
* A ground primitive of a draped line's own, drawn by a material (a
+32
View File
@@ -215,6 +215,38 @@ test('draped lines are ground polylines; a rebuild keeps the old ones until the
assert.equal(scene.added.length, 0);
});
test('a draped outlined line keeps its outline in its own material', () =>
withImageClasses(() => {
const { scene, draw } = drawOver();
const set = draw.lines({ id: 'edged' });
set.set([
{
id: 'a',
positions: [
{ lon: 0, lat: 0 },
{ lon: 1, lat: 1 },
],
widthPx: 6,
mode: 'draped',
style: {
kind: 'solid',
color: '#7fe6ed',
outline: { color: '#000000', widthPx: 2 },
},
},
]);
const host = scene.added[0];
const grounds = [];
for (let i = 0; i < host.length; i++)
if (host.get(i) instanceof Cesium.GroundPolylinePrimitive)
grounds.push(host.get(i));
assert.equal(grounds.length, 1);
const { material } = grounds[0].appearance;
assert.equal(material.type, 'PolylineOutline');
assert.equal(material.uniforms.outlineWidth, 2);
set.dispose();
}));
test('clamped fills are ground primitives packed so none overlap within one', () => {
const { scene, draw } = drawOver();
const set = draw.shapes({ id: 'discs' });
+1 -1
View File
@@ -353,7 +353,7 @@ function placeIn(outer, inner) {
* pixel wide image would never draw. Doubling the column samples the same.
*/
function widened(source) {
if (!(source?.width < 2)) return source;
if (source?.width !== 1) return source;
const canvas =
typeof document !== 'undefined'
? document.createElement('canvas')