konva 9.2.0 → 9.2.2
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/README.md +2 -2
- package/konva.js +270 -663
- package/konva.min.js +3 -3
- package/lib/Animation.d.ts +4 -4
- package/lib/Animation.js +27 -26
- package/lib/Container.d.ts +7 -6
- package/lib/Container.js +2 -3
- package/lib/Context.d.ts +29 -26
- package/lib/Context.js +53 -51
- package/lib/DragAndDrop.d.ts +2 -2
- package/lib/Factory.d.ts +2 -1
- package/lib/Global.d.ts +3 -3
- package/lib/Global.js +2 -2
- package/lib/Layer.d.ts +4 -4
- package/lib/Node.d.ts +15 -15
- package/lib/Node.js +15 -12
- package/lib/PointerEvents.d.ts +1 -1
- package/lib/Shape.d.ts +4 -4
- package/lib/Shape.js +9 -4
- package/lib/Stage.d.ts +10 -10
- package/lib/Stage.js +24 -21
- package/lib/Tween.d.ts +3 -3
- package/lib/Util.d.ts +58 -18
- package/lib/Util.js +7 -3
- package/lib/Validators.d.ts +9 -9
- package/lib/_CoreInternals.d.ts +62 -22
- package/lib/_FullInternals.d.ts +62 -22
- package/lib/filters/Blur.js +49 -512
- package/lib/shapes/Path.d.ts +6 -6
- package/lib/shapes/Path.js +1 -1
- package/lib/shapes/RegularPolygon.d.ts +4 -4
- package/lib/shapes/Text.d.ts +3 -0
- package/lib/shapes/Text.js +21 -3
- package/lib/shapes/TextPath.d.ts +6 -5
- package/lib/shapes/Transformer.d.ts +4 -2
- package/lib/shapes/Transformer.js +21 -14
- package/lib/types.d.ts +1 -1
- package/package.json +9 -9
package/lib/Animation.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ export declare class Animation {
|
|
|
6
6
|
layers: Layer[];
|
|
7
7
|
frame: IFrame;
|
|
8
8
|
constructor(func: AnimationFn, layers?: any);
|
|
9
|
-
setLayers(layers:
|
|
9
|
+
setLayers(layers: null | Layer | Layer[]): this;
|
|
10
10
|
getLayers(): Layer[];
|
|
11
|
-
addLayer(layer:
|
|
11
|
+
addLayer(layer: Layer): boolean;
|
|
12
12
|
isRunning(): boolean;
|
|
13
13
|
start(): this;
|
|
14
14
|
stop(): this;
|
|
15
|
-
_updateFrameObject(time:
|
|
16
|
-
static animations:
|
|
15
|
+
_updateFrameObject(time: number): void;
|
|
16
|
+
static animations: Array<Animation>;
|
|
17
17
|
static animIdCounter: number;
|
|
18
18
|
static animRunning: boolean;
|
|
19
19
|
static _addAnimation(anim: any): void;
|
package/lib/Animation.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Animation = void 0;
|
|
4
4
|
const Global_1 = require("./Global");
|
|
5
5
|
const Util_1 = require("./Util");
|
|
6
|
-
|
|
6
|
+
const now = (function () {
|
|
7
7
|
if (Global_1.glob.performance && Global_1.glob.performance.now) {
|
|
8
8
|
return function () {
|
|
9
9
|
return Global_1.glob.performance.now();
|
|
@@ -26,15 +26,9 @@ class Animation {
|
|
|
26
26
|
this.setLayers(layers);
|
|
27
27
|
}
|
|
28
28
|
setLayers(layers) {
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
lays = [];
|
|
32
|
-
}
|
|
33
|
-
else if (layers.length > 0) {
|
|
34
|
-
lays = layers;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
lays = [layers];
|
|
29
|
+
let lays = [];
|
|
30
|
+
if (layers) {
|
|
31
|
+
lays = Array.isArray(layers) ? layers : [layers];
|
|
38
32
|
}
|
|
39
33
|
this.layers = lays;
|
|
40
34
|
return this;
|
|
@@ -43,8 +37,9 @@ class Animation {
|
|
|
43
37
|
return this.layers;
|
|
44
38
|
}
|
|
45
39
|
addLayer(layer) {
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const layers = this.layers;
|
|
41
|
+
const len = layers.length;
|
|
42
|
+
for (let n = 0; n < len; n++) {
|
|
48
43
|
if (layers[n]._id === layer._id) {
|
|
49
44
|
return false;
|
|
50
45
|
}
|
|
@@ -53,8 +48,10 @@ class Animation {
|
|
|
53
48
|
return true;
|
|
54
49
|
}
|
|
55
50
|
isRunning() {
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
const a = Animation;
|
|
52
|
+
const animations = a.animations;
|
|
53
|
+
const len = animations.length;
|
|
54
|
+
for (let n = 0; n < len; n++) {
|
|
58
55
|
if (animations[n].id === this.id) {
|
|
59
56
|
return true;
|
|
60
57
|
}
|
|
@@ -83,8 +80,10 @@ class Animation {
|
|
|
83
80
|
this._handleAnimation();
|
|
84
81
|
}
|
|
85
82
|
static _removeAnimation(anim) {
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
const id = anim.id;
|
|
84
|
+
const animations = this.animations;
|
|
85
|
+
const len = animations.length;
|
|
86
|
+
for (let n = 0; n < len; n++) {
|
|
88
87
|
if (animations[n].id === id) {
|
|
89
88
|
this.animations.splice(n, 1);
|
|
90
89
|
break;
|
|
@@ -92,13 +91,15 @@ class Animation {
|
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
static _runFrames() {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
const layerHash = {};
|
|
95
|
+
const animations = this.animations;
|
|
96
|
+
for (let n = 0; n < animations.length; n++) {
|
|
97
|
+
const anim = animations[n];
|
|
98
|
+
const layers = anim.layers;
|
|
99
|
+
const func = anim.func;
|
|
100
100
|
anim._updateFrameObject(now());
|
|
101
|
-
layersLen = layers.length;
|
|
101
|
+
const layersLen = layers.length;
|
|
102
|
+
let needRedraw;
|
|
102
103
|
if (func) {
|
|
103
104
|
needRedraw = func.call(anim, anim.frame) !== false;
|
|
104
105
|
}
|
|
@@ -108,14 +109,14 @@ class Animation {
|
|
|
108
109
|
if (!needRedraw) {
|
|
109
110
|
continue;
|
|
110
111
|
}
|
|
111
|
-
for (i = 0; i < layersLen; i++) {
|
|
112
|
-
layer = layers[i];
|
|
112
|
+
for (let i = 0; i < layersLen; i++) {
|
|
113
|
+
const layer = layers[i];
|
|
113
114
|
if (layer._id !== undefined) {
|
|
114
115
|
layerHash[layer._id] = layer;
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
|
-
for (key in layerHash) {
|
|
119
|
+
for (let key in layerHash) {
|
|
119
120
|
if (!layerHash.hasOwnProperty(key)) {
|
|
120
121
|
continue;
|
|
121
122
|
}
|
|
@@ -123,7 +124,7 @@ class Animation {
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
static _animationLoop() {
|
|
126
|
-
|
|
127
|
+
const Anim = Animation;
|
|
127
128
|
if (Anim.animations.length) {
|
|
128
129
|
Anim._runFrames();
|
|
129
130
|
Util_1.Util.requestAnimFrame(Anim._animationLoop);
|
package/lib/Container.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Node, NodeConfig } from './Node.js';
|
|
2
2
|
import { GetSet, IRect } from './types.js';
|
|
3
|
+
import { Shape } from './Shape.js';
|
|
3
4
|
import { HitCanvas, SceneCanvas } from './Canvas.js';
|
|
4
5
|
import { SceneContext } from './Context.js';
|
|
5
6
|
export type ClipFuncOutput = void | [Path2D | CanvasFillRule] | [Path2D, CanvasFillRule];
|
|
@@ -12,7 +13,7 @@ export interface ContainerConfig extends NodeConfig {
|
|
|
12
13
|
clipHeight?: number;
|
|
13
14
|
}
|
|
14
15
|
export declare abstract class Container<ChildType extends Node = Node> extends Node<ContainerConfig> {
|
|
15
|
-
children: Array<ChildType
|
|
16
|
+
children: Array<ChildType>;
|
|
16
17
|
getChildren(filterFunc?: (item: Node) => boolean): ChildType[];
|
|
17
18
|
hasChildren(): boolean;
|
|
18
19
|
removeChildren(): this;
|
|
@@ -20,14 +21,14 @@ export declare abstract class Container<ChildType extends Node = Node> extends N
|
|
|
20
21
|
abstract _validateAdd(node: Node): void;
|
|
21
22
|
add(...children: ChildType[]): this;
|
|
22
23
|
destroy(): this;
|
|
23
|
-
find<ChildNode extends Node
|
|
24
|
-
findOne<ChildNode extends Node = Node>(selector: string | Function): ChildNode;
|
|
25
|
-
_generalFind<ChildNode extends Node
|
|
24
|
+
find<ChildNode extends Node>(selector: any): Array<ChildNode>;
|
|
25
|
+
findOne<ChildNode extends Node = Node>(selector: string | Function): ChildNode | undefined;
|
|
26
|
+
_generalFind<ChildNode extends Node>(selector: string | Function, findOne: boolean): ChildNode[];
|
|
26
27
|
private _descendants;
|
|
27
28
|
toObject(): any;
|
|
28
29
|
isAncestorOf(node: Node): boolean;
|
|
29
30
|
clone(obj?: any): this;
|
|
30
|
-
getAllIntersections(pos: any):
|
|
31
|
+
getAllIntersections(pos: any): Shape<import("./Shape.js").ShapeConfig>[];
|
|
31
32
|
_clearSelfAndDescendantCache(attr?: string): void;
|
|
32
33
|
_setChildrenIndices(): void;
|
|
33
34
|
drawScene(can?: SceneCanvas, top?: Node): this;
|
|
@@ -44,5 +45,5 @@ export declare abstract class Container<ChildType extends Node = Node> extends N
|
|
|
44
45
|
clipY: GetSet<number, this>;
|
|
45
46
|
clipWidth: GetSet<number, this>;
|
|
46
47
|
clipHeight: GetSet<number, this>;
|
|
47
|
-
clipFunc: GetSet<(ctx: CanvasRenderingContext2D, shape: Container
|
|
48
|
+
clipFunc: GetSet<(ctx: CanvasRenderingContext2D, shape: Container) => ClipFuncOutput, this>;
|
|
48
49
|
}
|
package/lib/Container.js
CHANGED
|
@@ -144,7 +144,7 @@ class Container extends Node_1.Node {
|
|
|
144
144
|
}
|
|
145
145
|
getAllIntersections(pos) {
|
|
146
146
|
var arr = [];
|
|
147
|
-
this.find('Shape').forEach(
|
|
147
|
+
this.find('Shape').forEach((shape) => {
|
|
148
148
|
if (shape.isVisible() && shape.intersects(pos)) {
|
|
149
149
|
arr.push(shape);
|
|
150
150
|
}
|
|
@@ -243,9 +243,8 @@ class Container extends Node_1.Node {
|
|
|
243
243
|
context.restore();
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
getClientRect(config) {
|
|
246
|
+
getClientRect(config = {}) {
|
|
247
247
|
var _a;
|
|
248
|
-
config = config || {};
|
|
249
248
|
var skipTransform = config.skipTransform;
|
|
250
249
|
var relativeTo = config.relativeTo;
|
|
251
250
|
var minX, minY, maxX, maxY;
|
package/lib/Context.d.ts
CHANGED
|
@@ -2,7 +2,10 @@ import { Canvas } from './Canvas.js';
|
|
|
2
2
|
import { Shape } from './Shape.js';
|
|
3
3
|
import { IRect } from './types.js';
|
|
4
4
|
import type { Node } from './Node.js';
|
|
5
|
-
declare var CONTEXT_PROPERTIES: readonly ["fillStyle", "strokeStyle", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "lineCap", "lineDashOffset", "lineJoin", "lineWidth", "miterLimit", "font", "textAlign", "textBaseline", "globalAlpha", "globalCompositeOperation", "imageSmoothingEnabled"];
|
|
5
|
+
declare var CONTEXT_PROPERTIES: readonly ["fillStyle", "strokeStyle", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "letterSpacing", "lineCap", "lineDashOffset", "lineJoin", "lineWidth", "miterLimit", "direction", "font", "textAlign", "textBaseline", "globalAlpha", "globalCompositeOperation", "imageSmoothingEnabled"];
|
|
6
|
+
interface ExtendedCanvasRenderingContext2D extends CanvasRenderingContext2D {
|
|
7
|
+
letterSpacing: string;
|
|
8
|
+
}
|
|
6
9
|
export declare class Context {
|
|
7
10
|
canvas: Canvas;
|
|
8
11
|
_context: CanvasRenderingContext2D;
|
|
@@ -23,20 +26,20 @@ export declare class Context {
|
|
|
23
26
|
_applyOpacity(shape: Node): void;
|
|
24
27
|
_applyLineJoin(shape: Shape): void;
|
|
25
28
|
setAttr(attr: string, val: any): void;
|
|
26
|
-
arc(
|
|
27
|
-
arcTo(
|
|
29
|
+
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterClockwise?: boolean): void;
|
|
30
|
+
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
|
|
28
31
|
beginPath(): void;
|
|
29
|
-
bezierCurveTo(
|
|
30
|
-
clearRect(
|
|
32
|
+
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
|
|
33
|
+
clearRect(x: number, y: number, width: number, height: number): void;
|
|
31
34
|
clip(fillRule?: CanvasFillRule): void;
|
|
32
35
|
clip(path: Path2D, fillRule?: CanvasFillRule): void;
|
|
33
36
|
closePath(): void;
|
|
34
|
-
createImageData(
|
|
35
|
-
createLinearGradient(
|
|
36
|
-
createPattern(
|
|
37
|
-
createRadialGradient(
|
|
38
|
-
drawImage(
|
|
39
|
-
ellipse(
|
|
37
|
+
createImageData(width: any, height: any): ImageData | undefined;
|
|
38
|
+
createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
|
|
39
|
+
createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null;
|
|
40
|
+
createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
|
|
41
|
+
drawImage(image: CanvasImageSource, sx: number, sy: number, sWidth?: number, sHeight?: number, dx?: number, dy?: number, dWidth?: number, dHeight?: number): void;
|
|
42
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
|
|
40
43
|
isPointInPath(x: number, y: number, path?: Path2D, fillRule?: CanvasFillRule): boolean;
|
|
41
44
|
fill(fillRule?: CanvasFillRule): void;
|
|
42
45
|
fill(path: Path2D, fillRule?: CanvasFillRule): void;
|
|
@@ -44,32 +47,32 @@ export declare class Context {
|
|
|
44
47
|
strokeRect(x: number, y: number, width: number, height: number): void;
|
|
45
48
|
fillText(text: string, x: number, y: number, maxWidth?: number): void;
|
|
46
49
|
measureText(text: string): TextMetrics;
|
|
47
|
-
getImageData(
|
|
48
|
-
lineTo(
|
|
49
|
-
moveTo(
|
|
50
|
-
rect(
|
|
51
|
-
putImageData(
|
|
52
|
-
quadraticCurveTo(
|
|
50
|
+
getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;
|
|
51
|
+
lineTo(x: number, y: number): void;
|
|
52
|
+
moveTo(x: number, y: number): void;
|
|
53
|
+
rect(x: number, y: number, width: number, height: number): void;
|
|
54
|
+
putImageData(imageData: ImageData, dx: number, dy: number): void;
|
|
55
|
+
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
|
|
53
56
|
restore(): void;
|
|
54
|
-
rotate(
|
|
57
|
+
rotate(angle: number): void;
|
|
55
58
|
save(): void;
|
|
56
|
-
scale(
|
|
57
|
-
setLineDash(
|
|
59
|
+
scale(x: number, y: number): void;
|
|
60
|
+
setLineDash(segments: number[]): void;
|
|
58
61
|
getLineDash(): number[];
|
|
59
|
-
setTransform(
|
|
62
|
+
setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
60
63
|
stroke(path2d?: Path2D): void;
|
|
61
|
-
strokeText(
|
|
62
|
-
transform(
|
|
63
|
-
translate(
|
|
64
|
+
strokeText(text: string, x: number, y: number, maxWidth?: number): void;
|
|
65
|
+
transform(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
66
|
+
translate(x: number, y: number): void;
|
|
64
67
|
_enableTrace(): void;
|
|
65
68
|
_applyGlobalCompositeOperation(node: any): void;
|
|
66
69
|
}
|
|
67
|
-
type CanvasContextProps = Pick<
|
|
70
|
+
type CanvasContextProps = Pick<ExtendedCanvasRenderingContext2D, (typeof CONTEXT_PROPERTIES)[number]>;
|
|
68
71
|
export interface Context extends CanvasContextProps {
|
|
69
72
|
}
|
|
70
73
|
export declare class SceneContext extends Context {
|
|
71
74
|
constructor(canvas: Canvas, { willReadFrequently }?: {
|
|
72
|
-
willReadFrequently?: boolean;
|
|
75
|
+
willReadFrequently?: boolean | undefined;
|
|
73
76
|
});
|
|
74
77
|
_fillColor(shape: Shape): void;
|
|
75
78
|
_fillPattern(shape: Shape): void;
|
package/lib/Context.js
CHANGED
|
@@ -57,11 +57,13 @@ var CONTEXT_PROPERTIES = [
|
|
|
57
57
|
'shadowBlur',
|
|
58
58
|
'shadowOffsetX',
|
|
59
59
|
'shadowOffsetY',
|
|
60
|
+
'letterSpacing',
|
|
60
61
|
'lineCap',
|
|
61
62
|
'lineDashOffset',
|
|
62
63
|
'lineJoin',
|
|
63
64
|
'lineWidth',
|
|
64
65
|
'miterLimit',
|
|
66
|
+
'direction',
|
|
65
67
|
'font',
|
|
66
68
|
'textAlign',
|
|
67
69
|
'textBaseline',
|
|
@@ -183,20 +185,20 @@ class Context {
|
|
|
183
185
|
setAttr(attr, val) {
|
|
184
186
|
this._context[attr] = val;
|
|
185
187
|
}
|
|
186
|
-
arc(
|
|
187
|
-
this._context.arc(
|
|
188
|
+
arc(x, y, radius, startAngle, endAngle, counterClockwise) {
|
|
189
|
+
this._context.arc(x, y, radius, startAngle, endAngle, counterClockwise);
|
|
188
190
|
}
|
|
189
|
-
arcTo(
|
|
190
|
-
this._context.arcTo(
|
|
191
|
+
arcTo(x1, y1, x2, y2, radius) {
|
|
192
|
+
this._context.arcTo(x1, y1, x2, y2, radius);
|
|
191
193
|
}
|
|
192
194
|
beginPath() {
|
|
193
195
|
this._context.beginPath();
|
|
194
196
|
}
|
|
195
|
-
bezierCurveTo(
|
|
196
|
-
this._context.bezierCurveTo(
|
|
197
|
+
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
|
|
198
|
+
this._context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
|
|
197
199
|
}
|
|
198
|
-
clearRect(
|
|
199
|
-
this._context.clearRect(
|
|
200
|
+
clearRect(x, y, width, height) {
|
|
201
|
+
this._context.clearRect(x, y, width, height);
|
|
200
202
|
}
|
|
201
203
|
clip(...args) {
|
|
202
204
|
this._context.clip.apply(this._context, args);
|
|
@@ -204,38 +206,38 @@ class Context {
|
|
|
204
206
|
closePath() {
|
|
205
207
|
this._context.closePath();
|
|
206
208
|
}
|
|
207
|
-
createImageData(
|
|
209
|
+
createImageData(width, height) {
|
|
208
210
|
var a = arguments;
|
|
209
211
|
if (a.length === 2) {
|
|
210
|
-
return this._context.createImageData(
|
|
212
|
+
return this._context.createImageData(width, height);
|
|
211
213
|
}
|
|
212
214
|
else if (a.length === 1) {
|
|
213
|
-
return this._context.createImageData(
|
|
215
|
+
return this._context.createImageData(width);
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
|
-
createLinearGradient(
|
|
217
|
-
return this._context.createLinearGradient(
|
|
218
|
+
createLinearGradient(x0, y0, x1, y1) {
|
|
219
|
+
return this._context.createLinearGradient(x0, y0, x1, y1);
|
|
218
220
|
}
|
|
219
|
-
createPattern(
|
|
220
|
-
return this._context.createPattern(
|
|
221
|
+
createPattern(image, repetition) {
|
|
222
|
+
return this._context.createPattern(image, repetition);
|
|
221
223
|
}
|
|
222
|
-
createRadialGradient(
|
|
223
|
-
return this._context.createRadialGradient(
|
|
224
|
+
createRadialGradient(x0, y0, r0, x1, y1, r1) {
|
|
225
|
+
return this._context.createRadialGradient(x0, y0, r0, x1, y1, r1);
|
|
224
226
|
}
|
|
225
|
-
drawImage(
|
|
227
|
+
drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) {
|
|
226
228
|
var a = arguments, _context = this._context;
|
|
227
229
|
if (a.length === 3) {
|
|
228
|
-
_context.drawImage(
|
|
230
|
+
_context.drawImage(image, sx, sy);
|
|
229
231
|
}
|
|
230
232
|
else if (a.length === 5) {
|
|
231
|
-
_context.drawImage(
|
|
233
|
+
_context.drawImage(image, sx, sy, sWidth, sHeight);
|
|
232
234
|
}
|
|
233
235
|
else if (a.length === 9) {
|
|
234
|
-
_context.drawImage(
|
|
236
|
+
_context.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
|
|
235
237
|
}
|
|
236
238
|
}
|
|
237
|
-
ellipse(
|
|
238
|
-
this._context.ellipse(
|
|
239
|
+
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise) {
|
|
240
|
+
this._context.ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise);
|
|
239
241
|
}
|
|
240
242
|
isPointInPath(x, y, path, fillRule) {
|
|
241
243
|
if (path) {
|
|
@@ -263,52 +265,52 @@ class Context {
|
|
|
263
265
|
measureText(text) {
|
|
264
266
|
return this._context.measureText(text);
|
|
265
267
|
}
|
|
266
|
-
getImageData(
|
|
267
|
-
return this._context.getImageData(
|
|
268
|
+
getImageData(sx, sy, sw, sh) {
|
|
269
|
+
return this._context.getImageData(sx, sy, sw, sh);
|
|
268
270
|
}
|
|
269
|
-
lineTo(
|
|
270
|
-
this._context.lineTo(
|
|
271
|
+
lineTo(x, y) {
|
|
272
|
+
this._context.lineTo(x, y);
|
|
271
273
|
}
|
|
272
|
-
moveTo(
|
|
273
|
-
this._context.moveTo(
|
|
274
|
+
moveTo(x, y) {
|
|
275
|
+
this._context.moveTo(x, y);
|
|
274
276
|
}
|
|
275
|
-
rect(
|
|
276
|
-
this._context.rect(
|
|
277
|
+
rect(x, y, width, height) {
|
|
278
|
+
this._context.rect(x, y, width, height);
|
|
277
279
|
}
|
|
278
|
-
putImageData(
|
|
279
|
-
this._context.putImageData(
|
|
280
|
+
putImageData(imageData, dx, dy) {
|
|
281
|
+
this._context.putImageData(imageData, dx, dy);
|
|
280
282
|
}
|
|
281
|
-
quadraticCurveTo(
|
|
282
|
-
this._context.quadraticCurveTo(
|
|
283
|
+
quadraticCurveTo(cpx, cpy, x, y) {
|
|
284
|
+
this._context.quadraticCurveTo(cpx, cpy, x, y);
|
|
283
285
|
}
|
|
284
286
|
restore() {
|
|
285
287
|
this._context.restore();
|
|
286
288
|
}
|
|
287
|
-
rotate(
|
|
288
|
-
this._context.rotate(
|
|
289
|
+
rotate(angle) {
|
|
290
|
+
this._context.rotate(angle);
|
|
289
291
|
}
|
|
290
292
|
save() {
|
|
291
293
|
this._context.save();
|
|
292
294
|
}
|
|
293
|
-
scale(
|
|
294
|
-
this._context.scale(
|
|
295
|
+
scale(x, y) {
|
|
296
|
+
this._context.scale(x, y);
|
|
295
297
|
}
|
|
296
|
-
setLineDash(
|
|
298
|
+
setLineDash(segments) {
|
|
297
299
|
if (this._context.setLineDash) {
|
|
298
|
-
this._context.setLineDash(
|
|
300
|
+
this._context.setLineDash(segments);
|
|
299
301
|
}
|
|
300
302
|
else if ('mozDash' in this._context) {
|
|
301
|
-
this._context['mozDash'] =
|
|
303
|
+
this._context['mozDash'] = segments;
|
|
302
304
|
}
|
|
303
305
|
else if ('webkitLineDash' in this._context) {
|
|
304
|
-
this._context['webkitLineDash'] =
|
|
306
|
+
this._context['webkitLineDash'] = segments;
|
|
305
307
|
}
|
|
306
308
|
}
|
|
307
309
|
getLineDash() {
|
|
308
310
|
return this._context.getLineDash();
|
|
309
311
|
}
|
|
310
|
-
setTransform(
|
|
311
|
-
this._context.setTransform(
|
|
312
|
+
setTransform(a, b, c, d, e, f) {
|
|
313
|
+
this._context.setTransform(a, b, c, d, e, f);
|
|
312
314
|
}
|
|
313
315
|
stroke(path2d) {
|
|
314
316
|
if (path2d) {
|
|
@@ -318,14 +320,14 @@ class Context {
|
|
|
318
320
|
this._context.stroke();
|
|
319
321
|
}
|
|
320
322
|
}
|
|
321
|
-
strokeText(
|
|
322
|
-
this._context.strokeText(
|
|
323
|
+
strokeText(text, x, y, maxWidth) {
|
|
324
|
+
this._context.strokeText(text, x, y, maxWidth);
|
|
323
325
|
}
|
|
324
|
-
transform(
|
|
325
|
-
this._context.transform(
|
|
326
|
+
transform(a, b, c, d, e, f) {
|
|
327
|
+
this._context.transform(a, b, c, d, e, f);
|
|
326
328
|
}
|
|
327
|
-
translate(
|
|
328
|
-
this._context.translate(
|
|
329
|
+
translate(x, y) {
|
|
330
|
+
this._context.translate(x, y);
|
|
329
331
|
}
|
|
330
332
|
_enableTrace() {
|
|
331
333
|
var that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args;
|
package/lib/DragAndDrop.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { Vector2d } from './types.js';
|
|
|
3
3
|
export declare const DD: {
|
|
4
4
|
readonly isDragging: boolean;
|
|
5
5
|
justDragged: boolean;
|
|
6
|
-
readonly node: Node<import("./Node.js").NodeConfig
|
|
6
|
+
readonly node: Node<import("./Node.js").NodeConfig> | undefined;
|
|
7
7
|
_dragElements: Map<number, {
|
|
8
8
|
node: Node;
|
|
9
9
|
startPointerPos: Vector2d;
|
|
10
10
|
offset: Vector2d;
|
|
11
|
-
pointerId?: number;
|
|
11
|
+
pointerId?: number | undefined;
|
|
12
12
|
dragStatus: 'ready' | 'dragging' | 'stopped';
|
|
13
13
|
}>;
|
|
14
14
|
_drag(evt: any): void;
|
package/lib/Factory.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Node } from './Node.js';
|
|
1
2
|
export declare const Factory: {
|
|
2
3
|
addGetterSetter(constructor: any, attr: any, def?: any, validator?: any, after?: any): void;
|
|
3
4
|
addGetter(constructor: any, attr: any, def?: any): void;
|
|
@@ -7,5 +8,5 @@ export declare const Factory: {
|
|
|
7
8
|
addOverloadedGetterSetter(constructor: any, attr: any): void;
|
|
8
9
|
addDeprecatedGetterSetter(constructor: any, attr: any, def: any, validator: any): void;
|
|
9
10
|
backCompat(constructor: any, methods: any): void;
|
|
10
|
-
afterSetFilter(): void;
|
|
11
|
+
afterSetFilter(this: Node): void;
|
|
11
12
|
};
|
package/lib/Global.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ export declare const Konva: {
|
|
|
17
17
|
_mouseInDblClickWindow: boolean;
|
|
18
18
|
_touchInDblClickWindow: boolean;
|
|
19
19
|
_pointerInDblClickWindow: boolean;
|
|
20
|
-
_mouseDblClickPointerId:
|
|
21
|
-
_touchDblClickPointerId:
|
|
22
|
-
_pointerDblClickPointerId:
|
|
20
|
+
_mouseDblClickPointerId: null;
|
|
21
|
+
_touchDblClickPointerId: null;
|
|
22
|
+
_pointerDblClickPointerId: null;
|
|
23
23
|
pixelRatio: number;
|
|
24
24
|
dragDistance: number;
|
|
25
25
|
angleDeg: boolean;
|
package/lib/Global.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports._registerNode = exports.Konva = exports.glob = void 0;
|
|
4
|
-
|
|
4
|
+
const PI_OVER_180 = Math.PI / 180;
|
|
5
5
|
function detectBrowser() {
|
|
6
6
|
return (typeof window !== 'undefined' &&
|
|
7
7
|
({}.toString.call(window) === '[object Window]' ||
|
|
@@ -16,7 +16,7 @@ exports.glob = typeof global !== 'undefined'
|
|
|
16
16
|
: {};
|
|
17
17
|
exports.Konva = {
|
|
18
18
|
_global: exports.glob,
|
|
19
|
-
version: '9.2.
|
|
19
|
+
version: '9.2.2',
|
|
20
20
|
isBrowser: detectBrowser(),
|
|
21
21
|
isUnminified: /param/.test(function (param) { }.toString()),
|
|
22
22
|
dblClickWindow: 400,
|
package/lib/Layer.d.ts
CHANGED
|
@@ -34,15 +34,15 @@ export declare class Layer extends Container<Group | Shape> {
|
|
|
34
34
|
height: any;
|
|
35
35
|
}): this;
|
|
36
36
|
_validateAdd(child: any): void;
|
|
37
|
-
_toKonvaCanvas(config: any):
|
|
37
|
+
_toKonvaCanvas(config: any): SceneCanvas;
|
|
38
38
|
_checkVisibility(): void;
|
|
39
39
|
_setSmoothEnabled(): void;
|
|
40
|
-
getWidth(): number;
|
|
40
|
+
getWidth(): number | undefined;
|
|
41
41
|
setWidth(): void;
|
|
42
|
-
getHeight(): number;
|
|
42
|
+
getHeight(): number | undefined;
|
|
43
43
|
setHeight(): void;
|
|
44
44
|
batchDraw(): this;
|
|
45
|
-
getIntersection(pos: Vector2d): Shape<import("./Shape.js").ShapeConfig
|
|
45
|
+
getIntersection(pos: Vector2d): Shape<import("./Shape.js").ShapeConfig> | null;
|
|
46
46
|
_getIntersection(pos: Vector2d): {
|
|
47
47
|
shape?: Shape;
|
|
48
48
|
antialiased?: boolean;
|