How to change cursor in Cesium?

1.7k Views Asked by At

I am trying to change the cursor when it mouses over certain cesium objects. I am using a mouse over listener and that part is working (found out by using debugger;). But when I mouse over it (and according to the Firefox debugger the variable name is changed), the cursor stays the same. Google and Cesium's API documentation have yielded no help. Any idea what I'm doing wrong?

var pickedObject = scene.pick(movement.endPosition);
if(Cesium.defined(pickedObject) && (pickedObject.id)) {
    document.body.style.cursor = 'pointer';
    debugger;
} else {
    document.body.style.cursor = 'default';
    debugger;
}

Before this code runs, Firefox says document.body.style.cursor = "" . At the first debugger; it says document.body.style.cursor="pointer". At the second debugger; it says document.body.style.cursor="default".

2

There are 2 best solutions below

0
On BEST ANSWER

Changing the third line to the following changed the cursor to the pointer:

Ext.get(scope.id).setStyle('cursor', 'pointer');

Changing the sixth line to the following changed it back:

Ext.get(scope.id).setStyle('cursor', 'grab');
0
On

Without using any external library it would be like this:

viewer._container.style.cursor = "crosshair";

or reset to default

viewer._container.style.cursor = "default";