mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +00:00
Give sensor picks plain screen positions and the canvas from their caller
sensorPickPosition returns {x, y} rather than a Cesium Cartesian2 and is
handed the canvas it sizes by, so it no longer reaches Cesium or the
viewer and leaves the Cesium allow-list. The style records stay keyed by
the scene object.
This commit is contained in:
1 parent
75ad7baf13
commit
afd8dba67b
4 files changed
+22
-14
No files matched your search
@@ -418,11 +418,11 @@ test('sensor styles move the pick to where the picture came from', () => {
|
||||
};
|
||||
registerStyleStages(scene, { surveillance: stage });
|
||||
const click = { x: 300, y: 50 };
|
||||
const mapped = sensorPickPosition(scene, click);
|
||||
const mapped = sensorPickPosition(scene, click, scene.canvas);
|
||||
assert.notDeepEqual([mapped.x, mapped.y], [300, 50]);
|
||||
assert.deepEqual(click, { x: 300, y: 50 }, 'the click is left alone');
|
||||
stage.enabled = false;
|
||||
const plain = sensorPickPosition(scene, click);
|
||||
const plain = sensorPickPosition(scene, click, scene.canvas);
|
||||
assert.deepEqual([plain.x, plain.y], [300, 50]);
|
||||
});
|
||||
|
||||
@@ -440,7 +440,11 @@ test('a move carries its pick-buffer position, sensor-corrected as a click is',
|
||||
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 });
|
||||
const expected = sensorPickPosition(
|
||||
h.viewer.scene,
|
||||
{ x: 300, y: 50 },
|
||||
h.viewer.scene.canvas,
|
||||
);
|
||||
assert.deepEqual(
|
||||
[seen[0].pickPosition.x, seen[0].pickPosition.y],
|
||||
[expected.x, expected.y],
|
||||
|
||||
Reference in new issue
Block a user