在 openlayers 3 中拖动时更改光标

Pou*_*sen 2 openlayers-3

用户拖动地图时更改光标的正确方法是什么。下面的示例并不是那么好,因为它仅在 pointerdrag 开始拖动时触发,然后在 125 毫秒没有事件后将其更改回来。有没有其他办法?

    var timer = null;
    this.map().on("pointerdrag",() => {
        this.map().getViewport().style.cursor = "-webkit-grabbing";
        clearTimeout(timer);
        timer = setTimeout(() => this.map().getViewport().style.cursor = "-webkit-grab", 125); 
    });
Run Code Online (Sandbox Code Playgroud)

tsa*_*ein 5

听听pointerup重置光标怎么样?

map.getViewport().style.cursor = "-webkit-grab";
map.on('pointerdrag', function(evt) {
    map.getViewport().style.cursor = "-webkit-grabbing";
});

map.on('pointerup', function(evt) {
    map.getViewport().style.cursor = "-webkit-grab";
});
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/9vwgdcyr/