CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.79k stars 3.46k forks source link

Camera inertia activates even though ScreenSpaceCameraController is disabled #5341

Open hpinkos opened 7 years ago

hpinkos commented 7 years ago

I would expect the following code to make the globe stay put since screenSpaceCameraController is disabled between pressing on the mouse button and releasing it. However, while the globe doesn't drag normally, if you flick it the camera inertia causes the globe to move at the end.

flick

var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var canvas = scene.canvas;

canvas.addEventListener('pointerdown', function() {
    scene.screenSpaceCameraController.enableInputs = false;
}, true);

canvas.addEventListener('pointerup', function() {
    scene.screenSpaceCameraController.enableInputs = true;
}, true);
tangtony commented 5 years ago

Any updates on this or even a workaround? I'm trying to use exactly the technique described to stop the globe from moving while interacting with the globe. I've tried setting the inertia values to zero on pointerdown and resetting them on pointer up, but that doesn't seem to work either.

jedfong commented 6 months ago

Any workaround for this? I'm running into this issue as well.

nbes4 commented 2 weeks ago

Hi, I think I’ve found a workaround that should work for drag-and-drop use cases, and potentially others as well. You can check out my detailed explanation along with a working Sandcastle demo here.