[英]ol3 reset to draw interaction mode if coordinates intersect
this.drawInteraction = new ol.interaction.Draw({
features: this.sourceFeatures,
type: 'Polygon',
geometryFunction: (coords, geom) => this.onDrawGeometryFunction(coords, geom)
});
private onDrawGeometryFunction(coords, geom): void {
if (!geom) {
geom = new ol.geom.Polygon(null);
}
if (coords[0].length !== this.coords_length) {
//if intersects undo last point
if (this.intersectionsExistInPolygon(coords[0])) {
this.drawInteraction.removeLastPoint();
return geom;
}
this.coords_length = coords[0].length;
}
geom.setCoordinates(coords);
return geom;
}
我能够识别交叉点,直到我点击起点完成绘制(通过绘制线连接)。 有没有办法在抽奖结束前听完抽奖(但不是'drawend')? 通过删除相交的最后一点来保持绘制模式处于活动状态。
好吧,我使用的是Openlayers@v3.14.2,这个完成条件可以从v3.16.0获得。 所以我不得不更新它工作正常的版本..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.