fix buffer export

This commit is contained in:
Anton Lavrenov
2024-01-17 19:12:49 -05:00
parent a1660e1ccb
commit 0d502baccd
5 changed files with 57 additions and 22 deletions

View File

@@ -12,6 +12,7 @@ import {
compareLayers,
loadImage,
Konva,
compareCanvases,
} from './test-utils';
describe('Shape', function () {
@@ -1479,6 +1480,40 @@ describe('Shape', function () {
}
});
it('export when buffer canvas is used should handle scaling correctly', async function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
var group = new Konva.Group();
layer.add(group);
var text = new Konva.Text({
text: 'hello',
fontSize: 300,
fill: 'green',
shadowColor: 'black',
});
group.add(text);
const canvas1 = group.toCanvas({
x: group.x(),
y: group.y(),
width: text.width(),
height: text.height(),
});
text.stroke('transparent');
const canvas2 = group.toCanvas({
x: group.x(),
y: group.y(),
width: text.width(),
height: text.height(),
});
compareCanvases(canvas2, canvas1, 255, 10);
});
// ======================================================
it('optional disable shadow for stroke', function () {
var stage = addStage();