Skip to content

Commit

Permalink
Merge pull request #5438 from camptocamp/GSNGM-1175
Browse files Browse the repository at this point in the history
Initialize verticesCounter to NaN
  • Loading branch information
fredj committed Jan 22, 2020
2 parents dfc7f76 + f93c859 commit 7908a7d
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions contribs/gmf/src/drawing/drawFeatureOptionsComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class DrawFeatureOptionsController {
* need to update the snap feature.
* @type {number}
*/
this.verticesCounter_ = 2;
this.verticesCounter_ = NaN;

/**
* @type {!OLFeature<import("ol/geom/Geometry.js").default>}
Expand Down Expand Up @@ -313,18 +313,15 @@ class DrawFeatureOptionsController {

this.feature_ = feature;

// For measureLength and measureArea, changing geometry needs to update
if (this.measureLength || this.measureArea) {
const geometry = feature.getGeometry();
this.listenerKeys_.push(
olEventsListen(
geometry,
'change',
this.handleFeatureGeometryChange_,
this
)
);
}
const geometry = feature.getGeometry();
this.listenerKeys_.push(
olEventsListen(
geometry,
'change',
this.handleFeatureGeometryChange_,
this
)
);
}

/**
Expand Down Expand Up @@ -354,6 +351,13 @@ class DrawFeatureOptionsController {
adjust = true;
}
}
} else if (this.drawRectangle) {
if (this.length && this.height) {
this.adjustSnapFeature_(this.length, this.lengthUnits, this.height, this.heightUnits);
return;
}
} else if (this.measureAzimut) {
adjust = true;
}

// Adjust snap feature if the number of vertices changed
Expand Down

0 comments on commit 7908a7d

Please sign in to comment.