Rename ol.interaction.ModifyEvent to ol.interaction.Modify.Event

This commit is contained in:
Frederic Junod
2016-09-07 16:54:28 +02:00
parent c30a97ef59
commit c6a9bc66d6
3 changed files with 45 additions and 46 deletions

View File

@@ -1,5 +1,4 @@
goog.provide('ol.interaction.Modify');
goog.provide('ol.interaction.ModifyEvent');
goog.require('ol');
goog.require('ol.Collection');
@@ -29,53 +28,19 @@ goog.require('ol.style.Style');
ol.ModifyEventType = {
/**
* Triggered upon feature modification start
* @event ol.interaction.ModifyEvent#modifystart
* @event ol.interaction.Modify.Event#modifystart
* @api
*/
MODIFYSTART: 'modifystart',
/**
* Triggered upon feature modification end
* @event ol.interaction.ModifyEvent#modifyend
* @event ol.interaction.Modify.Event#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
* Interaction for modifying feature geometries.
@@ -83,7 +48,7 @@ ol.inherits(ol.interaction.ModifyEvent, ol.events.Event);
* @constructor
* @extends {ol.interaction.Pointer}
* @param {olx.interaction.ModifyOptions} options Options.
* @fires ol.interaction.ModifyEvent
* @fires ol.interaction.Modify.Event
* @api
*/
ol.interaction.Modify = function(options) {
@@ -267,7 +232,7 @@ ol.interaction.Modify.prototype.addFeature_ = function(feature) {
ol.interaction.Modify.prototype.willModifyFeatures_ = function(evt) {
if (!this.modified_) {
this.modified_ = true;
this.dispatchEvent(new ol.interaction.ModifyEvent(
this.dispatchEvent(new ol.interaction.Modify.Event(
ol.ModifyEventType.MODIFYSTART, this.features_, evt));
}
};
@@ -674,7 +639,7 @@ ol.interaction.Modify.handleUpEvent_ = function(evt) {
segmentData);
}
if (this.modified_) {
this.dispatchEvent(new ol.interaction.ModifyEvent(
this.dispatchEvent(new ol.interaction.Modify.Event(
ol.ModifyEventType.MODIFYEND, this.features_, evt));
this.modified_ = false;
}
@@ -872,7 +837,7 @@ ol.interaction.Modify.prototype.removePoint = function() {
var evt = this.lastPointerEvent_;
this.willModifyFeatures_(evt);
handled = this.removeVertex_();
this.dispatchEvent(new ol.interaction.ModifyEvent(
this.dispatchEvent(new ol.interaction.Modify.Event(
ol.ModifyEventType.MODIFYEND, this.features_, evt));
this.modified_ = false;
}
@@ -1040,3 +1005,37 @@ ol.interaction.Modify.getDefaultStyleFunction = function() {
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.ModifyEventType} 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);