mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Deliver the application's pointer input through the renderer's input port
The Cesium renderer now creates the input port and exposes it as renderer.input. The input dispatcher becomes an adapter over the port: one port listener per event type, fanned out to its subscribers with the ownership check read once per event, keeping the legacy event shapes. - Ctrl+wheel zoom is switched on through renderer.input.ctrlWheelZoom. - A dispatcher made for a viewer with no port creates its own port with takeStock: false, which borrows the stock select and double-click follow only while they are suppressed. - The stock actions see the press as it began: a click whose press started while select or follow was held off never runs them. - A scene accepts one input port; cesiumInputOf(scene) returns it. - Releasing one mouse button while another is held no longer gives the held button a click. Cesium still ends that press.
This commit is contained in:
1 parent
1c29a54dc9
commit
910185bfe0
16 files changed
+427
-275
No files matched your search
@@ -18,13 +18,15 @@
|
||||
*/
|
||||
import { createApplicationViewer } from '../../app/viewer.js';
|
||||
import { CONTRACT_VERSION } from '../contract/index.js';
|
||||
import { createCesiumInput } from './input.js';
|
||||
import { cesiumCapabilities, createCesiumPorts } from './ports.js';
|
||||
|
||||
/**
|
||||
* The members a transitional renderer has today.
|
||||
* @typedef {Pick<import('../contract/renderer').Renderer,
|
||||
* 'id' | 'contractVersion' | 'capabilities' | 'canvas' | 'frame' | 'draw'
|
||||
* | 'camera' | 'query' | 'capture' | 'on' | 'resize' | 'destroy'>}
|
||||
* | 'camera' | 'query' | 'input' | 'capture' | 'on' | 'resize'
|
||||
* | 'destroy'>}
|
||||
* TransitionalRenderer
|
||||
*/
|
||||
|
||||
@@ -83,12 +85,18 @@ export function createCesiumRendererPlugin({
|
||||
document.body.appendChild(creditContainer);
|
||||
let viewer;
|
||||
let ports;
|
||||
let input;
|
||||
let capabilities;
|
||||
try {
|
||||
viewer = createViewer({ container, creditContainer });
|
||||
capabilities = new ReadonlySet(cesiumCapabilities(viewer.scene));
|
||||
ports = createCesiumPorts(viewer, { capabilities });
|
||||
input = createCesiumInput(viewer, {
|
||||
query: ports.query,
|
||||
report: ports.report,
|
||||
});
|
||||
} catch (error) {
|
||||
ports?.dispose();
|
||||
if (viewer && !viewer.isDestroyed()) viewer.destroy();
|
||||
creditContainer.remove();
|
||||
throw error;
|
||||
@@ -102,6 +110,7 @@ export function createCesiumRendererPlugin({
|
||||
draw: ports.draw,
|
||||
camera: ports.camera,
|
||||
query: ports.query,
|
||||
input: input.port,
|
||||
capture: ports.capture,
|
||||
on: ports.on,
|
||||
resize() {
|
||||
@@ -109,6 +118,7 @@ export function createCesiumRendererPlugin({
|
||||
},
|
||||
destroy() {
|
||||
try {
|
||||
input.dispose();
|
||||
ports.dispose();
|
||||
if (!viewer.isDestroyed()) viewer.destroy();
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user