mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
fixed up some text shadow issues
This commit is contained in:
@@ -136,26 +136,26 @@ Kinetic.Text.prototype = {
|
||||
};
|
||||
},
|
||||
fillText: function(context, text, skipShadow) {
|
||||
var textFill = this.getTextFill(), shadow = this.getShadow();
|
||||
var textFill = this.getTextFill(), textShadow = this.getTextShadow();
|
||||
if(textFill) {
|
||||
context.save();
|
||||
if(!skipShadow && shadow) {
|
||||
if(!skipShadow && textShadow) {
|
||||
this._applyTextShadow(context);
|
||||
}
|
||||
context.fillStyle = textFill;
|
||||
context.fillText(text, 0, 0);
|
||||
context.restore();
|
||||
|
||||
if(!skipShadow && shadow && shadow.opacity) {
|
||||
if(!skipShadow && textShadow && textShadow.opacity) {
|
||||
this.fillText(context, text, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
strokeText: function(context, text, skipShadow) {
|
||||
var textStroke = this.getTextStroke(), textStrokeWidth = this.getTextStrokeWidth(), shadow = this.getShadow();
|
||||
var textStroke = this.getTextStroke(), textStrokeWidth = this.getTextStrokeWidth(), textShadow = this.getTextShadow();
|
||||
if(textStroke || textStrokeWidth) {
|
||||
context.save();
|
||||
if(!skipShadow && shadow) {
|
||||
if(!skipShadow && textShadow) {
|
||||
this._applyTextShadow(context);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ Kinetic.Text.prototype = {
|
||||
context.strokeText(text, 0, 0);
|
||||
context.restore();
|
||||
|
||||
if(!skipShadow && shadow && shadow.opacity) {
|
||||
if(!skipShadow && textShadow && textShadow.opacity) {
|
||||
this.strokeText(context, text, true);
|
||||
}
|
||||
}
|
||||
|
@@ -303,9 +303,10 @@ Kinetic.Global.extend(Kinetic.TextPath, Kinetic.Shape);
|
||||
|
||||
// add setters and getters
|
||||
Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fontStyle', 'textFill', 'textStroke', 'textStrokeWidth']);
|
||||
Kinetic.Node.addGetters(Kinetic.TextPath, ['text']);
|
||||
Kinetic.Node.addGetters(Kinetic.TextPath, ['text', 'textShadow']);
|
||||
|
||||
// reference Text methods
|
||||
Kinetic.TextPath.prototype.setTextShadow = Kinetic.Text.prototype.setTextShadow;
|
||||
Kinetic.TextPath.prototype.fillText = Kinetic.Text.prototype.fillText;
|
||||
Kinetic.TextPath.prototype.strokeText = Kinetic.Text.prototype.strokeText;
|
||||
Kinetic.TextPath.prototype.fillStrokeText = Kinetic.Text.prototype.strokeText;
|
||||
|
Reference in New Issue
Block a user