fixed up some text shadow issues

This commit is contained in:
Eric Rowell
2012-11-24 09:15:02 -08:00
parent 0e514f7810
commit 0e6eb3ffe4
8 changed files with 16 additions and 19 deletions

View File

@@ -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);
}
}

View File

@@ -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;