mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 18:46:08 +08:00
fix fillPattern cache
This commit is contained in:
parent
0357a1e7b4
commit
08c8a78451
@ -3,6 +3,10 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 8.1.3
|
||||
|
||||
- Fix `fillPattern` cache invalidation on shapes
|
||||
|
||||
## 8.1.2
|
||||
|
||||
- Fix memory leak for `Konva.Image`
|
||||
|
5
konva.js
5
konva.js
@ -7096,7 +7096,7 @@
|
||||
Shape.prototype.eventListeners = {};
|
||||
Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearHasShadowCache);
|
||||
Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearGetShadowRGBACache);
|
||||
Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetX.konva fillPatternOffsetY.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotation.konva', _clearFillPatternCache);
|
||||
Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva', _clearFillPatternCache);
|
||||
Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva', _clearLinearGradientCache);
|
||||
Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva', _clearRadialGradientCache);
|
||||
// add getters and setters
|
||||
@ -11586,6 +11586,8 @@
|
||||
}
|
||||
_setImageLoad() {
|
||||
const image = this.image();
|
||||
console.log(image && image.complete);
|
||||
console.log(image && image.readyState === 4);
|
||||
// check is image is already loaded
|
||||
if (image && image.complete) {
|
||||
return;
|
||||
@ -11596,6 +11598,7 @@
|
||||
}
|
||||
if (image && image['addEventListener']) {
|
||||
image['addEventListener']('load', () => {
|
||||
console.log('onload');
|
||||
this._requestDraw();
|
||||
});
|
||||
}
|
||||
|
2
konva.min.js
vendored
2
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -848,7 +848,7 @@ Shape.prototype.on.call(
|
||||
|
||||
Shape.prototype.on.call(
|
||||
Shape.prototype,
|
||||
'fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetX.konva fillPatternOffsetY.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotation.konva',
|
||||
'fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva',
|
||||
_clearFillPatternCache
|
||||
);
|
||||
|
||||
|
@ -142,7 +142,7 @@ describe('AutoDraw', function () {
|
||||
) as HTMLImageElement;
|
||||
|
||||
const img = new Image();
|
||||
img.src = src;
|
||||
img.src = src + '?'; // change url to reset cache
|
||||
const image = new Konva.Image({
|
||||
image: img,
|
||||
});
|
||||
|
@ -1860,6 +1860,12 @@ describe('Shape', function () {
|
||||
|
||||
assert.notEqual(pattern4, pattern3);
|
||||
|
||||
star.fillPatternOffsetX(10);
|
||||
|
||||
var pattern5 = star._getFillPattern();
|
||||
|
||||
assert.notEqual(pattern4, pattern5);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ function simulateMouseUp(tr: Transformer, pos = { x: 0, y: 0 }) {
|
||||
su(tr.getStage(), pos || { x: 1, y: 1 });
|
||||
}
|
||||
|
||||
describe.only('Transformer', function () {
|
||||
describe('Transformer', function () {
|
||||
// ======================================================
|
||||
it('init transformer on simple rectangle', function () {
|
||||
var stage = addStage();
|
||||
@ -4025,7 +4025,6 @@ describe.only('Transformer', function () {
|
||||
// make sure drag also triggers on the transformer.
|
||||
tr.on('dragstart', (e) => {
|
||||
assert.equal(!!e.evt, true);
|
||||
console.log('transfomer');
|
||||
dragstart += 1;
|
||||
});
|
||||
tr.on('dragmove', () => {
|
||||
@ -4040,7 +4039,6 @@ describe.only('Transformer', function () {
|
||||
stage.on('dragstart', (e) => {
|
||||
assert.equal(!!e.evt, true);
|
||||
dragstart += 1;
|
||||
console.log('stage', e.target);
|
||||
});
|
||||
|
||||
layer.add(tr);
|
||||
|
Loading…
Reference in New Issue
Block a user