5
我想禁用DrawFeature控件的shift鍵或徒手模式。 一個典型的代碼看起來像這樣:OpenLayers:如何禁用DrawFeature的shift鍵或徒手模式
var drawOptions = {handlerOptions: {freehand: true}};
drawFeatureControl = new OpenLayers.Control.DrawFeature(lineLayer, OpenLayers.Handler.Path, drawOptions);
map.addControl(drawFeatureControl);
有切換寫意的選項。但是沒有什麼可以完全停用它。 每次我換班時都會使用寫意模式。
在我的使用案例中,我想使用Shift鍵的另一種行爲。
完美!有用。但是現在OpenLayers.Control.Navigation()中的方塊顯示出來,同時按下了移位;)你知道這個方法嗎? – strangeoptics
哼哼,像'map.getControlsByClass('OpenLayers.Control.Navigation')[0] .zoomBox.deactivate()'? – tonio
確認,「map.getControlsByClass('OpenLayers.Control.Navigation')[0] .zoomBox.deactivate()」禁用OpenLayers 2.13.1中的「Shift-Zoom-Box-feature」 – alfonx