Fixed order of shadow fills.

This commit is contained in:
photonstorm 2017-03-20 16:48:04 +00:00
parent 741b93dbfe
commit 808e53f645
3 changed files with 22 additions and 11 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: '0f082750-0d8a-11e7-b206-7db386f7c304'
build: 'd02c5bc0-0d8c-11e7-bd94-817b24a2ca5b'
};
module.exports = CHECKSUM;

View file

@ -70,24 +70,24 @@ var TextStyle = new Class({
context.lineJoin = 'round';
},
syncShadow: function (context, reset)
syncShadow: function (context, enabled)
{
var style = this;
if (reset)
{
context.shadowOffsetX = 0;
context.shadowOffsetY = 0;
context.shadowColor = 0;
context.shadowBlur = 0;
}
else
if (enabled)
{
context.shadowOffsetX = style.shadowOffsetX;
context.shadowOffsetY = style.shadowOffsetY;
context.shadowColor = style.shadowColor;
context.shadowBlur = style.shadowBlur;
}
else
{
context.shadowOffsetX = 0;
context.shadowOffsetY = 0;
context.shadowColor = 0;
context.shadowBlur = 0;
}
},
update: function (recalculateMetrics)
@ -169,6 +169,7 @@ var TextStyle = new Class({
setShadow: function (x, y, color, blur, shadowStroke, shadowFill)
{
if (x === undefined) { x = 0; }
if (y === undefined) { y = 0; }
if (color === undefined) { color = '#000'; }
if (blur === undefined) { blur = 0; }

View file

@ -56,7 +56,7 @@ var Text = new Class({
*/
this.splitRegExp = /(?:\r\n|\r|\n)/;
this.text = text;
this.text = (Array.isArray(text)) ? text.join('\n') : text;
this.resolution = 1;
@ -73,9 +73,15 @@ var Text = new Class({
setText: function (value)
{
if (Array.isArray(value))
{
value = value.join('\n');
}
if (value !== this.text)
{
this.text = value;
this.updateText();
}
@ -191,6 +197,10 @@ var Text = new Class({
canvas.width = w;
canvas.height = h;
}
else
{
context.clearRect(0, 0, w, h);
}
if (style.backgroundColor)
{