diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index d0e9f0d09e..e6ade9f5ef 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -19,6 +19,7 @@ A number of internal types have been renamed. This will not affect those who us * 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.ExtentEventType` to `ol.interaction.Extent.EventType` * rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event` diff --git a/src/ol/interaction/draw.js b/src/ol/interaction/draw.js index c0d2550a78..8d6453da76 100644 --- a/src/ol/interaction/draw.js +++ b/src/ol/interaction/draw.js @@ -1,5 +1,4 @@ goog.provide('ol.interaction.Draw'); -goog.provide('ol.interaction.DrawEventType'); goog.require('ol'); goog.require('ol.events'); @@ -25,25 +24,6 @@ goog.require('ol.source.Vector'); goog.require('ol.style.Style'); -/** - * @enum {string} - */ -ol.interaction.DrawEventType = { - /** - * 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' -}; - - /** * @classdesc * Interaction for drawing feature geometries. @@ -494,7 +474,7 @@ ol.interaction.Draw.prototype.startDrawing_ = function(event) { this.sketchFeature_.setGeometry(geometry); this.updateSketchFeatures_(); this.dispatchEvent(new ol.interaction.Draw.Event( - ol.interaction.DrawEventType.DRAWSTART, this.sketchFeature_)); + ol.interaction.Draw.EventType.DRAWSTART, this.sketchFeature_)); }; @@ -609,7 +589,7 @@ ol.interaction.Draw.prototype.removeLastPoint = function() { /** * 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. * @api */ @@ -641,7 +621,7 @@ ol.interaction.Draw.prototype.finishDrawing = function() { // First dispatch event to allow full set up of feature this.dispatchEvent(new ol.interaction.Draw.Event( - ol.interaction.DrawEventType.DRAWEND, sketchFeature)); + ol.interaction.Draw.EventType.DRAWEND, sketchFeature)); // Then insert feature if (this.features_) { @@ -692,7 +672,7 @@ ol.interaction.Draw.prototype.extend = function(feature) { this.sketchCoords_.push(last.slice()); this.updateSketchFeatures_(); this.dispatchEvent(new ol.interaction.Draw.Event( - ol.interaction.DrawEventType.DRAWSTART, this.sketchFeature_)); + ol.interaction.Draw.EventType.DRAWSTART, this.sketchFeature_)); }; @@ -817,7 +797,7 @@ ol.interaction.Draw.Mode = { * @constructor * @extends {ol.events.Event} * @implements {oli.DrawEvent} - * @param {ol.interaction.DrawEventType} type Type. + * @param {ol.interaction.Draw.EventType} type Type. * @param {ol.Feature} feature The feature drawn. */ ol.interaction.Draw.Event = function(type, feature) { @@ -833,3 +813,22 @@ ol.interaction.Draw.Event = function(type, 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' +};