Cesium Viewer
Optional
DEBUG: boolean = falseManages camera drag/aggregation.
Debug flag.
Registered input event callbacks by type.
Current highlighted feature (if any).
The main info box widget displayed in the DOM.
Tracks last successfully picked feature.
Tracks last successful pick position.
Main handler for low-level input.
Currently selected object (if any).
Enables object selection logic.
Enables info box pop-up.
The Cesium Viewer reference.
Adds an input event (e.g., mouse or touch event) to Cesium with throttling and duplicate support.
Callback to execute on event.
Cesium event type constant.
Optional
modifier: string | number(Optional) Event modifier.
Unregister callback.
Emits a DOM CustomEvent with last valid pick position and feature. Triggers 'viewer-mouse-move-3d'.
Handles mouse hover highlighting for features.
Raw picked object.
Handles full feature/entity selection and info box updating.
Sets up default event mappings and custom window event dispatches for core Cesium/scene events. Registers handlers for various mouse, click, and wheel events.
Picks both position and feature (entity/object) at a position, updating caches.
[pickedPosition, pickedFeature]
Applies highlighting or selection to a scene feature. Sets color (default or transparent) and tracks feature type for effect.
Either 'highlightedObject' or 'selectedObject'.
Removes a registered input action of a particular type.
Clears highlight or color effects from a feature/object.
Safely attempts to pick a 3D position in the scene. Caches result as lastValidPickPosition.
Mouse or input position.
Picked position or null.
Throttles a function so it cannot be called more than once per wait ms.
Callback to throttle.
Milliseconds to wait.
CustomHandler – Central event and interaction manager for Cesium viewers.
Handles input event setup, picking, feature/selection management, throttling, and communication between the Cesium scene and UI through DOM events.
Basic responsibilities:
Param: viewer
Cesium Viewer instance (must have canvas property).
Param: DEBUG
Enables debug mode (console/extra info hooks).
Method
throttle(func, wait) - Utility to throttle event firing.
Method
addInputAction(callback, type, modifier) - Adds an input event handler with throttling.
Method
removeInputAction(callback, type) - Removes a registered input handler.
Method
safePick(position) - Attempts to pick position in the scene, updating lastValidPickPosition.
Method
pickPositionAndFeature(position) - Picks both a position and a feature, updates track.
Method
emitLastValidPosition() - Fires a DOM event with last valid position and feature.
Method
init() - Sets up all main event listeners and handlers.
Method
resetObject(object) - Clears color/Highlight from a picked/highlighted object.
Method
processFeature(feature, targetObject, defaultColor, transparentColor) - Colors/updates the current scene feature as highlighted/selected.
Method
handleHighlight(pickedFeature) - Handles and displays highlights on hover or move.
Method
handleSelection(pickedFeature) - Handles object selection and info box population.
Example