Skip to content

Commit

Permalink
Merge pull request #979 from mike-000/geometryFunction
Browse files Browse the repository at this point in the history
bind and document `option.geometryFunction` for DrawHole
  • Loading branch information
Viglino authored Jul 27, 2023
2 parents fb0a7a0 + 9860163 commit b4481b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/interaction/DrawHole.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import ol_interaction_Select from 'ol/interaction/Select.js'
* @param {Array<ol.layer.Vector> | function | undefined} options.layers A list of layers from which polygons should be selected. Alternatively, a filter function can be provided. default: all visible layers
* @param {Array<ol.Feature> | ol.Collection<ol.Feature> | function | undefined} options.featureFilter An array or a collection of features the interaction applies on or a function that takes a feature and a layer and returns true if the feature is a candidate
* @param { ol.style.Style | Array<ol.style.Style> | StyleFunction | undefined } Style for the selected features, default: default edit style
* @param {function | undefined} options.geometryFunction Draw interaction geometry function to customize the hole
*/
var ol_interaction_DrawHole = class olinteractionDrawHole extends ol_interaction_Draw {
constructor(options) {
Expand All @@ -43,9 +44,9 @@ var ol_interaction_DrawHole = class olinteractionDrawHole extends ol_interaction
}
var geomFn = options.geometryFunction
if (geomFn) {
options.geometryFunction = function (c, g) {
g = _geometryFn(c, g)
return geomFn(c, g)
options.geometryFunction = function (c, g, p) {
g = _geometryFn.bind(this)(c, g)
return geomFn.bind(this)(c, g, p)
}
} else {
options.geometryFunction = _geometryFn
Expand Down

0 comments on commit b4481b2

Please sign in to comment.