在 Linux 上的 OpenLayers 3 中拖动旋转交互

Drag rotate interaction in OpenLayers 3 on Linux

我想在 Linux 下的浏览器 运行 上使用 OpenLayers 3 rotation interaction。这允许在按住 Alt 和 Ctrl 的同时拖动来旋转地图。这在 Windows 上工作正常,但在 Redhat 6u2 和可能的其他发行版中却不行,因为 Alt 键是为 X-Windows 拖动 Window 行为保留的。

首先,我使用 ol.events.condition.shiftKeyOnly 自定义了 DragRotate,这有效,但与缩放框功能冲突,即在旋转时绘制蓝色缩放框。

var map = new ol.Map({
    layers: [
    new ol.layer.Tile({
        source: new ol.source.OSM()
    })],
    target: 'map',
    view: new ol.View({
        center: [-25860000, 4130000],
        zoom: 10
    }),
    interactions: ol.interaction.defaults().extend([new ol.interaction.DragRotate({
        condition: ol.events.condition.shiftKeyOnly
    })])
});

我想保留缩放框的 shift-drag 并使用其他一些 key/combination,也许 'R+Shift'?我试过自定义条件。看我的 JSFiddle

var customCondition = function(mapBrowserEvent) {
   return false; // TODO
};

var map = new ol.Map({
    layers: [
    new ol.layer.Tile({
        source: new ol.source.OSM()
    })],
    target: 'map',
    view: new ol.View({
        center: [-25860000, 4130000],
        zoom: 10
    }),
    interactions: ol.interaction.defaults().extend([new ol.interaction.DragRotate({
        condition: customCondition
    })])
});

除了 ol.events and MapBrowserEvent 文档外,我在 API 中找不到任何关于实现自定义条件的内容。使用调试器,我在结构或包含键码等的嵌套 originalEvent 中找不到任何属性。

这里是自定义条件 - Ctrl + Shift:

ol.events.condition.custom = function(mapBrowserEvent) {
    var browserEvent = mapBrowserEvent.originalEvent;
    return (browserEvent.ctrlKey && browserEvent.shiftKey);
};

var map = new ol.Map({
    layers: [
    new ol.layer.Tile({
        source: new ol.source.OSM()
    })],
    target: 'map',
    view: new ol.View({
        center: [-25860000, 4130000],
        zoom: 10
    }),
    interactions: ol.interaction.defaults().extend([new ol.interaction.DragRotate({
        condition: ol.events.condition.custom
    })])
});