Make interaction ctor only have an option object
This commit is contained in:
@@ -235,10 +235,8 @@ var overlay = new ol.render.FeaturesOverlay({
|
|||||||
styleFunction: overlayStyle
|
styleFunction: overlayStyle
|
||||||
});
|
});
|
||||||
|
|
||||||
var modify = new ol.interaction.Modify(overlay);
|
var modify = new ol.interaction.Modify({ featuresOverlay: overlay });
|
||||||
var select = new ol.interaction.Select({
|
var select = new ol.interaction.Select({ featuresOverlay: overlay });
|
||||||
featuresOverlay: overlay
|
|
||||||
});
|
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
interactions: ol.interaction.defaults().extend([select, modify]),
|
interactions: ol.interaction.defaults().extend([select, modify]),
|
||||||
|
|||||||
@@ -440,6 +440,7 @@
|
|||||||
* the styleFunction for the feature
|
* the styleFunction for the feature
|
||||||
* @property {number|undefined} pixelTolerance Pixel tolerance for considering
|
* @property {number|undefined} pixelTolerance Pixel tolerance for considering
|
||||||
* the pointer close enough to a vertex for editing. Default is 20 pixels.
|
* the pointer close enough to a vertex for editing. Default is 20 pixels.
|
||||||
|
* @property {ol.render.FeaturesOverlay} featuresOverlay Features overlay.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,15 +39,12 @@ ol.interaction.SegmentDataType;
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Drag}
|
* @extends {ol.interaction.Drag}
|
||||||
* @param {ol.render.FeaturesOverlay} featuresOverlay FeaturesOverlay
|
* @param {olx.interaction.ModifyOptions} options Options.
|
||||||
* @param {olx.interaction.ModifyOptions=} opt_options Options.
|
|
||||||
*/
|
*/
|
||||||
ol.interaction.Modify = function(featuresOverlay, opt_options) {
|
ol.interaction.Modify = function(options) {
|
||||||
|
|
||||||
goog.base(this);
|
goog.base(this);
|
||||||
|
|
||||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editing vertex.
|
* Editing vertex.
|
||||||
@@ -93,7 +90,7 @@ ol.interaction.Modify = function(featuresOverlay, opt_options) {
|
|||||||
* @type {ol.render.FeaturesOverlay}
|
* @type {ol.render.FeaturesOverlay}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.overlay_ = featuresOverlay;
|
this.overlay_ = options.featuresOverlay;
|
||||||
|
|
||||||
this.overlay_.getFeatures().listen(ol.CollectionEventType.ADD,
|
this.overlay_.getFeatures().listen(ol.CollectionEventType.ADD,
|
||||||
this.addFeature_, false, this);
|
this.addFeature_, false, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user