Merge branch 'konvajs:master' into fix/corner-radius-negative-dimensions

This commit is contained in:
Caden Hornyak 2025-07-23 12:44:20 -07:00 committed by GitHub
commit 33e5ddf4ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 59 additions and 7 deletions

View File

@ -3,12 +3,18 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## 9.3.21 (not released)
## 9.3.22 (2025-07-08)
- Fixed possible crash on `node.to()` method
## 9.3.21 (2025-07-07)
- Fixed memory leaks on Tween destroy
- Fixed incorrect export of stage/layer when internal nodes used buffer canvas for rendering
- Fixed incorrect render of cached node when buffer canvas is used
- Fixed incorrect path lenth calculations
- Fixed `pointerleave` bubbling
- Added `pointerleave` event in `Stage`
## 9.3.20 (2025-03-20)

View File

@ -1,6 +1,6 @@
{
"name": "konva",
"version": "9.3.20",
"version": "9.3.22",
"description": "HTML5 2d canvas library.",
"author": "Anton Lavrenov",
"files": [

View File

@ -58,6 +58,7 @@ const STAGE = 'Stage',
[POINTERMOVE, '_pointermove'],
[POINTERUP, '_pointerup'],
[POINTERCANCEL, '_pointercancel'],
[POINTERLEAVE, '_pointerleave'],
[LOSTPOINTERCAPTURE, '_lostpointercapture'],
];

View File

@ -530,11 +530,13 @@ export class Tween {
delete Tween.attrs[nodeId][thisId];
// Clean up parent objects if empty
if (Object.keys(Tween.tweens[nodeId]).length === 0) {
delete Tween.tweens[nodeId];
}
if (Object.keys(Tween.attrs[nodeId]).length === 0) {
delete Tween.attrs[nodeId];
if (Tween.tweens[nodeId]) {
if (Object.keys(Tween.tweens[nodeId]).length === 0) {
delete Tween.tweens[nodeId];
}
if (Object.keys(Tween.attrs[nodeId]).length === 0) {
delete Tween.attrs[nodeId];
}
}
}
}

View File

@ -1223,6 +1223,19 @@ describe('Stage', function () {
assert.equal(count, 2);
});
it('stage pointerleave should fire when leaving stage', function () {
var stage = addStage();
var stageLeave = 0;
stage.on('pointerleave', function () {
stageLeave += 1;
});
stage.fire('pointerleave', undefined, false);
assert.equal(stageLeave, 1, 'stage pointerleave should fire');
});
it('stage pointerleave should not fire when leaving a child', function () {
var stage = addStage();
var layer = new Konva.Layer();

View File

@ -257,6 +257,34 @@ describe('Tween', function () {
});
});
it('to method double simple usage', function (done) {
var stage = addStage();
let finishCount = 0;
const onFinish = () => {
if (finishCount === 2) {
done();
}
};
stage.to({
x: 10,
duration: 0.001,
onFinish: () => {
assert(stage.x() === 10);
finishCount += 1;
onFinish();
},
});
stage.to({
y: 10,
duration: 0.001,
onFinish: () => {
finishCount += 1;
onFinish();
},
});
});
it('tween to call update callback', function (done) {
var stage = addStage();
var updateCount = 0;
@ -303,6 +331,8 @@ describe('Tween', function () {
line.to({
points: [100, 100, 200, 100, 200, 200, 100, 200],
// add another attribute for better test of cleanup
x: 10,
duration: 0.1,
onFinish: function () {
assert.deepEqual(