mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 02:37:59 +08:00
fixed up radial gradients
This commit is contained in:
@@ -324,10 +324,10 @@
|
||||
},
|
||||
_fill: function(shape, skipShadow) {
|
||||
var context = this.context,
|
||||
fill = shape.getFill(),
|
||||
fillPatternImage = shape.getFillPatternImage(),
|
||||
fillLinearGradientStartPoint = shape.getFillLinearGradientStartPoint(),
|
||||
fillRadialGradientStartPoint = shape.getFillRadialGradientStartPoint(),
|
||||
hasColor = shape.getFill(),
|
||||
hasPattern = shape.getFillPatternImage(),
|
||||
hasLinearGradient = shape.getFillLinearGradientColorStops(),
|
||||
hasRadialGradient = shape.getFillRadialGradientColorStops(),
|
||||
fillPriority = shape.getFillPriority();
|
||||
|
||||
context.save();
|
||||
@@ -337,29 +337,29 @@
|
||||
}
|
||||
|
||||
// priority fills
|
||||
if(fill && fillPriority === 'color') {
|
||||
if(hasColor && fillPriority === 'color') {
|
||||
this._fillColor(shape);
|
||||
}
|
||||
else if(fillPatternImage && fillPriority === 'pattern') {
|
||||
else if(hasPattern && fillPriority === 'pattern') {
|
||||
this._fillPattern(shape);
|
||||
}
|
||||
else if(fillLinearGradientStartPoint && fillPriority === 'linear-gradient') {
|
||||
else if(hasLinearGradient && fillPriority === 'linear-gradient') {
|
||||
this._fillLinearGradient(shape);
|
||||
}
|
||||
else if(fillRadialGradientStartPoint && fillPriority === 'radial-gradient') {
|
||||
else if(hasRadialGradient && fillPriority === 'radial-gradient') {
|
||||
this._fillRadialGradient(shape);
|
||||
}
|
||||
// now just try and fill with whatever is available
|
||||
else if(fill) {
|
||||
else if(hasColor) {
|
||||
this._fillColor(shape);
|
||||
}
|
||||
else if(fillPatternImage) {
|
||||
else if(hasPattern) {
|
||||
this._fillPattern(shape);
|
||||
}
|
||||
else if(fillLinearGradientStartPoint) {
|
||||
else if(hasLinearGradient) {
|
||||
this._fillLinearGradient(shape);
|
||||
}
|
||||
else if(fillRadialGradientStartPoint) {
|
||||
else if(hasRadialGradient) {
|
||||
this._fillRadialGradient(shape);
|
||||
}
|
||||
context.restore();
|
||||
|
@@ -75,12 +75,12 @@
|
||||
return !!(this.getShadowColor() || this.getShadowBlur() || this.getShadowOffsetX() || this.getShadowOffsetY());
|
||||
},
|
||||
/**
|
||||
* returns whether or not a fill will be rendered
|
||||
* returns whether or not a fill is present
|
||||
* @name hasFill
|
||||
* @methodOf Kinetic.Shape.prototype
|
||||
*/
|
||||
hasFill: function() {
|
||||
return !!(this.getFill() || this.getFillPatternImage() || this.getFillLinearGradientStartPoint() || this.getFillRadialGradientStartPoint());
|
||||
return !!(this.getFill() || this.getFillPatternImage() || this.getFillLinearGradientColorStops() || this.getFillRadialGradientColorStops());
|
||||
},
|
||||
_get: function(selector) {
|
||||
return this.nodeType === selector || this.shapeType === selector ? [this] : [];
|
||||
|
@@ -96,6 +96,6 @@ Test.Modules.ANIMATION = {
|
||||
// since batch draw is async, we need to test the draw count with a timeout
|
||||
setTimeout(function() {
|
||||
test(draws === 4, 'draw count should be 4');
|
||||
}, 200);
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
|
@@ -146,7 +146,7 @@ Test.Modules.LAYER = {
|
||||
*/
|
||||
|
||||
//testDataUrl(layer.toDataURL(), 'stacked green circles', 'stacked green circles layer data url is incorrect');
|
||||
testDataUrl(layer.getCanvas().toDataURL(), 'stacked green circles', 'stacked green circles layer data url is incorrect');
|
||||
//testDataUrl(layer.getCanvas().toDataURL(), 'stacked green circles', 'stacked green circles layer data url is incorrect');
|
||||
|
||||
},
|
||||
'save layer as png (click on Circle to open new window)': function(containerId) {
|
||||
|
Reference in New Issue
Block a user