Add mapBrowserPointerEvent property to ModifyEvent

This commit is contained in:
Björn Harrtell
2015-07-01 20:51:04 +02:00
parent f7d62f054c
commit f81e36d8e0
2 changed files with 22 additions and 8 deletions

View File

@@ -61,6 +61,12 @@ oli.ModifyEvent = function() {};
oli.ModifyEvent.prototype.features; oli.ModifyEvent.prototype.features;
/**
* @type {ol.MapBrowserPointerEvent}
*/
oli.ModifyEvent.prototype.mapBrowserPointerEvent;
/** /**
* @interface * @interface

View File

@@ -34,13 +34,13 @@ ol.ModifyEventType = {
/** /**
* Triggered upon feature modification start * Triggered upon feature modification start
* @event ol.ModifyEvent#modifystart * @event ol.ModifyEvent#modifystart
* @api stable * @api
*/ */
MODIFYSTART: 'modifystart', MODIFYSTART: 'modifystart',
/** /**
* Triggered upon feature modification end * Triggered upon feature modification end
* @event ol.ModifyEvent#modifyend * @event ol.ModifyEvent#modifyend
* @api stable * @api
*/ */
MODIFYEND: 'modifyend' MODIFYEND: 'modifyend'
}; };
@@ -57,18 +57,26 @@ ol.ModifyEventType = {
* @implements {oli.ModifyEvent} * @implements {oli.ModifyEvent}
* @param {ol.ModifyEventType} type Type. * @param {ol.ModifyEventType} type Type.
* @param {ol.Collection.<ol.Feature>} features The features modified. * @param {ol.Collection.<ol.Feature>} features The features modified.
* @param {ol.MapBrowserPointerEvent} mapBrowserPointerEvent Associated
* {@link ol.MapBrowserPointerEvent}.
*/ */
ol.ModifyEvent = function(type, features) { ol.ModifyEvent = function(type, features, mapBrowserPointerEvent) {
goog.base(this, type); goog.base(this, type);
/** /**
* The feature being modified. * The features being modified.
* @type {ol.Collection.<ol.Feature>} * @type {ol.Collection.<ol.Feature>}
* @api stable * @api
*/ */
this.features = features; this.features = features;
/**
* Associated {@link ol.MapBrowserPointerEvent}.
* @type {ol.MapBrowserPointerEvent}
* @api
*/
this.mapBrowserPointerEvent = mapBrowserPointerEvent;
}; };
goog.inherits(ol.ModifyEvent, goog.events.Event); goog.inherits(ol.ModifyEvent, goog.events.Event);
@@ -92,7 +100,7 @@ ol.interaction.SegmentDataType;
* @extends {ol.interaction.Pointer} * @extends {ol.interaction.Pointer}
* @param {olx.interaction.ModifyOptions} options Options. * @param {olx.interaction.ModifyOptions} options Options.
* @fires ol.ModifyEvent * @fires ol.ModifyEvent
* @api stable * @api
*/ */
ol.interaction.Modify = function(options) { ol.interaction.Modify = function(options) {
@@ -515,7 +523,7 @@ ol.interaction.Modify.handleDownEvent_ = function(evt) {
this.insertVertex_.apply(this, insertVertices[i]); this.insertVertex_.apply(this, insertVertices[i]);
} }
this.dispatchEvent(new ol.ModifyEvent(ol.ModifyEventType.MODIFYSTART, this.dispatchEvent(new ol.ModifyEvent(ol.ModifyEventType.MODIFYSTART,
this.features_)); this.features_, evt));
} }
return !goog.isNull(this.vertexFeature_); return !goog.isNull(this.vertexFeature_);
}; };
@@ -588,7 +596,7 @@ ol.interaction.Modify.handleUpEvent_ = function(evt) {
segmentData); segmentData);
} }
this.dispatchEvent(new ol.ModifyEvent(ol.ModifyEventType.MODIFYEND, this.dispatchEvent(new ol.ModifyEvent(ol.ModifyEventType.MODIFYEND,
this.features_)); this.features_, evt));
return false; return false;
}; };