From 430ff9c850be6642e6756e712a77bd8b937a02b3 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 13 Feb 2014 11:09:46 +0100 Subject: [PATCH] Add opacity property to ol.style.Image --- src/ol/style/circlestyle.js | 1 + src/ol/style/iconstyle.js | 6 ++++++ src/ol/style/imagestyle.js | 17 ++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/ol/style/circlestyle.js b/src/ol/style/circlestyle.js index eb7d53cc13..fc1b88cd17 100644 --- a/src/ol/style/circlestyle.js +++ b/src/ol/style/circlestyle.js @@ -69,6 +69,7 @@ ol.style.Circle = function(opt_options) { this.size_ = [size, size]; goog.base(this, { + opacity: 1, rotation: 0, scale: 1, snapToPixel: undefined, diff --git a/src/ol/style/iconstyle.js b/src/ol/style/iconstyle.js index 6af27dd27a..a173647254 100644 --- a/src/ol/style/iconstyle.js +++ b/src/ol/style/iconstyle.js @@ -72,6 +72,11 @@ ol.style.Icon = function(opt_options) { */ this.size_ = goog.isDef(options.size) ? options.size : null; + /** + * @type {number} + */ + var opacity = goog.isDef(options.opacity) ? options.opacity : 1; + /** * @type {number} */ @@ -83,6 +88,7 @@ ol.style.Icon = function(opt_options) { var scale = goog.isDef(options.scale) ? options.scale : 1; goog.base(this, { + opacity: opacity, rotation: rotation, scale: scale, snapToPixel: undefined, diff --git a/src/ol/style/imagestyle.js b/src/ol/style/imagestyle.js index 9063d65f99..caf76bb90d 100644 --- a/src/ol/style/imagestyle.js +++ b/src/ol/style/imagestyle.js @@ -16,7 +16,8 @@ ol.style.ImageState = { /** - * @typedef {{rotation: number, + * @typedef {{opacity: number, + * rotation: number, * scale: number, * snapToPixel: (boolean|undefined), * subtractViewRotation: boolean}} @@ -31,6 +32,12 @@ ol.style.ImageOptions; */ ol.style.Image = function(options) { + /** + * @private + * @type {number} + */ + this.opacity_ = options.opacity; + /** * @private * @type {number} @@ -58,6 +65,14 @@ ol.style.Image = function(options) { }; +/** + * @return {number} Opacity. + */ +ol.style.Image.prototype.getOpacity = function() { + return this.opacity_; +}; + + /** * @return {number} Rotation. */