From cf8adffdb272c28d99bb56c846fa4ce7e8d7f550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 5 Dec 2013 11:31:07 +0100 Subject: [PATCH] Add style option to DragZoom interaction --- src/objectliterals.jsdoc | 1 + src/ol/interaction/dragzoominteraction.js | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 2501eab27d..040dc6faba 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -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 */ diff --git a/src/ol/interaction/dragzoominteraction.js b/src/ol/interaction/dragzoominteraction.js index 084bcd1579..35c96be4b8 100644 --- a/src/ol/interaction/dragzoominteraction.js +++ b/src/ol/interaction/dragzoominteraction.js @@ -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);