mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 09:48:30 +08:00
Another fix for exporting buffered shapes
This commit is contained in:
parent
1e2c28738b
commit
4da037a2fa
@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
### 9.3.3 (2024-02-09)
|
||||||
|
|
||||||
|
- Another fix for exporting buffered shapes
|
||||||
|
|
||||||
### 9.3.2 (2024-01-26)
|
### 9.3.2 (2024-01-26)
|
||||||
|
|
||||||
- Fix large memory usage on node export
|
- Fix large memory usage on node export
|
||||||
|
@ -1935,8 +1935,9 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
|||||||
const bufferCanvas = new SceneCanvas({
|
const bufferCanvas = new SceneCanvas({
|
||||||
// width and height already multiplied by pixelRatio
|
// width and height already multiplied by pixelRatio
|
||||||
// so we need to revert that
|
// so we need to revert that
|
||||||
width: canvas.width / canvas.pixelRatio,
|
// also increase size by x nd y offset to make sure content fits canvas
|
||||||
height: canvas.height / canvas.pixelRatio,
|
width: canvas.width / canvas.pixelRatio + Math.abs(x),
|
||||||
|
height: canvas.height / canvas.pixelRatio + Math.abs(y),
|
||||||
pixelRatio: canvas.pixelRatio,
|
pixelRatio: canvas.pixelRatio,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1514,6 +1514,42 @@ describe('Shape', function () {
|
|||||||
compareCanvases(canvas2, canvas1, 255, 10);
|
compareCanvases(canvas2, canvas1, 255, 10);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('export when buffer canvas is used should handle scaling correctly another time', async function () {
|
||||||
|
var stage = addStage();
|
||||||
|
|
||||||
|
var layer = new Konva.Layer();
|
||||||
|
stage.add(layer);
|
||||||
|
|
||||||
|
var group = new Konva.Group({
|
||||||
|
x: 400,
|
||||||
|
});
|
||||||
|
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, 240, 110);
|
||||||
|
});
|
||||||
|
|
||||||
// ======================================================
|
// ======================================================
|
||||||
it('optional disable shadow for stroke', function () {
|
it('optional disable shadow for stroke', function () {
|
||||||
var stage = addStage();
|
var stage = addStage();
|
||||||
|
Loading…
Reference in New Issue
Block a user