使用的是angular 6和openlayers V5。
对于此openlayers来说是非常新的
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);
答案 0 :(得分:1)
尝试一下:
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})
])
});