Hi All,
I have been using Openlayers 4 for some time as part of my project.
Recently I got a requirement to open a closed Polygon feature to continue
drawing.This is kind of an undo funtionality.
So I wrote the code to add one more function to the Draw interaction. This
is working as expected.Can anyone suggest if I can raise a pullrequest to
the latest Openlayers Library?
ol.interaction.Draw.prototype.reStart = function (selectedFeature) {
this.abortDrawing_();
var coordinates, sketchLineGeom;
var geometry = selectedFeature.getGeometry();
var selectedCoordinates = geometry.getCoordinates()[0];
this.sketchFeature_ =
this.sketchFeature_?this.sketchFeature_:selectedFeature;
coordinates = selectedCoordinates;
if (this.mode_ === ol.interaction.Draw.Mode_.POLYGON) {
this.sketchCoords_ = [coordinates.slice(0,-1)];
var last = coordinates[coordinates.length-2];
this.finishCoordinate_ = last.slice()[0];
this.sketchCoords_[0].push(last.slice());
sketchLineGeom = new ol.geom.LineString(coordinates);
this.sketchLine_=new ol.Feature(sketchLineGeom);
this.geometryFunction_(this.sketchCoords_, geometry);
this.sketchLineCoords_ = this.sketchCoords_[0];
}
if (coordinates.length === 0) {
this.finishCoordinate_ = null;
}
this.updateSketchFeatures_();
this.dispatchEvent(new ol.interaction.Draw.Event(
ol.interaction.DrawEventType.DRAWSTART, this.sketchFeature_));
};
Thanks,
Harikrishnan S R
--
You received this message because you are subscribed to the Google Groups
"OpenLayers Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/openlayers-dev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/openlayers-dev/6c23a95f-65b8-4573-bb8a-ca7a928038b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.