web-vue2
Version:
web ui for vue2
24 lines (23 loc) • 826 B
JavaScript
import {DragRotate} from 'ol/interaction';
import {mouseOnly} from 'ol/events/condition.js';
import { MAC, WEBKIT } from 'ol/has';
class RightRotate extends DragRotate {
handleDownEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
return false;
}
if (this.condition_(mapBrowserEvent)) {
const map = mapBrowserEvent.map;
map.getView().beginInteraction();
this.lastAngle_ = undefined;
return true;
} else {
return false;
}
}
}
export default RightRotate;
export function mouseRightButton(mapBrowserEvent) {
let originalEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);
return originalEvent.button == 2 && !(WEBKIT && MAC && originalEvent.ctrlKey);
}