konva 9.1.0 → 9.2.1
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/konva.js +273 -682
- package/konva.min.js +3 -3
- package/lib/Animation.d.ts +4 -4
- package/lib/Animation.js +27 -26
- package/lib/Container.d.ts +9 -7
- package/lib/Container.js +5 -5
- package/lib/Context.d.ts +29 -27
- package/lib/Context.js +55 -60
- 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 +9 -7
- package/lib/Shape.js +17 -5
- 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 +1 -0
- package/lib/shapes/Text.js +9 -0
- 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 +11 -11
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,17 +1,19 @@
|
|
|
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';
|
|
6
|
+
export type ClipFuncOutput = void | [Path2D | CanvasFillRule] | [Path2D, CanvasFillRule];
|
|
5
7
|
export interface ContainerConfig extends NodeConfig {
|
|
6
8
|
clearBeforeDraw?: boolean;
|
|
7
|
-
clipFunc?: (ctx: SceneContext) =>
|
|
9
|
+
clipFunc?: (ctx: SceneContext) => ClipFuncOutput;
|
|
8
10
|
clipX?: number;
|
|
9
11
|
clipY?: number;
|
|
10
12
|
clipWidth?: number;
|
|
11
13
|
clipHeight?: number;
|
|
12
14
|
}
|
|
13
15
|
export declare abstract class Container<ChildType extends Node = Node> extends Node<ContainerConfig> {
|
|
14
|
-
children: Array<ChildType
|
|
16
|
+
children: Array<ChildType>;
|
|
15
17
|
getChildren(filterFunc?: (item: Node) => boolean): ChildType[];
|
|
16
18
|
hasChildren(): boolean;
|
|
17
19
|
removeChildren(): this;
|
|
@@ -19,14 +21,14 @@ export declare abstract class Container<ChildType extends Node = Node> extends N
|
|
|
19
21
|
abstract _validateAdd(node: Node): void;
|
|
20
22
|
add(...children: ChildType[]): this;
|
|
21
23
|
destroy(): this;
|
|
22
|
-
find<ChildNode extends Node
|
|
23
|
-
findOne<ChildNode extends Node = Node>(selector: string | Function): ChildNode;
|
|
24
|
-
_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[];
|
|
25
27
|
private _descendants;
|
|
26
28
|
toObject(): any;
|
|
27
29
|
isAncestorOf(node: Node): boolean;
|
|
28
30
|
clone(obj?: any): this;
|
|
29
|
-
getAllIntersections(pos: any):
|
|
31
|
+
getAllIntersections(pos: any): Shape<import("./Shape.js").ShapeConfig>[];
|
|
30
32
|
_clearSelfAndDescendantCache(attr?: string): void;
|
|
31
33
|
_setChildrenIndices(): void;
|
|
32
34
|
drawScene(can?: SceneCanvas, top?: Node): this;
|
|
@@ -43,5 +45,5 @@ export declare abstract class Container<ChildType extends Node = Node> extends N
|
|
|
43
45
|
clipY: GetSet<number, this>;
|
|
44
46
|
clipWidth: GetSet<number, this>;
|
|
45
47
|
clipHeight: GetSet<number, this>;
|
|
46
|
-
clipFunc: GetSet<(ctx: CanvasRenderingContext2D, shape: Container
|
|
48
|
+
clipFunc: GetSet<(ctx: CanvasRenderingContext2D, shape: Container) => ClipFuncOutput, this>;
|
|
47
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
|
}
|
|
@@ -213,15 +213,16 @@ class Container extends Node_1.Node {
|
|
|
213
213
|
var m = transform.getMatrix();
|
|
214
214
|
context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
215
215
|
context.beginPath();
|
|
216
|
+
let clipArgs;
|
|
216
217
|
if (clipFunc) {
|
|
217
|
-
clipFunc.call(this, context, this);
|
|
218
|
+
clipArgs = clipFunc.call(this, context, this);
|
|
218
219
|
}
|
|
219
220
|
else {
|
|
220
221
|
var clipX = this.clipX();
|
|
221
222
|
var clipY = this.clipY();
|
|
222
223
|
context.rect(clipX, clipY, clipWidth, clipHeight);
|
|
223
224
|
}
|
|
224
|
-
context.clip();
|
|
225
|
+
context.clip.apply(context, clipArgs);
|
|
225
226
|
m = transform.copy().invert().getMatrix();
|
|
226
227
|
context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
227
228
|
}
|
|
@@ -242,9 +243,8 @@ class Container extends Node_1.Node {
|
|
|
242
243
|
context.restore();
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
|
-
getClientRect(config) {
|
|
246
|
+
getClientRect(config = {}) {
|
|
246
247
|
var _a;
|
|
247
|
-
config = config || {};
|
|
248
248
|
var skipTransform = config.skipTransform;
|
|
249
249
|
var relativeTo = config.relativeTo;
|
|
250
250
|
var minX, minY, maxX, maxY;
|
package/lib/Context.d.ts
CHANGED
|
@@ -23,51 +23,53 @@ export declare class Context {
|
|
|
23
23
|
_applyOpacity(shape: Node): void;
|
|
24
24
|
_applyLineJoin(shape: Shape): void;
|
|
25
25
|
setAttr(attr: string, val: any): void;
|
|
26
|
-
arc(
|
|
27
|
-
arcTo(
|
|
26
|
+
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterClockwise?: boolean): void;
|
|
27
|
+
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
|
|
28
28
|
beginPath(): void;
|
|
29
|
-
bezierCurveTo(
|
|
30
|
-
clearRect(
|
|
31
|
-
clip(): void;
|
|
29
|
+
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
|
|
30
|
+
clearRect(x: number, y: number, width: number, height: number): void;
|
|
31
|
+
clip(fillRule?: CanvasFillRule): void;
|
|
32
|
+
clip(path: Path2D, fillRule?: CanvasFillRule): void;
|
|
32
33
|
closePath(): void;
|
|
33
|
-
createImageData(
|
|
34
|
-
createLinearGradient(
|
|
35
|
-
createPattern(
|
|
36
|
-
createRadialGradient(
|
|
37
|
-
drawImage(
|
|
38
|
-
ellipse(
|
|
34
|
+
createImageData(width: any, height: any): ImageData | undefined;
|
|
35
|
+
createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
|
|
36
|
+
createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null;
|
|
37
|
+
createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
|
|
38
|
+
drawImage(image: CanvasImageSource, sx: number, sy: number, sWidth?: number, sHeight?: number, dx?: number, dy?: number, dWidth?: number, dHeight?: number): void;
|
|
39
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
|
|
39
40
|
isPointInPath(x: number, y: number, path?: Path2D, fillRule?: CanvasFillRule): boolean;
|
|
40
|
-
fill(
|
|
41
|
+
fill(fillRule?: CanvasFillRule): void;
|
|
42
|
+
fill(path: Path2D, fillRule?: CanvasFillRule): void;
|
|
41
43
|
fillRect(x: number, y: number, width: number, height: number): void;
|
|
42
44
|
strokeRect(x: number, y: number, width: number, height: number): void;
|
|
43
45
|
fillText(text: string, x: number, y: number, maxWidth?: number): void;
|
|
44
46
|
measureText(text: string): TextMetrics;
|
|
45
|
-
getImageData(
|
|
46
|
-
lineTo(
|
|
47
|
-
moveTo(
|
|
48
|
-
rect(
|
|
49
|
-
putImageData(
|
|
50
|
-
quadraticCurveTo(
|
|
47
|
+
getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;
|
|
48
|
+
lineTo(x: number, y: number): void;
|
|
49
|
+
moveTo(x: number, y: number): void;
|
|
50
|
+
rect(x: number, y: number, width: number, height: number): void;
|
|
51
|
+
putImageData(imageData: ImageData, dx: number, dy: number): void;
|
|
52
|
+
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
|
|
51
53
|
restore(): void;
|
|
52
|
-
rotate(
|
|
54
|
+
rotate(angle: number): void;
|
|
53
55
|
save(): void;
|
|
54
|
-
scale(
|
|
55
|
-
setLineDash(
|
|
56
|
+
scale(x: number, y: number): void;
|
|
57
|
+
setLineDash(segments: number[]): void;
|
|
56
58
|
getLineDash(): number[];
|
|
57
|
-
setTransform(
|
|
59
|
+
setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
58
60
|
stroke(path2d?: Path2D): void;
|
|
59
|
-
strokeText(
|
|
60
|
-
transform(
|
|
61
|
-
translate(
|
|
61
|
+
strokeText(text: string, x: number, y: number, maxWidth?: number): void;
|
|
62
|
+
transform(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
63
|
+
translate(x: number, y: number): void;
|
|
62
64
|
_enableTrace(): void;
|
|
63
65
|
_applyGlobalCompositeOperation(node: any): void;
|
|
64
66
|
}
|
|
65
|
-
type CanvasContextProps = Pick<CanvasRenderingContext2D, typeof CONTEXT_PROPERTIES[number]>;
|
|
67
|
+
type CanvasContextProps = Pick<CanvasRenderingContext2D, (typeof CONTEXT_PROPERTIES)[number]>;
|
|
66
68
|
export interface Context extends CanvasContextProps {
|
|
67
69
|
}
|
|
68
70
|
export declare class SceneContext extends Context {
|
|
69
71
|
constructor(canvas: Canvas, { willReadFrequently }?: {
|
|
70
|
-
willReadFrequently?: boolean;
|
|
72
|
+
willReadFrequently?: boolean | undefined;
|
|
71
73
|
});
|
|
72
74
|
_fillColor(shape: Shape): void;
|
|
73
75
|
_fillPattern(shape: Shape): void;
|
package/lib/Context.js
CHANGED
|
@@ -183,59 +183,59 @@ class Context {
|
|
|
183
183
|
setAttr(attr, val) {
|
|
184
184
|
this._context[attr] = val;
|
|
185
185
|
}
|
|
186
|
-
arc(
|
|
187
|
-
this._context.arc(
|
|
186
|
+
arc(x, y, radius, startAngle, endAngle, counterClockwise) {
|
|
187
|
+
this._context.arc(x, y, radius, startAngle, endAngle, counterClockwise);
|
|
188
188
|
}
|
|
189
|
-
arcTo(
|
|
190
|
-
this._context.arcTo(
|
|
189
|
+
arcTo(x1, y1, x2, y2, radius) {
|
|
190
|
+
this._context.arcTo(x1, y1, x2, y2, radius);
|
|
191
191
|
}
|
|
192
192
|
beginPath() {
|
|
193
193
|
this._context.beginPath();
|
|
194
194
|
}
|
|
195
|
-
bezierCurveTo(
|
|
196
|
-
this._context.bezierCurveTo(
|
|
195
|
+
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
|
|
196
|
+
this._context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
|
|
197
197
|
}
|
|
198
|
-
clearRect(
|
|
199
|
-
this._context.clearRect(
|
|
198
|
+
clearRect(x, y, width, height) {
|
|
199
|
+
this._context.clearRect(x, y, width, height);
|
|
200
200
|
}
|
|
201
|
-
clip() {
|
|
202
|
-
this._context.clip();
|
|
201
|
+
clip(...args) {
|
|
202
|
+
this._context.clip.apply(this._context, args);
|
|
203
203
|
}
|
|
204
204
|
closePath() {
|
|
205
205
|
this._context.closePath();
|
|
206
206
|
}
|
|
207
|
-
createImageData(
|
|
207
|
+
createImageData(width, height) {
|
|
208
208
|
var a = arguments;
|
|
209
209
|
if (a.length === 2) {
|
|
210
|
-
return this._context.createImageData(
|
|
210
|
+
return this._context.createImageData(width, height);
|
|
211
211
|
}
|
|
212
212
|
else if (a.length === 1) {
|
|
213
|
-
return this._context.createImageData(
|
|
213
|
+
return this._context.createImageData(width);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
createLinearGradient(
|
|
217
|
-
return this._context.createLinearGradient(
|
|
216
|
+
createLinearGradient(x0, y0, x1, y1) {
|
|
217
|
+
return this._context.createLinearGradient(x0, y0, x1, y1);
|
|
218
218
|
}
|
|
219
|
-
createPattern(
|
|
220
|
-
return this._context.createPattern(
|
|
219
|
+
createPattern(image, repetition) {
|
|
220
|
+
return this._context.createPattern(image, repetition);
|
|
221
221
|
}
|
|
222
|
-
createRadialGradient(
|
|
223
|
-
return this._context.createRadialGradient(
|
|
222
|
+
createRadialGradient(x0, y0, r0, x1, y1, r1) {
|
|
223
|
+
return this._context.createRadialGradient(x0, y0, r0, x1, y1, r1);
|
|
224
224
|
}
|
|
225
|
-
drawImage(
|
|
225
|
+
drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) {
|
|
226
226
|
var a = arguments, _context = this._context;
|
|
227
227
|
if (a.length === 3) {
|
|
228
|
-
_context.drawImage(
|
|
228
|
+
_context.drawImage(image, sx, sy);
|
|
229
229
|
}
|
|
230
230
|
else if (a.length === 5) {
|
|
231
|
-
_context.drawImage(
|
|
231
|
+
_context.drawImage(image, sx, sy, sWidth, sHeight);
|
|
232
232
|
}
|
|
233
233
|
else if (a.length === 9) {
|
|
234
|
-
_context.drawImage(
|
|
234
|
+
_context.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
ellipse(
|
|
238
|
-
this._context.ellipse(
|
|
237
|
+
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise) {
|
|
238
|
+
this._context.ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise);
|
|
239
239
|
}
|
|
240
240
|
isPointInPath(x, y, path, fillRule) {
|
|
241
241
|
if (path) {
|
|
@@ -243,13 +243,8 @@ class Context {
|
|
|
243
243
|
}
|
|
244
244
|
return this._context.isPointInPath(x, y, fillRule);
|
|
245
245
|
}
|
|
246
|
-
fill(
|
|
247
|
-
|
|
248
|
-
this._context.fill(path2d);
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
this._context.fill();
|
|
252
|
-
}
|
|
246
|
+
fill(...args) {
|
|
247
|
+
this._context.fill.apply(this._context, args);
|
|
253
248
|
}
|
|
254
249
|
fillRect(x, y, width, height) {
|
|
255
250
|
this._context.fillRect(x, y, width, height);
|
|
@@ -268,52 +263,52 @@ class Context {
|
|
|
268
263
|
measureText(text) {
|
|
269
264
|
return this._context.measureText(text);
|
|
270
265
|
}
|
|
271
|
-
getImageData(
|
|
272
|
-
return this._context.getImageData(
|
|
266
|
+
getImageData(sx, sy, sw, sh) {
|
|
267
|
+
return this._context.getImageData(sx, sy, sw, sh);
|
|
273
268
|
}
|
|
274
|
-
lineTo(
|
|
275
|
-
this._context.lineTo(
|
|
269
|
+
lineTo(x, y) {
|
|
270
|
+
this._context.lineTo(x, y);
|
|
276
271
|
}
|
|
277
|
-
moveTo(
|
|
278
|
-
this._context.moveTo(
|
|
272
|
+
moveTo(x, y) {
|
|
273
|
+
this._context.moveTo(x, y);
|
|
279
274
|
}
|
|
280
|
-
rect(
|
|
281
|
-
this._context.rect(
|
|
275
|
+
rect(x, y, width, height) {
|
|
276
|
+
this._context.rect(x, y, width, height);
|
|
282
277
|
}
|
|
283
|
-
putImageData(
|
|
284
|
-
this._context.putImageData(
|
|
278
|
+
putImageData(imageData, dx, dy) {
|
|
279
|
+
this._context.putImageData(imageData, dx, dy);
|
|
285
280
|
}
|
|
286
|
-
quadraticCurveTo(
|
|
287
|
-
this._context.quadraticCurveTo(
|
|
281
|
+
quadraticCurveTo(cpx, cpy, x, y) {
|
|
282
|
+
this._context.quadraticCurveTo(cpx, cpy, x, y);
|
|
288
283
|
}
|
|
289
284
|
restore() {
|
|
290
285
|
this._context.restore();
|
|
291
286
|
}
|
|
292
|
-
rotate(
|
|
293
|
-
this._context.rotate(
|
|
287
|
+
rotate(angle) {
|
|
288
|
+
this._context.rotate(angle);
|
|
294
289
|
}
|
|
295
290
|
save() {
|
|
296
291
|
this._context.save();
|
|
297
292
|
}
|
|
298
|
-
scale(
|
|
299
|
-
this._context.scale(
|
|
293
|
+
scale(x, y) {
|
|
294
|
+
this._context.scale(x, y);
|
|
300
295
|
}
|
|
301
|
-
setLineDash(
|
|
296
|
+
setLineDash(segments) {
|
|
302
297
|
if (this._context.setLineDash) {
|
|
303
|
-
this._context.setLineDash(
|
|
298
|
+
this._context.setLineDash(segments);
|
|
304
299
|
}
|
|
305
300
|
else if ('mozDash' in this._context) {
|
|
306
|
-
this._context['mozDash'] =
|
|
301
|
+
this._context['mozDash'] = segments;
|
|
307
302
|
}
|
|
308
303
|
else if ('webkitLineDash' in this._context) {
|
|
309
|
-
this._context['webkitLineDash'] =
|
|
304
|
+
this._context['webkitLineDash'] = segments;
|
|
310
305
|
}
|
|
311
306
|
}
|
|
312
307
|
getLineDash() {
|
|
313
308
|
return this._context.getLineDash();
|
|
314
309
|
}
|
|
315
|
-
setTransform(
|
|
316
|
-
this._context.setTransform(
|
|
310
|
+
setTransform(a, b, c, d, e, f) {
|
|
311
|
+
this._context.setTransform(a, b, c, d, e, f);
|
|
317
312
|
}
|
|
318
313
|
stroke(path2d) {
|
|
319
314
|
if (path2d) {
|
|
@@ -323,14 +318,14 @@ class Context {
|
|
|
323
318
|
this._context.stroke();
|
|
324
319
|
}
|
|
325
320
|
}
|
|
326
|
-
strokeText(
|
|
327
|
-
this._context.strokeText(
|
|
321
|
+
strokeText(text, x, y, maxWidth) {
|
|
322
|
+
this._context.strokeText(text, x, y, maxWidth);
|
|
328
323
|
}
|
|
329
|
-
transform(
|
|
330
|
-
this._context.transform(
|
|
324
|
+
transform(a, b, c, d, e, f) {
|
|
325
|
+
this._context.transform(a, b, c, d, e, f);
|
|
331
326
|
}
|
|
332
|
-
translate(
|
|
333
|
-
this._context.translate(
|
|
327
|
+
translate(x, y) {
|
|
328
|
+
this._context.translate(x, y);
|
|
334
329
|
}
|
|
335
330
|
_enableTrace() {
|
|
336
331
|
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.1
|
|
19
|
+
version: '9.2.1',
|
|
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;
|