简体   繁体   English

是否可以在Openlayers中的矢量层上平移?

[英]Is it possible to allow panning on the vector layer in Openlayers?

在此处输入图片说明 As shown on the image above, "La Union" is selected so I was not able to pan. 如上图所示,选择了“ La Union”,所以我无法平移。 And even if it not selected as long as the cursor is above the vector layer, I can't pan on the map. 即使光标在矢量层上方也没有选择它,我也无法在地图上平移。

The obvious question is, is it possible without using the toolbar/controls? 显而易见的问题是,不使用工具栏/控件是否可能? Maybe using Jquery or JavaScript? 也许使用Jquery或JavaScript? BTW, I'm using Openlayers 2.14. 顺便说一句,我正在使用Openlayers 2.14。

This solves my problem, for example you have this SelectFeature control named "selectControl" just add this below: 这解决了我的问题,例如,您有一个名为“ selectControl”的SelectFeature控件,只需在下面添加即可:

if (typeof(selectControl.handlers) != "undefined") { // OL 2.7
    selectControl.handlers.feature.stopDown = false;
} else if (typeof(selectControl.handler) != "undefined") { // OL < 2.7
    selectControl.handler.stopDown = false;
    selectControl.handler.stopUp = false;
}

Reference 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM