From 45350a34ed42251c698d0963dcbb11501ef9c2d1 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Thu, 23 Jan 2014 18:37:00 +0100 Subject: [PATCH] Convert ol.interaction.DragAndDropEvent#get* methods into properties --- examples/drag-and-drop-image-vector.js | 4 ++-- examples/drag-and-drop.js | 4 ++-- externs/oli.js | 13 +++++++++++ .../draganddropinteraction.exports | 3 --- src/ol/interaction/draganddropinteraction.js | 23 +++---------------- 5 files changed, 20 insertions(+), 27 deletions(-) diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 9a6886af52..390771c1be 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -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({ diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index 2c05bcee5d..b870d4efd7 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -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, diff --git a/externs/oli.js b/externs/oli.js index 6d8c5eeeb4..1e1b3ac78d 100644 --- a/externs/oli.js +++ b/externs/oli.js @@ -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.} */ +oli.interaction.DragAndDropEvent.prototype.features; + + +/** @type {ol.proj.Projection} */ +oli.interaction.DragAndDropEvent.prototype.projection; diff --git a/src/ol/interaction/draganddropinteraction.exports b/src/ol/interaction/draganddropinteraction.exports index 0e8bc5ea27..50e9fef9e3 100644 --- a/src/ol/interaction/draganddropinteraction.exports +++ b/src/ol/interaction/draganddropinteraction.exports @@ -1,4 +1 @@ @exportSymbol ol.interaction.DragAndDrop - -@exportProperty ol.interaction.DragAndDropEvent.prototype.getFeatures -@exportProperty ol.interaction.DragAndDropEvent.prototype.getProjection diff --git a/src/ol/interaction/draganddropinteraction.js b/src/ol/interaction/draganddropinteraction.js index c9cf155fee..77645850c8 100644 --- a/src/ol/interaction/draganddropinteraction.js +++ b/src/ol/interaction/draganddropinteraction.js @@ -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.=} opt_features Features. @@ -194,32 +195,14 @@ ol.interaction.DragAndDropEvent = goog.base(this, type, opt_target); /** - * @private * @type {Array.|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.|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_; -};