4

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".

4

2 回答 2

2

将第三行更改为以下内容将光标更改为指针:

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

将第六行更改为以下内容将其改回:

Ext.get(scope.id).setStyle('cursor', 'grab');
于 2016-08-09T15:55:18.690 回答
0

如果不使用任何外部库,它将是这样的:

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

或重置为默认值

viewer._container.style.cursor = "default";
于 2020-01-22T16:50:32.347 回答