Skip to content

Instantly share code, notes, and snippets.

@dbauszus-glx
Created August 21, 2022 10:51
Show Gist options
  • Save dbauszus-glx/3890bcbf9a8be2befd4c7fdd0b3610bb to your computer and use it in GitHub Desktop.
Save dbauszus-glx/3890bcbf9a8be2befd4c7fdd0b3610bb to your computer and use it in GitHub Desktop.
draw.interaction = new ol.interaction.Draw({
source: draw.Layer.getSource(),
geometryFunction: draw.geometryFunction,
freehand: draw.freehand,
type: draw.type,
style: draw.style,
condition: e => {
if (e.originalEvent.buttons === 1) {
draw.vertices.push(e.coordinate);
draw.mapview.popup(null);
// Execute each method pushed into the draw.conditions array.
draw.conditions?.forEach(fn => typeof fn === 'function' && fn(e))
return true;
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment