Convert ol.interaction.DragAndDropEvent#get* methods into properties

This commit is contained in:
Tom Payne
2014-01-23 18:37:00 +01:00
parent 3d68a3550e
commit 45350a34ed
5 changed files with 20 additions and 27 deletions

View File

@@ -115,8 +115,8 @@ var map = new ol.Map({
dragAndDropInteraction.on('addfeatures', function(event) {
var vectorSource = new ol.source.Vector({
features: event.getFeatures(),
projection: event.getProjection()
features: event.features,
projection: event.projection
});
map.getLayers().push(new ol.layer.Image({
source: new ol.source.ImageVector({

View File

@@ -114,8 +114,8 @@ var map = new ol.Map({
dragAndDropInteraction.on('addfeatures', function(event) {
var vectorSource = new ol.source.Vector({
features: event.getFeatures(),
projection: event.getProjection()
features: event.features,
projection: event.projection
});
map.getLayers().push(new ol.layer.Vector({
source: vectorSource,

View File

@@ -29,3 +29,16 @@ oli.control.Control = function() {};
* @return {undefined} Undefined.
*/
oli.control.Control.prototype.setMap = function(map) {};
/** @interface */
oli.interaction.DragAndDropEvent = function() {};
/** @type {Array.<ol.Feature>} */
oli.interaction.DragAndDropEvent.prototype.features;
/** @type {ol.proj.Projection} */
oli.interaction.DragAndDropEvent.prototype.projection;

View File

@@ -1,4 +1 @@
@exportSymbol ol.interaction.DragAndDrop
@exportProperty ol.interaction.DragAndDropEvent.prototype.getFeatures
@exportProperty ol.interaction.DragAndDropEvent.prototype.getProjection

View File

@@ -183,6 +183,7 @@ ol.interaction.DragAndDropEventType = {
/**
* @constructor
* @extends {goog.events.Event}
* @implements {oli.interaction.DragAndDropEvent}
* @param {ol.interaction.DragAndDropEventType} type Type.
* @param {Object=} opt_target Target.
* @param {Array.<ol.Feature>=} opt_features Features.
@@ -194,32 +195,14 @@ ol.interaction.DragAndDropEvent =
goog.base(this, type, opt_target);
/**
* @private
* @type {Array.<ol.Feature>|undefined}
*/
this.features_ = opt_features;
this.features = opt_features;
/**
* @private
* @type {ol.proj.Projection|undefined}
*/
this.projection_ = opt_projection;
this.projection = opt_projection;
};
goog.inherits(ol.interaction.DragAndDropEvent, goog.events.Event);
/**
* @return {Array.<ol.Feature>|undefined} Features.
*/
ol.interaction.DragAndDropEvent.prototype.getFeatures = function() {
return this.features_;
};
/**
* @return {ol.proj.Projection|undefined} Projection.
*/
ol.interaction.DragAndDropEvent.prototype.getProjection = function() {
return this.projection_;
};