Share editing default styles

This commit is contained in:
Antoine Abt
2014-02-24 11:17:39 +01:00
parent 24ad507710
commit 5cc1a986c2
6 changed files with 108 additions and 106 deletions

View File

@@ -11,6 +11,7 @@ goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.ViewHint');
goog.require('ol.coordinate');
goog.require('ol.extent');
goog.require('ol.feature');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
@@ -101,7 +102,8 @@ ol.interaction.Modify = function(options) {
* @private
*/
this.overlay_ = new ol.FeatureOverlay({
style: options.style
style: (goog.isDef(options.style)) ? options.style :
ol.interaction.Modify.getDefaultStyleFunction()
});
/**
@@ -743,3 +745,14 @@ ol.interaction.Modify.prototype.updateSegmentIndices_ = function(
}
});
};
/**
* @return {ol.feature.StyleFunction} Styles.
*/
ol.interaction.Modify.getDefaultStyleFunction = function() {
var style = ol.feature.createDefaultEditingStyles();
return function(feature, resolution) {
return style[ol.geom.GeometryType.POINT];
};
};