@@ -17,10 +17,16 @@ A number of internal types have been renamed. This will not affect those who us
|
|||||||
* rename `ol.OverlayProperty` to `ol.Overlay.Property`
|
* rename `ol.OverlayProperty` to `ol.Overlay.Property`
|
||||||
* rename `ol.control.MousePositionProperty` to `ol.control.MousePosition.Property`
|
* rename `ol.control.MousePositionProperty` to `ol.control.MousePosition.Property`
|
||||||
* rename `ol.format.IGCZ` to `ol.format.IGC.Z`
|
* rename `ol.format.IGCZ` to `ol.format.IGC.Z`
|
||||||
|
* rename `ol.interaction.DrawMode` to `ol.interaction.Draw.Mode`
|
||||||
|
* rename `ol.interaction.DrawEvent` to `ol.interaction.Draw.Event`
|
||||||
|
* rename `ol.interaction.DrawEventType` to `ol.interaction.Draw.EventType`
|
||||||
* rename `ol.interaction.ExtentEvent` to `ol.interaction.Extent.Event`
|
* rename `ol.interaction.ExtentEvent` to `ol.interaction.Extent.Event`
|
||||||
* rename `ol.interaction.ExtentEventType` to `ol.interaction.Extent.EventType`
|
* rename `ol.interaction.ExtentEventType` to `ol.interaction.Extent.EventType`
|
||||||
* rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event`
|
* rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event`
|
||||||
* rename `ol.interaction.DragAndDropEventType` to `ol.interaction.DragAndDrop.EventType`
|
* rename `ol.interaction.DragAndDropEventType` to `ol.interaction.DragAndDrop.EventType`
|
||||||
|
* rename `ol.interaction.ModifyEvent` to `ol.interaction.Modify.Event`
|
||||||
|
* rename `ol.interaction.SelectEvent` to `ol.interaction.Select.Event`
|
||||||
|
* rename `ol.interaction.SelectEventType` to `ol.interaction.Select.EventType`
|
||||||
* rename `ol.interaction.TranslateEvent` to `ol.interaction.Translate.Event`
|
* rename `ol.interaction.TranslateEvent` to `ol.interaction.Translate.Event`
|
||||||
* rename `ol.interaction.TranslateEventType` to `ol.interaction.Translate.EventType`
|
* rename `ol.interaction.TranslateEventType` to `ol.interaction.Translate.EventType`
|
||||||
* rename `ol.layer.GroupProperty` to `ol.layer.Group.Property`
|
* rename `ol.layer.GroupProperty` to `ol.layer.Group.Property`
|
||||||
@@ -29,6 +35,7 @@ A number of internal types have been renamed. This will not affect those who us
|
|||||||
* rename `ol.layer.VectorTileRenderType` to `ol.layer.VectorTile.RenderType`
|
* rename `ol.layer.VectorTileRenderType` to `ol.layer.VectorTile.RenderType`
|
||||||
* rename `ol.MapEventType` to `ol.MapEvent.Type`
|
* rename `ol.MapEventType` to `ol.MapEvent.Type`
|
||||||
* rename `ol.MapProperty` to `ol.Map.Property`
|
* rename `ol.MapProperty` to `ol.Map.Property`
|
||||||
|
* rename `ol.ModifyEventType` to `ol.interaction.Modify.EventType`
|
||||||
* rename `ol.RendererType` to `ol.renderer.Type`
|
* rename `ol.RendererType` to `ol.renderer.Type`
|
||||||
* rename `ol.source.ImageEvent` to `ol.source.Image.Event`
|
* rename `ol.source.ImageEvent` to `ol.source.Image.Event`
|
||||||
* rename `ol.source.ImageEventType` to `ol.source.Image.EventType`
|
* rename `ol.source.ImageEventType` to `ol.source.Image.EventType`
|
||||||
|
|||||||
+83
-87
@@ -1,7 +1,4 @@
|
|||||||
goog.provide('ol.interaction.Draw');
|
goog.provide('ol.interaction.Draw');
|
||||||
goog.provide('ol.interaction.DrawEvent');
|
|
||||||
goog.provide('ol.interaction.DrawEventType');
|
|
||||||
goog.provide('ol.interaction.DrawMode');
|
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
@@ -27,58 +24,13 @@ goog.require('ol.source.Vector');
|
|||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.interaction.DrawEventType = {
|
|
||||||
/**
|
|
||||||
* Triggered upon feature draw start
|
|
||||||
* @event ol.interaction.DrawEvent#drawstart
|
|
||||||
* @api stable
|
|
||||||
*/
|
|
||||||
DRAWSTART: 'drawstart',
|
|
||||||
/**
|
|
||||||
* Triggered upon feature draw end
|
|
||||||
* @event ol.interaction.DrawEvent#drawend
|
|
||||||
* @api stable
|
|
||||||
*/
|
|
||||||
DRAWEND: 'drawend'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @classdesc
|
|
||||||
* Events emitted by {@link ol.interaction.Draw} instances are instances of
|
|
||||||
* this type.
|
|
||||||
*
|
|
||||||
* @constructor
|
|
||||||
* @extends {ol.events.Event}
|
|
||||||
* @implements {oli.DrawEvent}
|
|
||||||
* @param {ol.interaction.DrawEventType} type Type.
|
|
||||||
* @param {ol.Feature} feature The feature drawn.
|
|
||||||
*/
|
|
||||||
ol.interaction.DrawEvent = function(type, feature) {
|
|
||||||
|
|
||||||
ol.events.Event.call(this, type);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The feature being drawn.
|
|
||||||
* @type {ol.Feature}
|
|
||||||
* @api stable
|
|
||||||
*/
|
|
||||||
this.feature = feature;
|
|
||||||
|
|
||||||
};
|
|
||||||
ol.inherits(ol.interaction.DrawEvent, ol.events.Event);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Interaction for drawing feature geometries.
|
* Interaction for drawing feature geometries.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Pointer}
|
* @extends {ol.interaction.Pointer}
|
||||||
* @fires ol.interaction.DrawEvent
|
* @fires ol.interaction.Draw.Event
|
||||||
* @param {olx.interaction.DrawOptions} options Options.
|
* @param {olx.interaction.DrawOptions} options Options.
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
@@ -132,7 +84,7 @@ ol.interaction.Draw = function(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Drawing mode (derived from geometry type.
|
* Drawing mode (derived from geometry type.
|
||||||
* @type {ol.interaction.DrawMode}
|
* @type {ol.interaction.Draw.Mode}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.mode_ = ol.interaction.Draw.getMode_(this.type_);
|
this.mode_ = ol.interaction.Draw.getMode_(this.type_);
|
||||||
@@ -146,7 +98,7 @@ ol.interaction.Draw = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.minPoints_ = options.minPoints ?
|
this.minPoints_ = options.minPoints ?
|
||||||
options.minPoints :
|
options.minPoints :
|
||||||
(this.mode_ === ol.interaction.DrawMode.POLYGON ? 3 : 2);
|
(this.mode_ === ol.interaction.Draw.Mode.POLYGON ? 3 : 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of points that can be drawn before a polygon ring or line string
|
* The number of points that can be drawn before a polygon ring or line string
|
||||||
@@ -183,11 +135,11 @@ ol.interaction.Draw = function(options) {
|
|||||||
} else {
|
} else {
|
||||||
var Constructor;
|
var Constructor;
|
||||||
var mode = this.mode_;
|
var mode = this.mode_;
|
||||||
if (mode === ol.interaction.DrawMode.POINT) {
|
if (mode === ol.interaction.Draw.Mode.POINT) {
|
||||||
Constructor = ol.geom.Point;
|
Constructor = ol.geom.Point;
|
||||||
} else if (mode === ol.interaction.DrawMode.LINE_STRING) {
|
} else if (mode === ol.interaction.Draw.Mode.LINE_STRING) {
|
||||||
Constructor = ol.geom.LineString;
|
Constructor = ol.geom.LineString;
|
||||||
} else if (mode === ol.interaction.DrawMode.POLYGON) {
|
} else if (mode === ol.interaction.Draw.Mode.POLYGON) {
|
||||||
Constructor = ol.geom.Polygon;
|
Constructor = ol.geom.Polygon;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -339,8 +291,8 @@ ol.interaction.Draw.prototype.setMap = function(map) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.interaction.Draw.handleEvent = function(mapBrowserEvent) {
|
ol.interaction.Draw.handleEvent = function(mapBrowserEvent) {
|
||||||
if ((this.mode_ === ol.interaction.DrawMode.LINE_STRING ||
|
if ((this.mode_ === ol.interaction.Draw.Mode.LINE_STRING ||
|
||||||
this.mode_ === ol.interaction.DrawMode.POLYGON) &&
|
this.mode_ === ol.interaction.Draw.Mode.POLYGON) &&
|
||||||
this.freehandCondition_(mapBrowserEvent)) {
|
this.freehandCondition_(mapBrowserEvent)) {
|
||||||
this.freehand_ = true;
|
this.freehand_ = true;
|
||||||
}
|
}
|
||||||
@@ -399,10 +351,10 @@ ol.interaction.Draw.handleUpEvent_ = function(event) {
|
|||||||
this.handlePointerMove_(event);
|
this.handlePointerMove_(event);
|
||||||
if (!this.finishCoordinate_) {
|
if (!this.finishCoordinate_) {
|
||||||
this.startDrawing_(event);
|
this.startDrawing_(event);
|
||||||
if (this.mode_ === ol.interaction.DrawMode.POINT) {
|
if (this.mode_ === ol.interaction.Draw.Mode.POINT) {
|
||||||
this.finishDrawing();
|
this.finishDrawing();
|
||||||
}
|
}
|
||||||
} else if (this.mode_ === ol.interaction.DrawMode.CIRCLE) {
|
} else if (this.mode_ === ol.interaction.Draw.Mode.CIRCLE) {
|
||||||
this.finishDrawing();
|
this.finishDrawing();
|
||||||
} else if (this.atFinish_(event)) {
|
} else if (this.atFinish_(event)) {
|
||||||
if (this.finishCondition_(event)) {
|
if (this.finishCondition_(event)) {
|
||||||
@@ -444,9 +396,9 @@ ol.interaction.Draw.prototype.atFinish_ = function(event) {
|
|||||||
if (this.sketchFeature_) {
|
if (this.sketchFeature_) {
|
||||||
var potentiallyDone = false;
|
var potentiallyDone = false;
|
||||||
var potentiallyFinishCoordinates = [this.finishCoordinate_];
|
var potentiallyFinishCoordinates = [this.finishCoordinate_];
|
||||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
if (this.mode_ === ol.interaction.Draw.Mode.LINE_STRING) {
|
||||||
potentiallyDone = this.sketchCoords_.length > this.minPoints_;
|
potentiallyDone = this.sketchCoords_.length > this.minPoints_;
|
||||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
} else if (this.mode_ === ol.interaction.Draw.Mode.POLYGON) {
|
||||||
potentiallyDone = this.sketchCoords_[0].length >
|
potentiallyDone = this.sketchCoords_[0].length >
|
||||||
this.minPoints_;
|
this.minPoints_;
|
||||||
potentiallyFinishCoordinates = [this.sketchCoords_[0][0],
|
potentiallyFinishCoordinates = [this.sketchCoords_[0][0],
|
||||||
@@ -498,14 +450,14 @@ ol.interaction.Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
|
|||||||
ol.interaction.Draw.prototype.startDrawing_ = function(event) {
|
ol.interaction.Draw.prototype.startDrawing_ = function(event) {
|
||||||
var start = event.coordinate;
|
var start = event.coordinate;
|
||||||
this.finishCoordinate_ = start;
|
this.finishCoordinate_ = start;
|
||||||
if (this.mode_ === ol.interaction.DrawMode.POINT) {
|
if (this.mode_ === ol.interaction.Draw.Mode.POINT) {
|
||||||
this.sketchCoords_ = start.slice();
|
this.sketchCoords_ = start.slice();
|
||||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
} else if (this.mode_ === ol.interaction.Draw.Mode.POLYGON) {
|
||||||
this.sketchCoords_ = [[start.slice(), start.slice()]];
|
this.sketchCoords_ = [[start.slice(), start.slice()]];
|
||||||
this.sketchLineCoords_ = this.sketchCoords_[0];
|
this.sketchLineCoords_ = this.sketchCoords_[0];
|
||||||
} else {
|
} else {
|
||||||
this.sketchCoords_ = [start.slice(), start.slice()];
|
this.sketchCoords_ = [start.slice(), start.slice()];
|
||||||
if (this.mode_ === ol.interaction.DrawMode.CIRCLE) {
|
if (this.mode_ === ol.interaction.Draw.Mode.CIRCLE) {
|
||||||
this.sketchLineCoords_ = this.sketchCoords_;
|
this.sketchLineCoords_ = this.sketchCoords_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -521,8 +473,8 @@ ol.interaction.Draw.prototype.startDrawing_ = function(event) {
|
|||||||
}
|
}
|
||||||
this.sketchFeature_.setGeometry(geometry);
|
this.sketchFeature_.setGeometry(geometry);
|
||||||
this.updateSketchFeatures_();
|
this.updateSketchFeatures_();
|
||||||
this.dispatchEvent(new ol.interaction.DrawEvent(
|
this.dispatchEvent(new ol.interaction.Draw.Event(
|
||||||
ol.interaction.DrawEventType.DRAWSTART, this.sketchFeature_));
|
ol.interaction.Draw.EventType.DRAWSTART, this.sketchFeature_));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -535,9 +487,9 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
|||||||
var coordinate = event.coordinate;
|
var coordinate = event.coordinate;
|
||||||
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
|
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
|
||||||
var coordinates, last;
|
var coordinates, last;
|
||||||
if (this.mode_ === ol.interaction.DrawMode.POINT) {
|
if (this.mode_ === ol.interaction.Draw.Mode.POINT) {
|
||||||
last = this.sketchCoords_;
|
last = this.sketchCoords_;
|
||||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
} else if (this.mode_ === ol.interaction.Draw.Mode.POLYGON) {
|
||||||
coordinates = this.sketchCoords_[0];
|
coordinates = this.sketchCoords_[0];
|
||||||
last = coordinates[coordinates.length - 1];
|
last = coordinates[coordinates.length - 1];
|
||||||
if (this.atFinish_(event)) {
|
if (this.atFinish_(event)) {
|
||||||
@@ -560,7 +512,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
|||||||
}
|
}
|
||||||
var sketchLineGeom;
|
var sketchLineGeom;
|
||||||
if (geometry instanceof ol.geom.Polygon &&
|
if (geometry instanceof ol.geom.Polygon &&
|
||||||
this.mode_ !== ol.interaction.DrawMode.POLYGON) {
|
this.mode_ !== ol.interaction.Draw.Mode.POLYGON) {
|
||||||
if (!this.sketchLine_) {
|
if (!this.sketchLine_) {
|
||||||
this.sketchLine_ = new ol.Feature(new ol.geom.LineString(null));
|
this.sketchLine_ = new ol.Feature(new ol.geom.LineString(null));
|
||||||
}
|
}
|
||||||
@@ -586,13 +538,13 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) {
|
|||||||
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
|
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
|
||||||
var done;
|
var done;
|
||||||
var coordinates;
|
var coordinates;
|
||||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
if (this.mode_ === ol.interaction.Draw.Mode.LINE_STRING) {
|
||||||
this.finishCoordinate_ = coordinate.slice();
|
this.finishCoordinate_ = coordinate.slice();
|
||||||
coordinates = this.sketchCoords_;
|
coordinates = this.sketchCoords_;
|
||||||
coordinates.push(coordinate.slice());
|
coordinates.push(coordinate.slice());
|
||||||
done = coordinates.length > this.maxPoints_;
|
done = coordinates.length > this.maxPoints_;
|
||||||
this.geometryFunction_(coordinates, geometry);
|
this.geometryFunction_(coordinates, geometry);
|
||||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
} else if (this.mode_ === ol.interaction.Draw.Mode.POLYGON) {
|
||||||
coordinates = this.sketchCoords_[0];
|
coordinates = this.sketchCoords_[0];
|
||||||
coordinates.push(coordinate.slice());
|
coordinates.push(coordinate.slice());
|
||||||
done = coordinates.length > this.maxPoints_;
|
done = coordinates.length > this.maxPoints_;
|
||||||
@@ -615,11 +567,11 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) {
|
|||||||
ol.interaction.Draw.prototype.removeLastPoint = function() {
|
ol.interaction.Draw.prototype.removeLastPoint = function() {
|
||||||
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
|
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
|
||||||
var coordinates, sketchLineGeom;
|
var coordinates, sketchLineGeom;
|
||||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
if (this.mode_ === ol.interaction.Draw.Mode.LINE_STRING) {
|
||||||
coordinates = this.sketchCoords_;
|
coordinates = this.sketchCoords_;
|
||||||
coordinates.splice(-2, 1);
|
coordinates.splice(-2, 1);
|
||||||
this.geometryFunction_(coordinates, geometry);
|
this.geometryFunction_(coordinates, geometry);
|
||||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
} else if (this.mode_ === ol.interaction.Draw.Mode.POLYGON) {
|
||||||
coordinates = this.sketchCoords_[0];
|
coordinates = this.sketchCoords_[0];
|
||||||
coordinates.splice(-2, 1);
|
coordinates.splice(-2, 1);
|
||||||
sketchLineGeom = /** @type {ol.geom.LineString} */ (this.sketchLine_.getGeometry());
|
sketchLineGeom = /** @type {ol.geom.LineString} */ (this.sketchLine_.getGeometry());
|
||||||
@@ -637,7 +589,7 @@ ol.interaction.Draw.prototype.removeLastPoint = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop drawing and add the sketch feature to the target layer.
|
* Stop drawing and add the sketch feature to the target layer.
|
||||||
* The {@link ol.interaction.DrawEventType.DRAWEND} event is dispatched before
|
* The {@link ol.interaction.Draw.EventType.DRAWEND} event is dispatched before
|
||||||
* inserting the feature.
|
* inserting the feature.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -645,11 +597,11 @@ ol.interaction.Draw.prototype.finishDrawing = function() {
|
|||||||
var sketchFeature = this.abortDrawing_();
|
var sketchFeature = this.abortDrawing_();
|
||||||
var coordinates = this.sketchCoords_;
|
var coordinates = this.sketchCoords_;
|
||||||
var geometry = /** @type {ol.geom.SimpleGeometry} */ (sketchFeature.getGeometry());
|
var geometry = /** @type {ol.geom.SimpleGeometry} */ (sketchFeature.getGeometry());
|
||||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
if (this.mode_ === ol.interaction.Draw.Mode.LINE_STRING) {
|
||||||
// remove the redundant last point
|
// remove the redundant last point
|
||||||
coordinates.pop();
|
coordinates.pop();
|
||||||
this.geometryFunction_(coordinates, geometry);
|
this.geometryFunction_(coordinates, geometry);
|
||||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
} else if (this.mode_ === ol.interaction.Draw.Mode.POLYGON) {
|
||||||
// When we finish drawing a polygon on the last point,
|
// When we finish drawing a polygon on the last point,
|
||||||
// the last coordinate is duplicated as for LineString
|
// the last coordinate is duplicated as for LineString
|
||||||
// we force the replacement by the first point
|
// we force the replacement by the first point
|
||||||
@@ -668,8 +620,8 @@ ol.interaction.Draw.prototype.finishDrawing = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First dispatch event to allow full set up of feature
|
// First dispatch event to allow full set up of feature
|
||||||
this.dispatchEvent(new ol.interaction.DrawEvent(
|
this.dispatchEvent(new ol.interaction.Draw.Event(
|
||||||
ol.interaction.DrawEventType.DRAWEND, sketchFeature));
|
ol.interaction.Draw.EventType.DRAWEND, sketchFeature));
|
||||||
|
|
||||||
// Then insert feature
|
// Then insert feature
|
||||||
if (this.features_) {
|
if (this.features_) {
|
||||||
@@ -708,7 +660,7 @@ ol.interaction.Draw.prototype.abortDrawing_ = function() {
|
|||||||
*/
|
*/
|
||||||
ol.interaction.Draw.prototype.extend = function(feature) {
|
ol.interaction.Draw.prototype.extend = function(feature) {
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
ol.DEBUG && console.assert(this.mode_ == ol.interaction.DrawMode.LINE_STRING,
|
ol.DEBUG && console.assert(this.mode_ == ol.interaction.Draw.Mode.LINE_STRING,
|
||||||
'interaction mode must be "line"');
|
'interaction mode must be "line"');
|
||||||
ol.DEBUG && console.assert(geometry.getType() == ol.geom.GeometryType.LINE_STRING,
|
ol.DEBUG && console.assert(geometry.getType() == ol.geom.GeometryType.LINE_STRING,
|
||||||
'feature geometry must be a line string');
|
'feature geometry must be a line string');
|
||||||
@@ -719,8 +671,8 @@ ol.interaction.Draw.prototype.extend = function(feature) {
|
|||||||
this.finishCoordinate_ = last.slice();
|
this.finishCoordinate_ = last.slice();
|
||||||
this.sketchCoords_.push(last.slice());
|
this.sketchCoords_.push(last.slice());
|
||||||
this.updateSketchFeatures_();
|
this.updateSketchFeatures_();
|
||||||
this.dispatchEvent(new ol.interaction.DrawEvent(
|
this.dispatchEvent(new ol.interaction.Draw.Event(
|
||||||
ol.interaction.DrawEventType.DRAWSTART, this.sketchFeature_));
|
ol.interaction.Draw.EventType.DRAWSTART, this.sketchFeature_));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -804,24 +756,24 @@ ol.interaction.Draw.createRegularPolygon = function(opt_sides, opt_angle) {
|
|||||||
* Get the drawing mode. The mode for mult-part geometries is the same as for
|
* Get the drawing mode. The mode for mult-part geometries is the same as for
|
||||||
* their single-part cousins.
|
* their single-part cousins.
|
||||||
* @param {ol.geom.GeometryType} type Geometry type.
|
* @param {ol.geom.GeometryType} type Geometry type.
|
||||||
* @return {ol.interaction.DrawMode} Drawing mode.
|
* @return {ol.interaction.Draw.Mode} Drawing mode.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.interaction.Draw.getMode_ = function(type) {
|
ol.interaction.Draw.getMode_ = function(type) {
|
||||||
var mode;
|
var mode;
|
||||||
if (type === ol.geom.GeometryType.POINT ||
|
if (type === ol.geom.GeometryType.POINT ||
|
||||||
type === ol.geom.GeometryType.MULTI_POINT) {
|
type === ol.geom.GeometryType.MULTI_POINT) {
|
||||||
mode = ol.interaction.DrawMode.POINT;
|
mode = ol.interaction.Draw.Mode.POINT;
|
||||||
} else if (type === ol.geom.GeometryType.LINE_STRING ||
|
} else if (type === ol.geom.GeometryType.LINE_STRING ||
|
||||||
type === ol.geom.GeometryType.MULTI_LINE_STRING) {
|
type === ol.geom.GeometryType.MULTI_LINE_STRING) {
|
||||||
mode = ol.interaction.DrawMode.LINE_STRING;
|
mode = ol.interaction.Draw.Mode.LINE_STRING;
|
||||||
} else if (type === ol.geom.GeometryType.POLYGON ||
|
} else if (type === ol.geom.GeometryType.POLYGON ||
|
||||||
type === ol.geom.GeometryType.MULTI_POLYGON) {
|
type === ol.geom.GeometryType.MULTI_POLYGON) {
|
||||||
mode = ol.interaction.DrawMode.POLYGON;
|
mode = ol.interaction.Draw.Mode.POLYGON;
|
||||||
} else if (type === ol.geom.GeometryType.CIRCLE) {
|
} else if (type === ol.geom.GeometryType.CIRCLE) {
|
||||||
mode = ol.interaction.DrawMode.CIRCLE;
|
mode = ol.interaction.Draw.Mode.CIRCLE;
|
||||||
}
|
}
|
||||||
return /** @type {!ol.interaction.DrawMode} */ (mode);
|
return /** @type {!ol.interaction.Draw.Mode} */ (mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -830,9 +782,53 @@ ol.interaction.Draw.getMode_ = function(type) {
|
|||||||
* cousins.
|
* cousins.
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
ol.interaction.DrawMode = {
|
ol.interaction.Draw.Mode = {
|
||||||
POINT: 'Point',
|
POINT: 'Point',
|
||||||
LINE_STRING: 'LineString',
|
LINE_STRING: 'LineString',
|
||||||
POLYGON: 'Polygon',
|
POLYGON: 'Polygon',
|
||||||
CIRCLE: 'Circle'
|
CIRCLE: 'Circle'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @classdesc
|
||||||
|
* Events emitted by {@link ol.interaction.Draw} instances are instances of
|
||||||
|
* this type.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
* @extends {ol.events.Event}
|
||||||
|
* @implements {oli.DrawEvent}
|
||||||
|
* @param {ol.interaction.Draw.EventType} type Type.
|
||||||
|
* @param {ol.Feature} feature The feature drawn.
|
||||||
|
*/
|
||||||
|
ol.interaction.Draw.Event = function(type, feature) {
|
||||||
|
|
||||||
|
ol.events.Event.call(this, type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The feature being drawn.
|
||||||
|
* @type {ol.Feature}
|
||||||
|
* @api stable
|
||||||
|
*/
|
||||||
|
this.feature = feature;
|
||||||
|
|
||||||
|
};
|
||||||
|
ol.inherits(ol.interaction.Draw.Event, ol.events.Event);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.interaction.Draw.EventType = {
|
||||||
|
/**
|
||||||
|
* Triggered upon feature draw start
|
||||||
|
* @event ol.interaction.Draw.Event#drawstart
|
||||||
|
* @api stable
|
||||||
|
*/
|
||||||
|
DRAWSTART: 'drawstart',
|
||||||
|
/**
|
||||||
|
* Triggered upon feature draw end
|
||||||
|
* @event ol.interaction.Draw.Event#drawend
|
||||||
|
* @api stable
|
||||||
|
*/
|
||||||
|
DRAWEND: 'drawend'
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
goog.provide('ol.interaction.Modify');
|
goog.provide('ol.interaction.Modify');
|
||||||
goog.provide('ol.interaction.ModifyEvent');
|
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Collection');
|
goog.require('ol.Collection');
|
||||||
@@ -23,59 +22,6 @@ goog.require('ol.structs.RBush');
|
|||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.ModifyEventType = {
|
|
||||||
/**
|
|
||||||
* Triggered upon feature modification start
|
|
||||||
* @event ol.interaction.ModifyEvent#modifystart
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
MODIFYSTART: 'modifystart',
|
|
||||||
/**
|
|
||||||
* Triggered upon feature modification end
|
|
||||||
* @event ol.interaction.ModifyEvent#modifyend
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
MODIFYEND: 'modifyend'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @classdesc
|
|
||||||
* Events emitted by {@link ol.interaction.Modify} instances are instances of
|
|
||||||
* this type.
|
|
||||||
*
|
|
||||||
* @constructor
|
|
||||||
* @extends {ol.events.Event}
|
|
||||||
* @implements {oli.ModifyEvent}
|
|
||||||
* @param {ol.ModifyEventType} type Type.
|
|
||||||
* @param {ol.Collection.<ol.Feature>} features The features modified.
|
|
||||||
* @param {ol.MapBrowserPointerEvent} mapBrowserPointerEvent Associated
|
|
||||||
* {@link ol.MapBrowserPointerEvent}.
|
|
||||||
*/
|
|
||||||
ol.interaction.ModifyEvent = function(type, features, mapBrowserPointerEvent) {
|
|
||||||
|
|
||||||
ol.events.Event.call(this, type);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The features being modified.
|
|
||||||
* @type {ol.Collection.<ol.Feature>}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
this.features = features;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Associated {@link ol.MapBrowserEvent}.
|
|
||||||
* @type {ol.MapBrowserEvent}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
this.mapBrowserEvent = mapBrowserPointerEvent;
|
|
||||||
};
|
|
||||||
ol.inherits(ol.interaction.ModifyEvent, ol.events.Event);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Interaction for modifying feature geometries.
|
* Interaction for modifying feature geometries.
|
||||||
@@ -83,7 +29,7 @@ ol.inherits(ol.interaction.ModifyEvent, ol.events.Event);
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Pointer}
|
* @extends {ol.interaction.Pointer}
|
||||||
* @param {olx.interaction.ModifyOptions} options Options.
|
* @param {olx.interaction.ModifyOptions} options Options.
|
||||||
* @fires ol.interaction.ModifyEvent
|
* @fires ol.interaction.Modify.Event
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.interaction.Modify = function(options) {
|
ol.interaction.Modify = function(options) {
|
||||||
@@ -267,8 +213,8 @@ ol.interaction.Modify.prototype.addFeature_ = function(feature) {
|
|||||||
ol.interaction.Modify.prototype.willModifyFeatures_ = function(evt) {
|
ol.interaction.Modify.prototype.willModifyFeatures_ = function(evt) {
|
||||||
if (!this.modified_) {
|
if (!this.modified_) {
|
||||||
this.modified_ = true;
|
this.modified_ = true;
|
||||||
this.dispatchEvent(new ol.interaction.ModifyEvent(
|
this.dispatchEvent(new ol.interaction.Modify.Event(
|
||||||
ol.ModifyEventType.MODIFYSTART, this.features_, evt));
|
ol.interaction.Modify.EventType.MODIFYSTART, this.features_, evt));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -674,8 +620,8 @@ ol.interaction.Modify.handleUpEvent_ = function(evt) {
|
|||||||
segmentData);
|
segmentData);
|
||||||
}
|
}
|
||||||
if (this.modified_) {
|
if (this.modified_) {
|
||||||
this.dispatchEvent(new ol.interaction.ModifyEvent(
|
this.dispatchEvent(new ol.interaction.Modify.Event(
|
||||||
ol.ModifyEventType.MODIFYEND, this.features_, evt));
|
ol.interaction.Modify.EventType.MODIFYEND, this.features_, evt));
|
||||||
this.modified_ = false;
|
this.modified_ = false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -872,8 +818,8 @@ ol.interaction.Modify.prototype.removePoint = function() {
|
|||||||
var evt = this.lastPointerEvent_;
|
var evt = this.lastPointerEvent_;
|
||||||
this.willModifyFeatures_(evt);
|
this.willModifyFeatures_(evt);
|
||||||
handled = this.removeVertex_();
|
handled = this.removeVertex_();
|
||||||
this.dispatchEvent(new ol.interaction.ModifyEvent(
|
this.dispatchEvent(new ol.interaction.Modify.Event(
|
||||||
ol.ModifyEventType.MODIFYEND, this.features_, evt));
|
ol.interaction.Modify.EventType.MODIFYEND, this.features_, evt));
|
||||||
this.modified_ = false;
|
this.modified_ = false;
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
@@ -1040,3 +986,56 @@ ol.interaction.Modify.getDefaultStyleFunction = function() {
|
|||||||
return style[ol.geom.GeometryType.POINT];
|
return style[ol.geom.GeometryType.POINT];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @classdesc
|
||||||
|
* Events emitted by {@link ol.interaction.Modify} instances are instances of
|
||||||
|
* this type.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
* @extends {ol.events.Event}
|
||||||
|
* @implements {oli.ModifyEvent}
|
||||||
|
* @param {ol.interaction.Modify.EventType} type Type.
|
||||||
|
* @param {ol.Collection.<ol.Feature>} features The features modified.
|
||||||
|
* @param {ol.MapBrowserPointerEvent} mapBrowserPointerEvent Associated
|
||||||
|
* {@link ol.MapBrowserPointerEvent}.
|
||||||
|
*/
|
||||||
|
ol.interaction.Modify.Event = function(type, features, mapBrowserPointerEvent) {
|
||||||
|
|
||||||
|
ol.events.Event.call(this, type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The features being modified.
|
||||||
|
* @type {ol.Collection.<ol.Feature>}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
this.features = features;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associated {@link ol.MapBrowserEvent}.
|
||||||
|
* @type {ol.MapBrowserEvent}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
this.mapBrowserEvent = mapBrowserPointerEvent;
|
||||||
|
};
|
||||||
|
ol.inherits(ol.interaction.Modify.Event, ol.events.Event);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.interaction.Modify.EventType = {
|
||||||
|
/**
|
||||||
|
* Triggered upon feature modification start
|
||||||
|
* @event ol.interaction.Modify.Event#modifystart
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
MODIFYSTART: 'modifystart',
|
||||||
|
/**
|
||||||
|
* Triggered upon feature modification end
|
||||||
|
* @event ol.interaction.Modify.Event#modifyend
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
MODIFYEND: 'modifyend'
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
goog.provide('ol.interaction.Select');
|
goog.provide('ol.interaction.Select');
|
||||||
goog.provide('ol.interaction.SelectEvent');
|
|
||||||
goog.provide('ol.interaction.SelectEventType');
|
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.asserts');
|
goog.require('ol.asserts');
|
||||||
@@ -19,60 +17,6 @@ goog.require('ol.source.Vector');
|
|||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.interaction.SelectEventType = {
|
|
||||||
/**
|
|
||||||
* Triggered when feature(s) has been (de)selected.
|
|
||||||
* @event ol.interaction.SelectEvent#select
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
SELECT: 'select'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @classdesc
|
|
||||||
* Events emitted by {@link ol.interaction.Select} instances are instances of
|
|
||||||
* this type.
|
|
||||||
*
|
|
||||||
* @param {string} type The event type.
|
|
||||||
* @param {Array.<ol.Feature>} selected Selected features.
|
|
||||||
* @param {Array.<ol.Feature>} deselected Deselected features.
|
|
||||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Associated
|
|
||||||
* {@link ol.MapBrowserEvent}.
|
|
||||||
* @implements {oli.SelectEvent}
|
|
||||||
* @extends {ol.events.Event}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
ol.interaction.SelectEvent = function(type, selected, deselected, mapBrowserEvent) {
|
|
||||||
ol.events.Event.call(this, type);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Selected features array.
|
|
||||||
* @type {Array.<ol.Feature>}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
this.selected = selected;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deselected features array.
|
|
||||||
* @type {Array.<ol.Feature>}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
this.deselected = deselected;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Associated {@link ol.MapBrowserEvent}.
|
|
||||||
* @type {ol.MapBrowserEvent}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
this.mapBrowserEvent = mapBrowserEvent;
|
|
||||||
};
|
|
||||||
ol.inherits(ol.interaction.SelectEvent, ol.events.Event);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Interaction for selecting vector features. By default, selected features are
|
* Interaction for selecting vector features. By default, selected features are
|
||||||
@@ -88,7 +32,7 @@ ol.inherits(ol.interaction.SelectEvent, ol.events.Event);
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Interaction}
|
* @extends {ol.interaction.Interaction}
|
||||||
* @param {olx.interaction.SelectOptions=} opt_options Options.
|
* @param {olx.interaction.SelectOptions=} opt_options Options.
|
||||||
* @fires ol.interaction.SelectEvent
|
* @fires ol.interaction.Select.Event
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.interaction.Select = function(opt_options) {
|
ol.interaction.Select = function(opt_options) {
|
||||||
@@ -313,7 +257,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
|
|||||||
}
|
}
|
||||||
if (selected.length > 0 || deselected.length > 0) {
|
if (selected.length > 0 || deselected.length > 0) {
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new ol.interaction.SelectEvent(ol.interaction.SelectEventType.SELECT,
|
new ol.interaction.Select.Event(ol.interaction.Select.EventType.SELECT,
|
||||||
selected, deselected, mapBrowserEvent));
|
selected, deselected, mapBrowserEvent));
|
||||||
}
|
}
|
||||||
return ol.events.condition.pointerMove(mapBrowserEvent);
|
return ol.events.condition.pointerMove(mapBrowserEvent);
|
||||||
@@ -389,3 +333,57 @@ ol.interaction.Select.prototype.removeFeatureLayerAssociation_ = function(featur
|
|||||||
var key = ol.getUid(feature);
|
var key = ol.getUid(feature);
|
||||||
delete this.featureLayerAssociation_[key];
|
delete this.featureLayerAssociation_[key];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @classdesc
|
||||||
|
* Events emitted by {@link ol.interaction.Select} instances are instances of
|
||||||
|
* this type.
|
||||||
|
*
|
||||||
|
* @param {ol.interaction.Select.EventType} type The event type.
|
||||||
|
* @param {Array.<ol.Feature>} selected Selected features.
|
||||||
|
* @param {Array.<ol.Feature>} deselected Deselected features.
|
||||||
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Associated
|
||||||
|
* {@link ol.MapBrowserEvent}.
|
||||||
|
* @implements {oli.SelectEvent}
|
||||||
|
* @extends {ol.events.Event}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
ol.interaction.Select.Event = function(type, selected, deselected, mapBrowserEvent) {
|
||||||
|
ol.events.Event.call(this, type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selected features array.
|
||||||
|
* @type {Array.<ol.Feature>}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
this.selected = selected;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deselected features array.
|
||||||
|
* @type {Array.<ol.Feature>}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
this.deselected = deselected;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associated {@link ol.MapBrowserEvent}.
|
||||||
|
* @type {ol.MapBrowserEvent}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
this.mapBrowserEvent = mapBrowserEvent;
|
||||||
|
};
|
||||||
|
ol.inherits(ol.interaction.Select.Event, ol.events.Event);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.interaction.Select.EventType = {
|
||||||
|
/**
|
||||||
|
* Triggered when feature(s) has been (de)selected.
|
||||||
|
* @event ol.interaction.Select.Event#select
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
SELECT: 'select'
|
||||||
|
};
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ goog.require('ol.geom.LineString');
|
|||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
goog.require('ol.interaction.Modify');
|
goog.require('ol.interaction.Modify');
|
||||||
goog.require('ol.interaction.ModifyEvent');
|
|
||||||
goog.require('ol.layer.Vector');
|
goog.require('ol.layer.Vector');
|
||||||
goog.require('ol.pointer.PointerEvent');
|
goog.require('ol.pointer.PointerEvent');
|
||||||
goog.require('ol.source.Vector');
|
goog.require('ol.source.Vector');
|
||||||
@@ -102,7 +101,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
* modifications. Helper function to
|
* modifications. Helper function to
|
||||||
* @param {ol.Feature} feature Modified feature.
|
* @param {ol.Feature} feature Modified feature.
|
||||||
* @param {ol.interaction.Modify} interaction The interaction.
|
* @param {ol.interaction.Modify} interaction The interaction.
|
||||||
* @return {Array<ol.interaction.ModifyEvent|string>} events
|
* @return {Array<ol.interaction.Modify.Event|string>} events
|
||||||
*/
|
*/
|
||||||
function trackEvents(feature, interaction) {
|
function trackEvents(feature, interaction) {
|
||||||
var events = [];
|
var events = [];
|
||||||
@@ -122,7 +121,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
* Validates the event array to verify proper event sequence. Checks
|
* Validates the event array to verify proper event sequence. Checks
|
||||||
* that first and last event are correct ModifyEvents and that feature
|
* that first and last event are correct ModifyEvents and that feature
|
||||||
* modifications event are in between.
|
* modifications event are in between.
|
||||||
* @param {Array<ol.interaction.ModifyEvent|string>} events The events.
|
* @param {Array<ol.interaction.Modify.Event|string>} events The events.
|
||||||
* @param {Array<ol.Feature>} features The features.
|
* @param {Array<ol.Feature>} features The features.
|
||||||
*/
|
*/
|
||||||
function validateEvents(events, features) {
|
function validateEvents(events, features) {
|
||||||
@@ -131,11 +130,11 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var endevent = events[events.length - 1];
|
var endevent = events[events.length - 1];
|
||||||
|
|
||||||
// first event should be modifystary
|
// first event should be modifystary
|
||||||
expect(startevent).to.be.an(ol.interaction.ModifyEvent);
|
expect(startevent).to.be.an(ol.interaction.Modify.Event);
|
||||||
expect(startevent.type).to.eql('modifystart');
|
expect(startevent.type).to.eql('modifystart');
|
||||||
|
|
||||||
// last event should be modifyend
|
// last event should be modifyend
|
||||||
expect(endevent).to.be.an(ol.interaction.ModifyEvent);
|
expect(endevent).to.be.an(ol.interaction.Modify.Event);
|
||||||
expect(endevent.type).to.eql('modifyend');
|
expect(endevent.type).to.eql('modifyend');
|
||||||
|
|
||||||
// make sure we get change events to events array
|
// make sure we get change events to events array
|
||||||
|
|||||||
Reference in New Issue
Block a user