Add style option to DragZoom interaction

This commit is contained in:
Éric Lemoine
2013-12-05 11:31:07 +01:00
committed by Antoine Abt
parent eb840777e8
commit cf8adffdb2
2 changed files with 21 additions and 1 deletions

View File

@@ -327,6 +327,7 @@
* @property {ol.events.ConditionType|undefined} condition A conditional
* modifier (i.e. Shift key) that determines if the interaction is active
* or not, default is shift key.
* @property {ol.style.Style} style Style for the box.
* @todo stability experimental
*/

View File

@@ -5,6 +5,8 @@ goog.require('ol.Size');
goog.require('ol.View2D');
goog.require('ol.events.condition');
goog.require('ol.interaction.DragBox');
goog.require('ol.style.Fill');
goog.require('ol.style.Style');
@@ -53,9 +55,26 @@ ol.interaction.DragZoom = function(opt_options) {
});
});
/**
* @private
* @type {ol.style.Style}
*/
var style = goog.isDef(options.style) ?
options.style : new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(0,0,0,0.5)'
}),
image: null,
stroke: null,
text: null,
zIndex: 0
});
goog.base(this, {
behavior: behavior,
condition: condition
condition: condition,
style: style
});
};
goog.inherits(ol.interaction.DragZoom, ol.interaction.DragBox);