mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +00:00
Draw the Draw tool's live preview through the draw port and take the tool off the Cesium list
The preview of a shape being drawn is now two sets on the renderer's draw port instead of a Cesium data source: one dashed rubber band along the globe (the chosen colour at 0.9, 3 px, dash 16, primary at 0.35 behind the surface) and a dot per vertex (8 px, black outline at 0.6, drawn over depth). The band is written on each pointer move and vertex change rather than re-read every frame. A pointer move now carries `pickPosition`, its point in the pick buffer corrected for sensor styles as a click's position is, which the rubber band follows; the tool reads its canvas from the renderer and asks frames through the frame port. The diagnostics count the preview sets live on the viewer (`previewSets`, `previewItems`) in place of preview data sources. One difference: where the band runs behind the surface it is drawn in a solid colour, as the draw contract's depth-fail colour is a colour, not a dashed material.
This commit is contained in:
1 parent
c49191a87b
commit
3cce1aaa3e
7 files changed
+198
-167
No files matched your search
@@ -426,6 +426,28 @@ test('sensor styles move the pick to where the picture came from', () => {
|
||||
assert.deepEqual([plain.x, plain.y], [300, 50]);
|
||||
});
|
||||
|
||||
test('a move carries its pick-buffer position, sensor-corrected as a click is', (t) => {
|
||||
const h = harness();
|
||||
t.after(() => h.input.destroy());
|
||||
Object.assign(h.viewer.scene.canvas, {
|
||||
clientWidth: 400,
|
||||
clientHeight: 200,
|
||||
width: 400,
|
||||
height: 200,
|
||||
});
|
||||
const stage = { enabled: true, uniforms: { intensity: 1, pixelation: 4 } };
|
||||
registerStyleStages(h.viewer.scene, { surveillance: stage });
|
||||
const seen = [];
|
||||
h.input.onPointer('move', (event) => seen.push(event));
|
||||
h.handler.fire(TYPES.MOUSE_MOVE, { endPosition: { x: 300, y: 50 } });
|
||||
const expected = sensorPickPosition(h.viewer.scene, { x: 300, y: 50 });
|
||||
assert.deepEqual(
|
||||
[seen[0].pickPosition.x, seen[0].pickPosition.y],
|
||||
[expected.x, expected.y],
|
||||
);
|
||||
assert.deepEqual([seen[0].endPosition.x, seen[0].endPosition.y], [300, 50]);
|
||||
});
|
||||
|
||||
test('the dispatcher is the package input export', async () => {
|
||||
const exported = await import('gods-eye-view/input');
|
||||
assert.equal(exported.inputFor, inputFor);
|
||||
|
||||
Reference in new issue
Block a user