Fix ol.DrawGeometryFunctionType coordinates argument type

This commit is contained in:
Frederic Junod
2017-05-10 13:36:27 +02:00
parent 366bf46ca1
commit 55de3020d3
2 changed files with 6 additions and 9 deletions
+4 -6
View File
@@ -127,7 +127,7 @@ ol.interaction.Draw = function(options) {
if (!geometryFunction) { if (!geometryFunction) {
if (this.type_ === ol.geom.GeometryType.CIRCLE) { if (this.type_ === ol.geom.GeometryType.CIRCLE) {
/** /**
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates * @param {!Array.<ol.Coordinate>} coordinates
* The coordinates. * The coordinates.
* @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry. * @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry.
* @return {ol.geom.SimpleGeometry} A geometry. * @return {ol.geom.SimpleGeometry} A geometry.
@@ -151,7 +151,7 @@ ol.interaction.Draw = function(options) {
Constructor = ol.geom.Polygon; Constructor = ol.geom.Polygon;
} }
/** /**
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates * @param {!Array.<ol.Coordinate>} coordinates
* The coordinates. * The coordinates.
* @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry. * @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry.
* @return {ol.geom.SimpleGeometry} A geometry. * @return {ol.geom.SimpleGeometry} A geometry.
@@ -529,9 +529,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
} }
last[0] = coordinate[0]; last[0] = coordinate[0];
last[1] = coordinate[1]; last[1] = coordinate[1];
this.geometryFunction_( this.geometryFunction_(/** @type {!Array.<ol.Coordinate>} */ (this.sketchCoords_), geometry);
/** @type {!ol.Coordinate|!Array.<ol.Coordinate>|!Array.<Array.<ol.Coordinate>>} */ (this.sketchCoords_),
geometry);
if (this.sketchPoint_) { if (this.sketchPoint_) {
var sketchPointGeom = /** @type {ol.geom.Point} */ (this.sketchPoint_.getGeometry()); var sketchPointGeom = /** @type {ol.geom.Point} */ (this.sketchPoint_.getGeometry());
sketchPointGeom.setCoordinates(coordinate); sketchPointGeom.setCoordinates(coordinate);
@@ -800,7 +798,7 @@ ol.interaction.Draw.createRegularPolygon = function(opt_sides, opt_angle) {
ol.interaction.Draw.createBox = function() { ol.interaction.Draw.createBox = function() {
return ( return (
/** /**
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates * @param {Array.<ol.Coordinate>} coordinates
* @param {ol.geom.SimpleGeometry=} opt_geometry * @param {ol.geom.SimpleGeometry=} opt_geometry
* @return {ol.geom.SimpleGeometry} * @return {ol.geom.SimpleGeometry}
*/ */
+2 -3
View File
@@ -156,12 +156,11 @@ ol.DragBoxEndConditionType;
/** /**
* Function that takes coordinates and an optional existing geometry as * Function that takes an array of coordinates and an optional existing geometry as
* arguments, and returns a geometry. The optional existing geometry is the * arguments, and returns a geometry. The optional existing geometry is the
* geometry that is returned when the function is called without a second * geometry that is returned when the function is called without a second
* argument. * argument.
* @typedef {function(!(ol.Coordinate|Array.<ol.Coordinate>| * @typedef {function(!Array.<ol.Coordinate>, ol.geom.SimpleGeometry=):
* Array.<Array.<ol.Coordinate>>), ol.geom.SimpleGeometry=):
* ol.geom.SimpleGeometry} * ol.geom.SimpleGeometry}
*/ */
ol.DrawGeometryFunctionType; ol.DrawGeometryFunctionType;