【问题标题】:How to change cursor in Cesium?如何更改铯中的光标?
【发布时间】:2020-01-23 00:50:32
【问题描述】:

当鼠标悬停在某些铯对象上时,我正在尝试更改光标。我在侦听器上使用鼠标并且该部分正在工作(通过使用debugger; 发现)。但是当我将鼠标悬停在它上面时(根据 Firefox 调试器,变量名已更改),光标保持不变。 Google 和 Cesium 的 API 文档没有提供任何帮助。知道我做错了什么吗?

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;
}

在此代码运行之前,Firefox 会显示 document.body.style.cursor = "" 。 在第一个debugger; 它说document.body.style.cursor="pointer"。 在第二个debugger; 它说document.body.style.cursor="default"

【问题讨论】:

    标签: javascript extjs cesium webgl-earth


    【解决方案1】:

    将第三行改成如下,光标变为指针:

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

    把第六行改回如下:

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

    【讨论】:

      【解决方案2】:

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

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

      或重置为默认值

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-04-16
        • 1970-01-01
        • 1970-01-01
        • 2011-05-15
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多