Make interaction ctor only have an option object

This commit is contained in:
Antoine Abt
2014-02-06 15:24:09 +01:00
parent 5325af26d6
commit 72675bf6ad
3 changed files with 6 additions and 10 deletions

View File

@@ -235,10 +235,8 @@ var overlay = new ol.render.FeaturesOverlay({
styleFunction: overlayStyle
});
var modify = new ol.interaction.Modify(overlay);
var select = new ol.interaction.Select({
featuresOverlay: overlay
});
var modify = new ol.interaction.Modify({ featuresOverlay: overlay });
var select = new ol.interaction.Select({ featuresOverlay: overlay });
var map = new ol.Map({
interactions: ol.interaction.defaults().extend([select, modify]),

View File

@@ -440,6 +440,7 @@
* the styleFunction for the feature
* @property {number|undefined} pixelTolerance Pixel tolerance for considering
* the pointer close enough to a vertex for editing. Default is 20 pixels.
* @property {ol.render.FeaturesOverlay} featuresOverlay Features overlay.
*/
/**

View File

@@ -39,15 +39,12 @@ ol.interaction.SegmentDataType;
/**
* @constructor
* @extends {ol.interaction.Drag}
* @param {ol.render.FeaturesOverlay} featuresOverlay FeaturesOverlay
* @param {olx.interaction.ModifyOptions=} opt_options Options.
* @param {olx.interaction.ModifyOptions} options Options.
*/
ol.interaction.Modify = function(featuresOverlay, opt_options) {
ol.interaction.Modify = function(options) {
goog.base(this);
var options = goog.isDef(opt_options) ? opt_options : {};
/**
* Editing vertex.
@@ -93,7 +90,7 @@ ol.interaction.Modify = function(featuresOverlay, opt_options) {
* @type {ol.render.FeaturesOverlay}
* @private
*/
this.overlay_ = featuresOverlay;
this.overlay_ = options.featuresOverlay;
this.overlay_.getFeatures().listen(ol.CollectionEventType.ADD,
this.addFeature_, false, this);