konva 9.3.21 → 10.0.0-0
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 +1 -1
- package/konva.js +664 -226
- package/konva.min.js +46 -4
- package/lib/Animation.d.ts +2 -2
- package/lib/Animation.js +7 -11
- package/lib/BezierFunctions.js +9 -15
- package/lib/Canvas.d.ts +1 -1
- package/lib/Canvas.js +14 -20
- package/lib/Container.d.ts +7 -6
- package/lib/Container.js +12 -16
- package/lib/Context.d.ts +7 -5
- package/lib/Context.js +34 -14
- package/lib/Core.d.ts +2 -2
- package/lib/Core.js +3 -7
- package/lib/DragAndDrop.d.ts +3 -3
- package/lib/DragAndDrop.js +24 -27
- package/lib/Factory.d.ts +2 -2
- package/lib/Factory.js +24 -27
- package/lib/FastLayer.d.ts +1 -1
- package/lib/FastLayer.js +6 -10
- package/lib/Global.d.ts +4 -3
- package/lib/Global.js +19 -19
- package/lib/Group.d.ts +4 -3
- package/lib/Group.js +6 -10
- package/lib/Layer.d.ts +10 -9
- package/lib/Layer.js +33 -37
- package/lib/Node.d.ts +16 -13
- package/lib/Node.js +207 -123
- package/lib/PointerEvents.d.ts +4 -4
- package/lib/PointerEvents.js +7 -14
- package/lib/Shape.d.ts +7 -4
- package/lib/Shape.js +91 -91
- package/lib/Stage.d.ts +8 -7
- package/lib/Stage.js +66 -56
- package/lib/Tween.d.ts +3 -2
- package/lib/Tween.js +29 -31
- package/lib/Util.d.ts +3 -2
- package/lib/Util.js +98 -38
- package/lib/Validators.js +44 -57
- package/lib/_CoreInternals.d.ts +49 -23
- package/lib/_CoreInternals.js +33 -36
- package/lib/_FullInternals.d.ts +126 -62
- package/lib/_FullInternals.js +77 -78
- package/lib/canvas-backend.d.ts +2 -0
- package/lib/canvas-backend.js +27 -0
- package/lib/filters/Blur.d.ts +1 -1
- package/lib/filters/Blur.js +5 -9
- package/lib/filters/Brighten.d.ts +1 -1
- package/lib/filters/Brighten.js +5 -9
- package/lib/filters/Brightness.d.ts +2 -0
- package/lib/filters/Brightness.js +8 -0
- package/lib/filters/Contrast.d.ts +1 -1
- package/lib/filters/Contrast.js +5 -9
- package/lib/filters/Emboss.d.ts +1 -1
- package/lib/filters/Emboss.js +95 -101
- package/lib/filters/Enhance.d.ts +1 -1
- package/lib/filters/Enhance.js +5 -9
- package/lib/filters/Grayscale.d.ts +1 -1
- package/lib/filters/Grayscale.js +1 -5
- package/lib/filters/HSL.d.ts +1 -1
- package/lib/filters/HSL.js +7 -11
- package/lib/filters/HSV.d.ts +1 -1
- package/lib/filters/HSV.js +7 -11
- package/lib/filters/Invert.d.ts +1 -1
- package/lib/filters/Invert.js +1 -5
- package/lib/filters/Kaleidoscope.d.ts +1 -1
- package/lib/filters/Kaleidoscope.js +9 -13
- package/lib/filters/Mask.d.ts +1 -1
- package/lib/filters/Mask.js +16 -10
- package/lib/filters/Noise.d.ts +1 -1
- package/lib/filters/Noise.js +5 -9
- package/lib/filters/Pixelate.d.ts +1 -1
- package/lib/filters/Pixelate.js +7 -11
- package/lib/filters/Posterize.d.ts +1 -1
- package/lib/filters/Posterize.js +5 -9
- package/lib/filters/RGB.d.ts +1 -1
- package/lib/filters/RGB.js +7 -11
- package/lib/filters/RGBA.d.ts +1 -1
- package/lib/filters/RGBA.js +8 -12
- package/lib/filters/Sepia.d.ts +1 -1
- package/lib/filters/Sepia.js +1 -5
- package/lib/filters/Solarize.d.ts +1 -1
- package/lib/filters/Solarize.js +13 -29
- package/lib/filters/Threshold.d.ts +1 -1
- package/lib/filters/Threshold.js +5 -9
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -4
- package/lib/shapes/Arc.d.ts +4 -3
- package/lib/shapes/Arc.js +13 -17
- package/lib/shapes/Arrow.d.ts +4 -3
- package/lib/shapes/Arrow.js +13 -17
- package/lib/shapes/Circle.d.ts +4 -3
- package/lib/shapes/Circle.js +7 -11
- package/lib/shapes/Ellipse.d.ts +4 -3
- package/lib/shapes/Ellipse.js +9 -13
- package/lib/shapes/Image.d.ts +4 -3
- package/lib/shapes/Image.js +17 -21
- package/lib/shapes/Label.d.ts +7 -6
- package/lib/shapes/Label.js +13 -18
- package/lib/shapes/Line.d.ts +4 -3
- package/lib/shapes/Line.js +10 -14
- package/lib/shapes/Path.d.ts +3 -2
- package/lib/shapes/Path.js +83 -23
- package/lib/shapes/Rect.d.ts +4 -3
- package/lib/shapes/Rect.js +9 -13
- package/lib/shapes/RegularPolygon.d.ts +6 -3
- package/lib/shapes/RegularPolygon.js +19 -16
- package/lib/shapes/Ring.d.ts +4 -3
- package/lib/shapes/Ring.js +8 -12
- package/lib/shapes/Sprite.d.ts +5 -4
- package/lib/shapes/Sprite.js +15 -19
- package/lib/shapes/Star.d.ts +4 -3
- package/lib/shapes/Star.js +9 -13
- package/lib/shapes/Text.d.ts +16 -3
- package/lib/shapes/Text.js +73 -53
- package/lib/shapes/TextPath.d.ts +5 -4
- package/lib/shapes/TextPath.js +48 -41
- package/lib/shapes/Transformer.d.ts +8 -8
- package/lib/shapes/Transformer.js +90 -90
- package/lib/shapes/Wedge.d.ts +4 -3
- package/lib/shapes/Wedge.js +12 -16
- package/lib/skia-backend.d.ts +2 -0
- package/lib/skia-backend.js +24 -0
- package/lib/types.d.ts +22 -22
- package/lib/types.js +21 -25
- package/package.json +53 -25
- package/lib/index-node.d.ts +0 -2
- package/lib/index-node.js +0 -21
- package/lib/index-types.d.ts +0 -181
package/lib/PointerEvents.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { KonvaEventObject } from './Node.
|
|
2
|
-
import { Shape } from './Shape.
|
|
3
|
-
import { Stage } from './Stage.
|
|
1
|
+
import type { KonvaEventObject } from './Node.ts';
|
|
2
|
+
import type { Shape } from './Shape.ts';
|
|
3
|
+
import type { Stage } from './Stage.ts';
|
|
4
4
|
export interface KonvaPointerEvent extends KonvaEventObject<PointerEvent> {
|
|
5
5
|
pointerId: number;
|
|
6
6
|
}
|
|
7
|
-
export declare function getCapturedShape(pointerId: number): Shape<import("./Shape.
|
|
7
|
+
export declare function getCapturedShape(pointerId: number): Shape<import("./Shape.ts").ShapeConfig> | Stage | undefined;
|
|
8
8
|
export declare function createEvent(evt: PointerEvent): KonvaPointerEvent;
|
|
9
9
|
export declare function hasPointerCapture(pointerId: number, shape: Shape | Stage): boolean;
|
|
10
10
|
export declare function setPointerCapture(pointerId: number, shape: Shape | Stage): void;
|
package/lib/PointerEvents.js
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCapturedShape = getCapturedShape;
|
|
4
|
-
exports.createEvent = createEvent;
|
|
5
|
-
exports.hasPointerCapture = hasPointerCapture;
|
|
6
|
-
exports.setPointerCapture = setPointerCapture;
|
|
7
|
-
exports.releaseCapture = releaseCapture;
|
|
8
|
-
const Global_1 = require("./Global");
|
|
1
|
+
import { Konva } from "./Global.js";
|
|
9
2
|
const Captures = new Map();
|
|
10
|
-
const SUPPORT_POINTER_EVENTS =
|
|
11
|
-
function getCapturedShape(pointerId) {
|
|
3
|
+
const SUPPORT_POINTER_EVENTS = Konva._global['PointerEvent'] !== undefined;
|
|
4
|
+
export function getCapturedShape(pointerId) {
|
|
12
5
|
return Captures.get(pointerId);
|
|
13
6
|
}
|
|
14
|
-
function createEvent(evt) {
|
|
7
|
+
export function createEvent(evt) {
|
|
15
8
|
return {
|
|
16
9
|
evt,
|
|
17
10
|
pointerId: evt.pointerId,
|
|
18
11
|
};
|
|
19
12
|
}
|
|
20
|
-
function hasPointerCapture(pointerId, shape) {
|
|
13
|
+
export function hasPointerCapture(pointerId, shape) {
|
|
21
14
|
return Captures.get(pointerId) === shape;
|
|
22
15
|
}
|
|
23
|
-
function setPointerCapture(pointerId, shape) {
|
|
16
|
+
export function setPointerCapture(pointerId, shape) {
|
|
24
17
|
releaseCapture(pointerId);
|
|
25
18
|
const stage = shape.getStage();
|
|
26
19
|
if (!stage)
|
|
@@ -30,7 +23,7 @@ function setPointerCapture(pointerId, shape) {
|
|
|
30
23
|
shape._fire('gotpointercapture', createEvent(new PointerEvent('gotpointercapture')));
|
|
31
24
|
}
|
|
32
25
|
}
|
|
33
|
-
function releaseCapture(pointerId, target) {
|
|
26
|
+
export function releaseCapture(pointerId, target) {
|
|
34
27
|
const shape = Captures.get(pointerId);
|
|
35
28
|
if (!shape)
|
|
36
29
|
return;
|
package/lib/Shape.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { NodeConfig } from './Node.ts';
|
|
2
|
+
import { Node } from './Node.ts';
|
|
3
|
+
import type { Context } from './Context.ts';
|
|
4
|
+
import type { GetSet, Vector2d } from './types.ts';
|
|
5
|
+
import type { HitCanvas, SceneCanvas } from './Canvas.ts';
|
|
5
6
|
export type ShapeConfigHandler<TTarget> = {
|
|
6
7
|
bivarianceHack(ctx: Context, shape: TTarget): void;
|
|
7
8
|
}['bivarianceHack'];
|
|
@@ -48,6 +49,7 @@ export interface ShapeConfig extends NodeConfig {
|
|
|
48
49
|
strokeEnabled?: boolean;
|
|
49
50
|
lineJoin?: LineJoin;
|
|
50
51
|
lineCap?: LineCap;
|
|
52
|
+
miterLimit?: number;
|
|
51
53
|
sceneFunc?: (con: Context, shape: Shape) => void;
|
|
52
54
|
hitFunc?: (con: Context, shape: Shape) => void;
|
|
53
55
|
shadowColor?: string;
|
|
@@ -165,6 +167,7 @@ export declare class Shape<Config extends ShapeConfig = ShapeConfig> extends Nod
|
|
|
165
167
|
hitFunc: GetSet<ShapeConfigHandler<this>, this>;
|
|
166
168
|
lineCap: GetSet<LineCap, this>;
|
|
167
169
|
lineJoin: GetSet<LineJoin, this>;
|
|
170
|
+
miterLimit: GetSet<number, this>;
|
|
168
171
|
perfectDrawEnabled: GetSet<boolean, this>;
|
|
169
172
|
sceneFunc: GetSet<ShapeConfigHandler<this>, this>;
|
|
170
173
|
shadowColor: GetSet<string, this>;
|
package/lib/Shape.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const Validators_1 = require("./Validators");
|
|
9
|
-
const Global_2 = require("./Global");
|
|
10
|
-
const PointerEvents = require("./PointerEvents");
|
|
1
|
+
import { Konva } from "./Global.js";
|
|
2
|
+
import { Transform, Util } from "./Util.js";
|
|
3
|
+
import { Factory } from "./Factory.js";
|
|
4
|
+
import { Node } from "./Node.js";
|
|
5
|
+
import { getNumberValidator, getNumberOrAutoValidator, getStringValidator, getBooleanValidator, getStringOrGradientValidator, } from "./Validators.js";
|
|
6
|
+
import { _registerNode } from "./Global.js";
|
|
7
|
+
import * as PointerEvents from "./PointerEvents.js";
|
|
11
8
|
const HAS_SHADOW = 'hasShadow';
|
|
12
9
|
const SHADOW_RGBA = 'shadowRGBA';
|
|
13
10
|
const patternImage = 'patternImage';
|
|
@@ -18,10 +15,10 @@ function getDummyContext() {
|
|
|
18
15
|
if (dummyContext) {
|
|
19
16
|
return dummyContext;
|
|
20
17
|
}
|
|
21
|
-
dummyContext =
|
|
18
|
+
dummyContext = Util.createCanvasElement().getContext('2d');
|
|
22
19
|
return dummyContext;
|
|
23
20
|
}
|
|
24
|
-
|
|
21
|
+
export const shapes = {};
|
|
25
22
|
function _fillFunc(context) {
|
|
26
23
|
const fillRule = this.attrs.fillRule;
|
|
27
24
|
if (fillRule) {
|
|
@@ -61,25 +58,25 @@ function _clearLinearGradientCache() {
|
|
|
61
58
|
function _clearRadialGradientCache() {
|
|
62
59
|
this._clearCache(radialGradient);
|
|
63
60
|
}
|
|
64
|
-
class Shape extends
|
|
61
|
+
export class Shape extends Node {
|
|
65
62
|
constructor(config) {
|
|
66
63
|
super(config);
|
|
67
64
|
let key;
|
|
68
65
|
while (true) {
|
|
69
|
-
key =
|
|
70
|
-
if (key && !(key in
|
|
66
|
+
key = Util.getRandomColor();
|
|
67
|
+
if (key && !(key in shapes)) {
|
|
71
68
|
break;
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
this.colorKey = key;
|
|
75
|
-
|
|
72
|
+
shapes[key] = this;
|
|
76
73
|
}
|
|
77
74
|
getContext() {
|
|
78
|
-
|
|
75
|
+
Util.warn('shape.getContext() method is deprecated. Please do not use it.');
|
|
79
76
|
return this.getLayer().getContext();
|
|
80
77
|
}
|
|
81
78
|
getCanvas() {
|
|
82
|
-
|
|
79
|
+
Util.warn('shape.getCanvas() method is deprecated. Please do not use it.');
|
|
83
80
|
return this.getLayer().getCanvas();
|
|
84
81
|
}
|
|
85
82
|
getSceneFunc() {
|
|
@@ -107,9 +104,9 @@ class Shape extends Node_1.Node {
|
|
|
107
104
|
const ctx = getDummyContext();
|
|
108
105
|
const pattern = ctx.createPattern(this.fillPatternImage(), this.fillPatternRepeat() || 'repeat');
|
|
109
106
|
if (pattern && pattern.setTransform) {
|
|
110
|
-
const tr = new
|
|
107
|
+
const tr = new Transform();
|
|
111
108
|
tr.translate(this.fillPatternX(), this.fillPatternY());
|
|
112
|
-
tr.rotate(
|
|
109
|
+
tr.rotate(Konva.getAngle(this.fillPatternRotation()));
|
|
113
110
|
tr.scale(this.fillPatternScaleX(), this.fillPatternScaleY());
|
|
114
111
|
tr.translate(-1 * this.fillPatternOffsetX(), -1 * this.fillPatternOffsetY());
|
|
115
112
|
const m = tr.getMatrix();
|
|
@@ -167,7 +164,7 @@ class Shape extends Node_1.Node {
|
|
|
167
164
|
if (!this.hasShadow()) {
|
|
168
165
|
return;
|
|
169
166
|
}
|
|
170
|
-
const rgba =
|
|
167
|
+
const rgba = Util.colorToRGBA(this.shadowColor());
|
|
171
168
|
if (rgba) {
|
|
172
169
|
return ('rgba(' +
|
|
173
170
|
rgba.r +
|
|
@@ -226,8 +223,8 @@ class Shape extends Node_1.Node {
|
|
|
226
223
|
return p[3] > 0;
|
|
227
224
|
}
|
|
228
225
|
destroy() {
|
|
229
|
-
|
|
230
|
-
delete
|
|
226
|
+
Node.prototype.destroy.call(this);
|
|
227
|
+
delete shapes[this.colorKey];
|
|
231
228
|
delete this.colorKey;
|
|
232
229
|
return this;
|
|
233
230
|
}
|
|
@@ -251,7 +248,7 @@ class Shape extends Node_1.Node {
|
|
|
251
248
|
return false;
|
|
252
249
|
}
|
|
253
250
|
setStrokeHitEnabled(val) {
|
|
254
|
-
|
|
251
|
+
Util.warn('strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead.');
|
|
255
252
|
if (val) {
|
|
256
253
|
this.hitStrokeWidth('auto');
|
|
257
254
|
}
|
|
@@ -344,6 +341,7 @@ class Shape extends Node_1.Node {
|
|
|
344
341
|
bufferContext.clear();
|
|
345
342
|
bufferContext.save();
|
|
346
343
|
bufferContext._applyLineJoin(this);
|
|
344
|
+
bufferContext._applyMiterLimit(this);
|
|
347
345
|
const o = this.getAbsoluteTransform(top).getMatrix();
|
|
348
346
|
bufferContext.transform(o[0], o[1], o[2], o[3], o[4], o[5]);
|
|
349
347
|
drawFunc.call(this, bufferContext, this);
|
|
@@ -358,6 +356,7 @@ class Shape extends Node_1.Node {
|
|
|
358
356
|
}
|
|
359
357
|
else {
|
|
360
358
|
context._applyLineJoin(this);
|
|
359
|
+
context._applyMiterLimit(this);
|
|
361
360
|
if (!cachingSelf) {
|
|
362
361
|
const o = this.getAbsoluteTransform(top).getMatrix();
|
|
363
362
|
context.transform(o[0], o[1], o[2], o[3], o[4], o[5]);
|
|
@@ -378,7 +377,7 @@ class Shape extends Node_1.Node {
|
|
|
378
377
|
}
|
|
379
378
|
const layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
|
|
380
379
|
if (!this.colorKey) {
|
|
381
|
-
|
|
380
|
+
Util.warn('Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()');
|
|
382
381
|
}
|
|
383
382
|
if (cachedHitCanvas) {
|
|
384
383
|
context.save();
|
|
@@ -393,6 +392,7 @@ class Shape extends Node_1.Node {
|
|
|
393
392
|
}
|
|
394
393
|
context.save();
|
|
395
394
|
context._applyLineJoin(this);
|
|
395
|
+
context._applyMiterLimit(this);
|
|
396
396
|
const selfCache = this === top;
|
|
397
397
|
if (!selfCache) {
|
|
398
398
|
const o = this.getAbsoluteTransform(top).getMatrix();
|
|
@@ -410,7 +410,7 @@ class Shape extends Node_1.Node {
|
|
|
410
410
|
const hitImageData = hitContext.getImageData(0, 0, hitWidth, hitHeight);
|
|
411
411
|
const hitData = hitImageData.data;
|
|
412
412
|
const len = hitData.length;
|
|
413
|
-
const rgbColorKey =
|
|
413
|
+
const rgbColorKey = Util._hexToRgb(this.colorKey);
|
|
414
414
|
for (let i = 0; i < len; i += 4) {
|
|
415
415
|
const alpha = hitData[i + 3];
|
|
416
416
|
if (alpha > alphaThreshold) {
|
|
@@ -426,7 +426,7 @@ class Shape extends Node_1.Node {
|
|
|
426
426
|
hitContext.putImageData(hitImageData, 0, 0);
|
|
427
427
|
}
|
|
428
428
|
catch (e) {
|
|
429
|
-
|
|
429
|
+
Util.error('Unable to draw hit graph from cached scene canvas. ' + e.message);
|
|
430
430
|
}
|
|
431
431
|
return this;
|
|
432
432
|
}
|
|
@@ -440,100 +440,100 @@ class Shape extends Node_1.Node {
|
|
|
440
440
|
PointerEvents.releaseCapture(pointerId, this);
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
exports.Shape = Shape;
|
|
444
443
|
Shape.prototype._fillFunc = _fillFunc;
|
|
445
444
|
Shape.prototype._strokeFunc = _strokeFunc;
|
|
446
445
|
Shape.prototype._fillFuncHit = _fillFuncHit;
|
|
447
446
|
Shape.prototype._strokeFuncHit = _strokeFuncHit;
|
|
448
447
|
Shape.prototype._centroid = false;
|
|
449
448
|
Shape.prototype.nodeType = 'Shape';
|
|
450
|
-
|
|
449
|
+
_registerNode(Shape);
|
|
451
450
|
Shape.prototype.eventListeners = {};
|
|
452
451
|
Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearHasShadowCache);
|
|
453
452
|
Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearGetShadowRGBACache);
|
|
454
453
|
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);
|
|
455
454
|
Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva', _clearLinearGradientCache);
|
|
456
455
|
Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva', _clearRadialGradientCache);
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
456
|
+
Factory.addGetterSetter(Shape, 'stroke', undefined, getStringOrGradientValidator());
|
|
457
|
+
Factory.addGetterSetter(Shape, 'strokeWidth', 2, getNumberValidator());
|
|
458
|
+
Factory.addGetterSetter(Shape, 'fillAfterStrokeEnabled', false);
|
|
459
|
+
Factory.addGetterSetter(Shape, 'hitStrokeWidth', 'auto', getNumberOrAutoValidator());
|
|
460
|
+
Factory.addGetterSetter(Shape, 'strokeHitEnabled', true, getBooleanValidator());
|
|
461
|
+
Factory.addGetterSetter(Shape, 'perfectDrawEnabled', true, getBooleanValidator());
|
|
462
|
+
Factory.addGetterSetter(Shape, 'shadowForStrokeEnabled', true, getBooleanValidator());
|
|
463
|
+
Factory.addGetterSetter(Shape, 'lineJoin');
|
|
464
|
+
Factory.addGetterSetter(Shape, 'lineCap');
|
|
465
|
+
Factory.addGetterSetter(Shape, 'miterLimit');
|
|
466
|
+
Factory.addGetterSetter(Shape, 'sceneFunc');
|
|
467
|
+
Factory.addGetterSetter(Shape, 'hitFunc');
|
|
468
|
+
Factory.addGetterSetter(Shape, 'dash');
|
|
469
|
+
Factory.addGetterSetter(Shape, 'dashOffset', 0, getNumberValidator());
|
|
470
|
+
Factory.addGetterSetter(Shape, 'shadowColor', undefined, getStringValidator());
|
|
471
|
+
Factory.addGetterSetter(Shape, 'shadowBlur', 0, getNumberValidator());
|
|
472
|
+
Factory.addGetterSetter(Shape, 'shadowOpacity', 1, getNumberValidator());
|
|
473
|
+
Factory.addComponentsGetterSetter(Shape, 'shadowOffset', ['x', 'y']);
|
|
474
|
+
Factory.addGetterSetter(Shape, 'shadowOffsetX', 0, getNumberValidator());
|
|
475
|
+
Factory.addGetterSetter(Shape, 'shadowOffsetY', 0, getNumberValidator());
|
|
476
|
+
Factory.addGetterSetter(Shape, 'fillPatternImage');
|
|
477
|
+
Factory.addGetterSetter(Shape, 'fill', undefined, getStringOrGradientValidator());
|
|
478
|
+
Factory.addGetterSetter(Shape, 'fillPatternX', 0, getNumberValidator());
|
|
479
|
+
Factory.addGetterSetter(Shape, 'fillPatternY', 0, getNumberValidator());
|
|
480
|
+
Factory.addGetterSetter(Shape, 'fillLinearGradientColorStops');
|
|
481
|
+
Factory.addGetterSetter(Shape, 'strokeLinearGradientColorStops');
|
|
482
|
+
Factory.addGetterSetter(Shape, 'fillRadialGradientStartRadius', 0);
|
|
483
|
+
Factory.addGetterSetter(Shape, 'fillRadialGradientEndRadius', 0);
|
|
484
|
+
Factory.addGetterSetter(Shape, 'fillRadialGradientColorStops');
|
|
485
|
+
Factory.addGetterSetter(Shape, 'fillPatternRepeat', 'repeat');
|
|
486
|
+
Factory.addGetterSetter(Shape, 'fillEnabled', true);
|
|
487
|
+
Factory.addGetterSetter(Shape, 'strokeEnabled', true);
|
|
488
|
+
Factory.addGetterSetter(Shape, 'shadowEnabled', true);
|
|
489
|
+
Factory.addGetterSetter(Shape, 'dashEnabled', true);
|
|
490
|
+
Factory.addGetterSetter(Shape, 'strokeScaleEnabled', true);
|
|
491
|
+
Factory.addGetterSetter(Shape, 'fillPriority', 'color');
|
|
492
|
+
Factory.addComponentsGetterSetter(Shape, 'fillPatternOffset', ['x', 'y']);
|
|
493
|
+
Factory.addGetterSetter(Shape, 'fillPatternOffsetX', 0, getNumberValidator());
|
|
494
|
+
Factory.addGetterSetter(Shape, 'fillPatternOffsetY', 0, getNumberValidator());
|
|
495
|
+
Factory.addComponentsGetterSetter(Shape, 'fillPatternScale', ['x', 'y']);
|
|
496
|
+
Factory.addGetterSetter(Shape, 'fillPatternScaleX', 1, getNumberValidator());
|
|
497
|
+
Factory.addGetterSetter(Shape, 'fillPatternScaleY', 1, getNumberValidator());
|
|
498
|
+
Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientStartPoint', [
|
|
499
499
|
'x',
|
|
500
500
|
'y',
|
|
501
501
|
]);
|
|
502
|
-
|
|
502
|
+
Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientStartPoint', [
|
|
503
503
|
'x',
|
|
504
504
|
'y',
|
|
505
505
|
]);
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
506
|
+
Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointX', 0);
|
|
507
|
+
Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointX', 0);
|
|
508
|
+
Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointY', 0);
|
|
509
|
+
Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointY', 0);
|
|
510
|
+
Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientEndPoint', [
|
|
511
511
|
'x',
|
|
512
512
|
'y',
|
|
513
513
|
]);
|
|
514
|
-
|
|
514
|
+
Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientEndPoint', [
|
|
515
515
|
'x',
|
|
516
516
|
'y',
|
|
517
517
|
]);
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
518
|
+
Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointX', 0);
|
|
519
|
+
Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointX', 0);
|
|
520
|
+
Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointY', 0);
|
|
521
|
+
Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointY', 0);
|
|
522
|
+
Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientStartPoint', [
|
|
523
523
|
'x',
|
|
524
524
|
'y',
|
|
525
525
|
]);
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
526
|
+
Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointX', 0);
|
|
527
|
+
Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointY', 0);
|
|
528
|
+
Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientEndPoint', [
|
|
529
529
|
'x',
|
|
530
530
|
'y',
|
|
531
531
|
]);
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
532
|
+
Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointX', 0);
|
|
533
|
+
Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointY', 0);
|
|
534
|
+
Factory.addGetterSetter(Shape, 'fillPatternRotation', 0);
|
|
535
|
+
Factory.addGetterSetter(Shape, 'fillRule', undefined, getStringValidator());
|
|
536
|
+
Factory.backCompat(Shape, {
|
|
537
537
|
dashArray: 'dash',
|
|
538
538
|
getDashArray: 'getDash',
|
|
539
539
|
setDashArray: 'getDash',
|
package/lib/Stage.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { ContainerConfig } from './Container.ts';
|
|
2
|
+
import { Container } from './Container.ts';
|
|
3
|
+
import { SceneCanvas, HitCanvas } from './Canvas.ts';
|
|
4
|
+
import type { GetSet, Vector2d } from './types.ts';
|
|
5
|
+
import type { Shape } from './Shape.ts';
|
|
6
|
+
import type { Layer } from './Layer.ts';
|
|
6
7
|
export interface StageConfig extends ContainerConfig {
|
|
7
8
|
container?: HTMLDivElement | string;
|
|
8
9
|
}
|
|
@@ -48,7 +49,7 @@ export declare class Stage extends Container<Layer> {
|
|
|
48
49
|
getStage(): this;
|
|
49
50
|
getContent(): HTMLDivElement;
|
|
50
51
|
_toKonvaCanvas(config: any): SceneCanvas;
|
|
51
|
-
getIntersection(pos: Vector2d): Shape<import("./Shape.
|
|
52
|
+
getIntersection(pos: Vector2d): Shape<import("./Shape.ts").ShapeConfig> | null;
|
|
52
53
|
_resizeDOM(): void;
|
|
53
54
|
add(layer: Layer, ...rest: any[]): this;
|
|
54
55
|
getParent(): null;
|
|
@@ -60,7 +61,7 @@ export declare class Stage extends Container<Layer> {
|
|
|
60
61
|
_bindContentEvents(): void;
|
|
61
62
|
_pointerenter(evt: PointerEvent): void;
|
|
62
63
|
_pointerover(evt: any): void;
|
|
63
|
-
_getTargetShape(evenType: any): Shape<import("./Shape.
|
|
64
|
+
_getTargetShape(evenType: any): Shape<import("./Shape.ts").ShapeConfig> | null;
|
|
64
65
|
_pointerleave(evt: any): void;
|
|
65
66
|
_pointerdown(evt: TouchEvent | MouseEvent | PointerEvent): void;
|
|
66
67
|
_pointermove(evt: TouchEvent | MouseEvent | PointerEvent): void;
|