Add getters to ol.style.Fill
This commit is contained in:
@@ -378,8 +378,9 @@ ol.render.canvas.Immediate.prototype.setFillStrokeStyle =
|
||||
function(fillStyle, strokeStyle) {
|
||||
var state = this.state_;
|
||||
if (!goog.isNull(fillStyle)) {
|
||||
state.fillStyle = ol.color.asString(!goog.isNull(fillStyle.color) ?
|
||||
fillStyle.color : ol.render.canvas.defaultFillStyle);
|
||||
var fillStyleColor = fillStyle.getColor();
|
||||
state.fillStyle = ol.color.asString(!goog.isNull(fillStyleColor) ?
|
||||
fillStyleColor : ol.render.canvas.defaultFillStyle);
|
||||
} else {
|
||||
state.fillStyle = undefined;
|
||||
}
|
||||
|
||||
@@ -1027,8 +1027,9 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyle =
|
||||
goog.asserts.assert(!goog.isNull(fillStyle) || !goog.isNull(strokeStyle));
|
||||
var state = this.state_;
|
||||
if (!goog.isNull(fillStyle)) {
|
||||
state.fillStyle = ol.color.asString(!goog.isNull(fillStyle.color) ?
|
||||
fillStyle.color : ol.render.canvas.defaultFillStyle);
|
||||
var fillStyleColor = fillStyle.getColor();
|
||||
state.fillStyle = ol.color.asString(!goog.isNull(fillStyleColor) ?
|
||||
fillStyleColor : ol.render.canvas.defaultFillStyle);
|
||||
} else {
|
||||
state.fillStyle = undefined;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ ol.style.Circle.prototype.render_ = function() {
|
||||
context.arc(size / 2, size / 2, this.radius_, 0, 2 * Math.PI, true);
|
||||
|
||||
if (!goog.isNull(this.fill_)) {
|
||||
context.fillStyle = ol.color.asString(this.fill_.color);
|
||||
context.fillStyle = ol.color.asString(this.fill_.getColor());
|
||||
context.fill();
|
||||
}
|
||||
if (!goog.isNull(this.stroke_)) {
|
||||
|
||||
@@ -13,7 +13,16 @@ ol.style.Fill = function(opt_options) {
|
||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Color|string}
|
||||
*/
|
||||
this.color = goog.isDef(options.color) ? options.color : null;
|
||||
this.color_ = goog.isDef(options.color) ? options.color : null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Color|string} Color.
|
||||
*/
|
||||
ol.style.Fill.prototype.getColor = function() {
|
||||
return this.color_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user