2
我想在釋放鼠標按鈕而不是雙擊時完成繪製。我怎樣才能做到這一點?如何在鼠標釋放時在Openlayers中完成徒手繪製
現在,我使用此代碼,默認情況下激活的OpenLayers drawing feature徒手畫:
draw = new ol.interaction.Draw({
source: drawLayerSource,
type: 'LineString',
condition: ol.events.condition.singleClick,
freehandCondition: ol.events.condition.noModifierKeys
});
map.addInteraction(draw);
但我不知道如何避免雙擊完成線串,並使用鼠標釋放來代替。
其實它的工作也與freehandCondition noModifierKeys,但你要刪除的地圖dragPan:https://jsfiddle.net/geraldo/tfcy010q/1/ – geraldo
現在唯一的改進是使工作也直線畫。正如你可以在jsfiddle中看到的那樣,當你點擊時,線條開始,但是沒有完成,因爲drawend立即被調用。問題是我無法弄清楚如何區分不同位置上的mousedown和mouseup。 – geraldo
並且直線將如何完成?標準'dblclick'? –