CesiumGS/cesium

Mouse event function registered by ScreenSpaceEventHandler(cavasElement) won't properly fire when specific keys are being held

Closed this issue · 2 comments

What happened?

As simple as the title tells.

This issue does not happer if you switch to cavasElement.addEventListener('mousedown', function(e){ ... }) instead.

Or, suspension on these keys are on purpose ?

Reproduction steps

1 Register mouse event such as left_click, left_down or left_up using ScreenSpaceEventHandler(canvasElement).setInputAction()

2 Press down and hold any key of Ctrl, Shift or Alt

3 Click mouse's left button on map, the registered function won't be fired.

Sandcastle example

https://sandcastle.cesium.com/#c=dY9Ba8MwDIX/ismlCRSbnpeGja5jg7IeUraLYbiOupk5crDllGzsv89JL2VrdZKe3veEtMNArDdwBM+WDOHIVhBMbPnLpOUy09O8ckjKIHiZFTcSJZ5Za+0BsO6UhnUPSI8KG5vYUywPGhC4VtirUPAA9IRdpDtNxmF+iDg1LIcRLdh3CieVcMpni1kh8Wd+7c5u6IBv1g+7t/vt63ORzbMy0GChksimujVt5zyx6G3OuSBoO6sIgthH/QnEdQjjM6O1FOdo2ZiemWZ54XumrQohbQ7R2tp8gcyqUiT/P9Q61Rh83/bgrRpG28ei2pxEznkp0niZJOfsXvk/yb8

Environment

Browser: Chrome
CesiumJS Version: 1.121
Operating System: Windows 11

This is by design. The event handlers require you to specify what modifiers need to be held down for an action and only trigger that handler when fired. When you hold Ctrl, Shift or Alt it's firing a different event handler. See this sandcastle

This is by design. The event handlers require you to specify what modifiers need to be held down for an action and only trigger that handler when fired. When you hold Ctrl, Shift or Alt it's firing a different event handler. See this sandcastle

Cool, thanks!