konva 8.3.13 → 8.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cmj/Canvas.js +1 -0
- package/cmj/Context.d.ts +5 -0
- package/cmj/Context.js +1 -0
- package/cmj/Global.d.ts +1 -0
- package/cmj/Global.js +2 -1
- package/cmj/Layer.d.ts +1 -0
- package/cmj/Layer.js +4 -0
- package/cmj/Node.js +6 -1
- package/cmj/Stage.js +1 -0
- package/cmj/Util.d.ts +1 -0
- package/cmj/Util.js +8 -0
- package/cmj/_CoreInternals.d.ts +2 -0
- package/cmj/_FullInternals.d.ts +2 -0
- package/cmj/filters/Kaleidoscope.js +1 -0
- package/cmj/shapes/TextPath.d.ts +1 -0
- package/cmj/shapes/TextPath.js +4 -0
- package/konva.js +39 -4
- package/konva.min.js +3 -3
- package/lib/Canvas.js +1 -0
- package/lib/Context.d.ts +5 -0
- package/lib/Context.js +1 -0
- package/lib/Global.d.ts +1 -0
- package/lib/Global.js +2 -1
- package/lib/Layer.d.ts +1 -0
- package/lib/Layer.js +4 -0
- package/lib/Node.js +6 -1
- package/lib/Stage.js +1 -0
- package/lib/Util.d.ts +1 -0
- package/lib/Util.js +8 -0
- package/lib/_CoreInternals.d.ts +2 -0
- package/lib/_FullInternals.d.ts +2 -0
- package/lib/filters/Kaleidoscope.js +1 -0
- package/lib/shapes/TextPath.d.ts +1 -0
- package/lib/shapes/TextPath.js +4 -0
- package/package.json +1 -1
package/lib/Canvas.js
CHANGED
package/lib/Context.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Canvas } from './Canvas';
|
|
2
2
|
import { Shape } from './Shape';
|
|
3
|
+
declare var CONTEXT_PROPERTIES: readonly ["fillStyle", "strokeStyle", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "lineCap", "lineDashOffset", "lineJoin", "lineWidth", "miterLimit", "font", "textAlign", "textBaseline", "globalAlpha", "globalCompositeOperation", "imageSmoothingEnabled"];
|
|
3
4
|
export declare class Context {
|
|
4
5
|
canvas: Canvas;
|
|
5
6
|
_context: CanvasRenderingContext2D;
|
|
@@ -59,6 +60,9 @@ export declare class Context {
|
|
|
59
60
|
_enableTrace(): void;
|
|
60
61
|
_applyGlobalCompositeOperation(node: any): void;
|
|
61
62
|
}
|
|
63
|
+
declare type CanvasContextProps = Pick<CanvasRenderingContext2D, typeof CONTEXT_PROPERTIES[number]>;
|
|
64
|
+
export interface Context extends CanvasContextProps {
|
|
65
|
+
}
|
|
62
66
|
export declare class SceneContext extends Context {
|
|
63
67
|
constructor(canvas: Canvas);
|
|
64
68
|
_fillColor(shape: Shape): void;
|
|
@@ -76,3 +80,4 @@ export declare class HitContext extends Context {
|
|
|
76
80
|
strokeShape(shape: Shape): void;
|
|
77
81
|
_stroke(shape: any): void;
|
|
78
82
|
}
|
|
83
|
+
export {};
|
package/lib/Context.js
CHANGED
package/lib/Global.d.ts
CHANGED
package/lib/Global.js
CHANGED
|
@@ -13,7 +13,7 @@ export const glob = typeof global !== 'undefined'
|
|
|
13
13
|
: {};
|
|
14
14
|
export const Konva = {
|
|
15
15
|
_global: glob,
|
|
16
|
-
version: '8.3.
|
|
16
|
+
version: '8.3.14',
|
|
17
17
|
isBrowser: detectBrowser(),
|
|
18
18
|
isUnminified: /param/.test(function (param) { }.toString()),
|
|
19
19
|
dblClickWindow: 400,
|
|
@@ -45,6 +45,7 @@ export const Konva = {
|
|
|
45
45
|
isDragReady() {
|
|
46
46
|
return !!Konva['DD'].node;
|
|
47
47
|
},
|
|
48
|
+
releaseCanvasOnDestroy: true,
|
|
48
49
|
document: glob.document,
|
|
49
50
|
_injectGlobal(Konva) {
|
|
50
51
|
glob.Konva = Konva;
|
package/lib/Layer.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export declare class Layer extends Container<Group | Shape> {
|
|
|
54
54
|
setHitGraphEnabled(val: any): void;
|
|
55
55
|
getHitGraphEnabled(val: any): boolean;
|
|
56
56
|
toggleHitCanvas(): void;
|
|
57
|
+
destroy(): this;
|
|
57
58
|
hitGraphEnabled: GetSet<boolean, this>;
|
|
58
59
|
clearBeforeDraw: GetSet<boolean, this>;
|
|
59
60
|
imageSmoothingEnabled: GetSet<boolean, this>;
|
package/lib/Layer.js
CHANGED
|
@@ -293,6 +293,10 @@ export class Layer extends Container {
|
|
|
293
293
|
parent.content.appendChild(this.hitCanvas._canvas);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
+
destroy() {
|
|
297
|
+
Util.releaseCanvas(this.getNativeCanvasElement(), this.getHitCanvas()._canvas);
|
|
298
|
+
return super.destroy();
|
|
299
|
+
}
|
|
296
300
|
}
|
|
297
301
|
Layer.prototype.nodeType = 'Layer';
|
|
298
302
|
_registerNode(Layer);
|
package/lib/Node.js
CHANGED
|
@@ -82,7 +82,11 @@ export class Node {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
clearCache() {
|
|
85
|
-
this._cache.
|
|
85
|
+
if (this._cache.has(CANVAS)) {
|
|
86
|
+
const { scene, filter, hit } = this._cache.get(CANVAS);
|
|
87
|
+
Util.releaseCanvas(scene, filter, hit);
|
|
88
|
+
this._cache.delete(CANVAS);
|
|
89
|
+
}
|
|
86
90
|
this._clearSelfAndDescendantCache();
|
|
87
91
|
this._requestDraw();
|
|
88
92
|
return this;
|
|
@@ -350,6 +354,7 @@ export class Node {
|
|
|
350
354
|
}
|
|
351
355
|
destroy() {
|
|
352
356
|
this.remove();
|
|
357
|
+
this.clearCache();
|
|
353
358
|
return this;
|
|
354
359
|
}
|
|
355
360
|
getAttr(attr) {
|
package/lib/Stage.js
CHANGED
package/lib/Util.d.ts
CHANGED
package/lib/Util.js
CHANGED
|
@@ -740,4 +740,12 @@ export const Util = {
|
|
|
740
740
|
return evt.changedTouches[0].identifier;
|
|
741
741
|
}
|
|
742
742
|
},
|
|
743
|
+
releaseCanvas(...canvases) {
|
|
744
|
+
if (!Konva.releaseCanvasOnDestroy)
|
|
745
|
+
return;
|
|
746
|
+
canvases.forEach(c => {
|
|
747
|
+
c.width = 0;
|
|
748
|
+
c.height = 0;
|
|
749
|
+
});
|
|
750
|
+
}
|
|
743
751
|
};
|
package/lib/_CoreInternals.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare const Konva: {
|
|
|
38
38
|
dragButtons: number[];
|
|
39
39
|
isDragging(): any;
|
|
40
40
|
isDragReady(): boolean;
|
|
41
|
+
releaseCanvasOnDestroy: boolean;
|
|
41
42
|
document: any;
|
|
42
43
|
_injectGlobal(Konva: any): void;
|
|
43
44
|
} & {
|
|
@@ -93,6 +94,7 @@ export declare const Konva: {
|
|
|
93
94
|
_prepareToStringify(obj: any): any;
|
|
94
95
|
_assign<T, U>(target: T, source: U): T & U;
|
|
95
96
|
_getFirstPointerId(evt: any): any;
|
|
97
|
+
releaseCanvas(...canvases: HTMLCanvasElement[]): void;
|
|
96
98
|
};
|
|
97
99
|
Transform: typeof Transform;
|
|
98
100
|
Node: typeof Node;
|
package/lib/_FullInternals.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare const Konva: {
|
|
|
43
43
|
dragButtons: number[];
|
|
44
44
|
isDragging(): any;
|
|
45
45
|
isDragReady(): boolean;
|
|
46
|
+
releaseCanvasOnDestroy: boolean;
|
|
46
47
|
document: any;
|
|
47
48
|
_injectGlobal(Konva: any): void;
|
|
48
49
|
} & {
|
|
@@ -98,6 +99,7 @@ export declare const Konva: {
|
|
|
98
99
|
_prepareToStringify(obj: any): any;
|
|
99
100
|
_assign<T, U>(target: T, source: U): T & U;
|
|
100
101
|
_getFirstPointerId(evt: any): any;
|
|
102
|
+
releaseCanvas(...canvases: HTMLCanvasElement[]): void;
|
|
101
103
|
};
|
|
102
104
|
Transform: typeof import("./Util").Transform;
|
|
103
105
|
Node: typeof import("./Node").Node;
|
|
@@ -76,6 +76,7 @@ export const Kaleidoscope = function (imageData) {
|
|
|
76
76
|
var scratchData = tempCanvas
|
|
77
77
|
.getContext('2d')
|
|
78
78
|
.getImageData(0, 0, xSize, ySize);
|
|
79
|
+
Util.releaseCanvas(tempCanvas);
|
|
79
80
|
ToPolar(imageData, scratchData, {
|
|
80
81
|
polarCenterX: xSize / 2,
|
|
81
82
|
polarCenterY: ySize / 2,
|
package/lib/shapes/TextPath.d.ts
CHANGED
package/lib/shapes/TextPath.js
CHANGED
|
@@ -322,6 +322,10 @@ export class TextPath extends Shape {
|
|
|
322
322
|
height: maxY - minY + fontSize,
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
|
+
destroy() {
|
|
326
|
+
Util.releaseCanvas(this.dummyCanvas);
|
|
327
|
+
return super.destroy();
|
|
328
|
+
}
|
|
325
329
|
}
|
|
326
330
|
TextPath.prototype._fillFunc = _fillFunc;
|
|
327
331
|
TextPath.prototype._strokeFunc = _strokeFunc;
|