mirror of
https://github.com/konvajs/konva.git
synced 2025-04-30 08:20:03 +08:00
shadow blur fix
This commit is contained in:
parent
b855765736
commit
a498609412
2
konva.js
2
konva.js
@ -2082,7 +2082,7 @@
|
||||
scaleY = scale.y * ratio;
|
||||
|
||||
this.setAttr('shadowColor', color);
|
||||
this.setAttr('shadowBlur', blur * ratio);
|
||||
this.setAttr('shadowBlur', blur * ratio * Math.min(scaleX, scaleY));
|
||||
this.setAttr('shadowOffsetX', offset.x * scaleX);
|
||||
this.setAttr('shadowOffsetY', offset.y * scaleY);
|
||||
}
|
||||
|
2
konva.min.js
vendored
2
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -584,7 +584,7 @@
|
||||
scaleY = scale.y * ratio;
|
||||
|
||||
this.setAttr('shadowColor', color);
|
||||
this.setAttr('shadowBlur', blur * ratio);
|
||||
this.setAttr('shadowBlur', blur * ratio * Math.min(scaleX, scaleY));
|
||||
this.setAttr('shadowOffsetX', offset.x * scaleX);
|
||||
this.setAttr('shadowOffsetY', offset.y * scaleY);
|
||||
}
|
||||
|
@ -1170,4 +1170,47 @@ suite('Shape', function() {
|
||||
});
|
||||
|
||||
|
||||
test('text shadow blur should take scale into account', function() {
|
||||
var stage = addStage();
|
||||
var layer1 = new Konva.Layer();
|
||||
stage.add(layer1);
|
||||
|
||||
var rect1 = new Konva.Rect({
|
||||
x: 10,
|
||||
y: 10,
|
||||
scaleX: 0.5,
|
||||
scaleY: 0.5,
|
||||
width: 80, height: 80,
|
||||
fill: 'black',
|
||||
shadowColor: 'black',
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 50,
|
||||
shadowBlur: 10
|
||||
});
|
||||
layer1.add(rect1);
|
||||
stage.add(layer1);
|
||||
|
||||
|
||||
var layer2 = new Konva.Layer();
|
||||
stage.add(layer2);
|
||||
|
||||
var rect2 = new Konva.Rect({
|
||||
x: 10,
|
||||
y: 10,
|
||||
fill: 'black',
|
||||
width: 40, height: 40,
|
||||
shadowColor: 'black',
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 25,
|
||||
shadowBlur: 5
|
||||
});
|
||||
layer2.add(rect2);
|
||||
stage.add(layer2);
|
||||
|
||||
if (!window.isPhantomJS) {
|
||||
compareLayers(layer1, layer2, 30);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user