Merge pull request #5863 from fredj/stroke_pattern
Allow CanvasPattern or CanvasGradient as stroke style
This commit is contained in:
@@ -260,7 +260,7 @@ ol.style.Circle.prototype.render_ = function(atlasManager) {
|
||||
var strokeWidth = 0;
|
||||
|
||||
if (this.stroke_) {
|
||||
strokeStyle = ol.color.asString(this.stroke_.getColor());
|
||||
strokeStyle = ol.colorlike.asColorLike(this.stroke_.getColor());
|
||||
strokeWidth = this.stroke_.getWidth();
|
||||
if (strokeWidth === undefined) {
|
||||
strokeWidth = ol.render.canvas.defaultLineWidth;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.style.RegularShape');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.color');
|
||||
goog.require('ol.colorlike');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.has');
|
||||
@@ -329,7 +328,7 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
|
||||
var strokeWidth = 0;
|
||||
|
||||
if (this.stroke_) {
|
||||
strokeStyle = ol.color.asString(this.stroke_.getColor());
|
||||
strokeStyle = ol.colorlike.asColorLike(this.stroke_.getColor());
|
||||
strokeWidth = this.stroke_.getWidth();
|
||||
if (strokeWidth === undefined) {
|
||||
strokeWidth = ol.render.canvas.defaultLineWidth;
|
||||
|
||||
+14
-8
@@ -1,7 +1,5 @@
|
||||
goog.provide('ol.style.Stroke');
|
||||
|
||||
goog.require('ol.color');
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -20,7 +18,7 @@ ol.style.Stroke = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Color|string}
|
||||
* @type {ol.Color|ol.ColorLike}
|
||||
*/
|
||||
this.color_ = options.color !== undefined ? options.color : null;
|
||||
|
||||
@@ -82,7 +80,7 @@ ol.style.Stroke.prototype.clone = function() {
|
||||
|
||||
/**
|
||||
* Get the stroke color.
|
||||
* @return {ol.Color|string} Color.
|
||||
* @return {ol.Color|ol.ColorLike} Color.
|
||||
* @api
|
||||
*/
|
||||
ol.style.Stroke.prototype.getColor = function() {
|
||||
@@ -143,7 +141,7 @@ ol.style.Stroke.prototype.getWidth = function() {
|
||||
/**
|
||||
* Set the color.
|
||||
*
|
||||
* @param {ol.Color|string} color Color.
|
||||
* @param {ol.Color|ol.ColorLike} color Color.
|
||||
* @api
|
||||
*/
|
||||
ol.style.Stroke.prototype.setColor = function(color) {
|
||||
@@ -223,9 +221,17 @@ ol.style.Stroke.prototype.setWidth = function(width) {
|
||||
*/
|
||||
ol.style.Stroke.prototype.getChecksum = function() {
|
||||
if (this.checksum_ === undefined) {
|
||||
this.checksum_ = 's' +
|
||||
(this.color_ ?
|
||||
ol.color.asString(this.color_) : '-') + ',' +
|
||||
this.checksum_ = 's';
|
||||
if (this.color_) {
|
||||
if (typeof this.color_ === 'string') {
|
||||
this.checksum_ += this.color_;
|
||||
} else {
|
||||
this.checksum_ += ol.getUid(this.color_).toString();
|
||||
}
|
||||
} else {
|
||||
this.checksum_ += '-';
|
||||
}
|
||||
this.checksum_ += ',' +
|
||||
(this.lineCap_ !== undefined ?
|
||||
this.lineCap_.toString() : '-') + ',' +
|
||||
(this.lineDash_ ?
|
||||
|
||||
Reference in New Issue
Block a user