Openlayers DragRotate 地图交互不起作用

Openlayers DragRotate map interaction not working

我在尝试使用 OpenLayers 的 DragRotate 交互时遇到问题。我的地图通过使用 QWebView 小部件嵌入到 Qt 应用程序中。据我所知,默认情况下将 DragRotate 交互添加到地图中,您可以在文档中看到:https://i.stack.imgur.com/nr3yv.png

此外,默认情况下,DragRotate 交互通过按 Alt+Shift 进行:https://i.stack.imgur.com/McIn3.png

但是当我加载它并尝试使地图旋转时,它不起作用。其余的交互似乎工作正常。我还尝试使用 map.addInteraction(new ol.interaction.DragRotate()); 手动添加交互,但没有成功

相关信息:

更新:刚刚在Chrome浏览器中测试过,地图可以通过按住Shift+Alt并用鼠标左键拖动来旋转。但是Qt应用还是没有成功。

已经好几年了,但我也在寻找这个,并弄明白了。

import { altKeyOnly } from "ol/events/condition"

[...rest of your code here]

const dragDragRotateInteraction = new DragRotate({
  condition: altKeyOnly,
});