Switching shift/control+mouse camera behavior

69 views
Skip to first unread message

steven...@gmail.com

unread,
Apr 28, 2016, 9:39:18 AM4/28/16
to cesium-dev
In Cesium, Shift+Click+Dragging changes view while leaving the camera stationary and Control+Click+Dragging leaves the view point stationary while moving the camera. In the Google Earth plugin and in the Google Earth application, the Shift/Control dragging behavior is the opposite.

Is there example code that shows how to change this? I know how to trap for the shift and control keys (I'm doing that in conjunction with the arrow keys to mimic Google Earth's camera behavior), but I don't know how to change the behavior in Cesium.

Thanks!

Hannah Pinkos

unread,
Apr 28, 2016, 12:06:54 PM4/28/16
to cesium-dev, steven...@gmail.com
Hello,

Cesium has a class ScreenSpaceCameraController for setting which input control the camera.  You can switch the modifiers on look and tilt to get the behavior you want.  Here is an example:


var viewer = new Cesium.Viewer('cesiumContainer');
var cameraController = viewer.scene.screenSpaceCameraController;
cameraController
.lookEventTypes.modifier = Cesium.KeyboardEventModifier.CTRL;
cameraController
.tiltEventTypes[2].modifier = Cesium.KeyboardEventModifier.SHIFT;
cameraController
.tiltEventTypes[3].modifier = Cesium.KeyboardEventModifier.SHIFT;

Best,

Hannah

steven...@gmail.com

unread,
Apr 28, 2016, 1:03:52 PM4/28/16
to cesium-dev, steven...@gmail.com
Perfect! Thanks Hanna!

sari...@gmail.com

unread,
Jul 2, 2017, 4:32:21 AM7/2/17
to cesium-dev, steven...@gmail.com
בתאריך יום חמישי, 28 באפריל 2016 בשעה 20:03:52 UTC+3, מאת steven...@gmail.com:
> Perfect! Thanks Hanna!

Hi, When Pressing CLICK + CTRL and releasing, tilt camera status is locked.
How to cancel that ?

Rachel Hwang

unread,
Jul 4, 2017, 9:02:50 PM7/4/17
to cesium-dev, steven...@gmail.com
Hi there,


Hope that helps,
- Rachel
Reply all
Reply to author
Forward
0 new messages