I am working to implement click selection of entities.
I wrote the following function which will fire when I click while holding the shift key
const scene = viewer.value.scene
const handler = viewer.value.screenSpaceEventHandler
handler.setInputAction(
function (click) { console.log( 'shift-clicked' ) },
Cesium.ScreenSpaceEventType.LEFT_CLICK, Cesium.KeyboardEventModifier.SHIFT
)
However, this function will not fire if the shift key is not pressed. So, I need to add another function:
handler.setInputAction(
function (click) { console.log( 'clicked' ) },
Cesium.ScreenSpaceEventType.LEFT_CLICK
)
Adding another function seems strange to me. I am more used to a system where I just write a single function, receive the click event, and determine if the shift key was pressed.
Do I need two functions? Is there a better way?
Also, how can I disable holding down the shift key or ctrl key and moving the camera during a mouse move?