-2
  • in my app am using angular 6 and openlayers V5.

  • am very new for this openlayers

  • i have done directions, am able to set view direction(input client's choice)
  • i have changeling to drag on map directions using Ctrl+Drag instead of Alt+Shift+Drag
  • example is Rotate

map-component.ts

this.source = new OlXYZ({
   url: 'http://tile.osm.org/{z}/{x}/{y}.png'
});
this.layer = new OlTileLayer({
   source: this.source
});
this.view = new OlView({
   center: fromLonLat([6.661594, 50.433237]),
   zoom: 3,
   enableRotation: true
  // rotation: rotation
});
this.map = new OlMap({
   target: 'map',
   layers: [this.layer],
   view: this.view
});
this.view.setRotation(Math.PI / 180 * 90);

//this code will get list of roatate interations
console.log(this.map.controls.getArray()[1].map_.interactions.array_[0].condition_.name);
console.log(this.map.interactions.array_[0].condition_.name);
  • please check above code and how to change the defaults controls of rotate map drag rotation keys,
  • please save my days
  • thanks in advance
kks
  • 342
  • 5
  • 25

1 Answers1

1

Try this:

this.map = new OlMap({
   target: 'map',
   layers: [this.layer],
   view: this.view,
   interactions: ol.interaction.defaults({altShiftDragRotate: false}).extend([
      new ol.interaction.DragRotate({condition: ol.events.condition.platformModifierKeyOnly})
   ])
});
Moshe Slavin
  • 5,127
  • 5
  • 23
  • 38
Mike
  • 16,042
  • 2
  • 14
  • 30