Lidia Parrilla
Lidia Parrilla

Reputation: 589

Openlayers DragRotate map interaction not working

I'm facing an issue when trying to use the DragRotate interaction from OpenLayers. My map is embedded in a Qt Application by using a QWebView widget. As far as I know, the DragRotate interaction is added to the map by default as you can see in the documentation: https://i.sstatic.net/nr3yv.png

Also, by default, the DragRotate interaction works by pressing Alt+Shift: https://i.sstatic.net/McIn3.png

But when I load it and try to make the map rotate it doesn't work. The rest of interactions seem to work fine. I've also tried to add the interaction manually with map.addInteraction(new ol.interaction.DragRotate()); with no success

Relevant information:

Update: Just tested it in Chrome browser and the map is able to rotate by pressing Shift+Alt and dragging with left click. But still no success in the Qt Application.

Upvotes: 4

Views: 402

Answers (1)

TR3
TR3

Reputation: 387

It's been a few years but I was searching for this as well, and figured it out.

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

[...rest of your code here]

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

Upvotes: 1

Related Questions