移动设备上的OpenLayers 3 dragBox

移动设备上的OpenLayers 3 dragBox,openlayers,openlayers-3,angular-openlayers,Openlayers,Openlayers 3,Angular Openlayers,我目前正在实现一个dragBox来同时选择多个向量。 由于dragBox对象需要一个“条件:”并且在官方示例中它是一个按键,“shift”,我想,我已经在Angular中设置了一个单例布尔变量,将条件设置为“ol.events.condition.always”或“ol.events.condition.never”,对象接受并在计算机上正常工作……但是在移动设备上不工作,我想这可能适用于移动设备,比如画一个圆圈,但事实并非如此 有没有办法在手机上实现这一点 这是我的密码 mapFeature

我目前正在实现一个dragBox来同时选择多个向量。 由于dragBox对象需要一个“条件:”并且在官方示例中它是一个按键,“shift”,我想,我已经在Angular中设置了一个单例布尔变量,将条件设置为“ol.events.condition.always”或“ol.events.condition.never”,对象接受并在计算机上正常工作……但是在移动设备上不工作,我想这可能适用于移动设备,比如画一个圆圈,但事实并非如此

有没有办法在手机上实现这一点

这是我的密码

 mapFeature.addDragBox = function () {

            webMapValues.dragBox = new ol.interaction.DragBox({
                /* dragbox interaction is active only if "multi select" 
check box is checked is pressed */
                condition: ((webMapValues.multiSelect == true) ? 
ol.events.condition.always : ol.events.condition.never),
                /* style the box */
                style: new ol.style.Style({
                    stroke: new ol.style.Stroke({
                        color: [0, 0, 255, 1]
                    })
                })
            });
            /* add the DragBox interaction to the map */
            webMapValues.mapObj.addInteraction(webMapValues.dragBox);

            if (webMapValues.multiSelect == true) {
                webMapValues.vectorMultiSelect = new 
ol.interaction.Select();

webMapValues.mapObj.addInteraction(webMapValues.vectorMultiSelect);

                webMapValues.multiSelectFeatures = 
webMapValues.vectorMultiSelect.getFeatures();
                webMapValues.dragBox.on('boxend', function () {
                    // features that intersect the box are added to the 
collection of
                    // selected features
                    webMapValues.clickedCoordinates = 
webMapValues.dragBox.getGeometry().getCoordinates();
                    var extent = 
webMapValues.dragBox.getGeometry().getExtent();
                    var layer = rcisMapService.getLayer("vector");
                    angular.forEach(layer, function (Layer, key) {
                        var source = Layer.getSource();
                        source.forEachFeatureIntersectingExtent(extent, 
function (feature) {

webMapValues.multiSelectedFeatures.push(vector);
                        });
                    });
                    mapFeature.Highlight();

                });

                webMapValues.dragBox.on('boxstart', function () {
                    webMapValues.popup.setPosition(undefined);
                    webMapValues.multiSelectedFeatures = [];
                });
            }

        };
OpenLayers 3中不存在在移动设备上“拖动”的功能……最接近它的功能是使用“绘制”功能绘制一个正方形,然后获取与该正方形相交的所有内容

 if (selectionToolsSelection == "Box") {
                var geometryFunction = ol.interaction.Draw.createBox();
                drawObj = new ol.interaction.Draw({
                    features: features,
                    type: "Circle",
                    geometryFunction: geometryFunction
                });
                mapObj.addInteraction(drawObj);

            }  
然后你就可以抓住“抽屉”事件并做你需要做的事情

  drawObj.on('drawend', function (e) {Do magic stuff here});            

通过将条件选项设置为
mouseActionButton
(请参阅:),Dragbox支持触摸设备

从'ol/events/condition'导入{mouseActionButton};
const dragBox=新的dragBox({
条件:mouseActionButton,
});
API文档中说“此交互仅支持鼠标设备”。因此,不,这是不可能的。我想问题在于没有足够的手势来区分地图移动、缩放和绘图。(见附件)