@camstack/addon-pipeline-orchestrator 0.1.28 → 0.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/dist/_stub.js +981 -1097
- package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-ptZ0g8RF.mjs +186 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DTMQMZQR.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CnELcfi3.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-BiLBDmU5.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.js-CBokMOYQ.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-yD-rMaFX.mjs +26 -0
- package/dist/dist-CYZr2fwk.mjs +2726 -0
- package/dist/hostInit-Dj50hFGl.mjs +147 -0
- package/dist/index.js +25501 -21720
- package/dist/index.mjs +25497 -21724
- package/dist/remoteEntry.js +134 -2973
- package/dist/remoteEntry.ssr.js +33 -0
- package/dist/virtualExposes-Bv3e5bey.mjs +27 -0
- package/dist/virtual_mf-exposes-ssr___mfe_internal__addon_pipeline_orchestrator_widgets__remoteEntry_js-DGpOm1yU.mjs +10 -0
- package/package.json +8 -9
- package/dist/@mf-types/compiled-types/widgets/PipelineQuickStats.d.ts +0 -3
- package/dist/@mf-types/compiled-types/widgets/PipelineQuickStats.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/ZoneEditor.d.ts +0 -17
- package/dist/@mf-types/compiled-types/widgets/ZoneEditor.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/ZonesTab.d.ts +0 -7
- package/dist/@mf-types/compiled-types/widgets/ZonesTab.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/index.d.ts +0 -13
- package/dist/@mf-types/compiled-types/widgets/index.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneForm.d.ts +0 -23
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneForm.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneList.d.ts +0 -15
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneList.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneOverlay.d.ts +0 -19
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneOverlay.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneRulesEditor.d.ts +0 -9
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneRulesEditor.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/types.d.ts +0 -33
- package/dist/@mf-types/compiled-types/widgets/zone-editor/types.d.ts.map +0 -1
- package/dist/@mf-types/widgets.d.ts +0 -2
- package/dist/@mf-types.d.ts +0 -3
- package/dist/@mf-types.zip +0 -0
- package/dist/ReactKonva-Rg9MNR62.mjs +0 -7267
- package/dist/_CoreInternals-B7PHssO3.mjs +0 -3808
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-lantnv8e.mjs +0 -12
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C507UJJC.mjs +0 -30
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-Bau3YeQq.mjs +0 -35
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-DoWbefqS.mjs +0 -104
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-D4eEXltm.mjs +0 -85
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-CVrnrGED.mjs +0 -62
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__konva__loadShare__.mjs-C4PYo-VP.mjs +0 -30
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-B9__gOco.mjs +0 -89
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs_commonjs-proxy-7px_s7lQ.mjs +0 -29
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-Cg6QsnjR.mjs +0 -36
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom__loadShare__.mjs-Dp8hqYOB.mjs +0 -45
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-BP356DyI.mjs +0 -6
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-BBmNf5hf.mjs +0 -34
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_konva__loadShare__.mjs-BjxkVuVo.mjs +0 -65
- package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-LTEdXGaz.mjs +0 -186
- package/dist/client-DRnvBKkB.mjs +0 -9836
- package/dist/getErrorShape-BPSzUA7W-TlK8ipWe.mjs +0 -211
- package/dist/hostInit-I-qi78F9.mjs +0 -196
- package/dist/index-B7LnRgSE.mjs +0 -725
- package/dist/index-BRAmQOXI.mjs +0 -1641
- package/dist/index-C52WDzRJ.mjs +0 -3842
- package/dist/index-CSDhxUNV.mjs +0 -435
- package/dist/index-CWkKuNLr.mjs +0 -232
- package/dist/index-Dhyr_mtg.mjs +0 -52894
- package/dist/index-DtOI1aTU.mjs +0 -18504
- package/dist/index-DujcNO2E.mjs +0 -185
- package/dist/index-LZ9uQOMe.mjs +0 -2603
- package/dist/index-xncRG7-x.mjs +0 -2713
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/jsx-runtime-C5ymGPwR.mjs +0 -55
- package/dist/schemas-B7L0qZtq.mjs +0 -3599
- package/dist/virtualExposes-8FzWTdq3.mjs +0 -42
|
@@ -1,3808 +0,0 @@
|
|
|
1
|
-
const de = Math.PI / 180;
|
|
2
|
-
function ue() {
|
|
3
|
-
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
|
|
4
|
-
}
|
|
5
|
-
const B = typeof global < "u" ? global : typeof window < "u" ? window : typeof WorkerGlobalScope < "u" ? self : {}, m = {
|
|
6
|
-
_global: B,
|
|
7
|
-
version: "10.3.0",
|
|
8
|
-
isBrowser: ue(),
|
|
9
|
-
isUnminified: /param/.test(function(n) {
|
|
10
|
-
}.toString()),
|
|
11
|
-
dblClickWindow: 400,
|
|
12
|
-
getAngle(n) {
|
|
13
|
-
return m.angleDeg ? n * de : n;
|
|
14
|
-
},
|
|
15
|
-
enableTrace: !1,
|
|
16
|
-
pointerEventsEnabled: !0,
|
|
17
|
-
autoDrawEnabled: !0,
|
|
18
|
-
hitOnDragEnabled: !1,
|
|
19
|
-
capturePointerEventsEnabled: !1,
|
|
20
|
-
_mouseListenClick: !1,
|
|
21
|
-
_touchListenClick: !1,
|
|
22
|
-
_pointerListenClick: !1,
|
|
23
|
-
_mouseInDblClickWindow: !1,
|
|
24
|
-
_touchInDblClickWindow: !1,
|
|
25
|
-
_pointerInDblClickWindow: !1,
|
|
26
|
-
_mouseDblClickPointerId: null,
|
|
27
|
-
_touchDblClickPointerId: null,
|
|
28
|
-
_pointerDblClickPointerId: null,
|
|
29
|
-
_renderBackend: "web",
|
|
30
|
-
legacyTextRendering: !1,
|
|
31
|
-
pixelRatio: typeof window < "u" && window.devicePixelRatio || 1,
|
|
32
|
-
dragDistance: 3,
|
|
33
|
-
angleDeg: !0,
|
|
34
|
-
showWarnings: !0,
|
|
35
|
-
dragButtons: [0, 1],
|
|
36
|
-
isDragging() {
|
|
37
|
-
return m.DD.isDragging;
|
|
38
|
-
},
|
|
39
|
-
isTransforming() {
|
|
40
|
-
var n, t;
|
|
41
|
-
return (t = (n = m.Transformer) === null || n === void 0 ? void 0 : n.isTransforming()) !== null && t !== void 0 ? t : !1;
|
|
42
|
-
},
|
|
43
|
-
isDragReady() {
|
|
44
|
-
return !!m.DD.node;
|
|
45
|
-
},
|
|
46
|
-
releaseCanvasOnDestroy: !0,
|
|
47
|
-
document: B.document,
|
|
48
|
-
_injectGlobal(n) {
|
|
49
|
-
typeof B.Konva < "u" && console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."), B.Konva = n;
|
|
50
|
-
}
|
|
51
|
-
}, nt = (n) => {
|
|
52
|
-
m[n.prototype.getClassName()] = n;
|
|
53
|
-
};
|
|
54
|
-
m._injectGlobal(m);
|
|
55
|
-
const fe = `Konva.js unsupported environment.
|
|
56
|
-
|
|
57
|
-
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
58
|
-
|
|
59
|
-
To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
|
|
60
|
-
|
|
61
|
-
bash: npm install canvas
|
|
62
|
-
js: import "konva/canvas-backend";
|
|
63
|
-
|
|
64
|
-
or
|
|
65
|
-
|
|
66
|
-
bash: npm install skia-canvas
|
|
67
|
-
js: import "konva/skia-backend";
|
|
68
|
-
`, At = () => {
|
|
69
|
-
if (typeof document > "u")
|
|
70
|
-
throw new Error(fe);
|
|
71
|
-
};
|
|
72
|
-
class L {
|
|
73
|
-
constructor(t = [1, 0, 0, 1, 0, 0]) {
|
|
74
|
-
this.dirty = !1, this.m = t && t.slice() || [1, 0, 0, 1, 0, 0];
|
|
75
|
-
}
|
|
76
|
-
reset() {
|
|
77
|
-
this.m[0] = 1, this.m[1] = 0, this.m[2] = 0, this.m[3] = 1, this.m[4] = 0, this.m[5] = 0;
|
|
78
|
-
}
|
|
79
|
-
copy() {
|
|
80
|
-
return new L(this.m);
|
|
81
|
-
}
|
|
82
|
-
copyInto(t) {
|
|
83
|
-
t.m[0] = this.m[0], t.m[1] = this.m[1], t.m[2] = this.m[2], t.m[3] = this.m[3], t.m[4] = this.m[4], t.m[5] = this.m[5];
|
|
84
|
-
}
|
|
85
|
-
point(t) {
|
|
86
|
-
const e = this.m;
|
|
87
|
-
return {
|
|
88
|
-
x: e[0] * t.x + e[2] * t.y + e[4],
|
|
89
|
-
y: e[1] * t.x + e[3] * t.y + e[5]
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
translate(t, e) {
|
|
93
|
-
return this.m[4] += this.m[0] * t + this.m[2] * e, this.m[5] += this.m[1] * t + this.m[3] * e, this;
|
|
94
|
-
}
|
|
95
|
-
scale(t, e) {
|
|
96
|
-
return this.m[0] *= t, this.m[1] *= t, this.m[2] *= e, this.m[3] *= e, this;
|
|
97
|
-
}
|
|
98
|
-
rotate(t) {
|
|
99
|
-
const e = Math.cos(t), i = Math.sin(t), s = this.m[0] * e + this.m[2] * i, r = this.m[1] * e + this.m[3] * i, a = this.m[0] * -i + this.m[2] * e, o = this.m[1] * -i + this.m[3] * e;
|
|
100
|
-
return this.m[0] = s, this.m[1] = r, this.m[2] = a, this.m[3] = o, this;
|
|
101
|
-
}
|
|
102
|
-
getTranslation() {
|
|
103
|
-
return {
|
|
104
|
-
x: this.m[4],
|
|
105
|
-
y: this.m[5]
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
skew(t, e) {
|
|
109
|
-
const i = this.m[0] + this.m[2] * e, s = this.m[1] + this.m[3] * e, r = this.m[2] + this.m[0] * t, a = this.m[3] + this.m[1] * t;
|
|
110
|
-
return this.m[0] = i, this.m[1] = s, this.m[2] = r, this.m[3] = a, this;
|
|
111
|
-
}
|
|
112
|
-
multiply(t) {
|
|
113
|
-
const e = this.m[0] * t.m[0] + this.m[2] * t.m[1], i = this.m[1] * t.m[0] + this.m[3] * t.m[1], s = this.m[0] * t.m[2] + this.m[2] * t.m[3], r = this.m[1] * t.m[2] + this.m[3] * t.m[3], a = this.m[0] * t.m[4] + this.m[2] * t.m[5] + this.m[4], o = this.m[1] * t.m[4] + this.m[3] * t.m[5] + this.m[5];
|
|
114
|
-
return this.m[0] = e, this.m[1] = i, this.m[2] = s, this.m[3] = r, this.m[4] = a, this.m[5] = o, this;
|
|
115
|
-
}
|
|
116
|
-
invert() {
|
|
117
|
-
const t = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]), e = this.m[3] * t, i = -this.m[1] * t, s = -this.m[2] * t, r = this.m[0] * t, a = t * (this.m[2] * this.m[5] - this.m[3] * this.m[4]), o = t * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
|
|
118
|
-
return this.m[0] = e, this.m[1] = i, this.m[2] = s, this.m[3] = r, this.m[4] = a, this.m[5] = o, this;
|
|
119
|
-
}
|
|
120
|
-
getMatrix() {
|
|
121
|
-
return this.m;
|
|
122
|
-
}
|
|
123
|
-
decompose() {
|
|
124
|
-
const t = this.m[0], e = this.m[1], i = this.m[2], s = this.m[3], r = this.m[4], a = this.m[5], o = t * s - e * i, h = {
|
|
125
|
-
x: r,
|
|
126
|
-
y: a,
|
|
127
|
-
rotation: 0,
|
|
128
|
-
scaleX: 0,
|
|
129
|
-
scaleY: 0,
|
|
130
|
-
skewX: 0,
|
|
131
|
-
skewY: 0
|
|
132
|
-
};
|
|
133
|
-
if (t != 0 || e != 0) {
|
|
134
|
-
const l = Math.sqrt(t * t + e * e);
|
|
135
|
-
h.rotation = e > 0 ? Math.acos(t / l) : -Math.acos(t / l), h.scaleX = l, h.scaleY = o / l, h.skewX = (t * i + e * s) / o, h.skewY = 0;
|
|
136
|
-
} else if (i != 0 || s != 0) {
|
|
137
|
-
const l = Math.sqrt(i * i + s * s);
|
|
138
|
-
h.rotation = Math.PI / 2 - (s > 0 ? Math.acos(-i / l) : -Math.acos(i / l)), h.scaleX = o / l, h.scaleY = l, h.skewX = 0, h.skewY = (t * i + e * s) / o;
|
|
139
|
-
}
|
|
140
|
-
return h.rotation = c._getRotation(h.rotation), h;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
const ge = "[object Array]", pe = "[object Number]", me = "[object String]", _e = "[object Boolean]", ye = Math.PI / 180, Ce = 180 / Math.PI, X = "#", ve = "", be = "0", Se = "Konva warning: ", Gt = "Konva error: ", we = "rgb(", pt = {
|
|
144
|
-
aliceblue: [240, 248, 255],
|
|
145
|
-
antiquewhite: [250, 235, 215],
|
|
146
|
-
aqua: [0, 255, 255],
|
|
147
|
-
aquamarine: [127, 255, 212],
|
|
148
|
-
azure: [240, 255, 255],
|
|
149
|
-
beige: [245, 245, 220],
|
|
150
|
-
bisque: [255, 228, 196],
|
|
151
|
-
black: [0, 0, 0],
|
|
152
|
-
blanchedalmond: [255, 235, 205],
|
|
153
|
-
blue: [0, 0, 255],
|
|
154
|
-
blueviolet: [138, 43, 226],
|
|
155
|
-
brown: [165, 42, 42],
|
|
156
|
-
burlywood: [222, 184, 135],
|
|
157
|
-
cadetblue: [95, 158, 160],
|
|
158
|
-
chartreuse: [127, 255, 0],
|
|
159
|
-
chocolate: [210, 105, 30],
|
|
160
|
-
coral: [255, 127, 80],
|
|
161
|
-
cornflowerblue: [100, 149, 237],
|
|
162
|
-
cornsilk: [255, 248, 220],
|
|
163
|
-
crimson: [220, 20, 60],
|
|
164
|
-
cyan: [0, 255, 255],
|
|
165
|
-
darkblue: [0, 0, 139],
|
|
166
|
-
darkcyan: [0, 139, 139],
|
|
167
|
-
darkgoldenrod: [184, 132, 11],
|
|
168
|
-
darkgray: [169, 169, 169],
|
|
169
|
-
darkgreen: [0, 100, 0],
|
|
170
|
-
darkgrey: [169, 169, 169],
|
|
171
|
-
darkkhaki: [189, 183, 107],
|
|
172
|
-
darkmagenta: [139, 0, 139],
|
|
173
|
-
darkolivegreen: [85, 107, 47],
|
|
174
|
-
darkorange: [255, 140, 0],
|
|
175
|
-
darkorchid: [153, 50, 204],
|
|
176
|
-
darkred: [139, 0, 0],
|
|
177
|
-
darksalmon: [233, 150, 122],
|
|
178
|
-
darkseagreen: [143, 188, 143],
|
|
179
|
-
darkslateblue: [72, 61, 139],
|
|
180
|
-
darkslategray: [47, 79, 79],
|
|
181
|
-
darkslategrey: [47, 79, 79],
|
|
182
|
-
darkturquoise: [0, 206, 209],
|
|
183
|
-
darkviolet: [148, 0, 211],
|
|
184
|
-
deeppink: [255, 20, 147],
|
|
185
|
-
deepskyblue: [0, 191, 255],
|
|
186
|
-
dimgray: [105, 105, 105],
|
|
187
|
-
dimgrey: [105, 105, 105],
|
|
188
|
-
dodgerblue: [30, 144, 255],
|
|
189
|
-
firebrick: [178, 34, 34],
|
|
190
|
-
floralwhite: [255, 255, 240],
|
|
191
|
-
forestgreen: [34, 139, 34],
|
|
192
|
-
fuchsia: [255, 0, 255],
|
|
193
|
-
gainsboro: [220, 220, 220],
|
|
194
|
-
ghostwhite: [248, 248, 255],
|
|
195
|
-
gold: [255, 215, 0],
|
|
196
|
-
goldenrod: [218, 165, 32],
|
|
197
|
-
gray: [128, 128, 128],
|
|
198
|
-
green: [0, 128, 0],
|
|
199
|
-
greenyellow: [173, 255, 47],
|
|
200
|
-
grey: [128, 128, 128],
|
|
201
|
-
honeydew: [240, 255, 240],
|
|
202
|
-
hotpink: [255, 105, 180],
|
|
203
|
-
indianred: [205, 92, 92],
|
|
204
|
-
indigo: [75, 0, 130],
|
|
205
|
-
ivory: [255, 255, 240],
|
|
206
|
-
khaki: [240, 230, 140],
|
|
207
|
-
lavender: [230, 230, 250],
|
|
208
|
-
lavenderblush: [255, 240, 245],
|
|
209
|
-
lawngreen: [124, 252, 0],
|
|
210
|
-
lemonchiffon: [255, 250, 205],
|
|
211
|
-
lightblue: [173, 216, 230],
|
|
212
|
-
lightcoral: [240, 128, 128],
|
|
213
|
-
lightcyan: [224, 255, 255],
|
|
214
|
-
lightgoldenrodyellow: [250, 250, 210],
|
|
215
|
-
lightgray: [211, 211, 211],
|
|
216
|
-
lightgreen: [144, 238, 144],
|
|
217
|
-
lightgrey: [211, 211, 211],
|
|
218
|
-
lightpink: [255, 182, 193],
|
|
219
|
-
lightsalmon: [255, 160, 122],
|
|
220
|
-
lightseagreen: [32, 178, 170],
|
|
221
|
-
lightskyblue: [135, 206, 250],
|
|
222
|
-
lightslategray: [119, 136, 153],
|
|
223
|
-
lightslategrey: [119, 136, 153],
|
|
224
|
-
lightsteelblue: [176, 196, 222],
|
|
225
|
-
lightyellow: [255, 255, 224],
|
|
226
|
-
lime: [0, 255, 0],
|
|
227
|
-
limegreen: [50, 205, 50],
|
|
228
|
-
linen: [250, 240, 230],
|
|
229
|
-
magenta: [255, 0, 255],
|
|
230
|
-
maroon: [128, 0, 0],
|
|
231
|
-
mediumaquamarine: [102, 205, 170],
|
|
232
|
-
mediumblue: [0, 0, 205],
|
|
233
|
-
mediumorchid: [186, 85, 211],
|
|
234
|
-
mediumpurple: [147, 112, 219],
|
|
235
|
-
mediumseagreen: [60, 179, 113],
|
|
236
|
-
mediumslateblue: [123, 104, 238],
|
|
237
|
-
mediumspringgreen: [0, 250, 154],
|
|
238
|
-
mediumturquoise: [72, 209, 204],
|
|
239
|
-
mediumvioletred: [199, 21, 133],
|
|
240
|
-
midnightblue: [25, 25, 112],
|
|
241
|
-
mintcream: [245, 255, 250],
|
|
242
|
-
mistyrose: [255, 228, 225],
|
|
243
|
-
moccasin: [255, 228, 181],
|
|
244
|
-
navajowhite: [255, 222, 173],
|
|
245
|
-
navy: [0, 0, 128],
|
|
246
|
-
oldlace: [253, 245, 230],
|
|
247
|
-
olive: [128, 128, 0],
|
|
248
|
-
olivedrab: [107, 142, 35],
|
|
249
|
-
orange: [255, 165, 0],
|
|
250
|
-
orangered: [255, 69, 0],
|
|
251
|
-
orchid: [218, 112, 214],
|
|
252
|
-
palegoldenrod: [238, 232, 170],
|
|
253
|
-
palegreen: [152, 251, 152],
|
|
254
|
-
paleturquoise: [175, 238, 238],
|
|
255
|
-
palevioletred: [219, 112, 147],
|
|
256
|
-
papayawhip: [255, 239, 213],
|
|
257
|
-
peachpuff: [255, 218, 185],
|
|
258
|
-
peru: [205, 133, 63],
|
|
259
|
-
pink: [255, 192, 203],
|
|
260
|
-
plum: [221, 160, 203],
|
|
261
|
-
powderblue: [176, 224, 230],
|
|
262
|
-
purple: [128, 0, 128],
|
|
263
|
-
rebeccapurple: [102, 51, 153],
|
|
264
|
-
red: [255, 0, 0],
|
|
265
|
-
rosybrown: [188, 143, 143],
|
|
266
|
-
royalblue: [65, 105, 225],
|
|
267
|
-
saddlebrown: [139, 69, 19],
|
|
268
|
-
salmon: [250, 128, 114],
|
|
269
|
-
sandybrown: [244, 164, 96],
|
|
270
|
-
seagreen: [46, 139, 87],
|
|
271
|
-
seashell: [255, 245, 238],
|
|
272
|
-
sienna: [160, 82, 45],
|
|
273
|
-
silver: [192, 192, 192],
|
|
274
|
-
skyblue: [135, 206, 235],
|
|
275
|
-
slateblue: [106, 90, 205],
|
|
276
|
-
slategray: [119, 128, 144],
|
|
277
|
-
slategrey: [119, 128, 144],
|
|
278
|
-
snow: [255, 255, 250],
|
|
279
|
-
springgreen: [0, 255, 127],
|
|
280
|
-
steelblue: [70, 130, 180],
|
|
281
|
-
tan: [210, 180, 140],
|
|
282
|
-
teal: [0, 128, 128],
|
|
283
|
-
thistle: [216, 191, 216],
|
|
284
|
-
transparent: [255, 255, 255, 0],
|
|
285
|
-
tomato: [255, 99, 71],
|
|
286
|
-
turquoise: [64, 224, 208],
|
|
287
|
-
violet: [238, 130, 238],
|
|
288
|
-
wheat: [245, 222, 179],
|
|
289
|
-
white: [255, 255, 255],
|
|
290
|
-
whitesmoke: [245, 245, 245],
|
|
291
|
-
yellow: [255, 255, 0],
|
|
292
|
-
yellowgreen: [154, 205, 5]
|
|
293
|
-
}, xe = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;
|
|
294
|
-
let st = [], V = null;
|
|
295
|
-
const Ee = typeof requestAnimationFrame < "u" && requestAnimationFrame || function(n) {
|
|
296
|
-
setTimeout(n, 16);
|
|
297
|
-
}, c = {
|
|
298
|
-
_isElement(n) {
|
|
299
|
-
return !!(n && n.nodeType == 1);
|
|
300
|
-
},
|
|
301
|
-
_isFunction(n) {
|
|
302
|
-
return !!(n && n.constructor && n.call && n.apply);
|
|
303
|
-
},
|
|
304
|
-
_isPlainObject(n) {
|
|
305
|
-
return !!n && n.constructor === Object;
|
|
306
|
-
},
|
|
307
|
-
_isArray(n) {
|
|
308
|
-
return Object.prototype.toString.call(n) === ge;
|
|
309
|
-
},
|
|
310
|
-
_isNumber(n) {
|
|
311
|
-
return Object.prototype.toString.call(n) === pe && !isNaN(n) && isFinite(n);
|
|
312
|
-
},
|
|
313
|
-
_isString(n) {
|
|
314
|
-
return Object.prototype.toString.call(n) === me;
|
|
315
|
-
},
|
|
316
|
-
_isBoolean(n) {
|
|
317
|
-
return Object.prototype.toString.call(n) === _e;
|
|
318
|
-
},
|
|
319
|
-
isObject(n) {
|
|
320
|
-
return n instanceof Object;
|
|
321
|
-
},
|
|
322
|
-
isValidSelector(n) {
|
|
323
|
-
if (typeof n != "string")
|
|
324
|
-
return !1;
|
|
325
|
-
const t = n[0];
|
|
326
|
-
return t === "#" || t === "." || t === t.toUpperCase();
|
|
327
|
-
},
|
|
328
|
-
_sign(n) {
|
|
329
|
-
return n === 0 || n > 0 ? 1 : -1;
|
|
330
|
-
},
|
|
331
|
-
requestAnimFrame(n) {
|
|
332
|
-
st.push(n), st.length === 1 && Ee(function() {
|
|
333
|
-
const t = st;
|
|
334
|
-
st = [], t.forEach(function(e) {
|
|
335
|
-
e();
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
},
|
|
339
|
-
createCanvasElement() {
|
|
340
|
-
At();
|
|
341
|
-
const n = document.createElement("canvas");
|
|
342
|
-
try {
|
|
343
|
-
n.style = n.style || {};
|
|
344
|
-
} catch {
|
|
345
|
-
}
|
|
346
|
-
return n;
|
|
347
|
-
},
|
|
348
|
-
createImageElement() {
|
|
349
|
-
return At(), document.createElement("img");
|
|
350
|
-
},
|
|
351
|
-
_isInDocument(n) {
|
|
352
|
-
for (; n = n.parentNode; )
|
|
353
|
-
if (n == document)
|
|
354
|
-
return !0;
|
|
355
|
-
return !1;
|
|
356
|
-
},
|
|
357
|
-
_urlToImage(n, t) {
|
|
358
|
-
const e = c.createImageElement();
|
|
359
|
-
e.onload = function() {
|
|
360
|
-
t(e);
|
|
361
|
-
}, e.src = n;
|
|
362
|
-
},
|
|
363
|
-
_rgbToHex(n, t, e) {
|
|
364
|
-
return ((1 << 24) + (n << 16) + (t << 8) + e).toString(16).slice(1);
|
|
365
|
-
},
|
|
366
|
-
_hexToRgb(n) {
|
|
367
|
-
n = n.replace(X, ve);
|
|
368
|
-
const t = parseInt(n, 16);
|
|
369
|
-
return {
|
|
370
|
-
r: t >> 16 & 255,
|
|
371
|
-
g: t >> 8 & 255,
|
|
372
|
-
b: t & 255
|
|
373
|
-
};
|
|
374
|
-
},
|
|
375
|
-
getRandomColor() {
|
|
376
|
-
let n = (Math.random() * 16777215 << 0).toString(16);
|
|
377
|
-
for (; n.length < 6; )
|
|
378
|
-
n = be + n;
|
|
379
|
-
return X + n;
|
|
380
|
-
},
|
|
381
|
-
isCanvasFarblingActive() {
|
|
382
|
-
if (V !== null)
|
|
383
|
-
return V;
|
|
384
|
-
if (typeof document > "u")
|
|
385
|
-
return V = !1, !1;
|
|
386
|
-
const n = this.createCanvasElement();
|
|
387
|
-
n.width = 10, n.height = 10;
|
|
388
|
-
const t = n.getContext("2d", {
|
|
389
|
-
willReadFrequently: !0
|
|
390
|
-
});
|
|
391
|
-
t.clearRect(0, 0, 10, 10), t.fillStyle = "#282828", t.fillRect(0, 0, 10, 10);
|
|
392
|
-
const e = t.getImageData(0, 0, 10, 10).data;
|
|
393
|
-
let i = !1;
|
|
394
|
-
for (let s = 0; s < 100; s++)
|
|
395
|
-
if (e[s * 4] !== 40 || e[s * 4 + 1] !== 40 || e[s * 4 + 2] !== 40 || e[s * 4 + 3] !== 255) {
|
|
396
|
-
i = !0;
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
return V = i, this.releaseCanvas(n), V;
|
|
400
|
-
},
|
|
401
|
-
getHitColor() {
|
|
402
|
-
const n = this.getRandomColor();
|
|
403
|
-
return this.isCanvasFarblingActive() ? this.getSnappedHexColor(n) : n;
|
|
404
|
-
},
|
|
405
|
-
getHitColorKey(n, t, e) {
|
|
406
|
-
return this.isCanvasFarblingActive() && (n = Math.round(n / 5) * 5, t = Math.round(t / 5) * 5, e = Math.round(e / 5) * 5), X + this._rgbToHex(n, t, e);
|
|
407
|
-
},
|
|
408
|
-
getSnappedHexColor(n) {
|
|
409
|
-
const t = this._hexToRgb(n);
|
|
410
|
-
return X + this._rgbToHex(Math.round(t.r / 5) * 5, Math.round(t.g / 5) * 5, Math.round(t.b / 5) * 5);
|
|
411
|
-
},
|
|
412
|
-
getRGB(n) {
|
|
413
|
-
let t;
|
|
414
|
-
return n in pt ? (t = pt[n], {
|
|
415
|
-
r: t[0],
|
|
416
|
-
g: t[1],
|
|
417
|
-
b: t[2]
|
|
418
|
-
}) : n[0] === X ? this._hexToRgb(n.substring(1)) : n.substr(0, 4) === we ? (t = xe.exec(n.replace(/ /g, "")), {
|
|
419
|
-
r: parseInt(t[1], 10),
|
|
420
|
-
g: parseInt(t[2], 10),
|
|
421
|
-
b: parseInt(t[3], 10)
|
|
422
|
-
}) : {
|
|
423
|
-
r: 0,
|
|
424
|
-
g: 0,
|
|
425
|
-
b: 0
|
|
426
|
-
};
|
|
427
|
-
},
|
|
428
|
-
colorToRGBA(n) {
|
|
429
|
-
return n = n || "black", c._namedColorToRBA(n) || c._hex3ColorToRGBA(n) || c._hex4ColorToRGBA(n) || c._hex6ColorToRGBA(n) || c._hex8ColorToRGBA(n) || c._rgbColorToRGBA(n) || c._rgbaColorToRGBA(n) || c._hslColorToRGBA(n);
|
|
430
|
-
},
|
|
431
|
-
_namedColorToRBA(n) {
|
|
432
|
-
const t = pt[n.toLowerCase()];
|
|
433
|
-
return t ? {
|
|
434
|
-
r: t[0],
|
|
435
|
-
g: t[1],
|
|
436
|
-
b: t[2],
|
|
437
|
-
a: 1
|
|
438
|
-
} : null;
|
|
439
|
-
},
|
|
440
|
-
_rgbColorToRGBA(n) {
|
|
441
|
-
if (n.indexOf("rgb(") === 0) {
|
|
442
|
-
n = n.match(/rgb\(([^)]+)\)/)[1];
|
|
443
|
-
const t = n.split(/ *, */).map(Number);
|
|
444
|
-
return {
|
|
445
|
-
r: t[0],
|
|
446
|
-
g: t[1],
|
|
447
|
-
b: t[2],
|
|
448
|
-
a: 1
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
_rgbaColorToRGBA(n) {
|
|
453
|
-
if (n.indexOf("rgba(") === 0) {
|
|
454
|
-
n = n.match(/rgba\(([^)]+)\)/)[1];
|
|
455
|
-
const t = n.split(/ *, */).map((e, i) => e.slice(-1) === "%" ? i === 3 ? parseInt(e) / 100 : parseInt(e) / 100 * 255 : Number(e));
|
|
456
|
-
return {
|
|
457
|
-
r: t[0],
|
|
458
|
-
g: t[1],
|
|
459
|
-
b: t[2],
|
|
460
|
-
a: t[3]
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
_hex8ColorToRGBA(n) {
|
|
465
|
-
if (n[0] === "#" && n.length === 9)
|
|
466
|
-
return {
|
|
467
|
-
r: parseInt(n.slice(1, 3), 16),
|
|
468
|
-
g: parseInt(n.slice(3, 5), 16),
|
|
469
|
-
b: parseInt(n.slice(5, 7), 16),
|
|
470
|
-
a: parseInt(n.slice(7, 9), 16) / 255
|
|
471
|
-
};
|
|
472
|
-
},
|
|
473
|
-
_hex6ColorToRGBA(n) {
|
|
474
|
-
if (n[0] === "#" && n.length === 7)
|
|
475
|
-
return {
|
|
476
|
-
r: parseInt(n.slice(1, 3), 16),
|
|
477
|
-
g: parseInt(n.slice(3, 5), 16),
|
|
478
|
-
b: parseInt(n.slice(5, 7), 16),
|
|
479
|
-
a: 1
|
|
480
|
-
};
|
|
481
|
-
},
|
|
482
|
-
_hex4ColorToRGBA(n) {
|
|
483
|
-
if (n[0] === "#" && n.length === 5)
|
|
484
|
-
return {
|
|
485
|
-
r: parseInt(n[1] + n[1], 16),
|
|
486
|
-
g: parseInt(n[2] + n[2], 16),
|
|
487
|
-
b: parseInt(n[3] + n[3], 16),
|
|
488
|
-
a: parseInt(n[4] + n[4], 16) / 255
|
|
489
|
-
};
|
|
490
|
-
},
|
|
491
|
-
_hex3ColorToRGBA(n) {
|
|
492
|
-
if (n[0] === "#" && n.length === 4)
|
|
493
|
-
return {
|
|
494
|
-
r: parseInt(n[1] + n[1], 16),
|
|
495
|
-
g: parseInt(n[2] + n[2], 16),
|
|
496
|
-
b: parseInt(n[3] + n[3], 16),
|
|
497
|
-
a: 1
|
|
498
|
-
};
|
|
499
|
-
},
|
|
500
|
-
_hslColorToRGBA(n) {
|
|
501
|
-
if (/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(n)) {
|
|
502
|
-
const [t, ...e] = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(n), i = Number(e[0]) / 360, s = Number(e[1]) / 100, r = Number(e[2]) / 100;
|
|
503
|
-
let a, o, h;
|
|
504
|
-
if (s === 0)
|
|
505
|
-
return h = r * 255, {
|
|
506
|
-
r: Math.round(h),
|
|
507
|
-
g: Math.round(h),
|
|
508
|
-
b: Math.round(h),
|
|
509
|
-
a: 1
|
|
510
|
-
};
|
|
511
|
-
r < 0.5 ? a = r * (1 + s) : a = r + s - r * s;
|
|
512
|
-
const l = 2 * r - a, d = [0, 0, 0];
|
|
513
|
-
for (let u = 0; u < 3; u++)
|
|
514
|
-
o = i + 1 / 3 * -(u - 1), o < 0 && o++, o > 1 && o--, 6 * o < 1 ? h = l + (a - l) * 6 * o : 2 * o < 1 ? h = a : 3 * o < 2 ? h = l + (a - l) * (2 / 3 - o) * 6 : h = l, d[u] = h * 255;
|
|
515
|
-
return {
|
|
516
|
-
r: Math.round(d[0]),
|
|
517
|
-
g: Math.round(d[1]),
|
|
518
|
-
b: Math.round(d[2]),
|
|
519
|
-
a: 1
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
},
|
|
523
|
-
haveIntersection(n, t) {
|
|
524
|
-
return !(t.x > n.x + n.width || t.x + t.width < n.x || t.y > n.y + n.height || t.y + t.height < n.y);
|
|
525
|
-
},
|
|
526
|
-
cloneObject(n) {
|
|
527
|
-
const t = {};
|
|
528
|
-
for (const e in n)
|
|
529
|
-
this._isPlainObject(n[e]) ? t[e] = this.cloneObject(n[e]) : this._isArray(n[e]) ? t[e] = this.cloneArray(n[e]) : t[e] = n[e];
|
|
530
|
-
return t;
|
|
531
|
-
},
|
|
532
|
-
cloneArray(n) {
|
|
533
|
-
return n.slice(0);
|
|
534
|
-
},
|
|
535
|
-
degToRad(n) {
|
|
536
|
-
return n * ye;
|
|
537
|
-
},
|
|
538
|
-
radToDeg(n) {
|
|
539
|
-
return n * Ce;
|
|
540
|
-
},
|
|
541
|
-
_degToRad(n) {
|
|
542
|
-
return c.warn("Util._degToRad is removed. Please use public Util.degToRad instead."), c.degToRad(n);
|
|
543
|
-
},
|
|
544
|
-
_radToDeg(n) {
|
|
545
|
-
return c.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."), c.radToDeg(n);
|
|
546
|
-
},
|
|
547
|
-
_getRotation(n) {
|
|
548
|
-
return m.angleDeg ? c.radToDeg(n) : n;
|
|
549
|
-
},
|
|
550
|
-
_capitalize(n) {
|
|
551
|
-
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
552
|
-
},
|
|
553
|
-
throw(n) {
|
|
554
|
-
throw new Error(Gt + n);
|
|
555
|
-
},
|
|
556
|
-
error(n) {
|
|
557
|
-
console.error(Gt + n);
|
|
558
|
-
},
|
|
559
|
-
warn(n) {
|
|
560
|
-
m.showWarnings && console.warn(Se + n);
|
|
561
|
-
},
|
|
562
|
-
each(n, t) {
|
|
563
|
-
for (const e in n)
|
|
564
|
-
t(e, n[e]);
|
|
565
|
-
},
|
|
566
|
-
_inRange(n, t, e) {
|
|
567
|
-
return t <= n && n < e;
|
|
568
|
-
},
|
|
569
|
-
_getProjectionToSegment(n, t, e, i, s, r) {
|
|
570
|
-
let a, o, h;
|
|
571
|
-
const l = (n - e) * (n - e) + (t - i) * (t - i);
|
|
572
|
-
if (l == 0)
|
|
573
|
-
a = n, o = t, h = (s - e) * (s - e) + (r - i) * (r - i);
|
|
574
|
-
else {
|
|
575
|
-
const d = ((s - n) * (e - n) + (r - t) * (i - t)) / l;
|
|
576
|
-
d < 0 ? (a = n, o = t, h = (n - s) * (n - s) + (t - r) * (t - r)) : d > 1 ? (a = e, o = i, h = (e - s) * (e - s) + (i - r) * (i - r)) : (a = n + d * (e - n), o = t + d * (i - t), h = (a - s) * (a - s) + (o - r) * (o - r));
|
|
577
|
-
}
|
|
578
|
-
return [a, o, h];
|
|
579
|
-
},
|
|
580
|
-
_getProjectionToLine(n, t, e) {
|
|
581
|
-
const i = c.cloneObject(n);
|
|
582
|
-
let s = Number.MAX_VALUE;
|
|
583
|
-
return t.forEach(function(r, a) {
|
|
584
|
-
if (!e && a === t.length - 1)
|
|
585
|
-
return;
|
|
586
|
-
const o = t[(a + 1) % t.length], h = c._getProjectionToSegment(r.x, r.y, o.x, o.y, n.x, n.y), l = h[0], d = h[1], u = h[2];
|
|
587
|
-
u < s && (i.x = l, i.y = d, s = u);
|
|
588
|
-
}), i;
|
|
589
|
-
},
|
|
590
|
-
_prepareArrayForTween(n, t, e) {
|
|
591
|
-
const i = [], s = [];
|
|
592
|
-
if (n.length > t.length) {
|
|
593
|
-
const a = t;
|
|
594
|
-
t = n, n = a;
|
|
595
|
-
}
|
|
596
|
-
for (let a = 0; a < n.length; a += 2)
|
|
597
|
-
i.push({
|
|
598
|
-
x: n[a],
|
|
599
|
-
y: n[a + 1]
|
|
600
|
-
});
|
|
601
|
-
for (let a = 0; a < t.length; a += 2)
|
|
602
|
-
s.push({
|
|
603
|
-
x: t[a],
|
|
604
|
-
y: t[a + 1]
|
|
605
|
-
});
|
|
606
|
-
const r = [];
|
|
607
|
-
return s.forEach(function(a) {
|
|
608
|
-
const o = c._getProjectionToLine(a, i, e);
|
|
609
|
-
r.push(o.x), r.push(o.y);
|
|
610
|
-
}), r;
|
|
611
|
-
},
|
|
612
|
-
_prepareToStringify(n) {
|
|
613
|
-
let t;
|
|
614
|
-
n.visitedByCircularReferenceRemoval = !0;
|
|
615
|
-
for (const e in n)
|
|
616
|
-
if (n.hasOwnProperty(e) && n[e] && typeof n[e] == "object") {
|
|
617
|
-
if (t = Object.getOwnPropertyDescriptor(n, e), n[e].visitedByCircularReferenceRemoval || c._isElement(n[e]))
|
|
618
|
-
if (t.configurable)
|
|
619
|
-
delete n[e];
|
|
620
|
-
else
|
|
621
|
-
return null;
|
|
622
|
-
else if (c._prepareToStringify(n[e]) === null)
|
|
623
|
-
if (t.configurable)
|
|
624
|
-
delete n[e];
|
|
625
|
-
else
|
|
626
|
-
return null;
|
|
627
|
-
}
|
|
628
|
-
return delete n.visitedByCircularReferenceRemoval, n;
|
|
629
|
-
},
|
|
630
|
-
_assign(n, t) {
|
|
631
|
-
for (const e in t)
|
|
632
|
-
n[e] = t[e];
|
|
633
|
-
return n;
|
|
634
|
-
},
|
|
635
|
-
_getFirstPointerId(n) {
|
|
636
|
-
return n.touches ? n.changedTouches[0].identifier : n.pointerId || 999;
|
|
637
|
-
},
|
|
638
|
-
releaseCanvas(...n) {
|
|
639
|
-
m.releaseCanvasOnDestroy && n.forEach((t) => {
|
|
640
|
-
t.width = 0, t.height = 0;
|
|
641
|
-
});
|
|
642
|
-
},
|
|
643
|
-
drawRoundedRectPath(n, t, e, i) {
|
|
644
|
-
let s = t < 0 ? t : 0, r = e < 0 ? e : 0;
|
|
645
|
-
t = Math.abs(t), e = Math.abs(e);
|
|
646
|
-
let a = 0, o = 0, h = 0, l = 0;
|
|
647
|
-
typeof i == "number" ? a = o = h = l = Math.min(i, t / 2, e / 2) : (a = Math.min(i[0] || 0, t / 2, e / 2), o = Math.min(i[1] || 0, t / 2, e / 2), l = Math.min(i[2] || 0, t / 2, e / 2), h = Math.min(i[3] || 0, t / 2, e / 2)), n.moveTo(s + a, r), n.lineTo(s + t - o, r), n.arc(s + t - o, r + o, o, Math.PI * 3 / 2, 0, !1), n.lineTo(s + t, r + e - l), n.arc(s + t - l, r + e - l, l, 0, Math.PI / 2, !1), n.lineTo(s + h, r + e), n.arc(s + h, r + e - h, h, Math.PI / 2, Math.PI, !1), n.lineTo(s, r + a), n.arc(s + a, r + a, a, Math.PI, Math.PI * 3 / 2, !1);
|
|
648
|
-
},
|
|
649
|
-
drawRoundedPolygonPath(n, t, e, i, s) {
|
|
650
|
-
i = Math.abs(i);
|
|
651
|
-
for (let r = 0; r < e; r++) {
|
|
652
|
-
const a = t[(r - 1 + e) % e], o = t[r], h = t[(r + 1) % e], l = { x: o.x - a.x, y: o.y - a.y }, d = { x: h.x - o.x, y: h.y - o.y }, u = Math.hypot(l.x, l.y), f = Math.hypot(d.x, d.y);
|
|
653
|
-
let C;
|
|
654
|
-
typeof s == "number" ? C = s : C = r < s.length ? s[r] : 0, C = i * Math.cos(Math.PI / e) * Math.min(1, C / i * 2);
|
|
655
|
-
const P = { x: l.x / u, y: l.y / u }, E = { x: d.x / f, y: d.y / f }, x = {
|
|
656
|
-
x: o.x - P.x * C,
|
|
657
|
-
y: o.y - P.y * C
|
|
658
|
-
}, A = {
|
|
659
|
-
x: o.x + E.x * C,
|
|
660
|
-
y: o.y + E.y * C
|
|
661
|
-
};
|
|
662
|
-
r === 0 ? n.moveTo(x.x, x.y) : n.lineTo(x.x, x.y), n.arcTo(o.x, o.y, A.x, A.y, C);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
function Pe(n) {
|
|
667
|
-
const t = [], e = n.length, i = c;
|
|
668
|
-
for (let s = 0; s < e; s++) {
|
|
669
|
-
let r = n[s];
|
|
670
|
-
i._isNumber(r) ? r = Math.round(r * 1e3) / 1e3 : i._isString(r) || (r = r + ""), t.push(r);
|
|
671
|
-
}
|
|
672
|
-
return t;
|
|
673
|
-
}
|
|
674
|
-
const Ot = ",", ke = "(", Re = ")", Te = "([", Ae = "])", Ge = ";", Oe = "()", De = "=", Dt = [
|
|
675
|
-
"arc",
|
|
676
|
-
"arcTo",
|
|
677
|
-
"beginPath",
|
|
678
|
-
"bezierCurveTo",
|
|
679
|
-
"clearRect",
|
|
680
|
-
"clip",
|
|
681
|
-
"closePath",
|
|
682
|
-
"createLinearGradient",
|
|
683
|
-
"createPattern",
|
|
684
|
-
"createRadialGradient",
|
|
685
|
-
"drawImage",
|
|
686
|
-
"ellipse",
|
|
687
|
-
"fill",
|
|
688
|
-
"fillText",
|
|
689
|
-
"getImageData",
|
|
690
|
-
"createImageData",
|
|
691
|
-
"lineTo",
|
|
692
|
-
"moveTo",
|
|
693
|
-
"putImageData",
|
|
694
|
-
"quadraticCurveTo",
|
|
695
|
-
"rect",
|
|
696
|
-
"roundRect",
|
|
697
|
-
"restore",
|
|
698
|
-
"rotate",
|
|
699
|
-
"save",
|
|
700
|
-
"scale",
|
|
701
|
-
"setLineDash",
|
|
702
|
-
"setTransform",
|
|
703
|
-
"stroke",
|
|
704
|
-
"strokeText",
|
|
705
|
-
"transform",
|
|
706
|
-
"translate"
|
|
707
|
-
], Le = [
|
|
708
|
-
"fillStyle",
|
|
709
|
-
"strokeStyle",
|
|
710
|
-
"shadowColor",
|
|
711
|
-
"shadowBlur",
|
|
712
|
-
"shadowOffsetX",
|
|
713
|
-
"shadowOffsetY",
|
|
714
|
-
"letterSpacing",
|
|
715
|
-
"lineCap",
|
|
716
|
-
"lineDashOffset",
|
|
717
|
-
"lineJoin",
|
|
718
|
-
"lineWidth",
|
|
719
|
-
"miterLimit",
|
|
720
|
-
"direction",
|
|
721
|
-
"font",
|
|
722
|
-
"textAlign",
|
|
723
|
-
"textBaseline",
|
|
724
|
-
"globalAlpha",
|
|
725
|
-
"globalCompositeOperation",
|
|
726
|
-
"imageSmoothingEnabled",
|
|
727
|
-
"filter"
|
|
728
|
-
], Ie = 100;
|
|
729
|
-
let rt = null;
|
|
730
|
-
function Lt() {
|
|
731
|
-
if (rt !== null)
|
|
732
|
-
return rt;
|
|
733
|
-
try {
|
|
734
|
-
const t = c.createCanvasElement().getContext("2d");
|
|
735
|
-
return t ? !!t && "filter" in t : (rt = !1, !1);
|
|
736
|
-
} catch {
|
|
737
|
-
return rt = !1, !1;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
class ft {
|
|
741
|
-
constructor(t) {
|
|
742
|
-
this.canvas = t, m.enableTrace && (this.traceArr = [], this._enableTrace());
|
|
743
|
-
}
|
|
744
|
-
fillShape(t) {
|
|
745
|
-
t.fillEnabled() && this._fill(t);
|
|
746
|
-
}
|
|
747
|
-
_fill(t) {
|
|
748
|
-
}
|
|
749
|
-
strokeShape(t) {
|
|
750
|
-
t.hasStroke() && this._stroke(t);
|
|
751
|
-
}
|
|
752
|
-
_stroke(t) {
|
|
753
|
-
}
|
|
754
|
-
fillStrokeShape(t) {
|
|
755
|
-
t.attrs.fillAfterStrokeEnabled ? (this.strokeShape(t), this.fillShape(t)) : (this.fillShape(t), this.strokeShape(t));
|
|
756
|
-
}
|
|
757
|
-
getTrace(t, e) {
|
|
758
|
-
let i = this.traceArr, s = i.length, r = "", a, o, h, l;
|
|
759
|
-
for (a = 0; a < s; a++)
|
|
760
|
-
o = i[a], h = o.method, h ? (l = o.args, r += h, t ? r += Oe : c._isArray(l[0]) ? r += Te + l.join(Ot) + Ae : (e && (l = l.map((d) => typeof d == "number" ? Math.floor(d) : d)), r += ke + l.join(Ot) + Re)) : (r += o.property, t || (r += De + o.val)), r += Ge;
|
|
761
|
-
return r;
|
|
762
|
-
}
|
|
763
|
-
clearTrace() {
|
|
764
|
-
this.traceArr = [];
|
|
765
|
-
}
|
|
766
|
-
_trace(t) {
|
|
767
|
-
let e = this.traceArr, i;
|
|
768
|
-
e.push(t), i = e.length, i >= Ie && e.shift();
|
|
769
|
-
}
|
|
770
|
-
reset() {
|
|
771
|
-
const t = this.getCanvas().getPixelRatio();
|
|
772
|
-
this.setTransform(1 * t, 0, 0, 1 * t, 0, 0);
|
|
773
|
-
}
|
|
774
|
-
getCanvas() {
|
|
775
|
-
return this.canvas;
|
|
776
|
-
}
|
|
777
|
-
clear(t) {
|
|
778
|
-
const e = this.getCanvas();
|
|
779
|
-
t ? this.clearRect(t.x || 0, t.y || 0, t.width || 0, t.height || 0) : this.clearRect(0, 0, e.getWidth() / e.pixelRatio, e.getHeight() / e.pixelRatio);
|
|
780
|
-
}
|
|
781
|
-
_applyLineCap(t) {
|
|
782
|
-
const e = t.attrs.lineCap;
|
|
783
|
-
e && this.setAttr("lineCap", e);
|
|
784
|
-
}
|
|
785
|
-
_applyOpacity(t) {
|
|
786
|
-
const e = t.getAbsoluteOpacity();
|
|
787
|
-
e !== 1 && this.setAttr("globalAlpha", e);
|
|
788
|
-
}
|
|
789
|
-
_applyLineJoin(t) {
|
|
790
|
-
const e = t.attrs.lineJoin;
|
|
791
|
-
e && this.setAttr("lineJoin", e);
|
|
792
|
-
}
|
|
793
|
-
_applyMiterLimit(t) {
|
|
794
|
-
const e = t.attrs.miterLimit;
|
|
795
|
-
e != null && this.setAttr("miterLimit", e);
|
|
796
|
-
}
|
|
797
|
-
setAttr(t, e) {
|
|
798
|
-
this._context[t] = e;
|
|
799
|
-
}
|
|
800
|
-
arc(t, e, i, s, r, a) {
|
|
801
|
-
this._context.arc(t, e, i, s, r, a);
|
|
802
|
-
}
|
|
803
|
-
arcTo(t, e, i, s, r) {
|
|
804
|
-
this._context.arcTo(t, e, i, s, r);
|
|
805
|
-
}
|
|
806
|
-
beginPath() {
|
|
807
|
-
this._context.beginPath();
|
|
808
|
-
}
|
|
809
|
-
bezierCurveTo(t, e, i, s, r, a) {
|
|
810
|
-
this._context.bezierCurveTo(t, e, i, s, r, a);
|
|
811
|
-
}
|
|
812
|
-
clearRect(t, e, i, s) {
|
|
813
|
-
this._context.clearRect(t, e, i, s);
|
|
814
|
-
}
|
|
815
|
-
clip(...t) {
|
|
816
|
-
this._context.clip.apply(this._context, t);
|
|
817
|
-
}
|
|
818
|
-
closePath() {
|
|
819
|
-
this._context.closePath();
|
|
820
|
-
}
|
|
821
|
-
createImageData(t, e) {
|
|
822
|
-
const i = arguments;
|
|
823
|
-
if (i.length === 2)
|
|
824
|
-
return this._context.createImageData(t, e);
|
|
825
|
-
if (i.length === 1)
|
|
826
|
-
return this._context.createImageData(t);
|
|
827
|
-
}
|
|
828
|
-
createLinearGradient(t, e, i, s) {
|
|
829
|
-
return this._context.createLinearGradient(t, e, i, s);
|
|
830
|
-
}
|
|
831
|
-
createPattern(t, e) {
|
|
832
|
-
return this._context.createPattern(t, e);
|
|
833
|
-
}
|
|
834
|
-
createRadialGradient(t, e, i, s, r, a) {
|
|
835
|
-
return this._context.createRadialGradient(t, e, i, s, r, a);
|
|
836
|
-
}
|
|
837
|
-
drawImage(t, e, i, s, r, a, o, h, l) {
|
|
838
|
-
const d = arguments, u = this._context;
|
|
839
|
-
d.length === 3 ? u.drawImage(t, e, i) : d.length === 5 ? u.drawImage(t, e, i, s, r) : d.length === 9 && u.drawImage(t, e, i, s, r, a, o, h, l);
|
|
840
|
-
}
|
|
841
|
-
ellipse(t, e, i, s, r, a, o, h) {
|
|
842
|
-
this._context.ellipse(t, e, i, s, r, a, o, h);
|
|
843
|
-
}
|
|
844
|
-
isPointInPath(t, e, i, s) {
|
|
845
|
-
return i ? this._context.isPointInPath(i, t, e, s) : this._context.isPointInPath(t, e, s);
|
|
846
|
-
}
|
|
847
|
-
fill(...t) {
|
|
848
|
-
this._context.fill.apply(this._context, t);
|
|
849
|
-
}
|
|
850
|
-
fillRect(t, e, i, s) {
|
|
851
|
-
this._context.fillRect(t, e, i, s);
|
|
852
|
-
}
|
|
853
|
-
strokeRect(t, e, i, s) {
|
|
854
|
-
this._context.strokeRect(t, e, i, s);
|
|
855
|
-
}
|
|
856
|
-
fillText(t, e, i, s) {
|
|
857
|
-
s ? this._context.fillText(t, e, i, s) : this._context.fillText(t, e, i);
|
|
858
|
-
}
|
|
859
|
-
measureText(t) {
|
|
860
|
-
return this._context.measureText(t);
|
|
861
|
-
}
|
|
862
|
-
getImageData(t, e, i, s) {
|
|
863
|
-
return this._context.getImageData(t, e, i, s);
|
|
864
|
-
}
|
|
865
|
-
lineTo(t, e) {
|
|
866
|
-
this._context.lineTo(t, e);
|
|
867
|
-
}
|
|
868
|
-
moveTo(t, e) {
|
|
869
|
-
this._context.moveTo(t, e);
|
|
870
|
-
}
|
|
871
|
-
rect(t, e, i, s) {
|
|
872
|
-
this._context.rect(t, e, i, s);
|
|
873
|
-
}
|
|
874
|
-
roundRect(t, e, i, s, r) {
|
|
875
|
-
this._context.roundRect(t, e, i, s, r);
|
|
876
|
-
}
|
|
877
|
-
putImageData(t, e, i) {
|
|
878
|
-
this._context.putImageData(t, e, i);
|
|
879
|
-
}
|
|
880
|
-
quadraticCurveTo(t, e, i, s) {
|
|
881
|
-
this._context.quadraticCurveTo(t, e, i, s);
|
|
882
|
-
}
|
|
883
|
-
restore() {
|
|
884
|
-
this._context.restore();
|
|
885
|
-
}
|
|
886
|
-
rotate(t) {
|
|
887
|
-
this._context.rotate(t);
|
|
888
|
-
}
|
|
889
|
-
save() {
|
|
890
|
-
this._context.save();
|
|
891
|
-
}
|
|
892
|
-
scale(t, e) {
|
|
893
|
-
this._context.scale(t, e);
|
|
894
|
-
}
|
|
895
|
-
setLineDash(t) {
|
|
896
|
-
this._context.setLineDash ? this._context.setLineDash(t) : "mozDash" in this._context ? this._context.mozDash = t : "webkitLineDash" in this._context && (this._context.webkitLineDash = t);
|
|
897
|
-
}
|
|
898
|
-
getLineDash() {
|
|
899
|
-
return this._context.getLineDash();
|
|
900
|
-
}
|
|
901
|
-
setTransform(t, e, i, s, r, a) {
|
|
902
|
-
this._context.setTransform(t, e, i, s, r, a);
|
|
903
|
-
}
|
|
904
|
-
stroke(t) {
|
|
905
|
-
t ? this._context.stroke(t) : this._context.stroke();
|
|
906
|
-
}
|
|
907
|
-
strokeText(t, e, i, s) {
|
|
908
|
-
this._context.strokeText(t, e, i, s);
|
|
909
|
-
}
|
|
910
|
-
transform(t, e, i, s, r, a) {
|
|
911
|
-
this._context.transform(t, e, i, s, r, a);
|
|
912
|
-
}
|
|
913
|
-
translate(t, e) {
|
|
914
|
-
this._context.translate(t, e);
|
|
915
|
-
}
|
|
916
|
-
_enableTrace() {
|
|
917
|
-
let t = this, e = Dt.length, i = this.setAttr, s, r;
|
|
918
|
-
const a = function(o) {
|
|
919
|
-
let h = t[o], l;
|
|
920
|
-
t[o] = function() {
|
|
921
|
-
return r = Pe(Array.prototype.slice.call(arguments, 0)), l = h.apply(t, arguments), t._trace({
|
|
922
|
-
method: o,
|
|
923
|
-
args: r
|
|
924
|
-
}), l;
|
|
925
|
-
};
|
|
926
|
-
};
|
|
927
|
-
for (s = 0; s < e; s++)
|
|
928
|
-
a(Dt[s]);
|
|
929
|
-
t.setAttr = function() {
|
|
930
|
-
i.apply(t, arguments);
|
|
931
|
-
const o = arguments[0];
|
|
932
|
-
let h = arguments[1];
|
|
933
|
-
(o === "shadowOffsetX" || o === "shadowOffsetY" || o === "shadowBlur") && (h = h / this.canvas.getPixelRatio()), t._trace({
|
|
934
|
-
property: o,
|
|
935
|
-
val: h
|
|
936
|
-
});
|
|
937
|
-
};
|
|
938
|
-
}
|
|
939
|
-
_applyGlobalCompositeOperation(t) {
|
|
940
|
-
const e = t.attrs.globalCompositeOperation;
|
|
941
|
-
!e || e === "source-over" || this.setAttr("globalCompositeOperation", e);
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
Le.forEach(function(n) {
|
|
945
|
-
Object.defineProperty(ft.prototype, n, {
|
|
946
|
-
get() {
|
|
947
|
-
return this._context[n];
|
|
948
|
-
},
|
|
949
|
-
set(t) {
|
|
950
|
-
this._context[n] = t;
|
|
951
|
-
}
|
|
952
|
-
});
|
|
953
|
-
});
|
|
954
|
-
class Me extends ft {
|
|
955
|
-
constructor(t, { willReadFrequently: e = !1 } = {}) {
|
|
956
|
-
super(t), this._context = t._canvas.getContext("2d", {
|
|
957
|
-
willReadFrequently: e
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
_fillColor(t) {
|
|
961
|
-
const e = t.fill();
|
|
962
|
-
this.setAttr("fillStyle", e), t._fillFunc(this);
|
|
963
|
-
}
|
|
964
|
-
_fillPattern(t) {
|
|
965
|
-
this.setAttr("fillStyle", t._getFillPattern()), t._fillFunc(this);
|
|
966
|
-
}
|
|
967
|
-
_fillLinearGradient(t) {
|
|
968
|
-
const e = t._getLinearGradient();
|
|
969
|
-
e && (this.setAttr("fillStyle", e), t._fillFunc(this));
|
|
970
|
-
}
|
|
971
|
-
_fillRadialGradient(t) {
|
|
972
|
-
const e = t._getRadialGradient();
|
|
973
|
-
e && (this.setAttr("fillStyle", e), t._fillFunc(this));
|
|
974
|
-
}
|
|
975
|
-
_fill(t) {
|
|
976
|
-
const e = t.fill(), i = t.getFillPriority();
|
|
977
|
-
if (e && i === "color") {
|
|
978
|
-
this._fillColor(t);
|
|
979
|
-
return;
|
|
980
|
-
}
|
|
981
|
-
const s = t.getFillPatternImage();
|
|
982
|
-
if (s && i === "pattern") {
|
|
983
|
-
this._fillPattern(t);
|
|
984
|
-
return;
|
|
985
|
-
}
|
|
986
|
-
const r = t.getFillLinearGradientColorStops();
|
|
987
|
-
if (r && i === "linear-gradient") {
|
|
988
|
-
this._fillLinearGradient(t);
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
const a = t.getFillRadialGradientColorStops();
|
|
992
|
-
if (a && i === "radial-gradient") {
|
|
993
|
-
this._fillRadialGradient(t);
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
e ? this._fillColor(t) : s ? this._fillPattern(t) : r ? this._fillLinearGradient(t) : a && this._fillRadialGradient(t);
|
|
997
|
-
}
|
|
998
|
-
_strokeLinearGradient(t) {
|
|
999
|
-
const e = t.getStrokeLinearGradientStartPoint(), i = t.getStrokeLinearGradientEndPoint(), s = t.getStrokeLinearGradientColorStops(), r = this.createLinearGradient(e.x, e.y, i.x, i.y);
|
|
1000
|
-
if (s) {
|
|
1001
|
-
for (let a = 0; a < s.length; a += 2)
|
|
1002
|
-
r.addColorStop(s[a], s[a + 1]);
|
|
1003
|
-
this.setAttr("strokeStyle", r);
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
_stroke(t) {
|
|
1007
|
-
const e = t.dash(), i = t.getStrokeScaleEnabled();
|
|
1008
|
-
if (t.hasStroke()) {
|
|
1009
|
-
if (!i) {
|
|
1010
|
-
this.save();
|
|
1011
|
-
const r = this.getCanvas().getPixelRatio();
|
|
1012
|
-
this.setTransform(r, 0, 0, r, 0, 0);
|
|
1013
|
-
}
|
|
1014
|
-
this._applyLineCap(t), e && t.dashEnabled() && (this.setLineDash(e), this.setAttr("lineDashOffset", t.dashOffset())), this.setAttr("lineWidth", t.strokeWidth()), t.getShadowForStrokeEnabled() || this.setAttr("shadowColor", "rgba(0,0,0,0)"), t.getStrokeLinearGradientColorStops() ? this._strokeLinearGradient(t) : this.setAttr("strokeStyle", t.stroke()), t._strokeFunc(this), i || this.restore();
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
_applyShadow(t) {
|
|
1018
|
-
var e, i, s;
|
|
1019
|
-
const r = (e = t.getShadowRGBA()) !== null && e !== void 0 ? e : "black", a = (i = t.getShadowBlur()) !== null && i !== void 0 ? i : 5, o = (s = t.getShadowOffset()) !== null && s !== void 0 ? s : {
|
|
1020
|
-
x: 0,
|
|
1021
|
-
y: 0
|
|
1022
|
-
}, h = t.getAbsoluteScale(), l = this.canvas.getPixelRatio(), d = h.x * l, u = h.y * l;
|
|
1023
|
-
this.setAttr("shadowColor", r), this.setAttr("shadowBlur", a * Math.min(Math.abs(d), Math.abs(u))), this.setAttr("shadowOffsetX", o.x * d), this.setAttr("shadowOffsetY", o.y * u);
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
class Fe extends ft {
|
|
1027
|
-
constructor(t) {
|
|
1028
|
-
super(t), this._context = t._canvas.getContext("2d", {
|
|
1029
|
-
willReadFrequently: !0
|
|
1030
|
-
});
|
|
1031
|
-
}
|
|
1032
|
-
_fill(t) {
|
|
1033
|
-
this.save(), this.setAttr("fillStyle", t.colorKey), t._fillFuncHit(this), this.restore();
|
|
1034
|
-
}
|
|
1035
|
-
strokeShape(t) {
|
|
1036
|
-
t.hasHitStroke() && this._stroke(t);
|
|
1037
|
-
}
|
|
1038
|
-
_stroke(t) {
|
|
1039
|
-
if (t.hasHitStroke()) {
|
|
1040
|
-
const e = t.getStrokeScaleEnabled();
|
|
1041
|
-
if (!e) {
|
|
1042
|
-
this.save();
|
|
1043
|
-
const r = this.getCanvas().getPixelRatio();
|
|
1044
|
-
this.setTransform(r, 0, 0, r, 0, 0);
|
|
1045
|
-
}
|
|
1046
|
-
this._applyLineCap(t);
|
|
1047
|
-
const i = t.hitStrokeWidth(), s = i === "auto" ? t.strokeWidth() : i;
|
|
1048
|
-
this.setAttr("lineWidth", s), this.setAttr("strokeStyle", t.colorKey), t._strokeFuncHit(this), e || this.restore();
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
let at;
|
|
1053
|
-
function Be() {
|
|
1054
|
-
if (at)
|
|
1055
|
-
return at;
|
|
1056
|
-
const n = c.createCanvasElement(), t = n.getContext("2d");
|
|
1057
|
-
return at = (function() {
|
|
1058
|
-
const e = m._global.devicePixelRatio || 1, i = t.webkitBackingStorePixelRatio || t.mozBackingStorePixelRatio || t.msBackingStorePixelRatio || t.oBackingStorePixelRatio || t.backingStorePixelRatio || 1;
|
|
1059
|
-
return e / i;
|
|
1060
|
-
})(), c.releaseCanvas(n), at;
|
|
1061
|
-
}
|
|
1062
|
-
class xt {
|
|
1063
|
-
constructor(t) {
|
|
1064
|
-
this.pixelRatio = 1, this.width = 0, this.height = 0, this.isCache = !1;
|
|
1065
|
-
const i = (t || {}).pixelRatio || m.pixelRatio || Be();
|
|
1066
|
-
this.pixelRatio = i, this._canvas = c.createCanvasElement(), this._canvas.style.padding = "0", this._canvas.style.margin = "0", this._canvas.style.border = "0", this._canvas.style.background = "transparent", this._canvas.style.position = "absolute", this._canvas.style.top = "0", this._canvas.style.left = "0";
|
|
1067
|
-
}
|
|
1068
|
-
getContext() {
|
|
1069
|
-
return this.context;
|
|
1070
|
-
}
|
|
1071
|
-
getPixelRatio() {
|
|
1072
|
-
return this.pixelRatio;
|
|
1073
|
-
}
|
|
1074
|
-
setPixelRatio(t) {
|
|
1075
|
-
const e = this.pixelRatio;
|
|
1076
|
-
this.pixelRatio = t, this.setSize(this.getWidth() / e, this.getHeight() / e);
|
|
1077
|
-
}
|
|
1078
|
-
setWidth(t) {
|
|
1079
|
-
this.width = this._canvas.width = t * this.pixelRatio, this._canvas.style.width = t + "px";
|
|
1080
|
-
const e = this.pixelRatio;
|
|
1081
|
-
this.getContext()._context.scale(e, e);
|
|
1082
|
-
}
|
|
1083
|
-
setHeight(t) {
|
|
1084
|
-
this.height = this._canvas.height = t * this.pixelRatio, this._canvas.style.height = t + "px";
|
|
1085
|
-
const e = this.pixelRatio;
|
|
1086
|
-
this.getContext()._context.scale(e, e);
|
|
1087
|
-
}
|
|
1088
|
-
getWidth() {
|
|
1089
|
-
return this.width;
|
|
1090
|
-
}
|
|
1091
|
-
getHeight() {
|
|
1092
|
-
return this.height;
|
|
1093
|
-
}
|
|
1094
|
-
setSize(t, e) {
|
|
1095
|
-
this.setWidth(t || 0), this.setHeight(e || 0);
|
|
1096
|
-
}
|
|
1097
|
-
toDataURL(t, e) {
|
|
1098
|
-
try {
|
|
1099
|
-
return this._canvas.toDataURL(t, e);
|
|
1100
|
-
} catch {
|
|
1101
|
-
try {
|
|
1102
|
-
return this._canvas.toDataURL();
|
|
1103
|
-
} catch (s) {
|
|
1104
|
-
return c.error("Unable to get data URL. " + s.message + " For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."), "";
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
class D extends xt {
|
|
1110
|
-
constructor(t = { width: 0, height: 0, willReadFrequently: !1 }) {
|
|
1111
|
-
super(t), this.context = new Me(this, {
|
|
1112
|
-
willReadFrequently: t.willReadFrequently
|
|
1113
|
-
}), this.setSize(t.width, t.height);
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
class Et extends xt {
|
|
1117
|
-
constructor(t = { width: 0, height: 0 }) {
|
|
1118
|
-
super(t), this.hitCanvas = !0, this.context = new Fe(this), this.setSize(t.width, t.height);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
const v = {
|
|
1122
|
-
get isDragging() {
|
|
1123
|
-
let n = !1;
|
|
1124
|
-
return v._dragElements.forEach((t) => {
|
|
1125
|
-
t.dragStatus === "dragging" && (n = !0);
|
|
1126
|
-
}), n;
|
|
1127
|
-
},
|
|
1128
|
-
justDragged: !1,
|
|
1129
|
-
get node() {
|
|
1130
|
-
let n;
|
|
1131
|
-
return v._dragElements.forEach((t) => {
|
|
1132
|
-
n = t.node;
|
|
1133
|
-
}), n;
|
|
1134
|
-
},
|
|
1135
|
-
_dragElements: /* @__PURE__ */ new Map(),
|
|
1136
|
-
_drag(n) {
|
|
1137
|
-
const t = [];
|
|
1138
|
-
v._dragElements.forEach((e, i) => {
|
|
1139
|
-
const { node: s } = e, r = s.getStage();
|
|
1140
|
-
r.setPointersPositions(n), e.pointerId === void 0 && (e.pointerId = c._getFirstPointerId(n));
|
|
1141
|
-
const a = r._changedPointerPositions.find((o) => o.id === e.pointerId);
|
|
1142
|
-
if (a) {
|
|
1143
|
-
if (e.dragStatus !== "dragging") {
|
|
1144
|
-
const o = s.dragDistance();
|
|
1145
|
-
if (Math.max(Math.abs(a.x - e.startPointerPos.x), Math.abs(a.y - e.startPointerPos.y)) < o || (s.startDrag({ evt: n }), !s.isDragging()))
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
s._setDragPosition(n, e), t.push(s);
|
|
1149
|
-
}
|
|
1150
|
-
}), t.forEach((e) => {
|
|
1151
|
-
e.getStage() && e.fire("dragmove", {
|
|
1152
|
-
type: "dragmove",
|
|
1153
|
-
target: e,
|
|
1154
|
-
evt: n
|
|
1155
|
-
}, !0);
|
|
1156
|
-
});
|
|
1157
|
-
},
|
|
1158
|
-
_endDragBefore(n) {
|
|
1159
|
-
const t = [];
|
|
1160
|
-
v._dragElements.forEach((e) => {
|
|
1161
|
-
const { node: i } = e, s = i.getStage();
|
|
1162
|
-
if (n && s.setPointersPositions(n), !s._changedPointerPositions.find((o) => o.id === e.pointerId))
|
|
1163
|
-
return;
|
|
1164
|
-
(e.dragStatus === "dragging" || e.dragStatus === "stopped") && (v.justDragged = !0, m._mouseListenClick = !1, m._touchListenClick = !1, m._pointerListenClick = !1, e.dragStatus = "stopped");
|
|
1165
|
-
const a = e.node.getLayer() || e.node instanceof m.Stage && e.node;
|
|
1166
|
-
a && t.indexOf(a) === -1 && t.push(a);
|
|
1167
|
-
}), t.forEach((e) => {
|
|
1168
|
-
e.draw();
|
|
1169
|
-
});
|
|
1170
|
-
},
|
|
1171
|
-
_endDragAfter(n) {
|
|
1172
|
-
v._dragElements.forEach((t, e) => {
|
|
1173
|
-
t.dragStatus === "stopped" && t.node.fire("dragend", {
|
|
1174
|
-
type: "dragend",
|
|
1175
|
-
target: t.node,
|
|
1176
|
-
evt: n
|
|
1177
|
-
}, !0), t.dragStatus !== "dragging" && v._dragElements.delete(e);
|
|
1178
|
-
});
|
|
1179
|
-
}
|
|
1180
|
-
};
|
|
1181
|
-
m.isBrowser && (window.addEventListener("mouseup", v._endDragBefore, !0), window.addEventListener("touchend", v._endDragBefore, !0), window.addEventListener("touchcancel", v._endDragBefore, !0), window.addEventListener("mousemove", v._drag), window.addEventListener("touchmove", v._drag), window.addEventListener("mouseup", v._endDragAfter, !1), window.addEventListener("touchend", v._endDragAfter, !1), window.addEventListener("touchcancel", v._endDragAfter, !1));
|
|
1182
|
-
function I(n) {
|
|
1183
|
-
return c._isString(n) ? '"' + n + '"' : Object.prototype.toString.call(n) === "[object Number]" || c._isBoolean(n) ? n : Object.prototype.toString.call(n);
|
|
1184
|
-
}
|
|
1185
|
-
function wi(n) {
|
|
1186
|
-
return n > 255 ? 255 : n < 0 ? 0 : Math.round(n);
|
|
1187
|
-
}
|
|
1188
|
-
function b() {
|
|
1189
|
-
if (m.isUnminified)
|
|
1190
|
-
return function(n, t) {
|
|
1191
|
-
return c._isNumber(n) || c.warn(I(n) + ' is a not valid value for "' + t + '" attribute. The value should be a number.'), n;
|
|
1192
|
-
};
|
|
1193
|
-
}
|
|
1194
|
-
function xi(n) {
|
|
1195
|
-
if (m.isUnminified)
|
|
1196
|
-
return function(t, e) {
|
|
1197
|
-
let i = c._isNumber(t), s = c._isArray(t) && t.length == n;
|
|
1198
|
-
return !i && !s && c.warn(I(t) + ' is a not valid value for "' + e + '" attribute. The value should be a number or Array<number>(' + n + ")"), t;
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
function Ne() {
|
|
1202
|
-
if (m.isUnminified)
|
|
1203
|
-
return function(n, t) {
|
|
1204
|
-
return c._isNumber(n) || n === "auto" || c.warn(I(n) + ' is a not valid value for "' + t + '" attribute. The value should be a number or "auto".'), n;
|
|
1205
|
-
};
|
|
1206
|
-
}
|
|
1207
|
-
function Y() {
|
|
1208
|
-
if (m.isUnminified)
|
|
1209
|
-
return function(n, t) {
|
|
1210
|
-
return c._isString(n) || c.warn(I(n) + ' is a not valid value for "' + t + '" attribute. The value should be a string.'), n;
|
|
1211
|
-
};
|
|
1212
|
-
}
|
|
1213
|
-
function Wt() {
|
|
1214
|
-
if (m.isUnminified)
|
|
1215
|
-
return function(n, t) {
|
|
1216
|
-
const e = c._isString(n), i = Object.prototype.toString.call(n) === "[object CanvasGradient]" || n && n.addColorStop;
|
|
1217
|
-
return e || i || c.warn(I(n) + ' is a not valid value for "' + t + '" attribute. The value should be a string or a native gradient.'), n;
|
|
1218
|
-
};
|
|
1219
|
-
}
|
|
1220
|
-
function Ei() {
|
|
1221
|
-
if (m.isUnminified)
|
|
1222
|
-
return function(n, t) {
|
|
1223
|
-
const e = Int8Array ? Object.getPrototypeOf(Int8Array) : null;
|
|
1224
|
-
return e && n instanceof e || (c._isArray(n) ? n.forEach(function(i) {
|
|
1225
|
-
c._isNumber(i) || c.warn('"' + t + '" attribute has non numeric element ' + i + ". Make sure that all elements are numbers.");
|
|
1226
|
-
}) : c.warn(I(n) + ' is a not valid value for "' + t + '" attribute. The value should be a array of numbers.')), n;
|
|
1227
|
-
};
|
|
1228
|
-
}
|
|
1229
|
-
function M() {
|
|
1230
|
-
if (m.isUnminified)
|
|
1231
|
-
return function(n, t) {
|
|
1232
|
-
return n === !0 || n === !1 || c.warn(I(n) + ' is a not valid value for "' + t + '" attribute. The value should be a boolean.'), n;
|
|
1233
|
-
};
|
|
1234
|
-
}
|
|
1235
|
-
function He(n) {
|
|
1236
|
-
if (m.isUnminified)
|
|
1237
|
-
return function(t, e) {
|
|
1238
|
-
return t == null || c.isObject(t) || c.warn(I(t) + ' is a not valid value for "' + e + '" attribute. The value should be an object with properties ' + n), t;
|
|
1239
|
-
};
|
|
1240
|
-
}
|
|
1241
|
-
const W = "get", j = "set", g = {
|
|
1242
|
-
addGetterSetter(n, t, e, i, s) {
|
|
1243
|
-
g.addGetter(n, t, e), g.addSetter(n, t, i, s), g.addOverloadedGetterSetter(n, t);
|
|
1244
|
-
},
|
|
1245
|
-
addGetter(n, t, e) {
|
|
1246
|
-
const i = W + c._capitalize(t);
|
|
1247
|
-
n.prototype[i] = n.prototype[i] || function() {
|
|
1248
|
-
const s = this.attrs[t];
|
|
1249
|
-
return s === void 0 ? e : s;
|
|
1250
|
-
};
|
|
1251
|
-
},
|
|
1252
|
-
addSetter(n, t, e, i) {
|
|
1253
|
-
const s = j + c._capitalize(t);
|
|
1254
|
-
n.prototype[s] || g.overWriteSetter(n, t, e, i);
|
|
1255
|
-
},
|
|
1256
|
-
overWriteSetter(n, t, e, i) {
|
|
1257
|
-
const s = j + c._capitalize(t);
|
|
1258
|
-
n.prototype[s] = function(r) {
|
|
1259
|
-
return e && r !== void 0 && r !== null && (r = e.call(this, r, t)), this._setAttr(t, r), i && i.call(this), this;
|
|
1260
|
-
};
|
|
1261
|
-
},
|
|
1262
|
-
addComponentsGetterSetter(n, t, e, i, s) {
|
|
1263
|
-
const r = e.length, a = c._capitalize, o = W + a(t), h = j + a(t);
|
|
1264
|
-
n.prototype[o] = function() {
|
|
1265
|
-
const d = {};
|
|
1266
|
-
for (let u = 0; u < r; u++) {
|
|
1267
|
-
const f = e[u];
|
|
1268
|
-
d[f] = this.getAttr(t + a(f));
|
|
1269
|
-
}
|
|
1270
|
-
return d;
|
|
1271
|
-
};
|
|
1272
|
-
const l = He(e);
|
|
1273
|
-
n.prototype[h] = function(d) {
|
|
1274
|
-
const u = this.attrs[t];
|
|
1275
|
-
i && (d = i.call(this, d, t)), l && l.call(this, d, t);
|
|
1276
|
-
for (const f in d)
|
|
1277
|
-
d.hasOwnProperty(f) && this._setAttr(t + a(f), d[f]);
|
|
1278
|
-
return d || e.forEach((f) => {
|
|
1279
|
-
this._setAttr(t + a(f), void 0);
|
|
1280
|
-
}), this._fireChangeEvent(t, u, d), s && s.call(this), this;
|
|
1281
|
-
}, g.addOverloadedGetterSetter(n, t);
|
|
1282
|
-
},
|
|
1283
|
-
addOverloadedGetterSetter(n, t) {
|
|
1284
|
-
const e = c._capitalize(t), i = j + e, s = W + e;
|
|
1285
|
-
n.prototype[t] = function() {
|
|
1286
|
-
return arguments.length ? (this[i](arguments[0]), this) : this[s]();
|
|
1287
|
-
};
|
|
1288
|
-
},
|
|
1289
|
-
addDeprecatedGetterSetter(n, t, e, i) {
|
|
1290
|
-
c.error("Adding deprecated " + t);
|
|
1291
|
-
const s = W + c._capitalize(t), r = t + " property is deprecated and will be removed soon. Look at Konva change log for more information.";
|
|
1292
|
-
n.prototype[s] = function() {
|
|
1293
|
-
c.error(r);
|
|
1294
|
-
const a = this.attrs[t];
|
|
1295
|
-
return a === void 0 ? e : a;
|
|
1296
|
-
}, g.addSetter(n, t, i, function() {
|
|
1297
|
-
c.error(r);
|
|
1298
|
-
}), g.addOverloadedGetterSetter(n, t);
|
|
1299
|
-
},
|
|
1300
|
-
backCompat(n, t) {
|
|
1301
|
-
c.each(t, function(e, i) {
|
|
1302
|
-
const s = n.prototype[i], r = W + c._capitalize(e), a = j + c._capitalize(e);
|
|
1303
|
-
function o() {
|
|
1304
|
-
s.apply(this, arguments), c.error('"' + e + '" method is deprecated and will be removed soon. Use ""' + i + '" instead.');
|
|
1305
|
-
}
|
|
1306
|
-
n.prototype[e] = o, n.prototype[r] = o, n.prototype[a] = o;
|
|
1307
|
-
});
|
|
1308
|
-
},
|
|
1309
|
-
afterSetFilter() {
|
|
1310
|
-
this._filterUpToDate = !1;
|
|
1311
|
-
}
|
|
1312
|
-
};
|
|
1313
|
-
function Ue(n) {
|
|
1314
|
-
const t = /(\w+)\(([^)]+)\)/g;
|
|
1315
|
-
let e;
|
|
1316
|
-
for (; (e = t.exec(n)) !== null; ) {
|
|
1317
|
-
const [, i, s] = e;
|
|
1318
|
-
switch (i) {
|
|
1319
|
-
case "blur": {
|
|
1320
|
-
const r = parseFloat(s.replace("px", ""));
|
|
1321
|
-
return function(a) {
|
|
1322
|
-
this.blurRadius(r * 0.5);
|
|
1323
|
-
const o = m.Filters;
|
|
1324
|
-
o && o.Blur && o.Blur.call(this, a);
|
|
1325
|
-
};
|
|
1326
|
-
}
|
|
1327
|
-
case "brightness": {
|
|
1328
|
-
const r = s.includes("%") ? parseFloat(s) / 100 : parseFloat(s);
|
|
1329
|
-
return function(a) {
|
|
1330
|
-
this.brightness(r);
|
|
1331
|
-
const o = m.Filters;
|
|
1332
|
-
o && o.Brightness && o.Brightness.call(this, a);
|
|
1333
|
-
};
|
|
1334
|
-
}
|
|
1335
|
-
case "contrast": {
|
|
1336
|
-
const r = parseFloat(s);
|
|
1337
|
-
return function(a) {
|
|
1338
|
-
const o = 100 * (Math.sqrt(r) - 1);
|
|
1339
|
-
this.contrast(o);
|
|
1340
|
-
const h = m.Filters;
|
|
1341
|
-
h && h.Contrast && h.Contrast.call(this, a);
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
case "grayscale":
|
|
1345
|
-
return function(r) {
|
|
1346
|
-
const a = m.Filters;
|
|
1347
|
-
a && a.Grayscale && a.Grayscale.call(this, r);
|
|
1348
|
-
};
|
|
1349
|
-
case "sepia":
|
|
1350
|
-
return function(r) {
|
|
1351
|
-
const a = m.Filters;
|
|
1352
|
-
a && a.Sepia && a.Sepia.call(this, r);
|
|
1353
|
-
};
|
|
1354
|
-
case "invert":
|
|
1355
|
-
return function(r) {
|
|
1356
|
-
const a = m.Filters;
|
|
1357
|
-
a && a.Invert && a.Invert.call(this, r);
|
|
1358
|
-
};
|
|
1359
|
-
default:
|
|
1360
|
-
c.warn(`CSS filter "${i}" is not supported in fallback mode. Consider using function filters for better compatibility.`);
|
|
1361
|
-
break;
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
return () => {
|
|
1365
|
-
};
|
|
1366
|
-
}
|
|
1367
|
-
const dt = "absoluteOpacity", It = "allEventListeners", T = "absoluteTransform", Mt = "absoluteScale", F = "canvas", Ye = "Change", Xe = "children", Ve = "konva", vt = "listening", We = "mouseenter", je = "mouseleave", Ke = "pointerenter", qe = "pointerleave", ze = "touchenter", Je = "touchleave", Ft = "set", Bt = "Shape", ut = " ", Nt = "stage", O = "transform", $e = "Stage", bt = "visible", Ze = [
|
|
1368
|
-
"xChange.konva",
|
|
1369
|
-
"yChange.konva",
|
|
1370
|
-
"scaleXChange.konva",
|
|
1371
|
-
"scaleYChange.konva",
|
|
1372
|
-
"skewXChange.konva",
|
|
1373
|
-
"skewYChange.konva",
|
|
1374
|
-
"rotationChange.konva",
|
|
1375
|
-
"offsetXChange.konva",
|
|
1376
|
-
"offsetYChange.konva",
|
|
1377
|
-
"transformsEnabledChange.konva"
|
|
1378
|
-
].join(ut);
|
|
1379
|
-
let Qe = 1;
|
|
1380
|
-
class _ {
|
|
1381
|
-
constructor(t) {
|
|
1382
|
-
this._id = Qe++, this.eventListeners = {}, this.attrs = {}, this.index = 0, this._allEventListeners = null, this.parent = null, this._cache = /* @__PURE__ */ new Map(), this._attachedDepsListeners = /* @__PURE__ */ new Map(), this._lastPos = null, this._batchingTransformChange = !1, this._needClearTransformCache = !1, this._filterUpToDate = !1, this._isUnderCache = !1, this._dragEventId = null, this._shouldFireChangeEvents = !1, this.setAttrs(t), this._shouldFireChangeEvents = !0;
|
|
1383
|
-
}
|
|
1384
|
-
hasChildren() {
|
|
1385
|
-
return !1;
|
|
1386
|
-
}
|
|
1387
|
-
_clearCache(t) {
|
|
1388
|
-
(t === O || t === T) && this._cache.get(t) ? this._cache.get(t).dirty = !0 : t ? this._cache.delete(t) : this._cache.clear();
|
|
1389
|
-
}
|
|
1390
|
-
_getCache(t, e) {
|
|
1391
|
-
let i = this._cache.get(t);
|
|
1392
|
-
return (i === void 0 || (t === O || t === T) && i.dirty === !0) && (i = e.call(this), this._cache.set(t, i)), i;
|
|
1393
|
-
}
|
|
1394
|
-
_calculate(t, e, i) {
|
|
1395
|
-
if (!this._attachedDepsListeners.get(t)) {
|
|
1396
|
-
const s = e.map((r) => r + "Change.konva").join(ut);
|
|
1397
|
-
this.on(s, () => {
|
|
1398
|
-
this._clearCache(t);
|
|
1399
|
-
}), this._attachedDepsListeners.set(t, !0);
|
|
1400
|
-
}
|
|
1401
|
-
return this._getCache(t, i);
|
|
1402
|
-
}
|
|
1403
|
-
_getCanvasCache() {
|
|
1404
|
-
return this._cache.get(F);
|
|
1405
|
-
}
|
|
1406
|
-
_clearSelfAndDescendantCache(t) {
|
|
1407
|
-
this._clearCache(t), t === T && this.fire("absoluteTransformChange");
|
|
1408
|
-
}
|
|
1409
|
-
clearCache() {
|
|
1410
|
-
if (this._cache.has(F)) {
|
|
1411
|
-
const { scene: t, filter: e, hit: i } = this._cache.get(F);
|
|
1412
|
-
c.releaseCanvas(t._canvas, e._canvas, i._canvas), this._cache.delete(F);
|
|
1413
|
-
}
|
|
1414
|
-
return this._clearSelfAndDescendantCache(), this._requestDraw(), this;
|
|
1415
|
-
}
|
|
1416
|
-
cache(t) {
|
|
1417
|
-
const e = t || {};
|
|
1418
|
-
let i = {};
|
|
1419
|
-
(e.x === void 0 || e.y === void 0 || e.width === void 0 || e.height === void 0) && (i = this.getClientRect({
|
|
1420
|
-
skipTransform: !0,
|
|
1421
|
-
relativeTo: this.getParent() || void 0
|
|
1422
|
-
}));
|
|
1423
|
-
let s = Math.ceil(e.width || i.width), r = Math.ceil(e.height || i.height), a = e.pixelRatio, o = e.x === void 0 ? Math.floor(i.x) : e.x, h = e.y === void 0 ? Math.floor(i.y) : e.y, l = e.offset || 0, d = e.drawBorder || !1, u = e.hitCanvasPixelRatio || 1;
|
|
1424
|
-
if (!s || !r) {
|
|
1425
|
-
c.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");
|
|
1426
|
-
return;
|
|
1427
|
-
}
|
|
1428
|
-
const f = Math.abs(Math.round(i.x) - o) > 0.5 ? 1 : 0, C = Math.abs(Math.round(i.y) - h) > 0.5 ? 1 : 0;
|
|
1429
|
-
s += l * 2 + f, r += l * 2 + C, o -= l, h -= l;
|
|
1430
|
-
const y = new D({
|
|
1431
|
-
pixelRatio: a,
|
|
1432
|
-
width: s,
|
|
1433
|
-
height: r
|
|
1434
|
-
}), P = new D({
|
|
1435
|
-
pixelRatio: a,
|
|
1436
|
-
width: 0,
|
|
1437
|
-
height: 0,
|
|
1438
|
-
willReadFrequently: !0
|
|
1439
|
-
}), E = new Et({
|
|
1440
|
-
pixelRatio: u,
|
|
1441
|
-
width: s,
|
|
1442
|
-
height: r
|
|
1443
|
-
}), x = y.getContext(), A = E.getContext(), G = new D({
|
|
1444
|
-
width: y.width / y.pixelRatio + Math.abs(o),
|
|
1445
|
-
height: y.height / y.pixelRatio + Math.abs(h),
|
|
1446
|
-
pixelRatio: y.pixelRatio
|
|
1447
|
-
}), Tt = G.getContext();
|
|
1448
|
-
return E.isCache = !0, y.isCache = !0, this._cache.delete(F), this._filterUpToDate = !1, e.imageSmoothingEnabled === !1 && (y.getContext()._context.imageSmoothingEnabled = !1, P.getContext()._context.imageSmoothingEnabled = !1), x.save(), A.save(), Tt.save(), x.translate(-o, -h), A.translate(-o, -h), Tt.translate(-o, -h), G.x = o, G.y = h, this._isUnderCache = !0, this._clearSelfAndDescendantCache(dt), this._clearSelfAndDescendantCache(Mt), this.drawScene(y, this, G), this.drawHit(E, this), this._isUnderCache = !1, x.restore(), A.restore(), d && (x.save(), x.beginPath(), x.rect(0, 0, s, r), x.closePath(), x.setAttr("strokeStyle", "red"), x.setAttr("lineWidth", 5), x.stroke(), x.restore()), c.releaseCanvas(G._canvas), this._cache.set(F, {
|
|
1449
|
-
scene: y,
|
|
1450
|
-
filter: P,
|
|
1451
|
-
hit: E,
|
|
1452
|
-
x: o,
|
|
1453
|
-
y: h
|
|
1454
|
-
}), this._requestDraw(), this;
|
|
1455
|
-
}
|
|
1456
|
-
isCached() {
|
|
1457
|
-
return this._cache.has(F);
|
|
1458
|
-
}
|
|
1459
|
-
getClientRect(t) {
|
|
1460
|
-
throw new Error('abstract "getClientRect" method call');
|
|
1461
|
-
}
|
|
1462
|
-
_transformedRect(t, e) {
|
|
1463
|
-
const i = [
|
|
1464
|
-
{ x: t.x, y: t.y },
|
|
1465
|
-
{ x: t.x + t.width, y: t.y },
|
|
1466
|
-
{ x: t.x + t.width, y: t.y + t.height },
|
|
1467
|
-
{ x: t.x, y: t.y + t.height }
|
|
1468
|
-
];
|
|
1469
|
-
let s = 1 / 0, r = 1 / 0, a = -1 / 0, o = -1 / 0;
|
|
1470
|
-
const h = this.getAbsoluteTransform(e);
|
|
1471
|
-
return i.forEach(function(l) {
|
|
1472
|
-
const d = h.point(l);
|
|
1473
|
-
s === void 0 && (s = a = d.x, r = o = d.y), s = Math.min(s, d.x), r = Math.min(r, d.y), a = Math.max(a, d.x), o = Math.max(o, d.y);
|
|
1474
|
-
}), {
|
|
1475
|
-
x: s,
|
|
1476
|
-
y: r,
|
|
1477
|
-
width: a - s,
|
|
1478
|
-
height: o - r
|
|
1479
|
-
};
|
|
1480
|
-
}
|
|
1481
|
-
_drawCachedSceneCanvas(t) {
|
|
1482
|
-
t.save(), t._applyOpacity(this), t._applyGlobalCompositeOperation(this);
|
|
1483
|
-
const e = this._getCanvasCache();
|
|
1484
|
-
t.translate(e.x, e.y);
|
|
1485
|
-
const i = this._getCachedSceneCanvas(), s = i.pixelRatio;
|
|
1486
|
-
t.drawImage(i._canvas, 0, 0, i.width / s, i.height / s), t.restore();
|
|
1487
|
-
}
|
|
1488
|
-
_drawCachedHitCanvas(t) {
|
|
1489
|
-
const e = this._getCanvasCache(), i = e.hit;
|
|
1490
|
-
t.save(), t.translate(e.x, e.y), t.drawImage(i._canvas, 0, 0, i.width / i.pixelRatio, i.height / i.pixelRatio), t.restore();
|
|
1491
|
-
}
|
|
1492
|
-
_getCachedSceneCanvas() {
|
|
1493
|
-
let t = this.filters(), e = this._getCanvasCache(), i = e.scene, s = e.filter, r = s.getContext(), a, o, h, l;
|
|
1494
|
-
if (!t || t.length === 0)
|
|
1495
|
-
return i;
|
|
1496
|
-
if (this._filterUpToDate)
|
|
1497
|
-
return s;
|
|
1498
|
-
let d = !0;
|
|
1499
|
-
for (let f = 0; f < t.length; f++)
|
|
1500
|
-
if (typeof t[f] == "string" && Lt(), typeof t[f] != "string" || !Lt()) {
|
|
1501
|
-
d = !1;
|
|
1502
|
-
break;
|
|
1503
|
-
}
|
|
1504
|
-
const u = i.pixelRatio;
|
|
1505
|
-
if (s.setSize(i.width / i.pixelRatio, i.height / i.pixelRatio), d) {
|
|
1506
|
-
const f = t.join(" ");
|
|
1507
|
-
return r.save(), r.setAttr("filter", f), r.drawImage(i._canvas, 0, 0, i.getWidth() / u, i.getHeight() / u), r.restore(), this._filterUpToDate = !0, s;
|
|
1508
|
-
}
|
|
1509
|
-
try {
|
|
1510
|
-
for (a = t.length, r.clear(), r.drawImage(i._canvas, 0, 0, i.getWidth() / u, i.getHeight() / u), o = r.getImageData(0, 0, s.getWidth(), s.getHeight()), h = 0; h < a; h++)
|
|
1511
|
-
l = t[h], typeof l == "string" && (l = Ue(l)), l.call(this, o), r.putImageData(o, 0, 0);
|
|
1512
|
-
} catch (f) {
|
|
1513
|
-
c.error("Unable to apply filter. " + f.message + " This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.");
|
|
1514
|
-
}
|
|
1515
|
-
return this._filterUpToDate = !0, s;
|
|
1516
|
-
}
|
|
1517
|
-
on(...t) {
|
|
1518
|
-
const e = t[0], i = t[1];
|
|
1519
|
-
if (t[2], this._cache && this._cache.delete(It), t.length === 3)
|
|
1520
|
-
return this._delegate.apply(this, t);
|
|
1521
|
-
const s = e.split(ut);
|
|
1522
|
-
for (let r = 0; r < s.length; r++) {
|
|
1523
|
-
const o = s[r].split("."), h = o[0], l = o[1] || "";
|
|
1524
|
-
this.eventListeners[h] || (this.eventListeners[h] = []), this.eventListeners[h].push({ name: l, handler: i });
|
|
1525
|
-
}
|
|
1526
|
-
return this;
|
|
1527
|
-
}
|
|
1528
|
-
off(t, e) {
|
|
1529
|
-
let i = (t || "").split(ut), s = i.length, r, a, o, h, l, d;
|
|
1530
|
-
if (this._cache && this._cache.delete(It), !t)
|
|
1531
|
-
for (a in this.eventListeners)
|
|
1532
|
-
this._off(a);
|
|
1533
|
-
for (r = 0; r < s; r++)
|
|
1534
|
-
if (o = i[r], h = o.split("."), l = h[0], d = h[1], l)
|
|
1535
|
-
this.eventListeners[l] && this._off(l, d, e);
|
|
1536
|
-
else
|
|
1537
|
-
for (a in this.eventListeners)
|
|
1538
|
-
this._off(a, d, e);
|
|
1539
|
-
return this;
|
|
1540
|
-
}
|
|
1541
|
-
dispatchEvent(t) {
|
|
1542
|
-
const e = {
|
|
1543
|
-
target: this,
|
|
1544
|
-
type: t.type,
|
|
1545
|
-
evt: t
|
|
1546
|
-
};
|
|
1547
|
-
return this.fire(t.type, e), this;
|
|
1548
|
-
}
|
|
1549
|
-
addEventListener(t, e) {
|
|
1550
|
-
return this.on(t, function(i) {
|
|
1551
|
-
e.call(this, i.evt);
|
|
1552
|
-
}), this;
|
|
1553
|
-
}
|
|
1554
|
-
removeEventListener(t) {
|
|
1555
|
-
return this.off(t), this;
|
|
1556
|
-
}
|
|
1557
|
-
_delegate(t, e, i) {
|
|
1558
|
-
const s = this;
|
|
1559
|
-
return this.on(t, function(r) {
|
|
1560
|
-
const a = r.target.findAncestors(e, !0, s);
|
|
1561
|
-
for (let o = 0; o < a.length; o++)
|
|
1562
|
-
r = c.cloneObject(r), r.currentTarget = a[o], i.call(a[o], r);
|
|
1563
|
-
}), this;
|
|
1564
|
-
}
|
|
1565
|
-
remove() {
|
|
1566
|
-
return this.isDragging() && this.stopDrag(), v._dragElements.delete(this._id), v._dragElements.forEach((t, e) => {
|
|
1567
|
-
this.isAncestorOf(t.node) && v._dragElements.delete(e);
|
|
1568
|
-
}), this._remove(), this;
|
|
1569
|
-
}
|
|
1570
|
-
_clearCaches() {
|
|
1571
|
-
this._clearSelfAndDescendantCache(T), this._clearSelfAndDescendantCache(dt), this._clearSelfAndDescendantCache(Mt), this._clearSelfAndDescendantCache(Nt), this._clearSelfAndDescendantCache(bt), this._clearSelfAndDescendantCache(vt);
|
|
1572
|
-
}
|
|
1573
|
-
_remove() {
|
|
1574
|
-
this._clearCaches();
|
|
1575
|
-
const t = this.getParent();
|
|
1576
|
-
t && t.children && (t.children.splice(this.index, 1), t._setChildrenIndices(), this.parent = null);
|
|
1577
|
-
}
|
|
1578
|
-
destroy() {
|
|
1579
|
-
return this.remove(), this.clearCache(), this;
|
|
1580
|
-
}
|
|
1581
|
-
getAttr(t) {
|
|
1582
|
-
const e = "get" + c._capitalize(t);
|
|
1583
|
-
return c._isFunction(this[e]) ? this[e]() : this.attrs[t];
|
|
1584
|
-
}
|
|
1585
|
-
getAncestors() {
|
|
1586
|
-
let t = this.getParent(), e = [];
|
|
1587
|
-
for (; t; )
|
|
1588
|
-
e.push(t), t = t.getParent();
|
|
1589
|
-
return e;
|
|
1590
|
-
}
|
|
1591
|
-
getAttrs() {
|
|
1592
|
-
return this.attrs || {};
|
|
1593
|
-
}
|
|
1594
|
-
setAttrs(t) {
|
|
1595
|
-
return this._batchTransformChanges(() => {
|
|
1596
|
-
let e, i;
|
|
1597
|
-
if (!t)
|
|
1598
|
-
return this;
|
|
1599
|
-
for (e in t)
|
|
1600
|
-
e !== Xe && (i = Ft + c._capitalize(e), c._isFunction(this[i]) ? this[i](t[e]) : this._setAttr(e, t[e]));
|
|
1601
|
-
}), this;
|
|
1602
|
-
}
|
|
1603
|
-
isListening() {
|
|
1604
|
-
return this._getCache(vt, this._isListening);
|
|
1605
|
-
}
|
|
1606
|
-
_isListening(t) {
|
|
1607
|
-
if (!this.listening())
|
|
1608
|
-
return !1;
|
|
1609
|
-
const i = this.getParent();
|
|
1610
|
-
return i && i !== t && this !== t ? i._isListening(t) : !0;
|
|
1611
|
-
}
|
|
1612
|
-
isVisible() {
|
|
1613
|
-
return this._getCache(bt, this._isVisible);
|
|
1614
|
-
}
|
|
1615
|
-
_isVisible(t) {
|
|
1616
|
-
if (!this.visible())
|
|
1617
|
-
return !1;
|
|
1618
|
-
const i = this.getParent();
|
|
1619
|
-
return i && i !== t && this !== t ? i._isVisible(t) : !0;
|
|
1620
|
-
}
|
|
1621
|
-
shouldDrawHit(t, e = !1) {
|
|
1622
|
-
if (t)
|
|
1623
|
-
return this._isVisible(t) && this._isListening(t);
|
|
1624
|
-
const i = this.getLayer();
|
|
1625
|
-
let s = !1;
|
|
1626
|
-
v._dragElements.forEach((a) => {
|
|
1627
|
-
a.dragStatus === "dragging" && (a.node.nodeType === "Stage" || a.node.getLayer() === i) && (s = !0);
|
|
1628
|
-
});
|
|
1629
|
-
const r = !e && !m.hitOnDragEnabled && (s || m.isTransforming());
|
|
1630
|
-
return this.isListening() && this.isVisible() && !r;
|
|
1631
|
-
}
|
|
1632
|
-
show() {
|
|
1633
|
-
return this.visible(!0), this;
|
|
1634
|
-
}
|
|
1635
|
-
hide() {
|
|
1636
|
-
return this.visible(!1), this;
|
|
1637
|
-
}
|
|
1638
|
-
getZIndex() {
|
|
1639
|
-
return this.index || 0;
|
|
1640
|
-
}
|
|
1641
|
-
getAbsoluteZIndex() {
|
|
1642
|
-
let t = this.getDepth(), e = this, i = 0, s, r, a, o;
|
|
1643
|
-
function h(d) {
|
|
1644
|
-
for (s = [], r = d.length, a = 0; a < r; a++)
|
|
1645
|
-
o = d[a], i++, o.nodeType !== Bt && (s = s.concat(o.getChildren().slice())), o._id === e._id && (a = r);
|
|
1646
|
-
s.length > 0 && s[0].getDepth() <= t && h(s);
|
|
1647
|
-
}
|
|
1648
|
-
const l = this.getStage();
|
|
1649
|
-
return e.nodeType !== $e && l && h(l.getChildren()), i;
|
|
1650
|
-
}
|
|
1651
|
-
getDepth() {
|
|
1652
|
-
let t = 0, e = this.parent;
|
|
1653
|
-
for (; e; )
|
|
1654
|
-
t++, e = e.parent;
|
|
1655
|
-
return t;
|
|
1656
|
-
}
|
|
1657
|
-
_batchTransformChanges(t) {
|
|
1658
|
-
this._batchingTransformChange = !0, t(), this._batchingTransformChange = !1, this._needClearTransformCache && (this._clearCache(O), this._clearSelfAndDescendantCache(T)), this._needClearTransformCache = !1;
|
|
1659
|
-
}
|
|
1660
|
-
setPosition(t) {
|
|
1661
|
-
return this._batchTransformChanges(() => {
|
|
1662
|
-
this.x(t.x), this.y(t.y);
|
|
1663
|
-
}), this;
|
|
1664
|
-
}
|
|
1665
|
-
getPosition() {
|
|
1666
|
-
return {
|
|
1667
|
-
x: this.x(),
|
|
1668
|
-
y: this.y()
|
|
1669
|
-
};
|
|
1670
|
-
}
|
|
1671
|
-
getRelativePointerPosition() {
|
|
1672
|
-
const t = this.getStage();
|
|
1673
|
-
if (!t)
|
|
1674
|
-
return null;
|
|
1675
|
-
const e = t.getPointerPosition();
|
|
1676
|
-
if (!e)
|
|
1677
|
-
return null;
|
|
1678
|
-
const i = this.getAbsoluteTransform().copy();
|
|
1679
|
-
return i.invert(), i.point(e);
|
|
1680
|
-
}
|
|
1681
|
-
getAbsolutePosition(t) {
|
|
1682
|
-
let e = !1, i = this.parent;
|
|
1683
|
-
for (; i; ) {
|
|
1684
|
-
if (i.isCached()) {
|
|
1685
|
-
e = !0;
|
|
1686
|
-
break;
|
|
1687
|
-
}
|
|
1688
|
-
i = i.parent;
|
|
1689
|
-
}
|
|
1690
|
-
e && !t && (t = !0);
|
|
1691
|
-
const s = this.getAbsoluteTransform(t).getMatrix(), r = new L(), a = this.offset();
|
|
1692
|
-
return r.m = s.slice(), r.translate(a.x, a.y), r.getTranslation();
|
|
1693
|
-
}
|
|
1694
|
-
setAbsolutePosition(t) {
|
|
1695
|
-
const { x: e, y: i, ...s } = this._clearTransform();
|
|
1696
|
-
this.attrs.x = e, this.attrs.y = i, this._clearCache(O);
|
|
1697
|
-
const r = this._getAbsoluteTransform().copy();
|
|
1698
|
-
return r.invert(), r.translate(t.x, t.y), t = {
|
|
1699
|
-
x: this.attrs.x + r.getTranslation().x,
|
|
1700
|
-
y: this.attrs.y + r.getTranslation().y
|
|
1701
|
-
}, this._setTransform(s), this.setPosition({ x: t.x, y: t.y }), this._clearCache(O), this._clearSelfAndDescendantCache(T), this;
|
|
1702
|
-
}
|
|
1703
|
-
_setTransform(t) {
|
|
1704
|
-
let e;
|
|
1705
|
-
for (e in t)
|
|
1706
|
-
this.attrs[e] = t[e];
|
|
1707
|
-
}
|
|
1708
|
-
_clearTransform() {
|
|
1709
|
-
const t = {
|
|
1710
|
-
x: this.x(),
|
|
1711
|
-
y: this.y(),
|
|
1712
|
-
rotation: this.rotation(),
|
|
1713
|
-
scaleX: this.scaleX(),
|
|
1714
|
-
scaleY: this.scaleY(),
|
|
1715
|
-
offsetX: this.offsetX(),
|
|
1716
|
-
offsetY: this.offsetY(),
|
|
1717
|
-
skewX: this.skewX(),
|
|
1718
|
-
skewY: this.skewY()
|
|
1719
|
-
};
|
|
1720
|
-
return this.attrs.x = 0, this.attrs.y = 0, this.attrs.rotation = 0, this.attrs.scaleX = 1, this.attrs.scaleY = 1, this.attrs.offsetX = 0, this.attrs.offsetY = 0, this.attrs.skewX = 0, this.attrs.skewY = 0, t;
|
|
1721
|
-
}
|
|
1722
|
-
move(t) {
|
|
1723
|
-
let e = t.x, i = t.y, s = this.x(), r = this.y();
|
|
1724
|
-
return e !== void 0 && (s += e), i !== void 0 && (r += i), this.setPosition({ x: s, y: r }), this;
|
|
1725
|
-
}
|
|
1726
|
-
_eachAncestorReverse(t, e) {
|
|
1727
|
-
let i = [], s = this.getParent(), r, a;
|
|
1728
|
-
if (!(e && e._id === this._id)) {
|
|
1729
|
-
for (i.unshift(this); s && (!e || s._id !== e._id); )
|
|
1730
|
-
i.unshift(s), s = s.parent;
|
|
1731
|
-
for (r = i.length, a = 0; a < r; a++)
|
|
1732
|
-
t(i[a]);
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
rotate(t) {
|
|
1736
|
-
return this.rotation(this.rotation() + t), this;
|
|
1737
|
-
}
|
|
1738
|
-
moveToTop() {
|
|
1739
|
-
if (!this.parent)
|
|
1740
|
-
return c.warn("Node has no parent. moveToTop function is ignored."), !1;
|
|
1741
|
-
const t = this.index, e = this.parent.getChildren().length;
|
|
1742
|
-
return t < e - 1 ? (this.parent.children.splice(t, 1), this.parent.children.push(this), this.parent._setChildrenIndices(), !0) : !1;
|
|
1743
|
-
}
|
|
1744
|
-
moveUp() {
|
|
1745
|
-
if (!this.parent)
|
|
1746
|
-
return c.warn("Node has no parent. moveUp function is ignored."), !1;
|
|
1747
|
-
const t = this.index, e = this.parent.getChildren().length;
|
|
1748
|
-
return t < e - 1 ? (this.parent.children.splice(t, 1), this.parent.children.splice(t + 1, 0, this), this.parent._setChildrenIndices(), !0) : !1;
|
|
1749
|
-
}
|
|
1750
|
-
moveDown() {
|
|
1751
|
-
if (!this.parent)
|
|
1752
|
-
return c.warn("Node has no parent. moveDown function is ignored."), !1;
|
|
1753
|
-
const t = this.index;
|
|
1754
|
-
return t > 0 ? (this.parent.children.splice(t, 1), this.parent.children.splice(t - 1, 0, this), this.parent._setChildrenIndices(), !0) : !1;
|
|
1755
|
-
}
|
|
1756
|
-
moveToBottom() {
|
|
1757
|
-
if (!this.parent)
|
|
1758
|
-
return c.warn("Node has no parent. moveToBottom function is ignored."), !1;
|
|
1759
|
-
const t = this.index;
|
|
1760
|
-
return t > 0 ? (this.parent.children.splice(t, 1), this.parent.children.unshift(this), this.parent._setChildrenIndices(), !0) : !1;
|
|
1761
|
-
}
|
|
1762
|
-
setZIndex(t) {
|
|
1763
|
-
if (!this.parent)
|
|
1764
|
-
return c.warn("Node has no parent. zIndex parameter is ignored."), this;
|
|
1765
|
-
(t < 0 || t >= this.parent.children.length) && c.warn("Unexpected value " + t + " for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to " + (this.parent.children.length - 1) + ".");
|
|
1766
|
-
const e = this.index;
|
|
1767
|
-
return this.parent.children.splice(e, 1), this.parent.children.splice(t, 0, this), this.parent._setChildrenIndices(), this;
|
|
1768
|
-
}
|
|
1769
|
-
getAbsoluteOpacity() {
|
|
1770
|
-
return this._getCache(dt, this._getAbsoluteOpacity);
|
|
1771
|
-
}
|
|
1772
|
-
_getAbsoluteOpacity() {
|
|
1773
|
-
let t = this.opacity();
|
|
1774
|
-
const e = this.getParent();
|
|
1775
|
-
return e && !e._isUnderCache && (t *= e.getAbsoluteOpacity()), t;
|
|
1776
|
-
}
|
|
1777
|
-
moveTo(t) {
|
|
1778
|
-
return this.getParent() !== t && (this._remove(), t.add(this)), this;
|
|
1779
|
-
}
|
|
1780
|
-
toObject() {
|
|
1781
|
-
let t = this.getAttrs(), e, i, s, r, a;
|
|
1782
|
-
const o = {
|
|
1783
|
-
attrs: {},
|
|
1784
|
-
className: this.getClassName()
|
|
1785
|
-
};
|
|
1786
|
-
for (e in t)
|
|
1787
|
-
i = t[e], a = c.isObject(i) && !c._isPlainObject(i) && !c._isArray(i), !a && (s = typeof this[e] == "function" && this[e], delete t[e], r = s ? s.call(this) : null, t[e] = i, r !== i && (o.attrs[e] = i));
|
|
1788
|
-
return c._prepareToStringify(o);
|
|
1789
|
-
}
|
|
1790
|
-
toJSON() {
|
|
1791
|
-
return JSON.stringify(this.toObject());
|
|
1792
|
-
}
|
|
1793
|
-
getParent() {
|
|
1794
|
-
return this.parent;
|
|
1795
|
-
}
|
|
1796
|
-
findAncestors(t, e, i) {
|
|
1797
|
-
const s = [];
|
|
1798
|
-
e && this._isMatch(t) && s.push(this);
|
|
1799
|
-
let r = this.parent;
|
|
1800
|
-
for (; r; ) {
|
|
1801
|
-
if (r === i)
|
|
1802
|
-
return s;
|
|
1803
|
-
r._isMatch(t) && s.push(r), r = r.parent;
|
|
1804
|
-
}
|
|
1805
|
-
return s;
|
|
1806
|
-
}
|
|
1807
|
-
isAncestorOf(t) {
|
|
1808
|
-
return !1;
|
|
1809
|
-
}
|
|
1810
|
-
findAncestor(t, e, i) {
|
|
1811
|
-
return this.findAncestors(t, e, i)[0];
|
|
1812
|
-
}
|
|
1813
|
-
_isMatch(t) {
|
|
1814
|
-
if (!t)
|
|
1815
|
-
return !1;
|
|
1816
|
-
if (typeof t == "function")
|
|
1817
|
-
return t(this);
|
|
1818
|
-
let e = t.replace(/ /g, "").split(","), i = e.length, s, r;
|
|
1819
|
-
for (s = 0; s < i; s++)
|
|
1820
|
-
if (r = e[s], c.isValidSelector(r) || (c.warn('Selector "' + r + '" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'), c.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'), c.warn("Konva is awesome, right?")), r.charAt(0) === "#") {
|
|
1821
|
-
if (this.id() === r.slice(1))
|
|
1822
|
-
return !0;
|
|
1823
|
-
} else if (r.charAt(0) === ".") {
|
|
1824
|
-
if (this.hasName(r.slice(1)))
|
|
1825
|
-
return !0;
|
|
1826
|
-
} else if (this.className === r || this.nodeType === r)
|
|
1827
|
-
return !0;
|
|
1828
|
-
return !1;
|
|
1829
|
-
}
|
|
1830
|
-
getLayer() {
|
|
1831
|
-
const t = this.getParent();
|
|
1832
|
-
return t ? t.getLayer() : null;
|
|
1833
|
-
}
|
|
1834
|
-
getStage() {
|
|
1835
|
-
return this._getCache(Nt, this._getStage);
|
|
1836
|
-
}
|
|
1837
|
-
_getStage() {
|
|
1838
|
-
const t = this.getParent();
|
|
1839
|
-
return t ? t.getStage() : null;
|
|
1840
|
-
}
|
|
1841
|
-
fire(t, e = {}, i) {
|
|
1842
|
-
return e.target = e.target || this, i ? this._fireAndBubble(t, e) : this._fire(t, e), this;
|
|
1843
|
-
}
|
|
1844
|
-
getAbsoluteTransform(t) {
|
|
1845
|
-
return t ? this._getAbsoluteTransform(t) : this._getCache(T, this._getAbsoluteTransform);
|
|
1846
|
-
}
|
|
1847
|
-
_getAbsoluteTransform(t) {
|
|
1848
|
-
let e;
|
|
1849
|
-
if (t)
|
|
1850
|
-
return e = new L(), this._eachAncestorReverse(function(i) {
|
|
1851
|
-
const s = i.transformsEnabled();
|
|
1852
|
-
s === "all" ? e.multiply(i.getTransform()) : s === "position" && e.translate(i.x() - i.offsetX(), i.y() - i.offsetY());
|
|
1853
|
-
}, t), e;
|
|
1854
|
-
{
|
|
1855
|
-
e = this._cache.get(T) || new L(), this.parent ? this.parent.getAbsoluteTransform().copyInto(e) : e.reset();
|
|
1856
|
-
const i = this.transformsEnabled();
|
|
1857
|
-
if (i === "all")
|
|
1858
|
-
e.multiply(this.getTransform());
|
|
1859
|
-
else if (i === "position") {
|
|
1860
|
-
const s = this.attrs.x || 0, r = this.attrs.y || 0, a = this.attrs.offsetX || 0, o = this.attrs.offsetY || 0;
|
|
1861
|
-
e.translate(s - a, r - o);
|
|
1862
|
-
}
|
|
1863
|
-
return e.dirty = !1, e;
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
getAbsoluteScale(t) {
|
|
1867
|
-
let e = this;
|
|
1868
|
-
for (; e; )
|
|
1869
|
-
e._isUnderCache && (t = e), e = e.getParent();
|
|
1870
|
-
const s = this.getAbsoluteTransform(t).decompose();
|
|
1871
|
-
return {
|
|
1872
|
-
x: s.scaleX,
|
|
1873
|
-
y: s.scaleY
|
|
1874
|
-
};
|
|
1875
|
-
}
|
|
1876
|
-
getAbsoluteRotation() {
|
|
1877
|
-
return this.getAbsoluteTransform().decompose().rotation;
|
|
1878
|
-
}
|
|
1879
|
-
getTransform() {
|
|
1880
|
-
return this._getCache(O, this._getTransform);
|
|
1881
|
-
}
|
|
1882
|
-
_getTransform() {
|
|
1883
|
-
var t, e;
|
|
1884
|
-
const i = this._cache.get(O) || new L();
|
|
1885
|
-
i.reset();
|
|
1886
|
-
const s = this.x(), r = this.y(), a = m.getAngle(this.rotation()), o = (t = this.attrs.scaleX) !== null && t !== void 0 ? t : 1, h = (e = this.attrs.scaleY) !== null && e !== void 0 ? e : 1, l = this.attrs.skewX || 0, d = this.attrs.skewY || 0, u = this.attrs.offsetX || 0, f = this.attrs.offsetY || 0;
|
|
1887
|
-
return (s !== 0 || r !== 0) && i.translate(s, r), a !== 0 && i.rotate(a), (l !== 0 || d !== 0) && i.skew(l, d), (o !== 1 || h !== 1) && i.scale(o, h), (u !== 0 || f !== 0) && i.translate(-1 * u, -1 * f), i.dirty = !1, i;
|
|
1888
|
-
}
|
|
1889
|
-
clone(t) {
|
|
1890
|
-
let e = c.cloneObject(this.attrs), i, s, r, a, o;
|
|
1891
|
-
for (i in t)
|
|
1892
|
-
e[i] = t[i];
|
|
1893
|
-
const h = new this.constructor(e);
|
|
1894
|
-
for (i in this.eventListeners)
|
|
1895
|
-
for (s = this.eventListeners[i], r = s.length, a = 0; a < r; a++)
|
|
1896
|
-
o = s[a], o.name.indexOf(Ve) < 0 && (h.eventListeners[i] || (h.eventListeners[i] = []), h.eventListeners[i].push(o));
|
|
1897
|
-
return h;
|
|
1898
|
-
}
|
|
1899
|
-
_toKonvaCanvas(t) {
|
|
1900
|
-
t = t || {};
|
|
1901
|
-
const e = this.getClientRect(), i = this.getStage(), s = t.x !== void 0 ? t.x : Math.floor(e.x), r = t.y !== void 0 ? t.y : Math.floor(e.y), a = t.pixelRatio || 1, o = new D({
|
|
1902
|
-
width: t.width || Math.ceil(e.width) || (i ? i.width() : 0),
|
|
1903
|
-
height: t.height || Math.ceil(e.height) || (i ? i.height() : 0),
|
|
1904
|
-
pixelRatio: a
|
|
1905
|
-
}), h = o.getContext(), l = new D({
|
|
1906
|
-
width: o.width / o.pixelRatio + Math.abs(s),
|
|
1907
|
-
height: o.height / o.pixelRatio + Math.abs(r),
|
|
1908
|
-
pixelRatio: o.pixelRatio
|
|
1909
|
-
});
|
|
1910
|
-
return t.imageSmoothingEnabled === !1 && (h._context.imageSmoothingEnabled = !1), h.save(), (s || r) && h.translate(-1 * s, -1 * r), this.drawScene(o, void 0, l), h.restore(), o;
|
|
1911
|
-
}
|
|
1912
|
-
toCanvas(t) {
|
|
1913
|
-
return this._toKonvaCanvas(t)._canvas;
|
|
1914
|
-
}
|
|
1915
|
-
toDataURL(t) {
|
|
1916
|
-
t = t || {};
|
|
1917
|
-
const e = t.mimeType || null, i = t.quality || null, s = this._toKonvaCanvas(t).toDataURL(e, i);
|
|
1918
|
-
return t.callback && t.callback(s), s;
|
|
1919
|
-
}
|
|
1920
|
-
toImage(t) {
|
|
1921
|
-
return new Promise((e, i) => {
|
|
1922
|
-
try {
|
|
1923
|
-
const s = t?.callback;
|
|
1924
|
-
s && delete t.callback, c._urlToImage(this.toDataURL(t), function(r) {
|
|
1925
|
-
e(r), s?.(r);
|
|
1926
|
-
});
|
|
1927
|
-
} catch (s) {
|
|
1928
|
-
i(s);
|
|
1929
|
-
}
|
|
1930
|
-
});
|
|
1931
|
-
}
|
|
1932
|
-
toBlob(t) {
|
|
1933
|
-
return new Promise((e, i) => {
|
|
1934
|
-
try {
|
|
1935
|
-
const s = t?.callback;
|
|
1936
|
-
s && delete t.callback, this.toCanvas(t).toBlob((r) => {
|
|
1937
|
-
e(r), s?.(r);
|
|
1938
|
-
}, t?.mimeType, t?.quality);
|
|
1939
|
-
} catch (s) {
|
|
1940
|
-
i(s);
|
|
1941
|
-
}
|
|
1942
|
-
});
|
|
1943
|
-
}
|
|
1944
|
-
setSize(t) {
|
|
1945
|
-
return this.width(t.width), this.height(t.height), this;
|
|
1946
|
-
}
|
|
1947
|
-
getSize() {
|
|
1948
|
-
return {
|
|
1949
|
-
width: this.width(),
|
|
1950
|
-
height: this.height()
|
|
1951
|
-
};
|
|
1952
|
-
}
|
|
1953
|
-
getClassName() {
|
|
1954
|
-
return this.className || this.nodeType;
|
|
1955
|
-
}
|
|
1956
|
-
getType() {
|
|
1957
|
-
return this.nodeType;
|
|
1958
|
-
}
|
|
1959
|
-
getDragDistance() {
|
|
1960
|
-
return this.attrs.dragDistance !== void 0 ? this.attrs.dragDistance : this.parent ? this.parent.getDragDistance() : m.dragDistance;
|
|
1961
|
-
}
|
|
1962
|
-
_off(t, e, i) {
|
|
1963
|
-
let s = this.eventListeners[t], r, a, o;
|
|
1964
|
-
for (r = 0; r < s.length; r++)
|
|
1965
|
-
if (a = s[r].name, o = s[r].handler, (a !== "konva" || e === "konva") && (!e || a === e) && (!i || i === o)) {
|
|
1966
|
-
if (s.splice(r, 1), s.length === 0) {
|
|
1967
|
-
delete this.eventListeners[t];
|
|
1968
|
-
break;
|
|
1969
|
-
}
|
|
1970
|
-
r--;
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
_fireChangeEvent(t, e, i) {
|
|
1974
|
-
this._fire(t + Ye, {
|
|
1975
|
-
oldVal: e,
|
|
1976
|
-
newVal: i
|
|
1977
|
-
});
|
|
1978
|
-
}
|
|
1979
|
-
addName(t) {
|
|
1980
|
-
if (!this.hasName(t)) {
|
|
1981
|
-
const e = this.name(), i = e ? e + " " + t : t;
|
|
1982
|
-
this.name(i);
|
|
1983
|
-
}
|
|
1984
|
-
return this;
|
|
1985
|
-
}
|
|
1986
|
-
hasName(t) {
|
|
1987
|
-
if (!t)
|
|
1988
|
-
return !1;
|
|
1989
|
-
const e = this.name();
|
|
1990
|
-
return e ? (e || "").split(/\s/g).indexOf(t) !== -1 : !1;
|
|
1991
|
-
}
|
|
1992
|
-
removeName(t) {
|
|
1993
|
-
const e = (this.name() || "").split(/\s/g), i = e.indexOf(t);
|
|
1994
|
-
return i !== -1 && (e.splice(i, 1), this.name(e.join(" "))), this;
|
|
1995
|
-
}
|
|
1996
|
-
setAttr(t, e) {
|
|
1997
|
-
const i = this[Ft + c._capitalize(t)];
|
|
1998
|
-
return c._isFunction(i) ? i.call(this, e) : this._setAttr(t, e), this;
|
|
1999
|
-
}
|
|
2000
|
-
_requestDraw() {
|
|
2001
|
-
if (m.autoDrawEnabled) {
|
|
2002
|
-
const t = this.getLayer() || this.getStage();
|
|
2003
|
-
t?.batchDraw();
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
_setAttr(t, e) {
|
|
2007
|
-
const i = this.attrs[t];
|
|
2008
|
-
i === e && !c.isObject(e) || (e == null ? delete this.attrs[t] : this.attrs[t] = e, this._shouldFireChangeEvents && this._fireChangeEvent(t, i, e), this._requestDraw());
|
|
2009
|
-
}
|
|
2010
|
-
_setComponentAttr(t, e, i) {
|
|
2011
|
-
let s;
|
|
2012
|
-
i !== void 0 && (s = this.attrs[t], s || (this.attrs[t] = this.getAttr(t)), this.attrs[t][e] = i, this._fireChangeEvent(t, s, i));
|
|
2013
|
-
}
|
|
2014
|
-
_fireAndBubble(t, e, i) {
|
|
2015
|
-
e && this.nodeType === Bt && (e.target = this);
|
|
2016
|
-
const s = [
|
|
2017
|
-
We,
|
|
2018
|
-
je,
|
|
2019
|
-
Ke,
|
|
2020
|
-
qe,
|
|
2021
|
-
ze,
|
|
2022
|
-
Je
|
|
2023
|
-
];
|
|
2024
|
-
if (!(s.indexOf(t) !== -1 && (i && (this === i || this.isAncestorOf && this.isAncestorOf(i)) || this.nodeType === "Stage" && !i))) {
|
|
2025
|
-
this._fire(t, e);
|
|
2026
|
-
const a = s.indexOf(t) !== -1 && i && i.isAncestorOf && i.isAncestorOf(this) && !i.isAncestorOf(this.parent);
|
|
2027
|
-
(e && !e.cancelBubble || !e) && this.parent && this.parent.isListening() && !a && (i && i.parent ? this._fireAndBubble.call(this.parent, t, e, i) : this._fireAndBubble.call(this.parent, t, e));
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
_getProtoListeners(t) {
|
|
2031
|
-
var e, i;
|
|
2032
|
-
const { nodeType: s } = this, r = _.protoListenerMap.get(s) || {};
|
|
2033
|
-
let a = r?.[t];
|
|
2034
|
-
if (a === void 0) {
|
|
2035
|
-
a = [];
|
|
2036
|
-
let o = Object.getPrototypeOf(this);
|
|
2037
|
-
for (; o; ) {
|
|
2038
|
-
const h = (i = (e = o.eventListeners) === null || e === void 0 ? void 0 : e[t]) !== null && i !== void 0 ? i : [];
|
|
2039
|
-
a.push(...h), o = Object.getPrototypeOf(o);
|
|
2040
|
-
}
|
|
2041
|
-
r[t] = a, _.protoListenerMap.set(s, r);
|
|
2042
|
-
}
|
|
2043
|
-
return a;
|
|
2044
|
-
}
|
|
2045
|
-
_fire(t, e) {
|
|
2046
|
-
e = e || {}, e.currentTarget = this, e.type = t;
|
|
2047
|
-
const i = this._getProtoListeners(t);
|
|
2048
|
-
if (i) {
|
|
2049
|
-
const r = i.slice();
|
|
2050
|
-
for (let a = 0; a < r.length; a++)
|
|
2051
|
-
r[a].handler.call(this, e);
|
|
2052
|
-
}
|
|
2053
|
-
const s = this.eventListeners[t];
|
|
2054
|
-
if (s) {
|
|
2055
|
-
const r = s.slice(), a = r.length;
|
|
2056
|
-
for (let h = 0; h < r.length; h++)
|
|
2057
|
-
r[h].handler.call(this, e);
|
|
2058
|
-
const o = this.eventListeners[t];
|
|
2059
|
-
if (o)
|
|
2060
|
-
for (let h = a; h < o.length; h++)
|
|
2061
|
-
o[h].handler.call(this, e);
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
draw() {
|
|
2065
|
-
return this.drawScene(), this.drawHit(), this;
|
|
2066
|
-
}
|
|
2067
|
-
_createDragElement(t) {
|
|
2068
|
-
const e = t ? t.pointerId : void 0, i = this.getStage(), s = this.getAbsolutePosition();
|
|
2069
|
-
if (!i)
|
|
2070
|
-
return;
|
|
2071
|
-
const r = i._getPointerById(e) || i._changedPointerPositions[0] || s;
|
|
2072
|
-
v._dragElements.set(this._id, {
|
|
2073
|
-
node: this,
|
|
2074
|
-
startPointerPos: r,
|
|
2075
|
-
offset: {
|
|
2076
|
-
x: r.x - s.x,
|
|
2077
|
-
y: r.y - s.y
|
|
2078
|
-
},
|
|
2079
|
-
dragStatus: "ready",
|
|
2080
|
-
pointerId: e,
|
|
2081
|
-
startEvent: t
|
|
2082
|
-
});
|
|
2083
|
-
}
|
|
2084
|
-
startDrag(t, e = !0) {
|
|
2085
|
-
v._dragElements.has(this._id) || this._createDragElement(t);
|
|
2086
|
-
const i = v._dragElements.get(this._id);
|
|
2087
|
-
i.dragStatus = "dragging", this.fire("dragstart", {
|
|
2088
|
-
type: "dragstart",
|
|
2089
|
-
target: this,
|
|
2090
|
-
evt: i.startEvent && i.startEvent.evt || t && t.evt
|
|
2091
|
-
}, e);
|
|
2092
|
-
}
|
|
2093
|
-
_setDragPosition(t, e) {
|
|
2094
|
-
const i = this.getStage()._getPointerById(e.pointerId);
|
|
2095
|
-
if (!i)
|
|
2096
|
-
return;
|
|
2097
|
-
let s = {
|
|
2098
|
-
x: i.x - e.offset.x,
|
|
2099
|
-
y: i.y - e.offset.y
|
|
2100
|
-
};
|
|
2101
|
-
const r = this.dragBoundFunc();
|
|
2102
|
-
if (r !== void 0) {
|
|
2103
|
-
const a = r.call(this, s, t);
|
|
2104
|
-
a ? s = a : c.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.");
|
|
2105
|
-
}
|
|
2106
|
-
(!this._lastPos || this._lastPos.x !== s.x || this._lastPos.y !== s.y) && (this.setAbsolutePosition(s), this._requestDraw()), this._lastPos = s;
|
|
2107
|
-
}
|
|
2108
|
-
stopDrag(t) {
|
|
2109
|
-
const e = v._dragElements.get(this._id);
|
|
2110
|
-
e && (e.dragStatus = "stopped"), v._endDragBefore(t), v._endDragAfter(t);
|
|
2111
|
-
}
|
|
2112
|
-
setDraggable(t) {
|
|
2113
|
-
this._setAttr("draggable", t), this._dragChange();
|
|
2114
|
-
}
|
|
2115
|
-
isDragging() {
|
|
2116
|
-
const t = v._dragElements.get(this._id);
|
|
2117
|
-
return t ? t.dragStatus === "dragging" : !1;
|
|
2118
|
-
}
|
|
2119
|
-
_listenDrag() {
|
|
2120
|
-
this._dragCleanup(), this.on("mousedown.konva touchstart.konva", function(t) {
|
|
2121
|
-
if (!(!(t.evt.button !== void 0) || m.dragButtons.indexOf(t.evt.button) >= 0) || this.isDragging())
|
|
2122
|
-
return;
|
|
2123
|
-
let s = !1;
|
|
2124
|
-
v._dragElements.forEach((r) => {
|
|
2125
|
-
this.isAncestorOf(r.node) && (s = !0);
|
|
2126
|
-
}), s || this._createDragElement(t);
|
|
2127
|
-
});
|
|
2128
|
-
}
|
|
2129
|
-
_dragChange() {
|
|
2130
|
-
if (this.attrs.draggable)
|
|
2131
|
-
this._listenDrag();
|
|
2132
|
-
else {
|
|
2133
|
-
if (this._dragCleanup(), !this.getStage())
|
|
2134
|
-
return;
|
|
2135
|
-
const e = v._dragElements.get(this._id), i = e && e.dragStatus === "dragging", s = e && e.dragStatus === "ready";
|
|
2136
|
-
i ? this.stopDrag() : s && v._dragElements.delete(this._id);
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
_dragCleanup() {
|
|
2140
|
-
this.off("mousedown.konva"), this.off("touchstart.konva");
|
|
2141
|
-
}
|
|
2142
|
-
isClientRectOnScreen(t = { x: 0, y: 0 }) {
|
|
2143
|
-
const e = this.getStage();
|
|
2144
|
-
if (!e)
|
|
2145
|
-
return !1;
|
|
2146
|
-
const i = {
|
|
2147
|
-
x: -t.x,
|
|
2148
|
-
y: -t.y,
|
|
2149
|
-
width: e.width() + 2 * t.x,
|
|
2150
|
-
height: e.height() + 2 * t.y
|
|
2151
|
-
};
|
|
2152
|
-
return c.haveIntersection(i, this.getClientRect());
|
|
2153
|
-
}
|
|
2154
|
-
static create(t, e) {
|
|
2155
|
-
return c._isString(t) && (t = JSON.parse(t)), this._createNode(t, e);
|
|
2156
|
-
}
|
|
2157
|
-
static _createNode(t, e) {
|
|
2158
|
-
let i = _.prototype.getClassName.call(t), s = t.children, r, a, o;
|
|
2159
|
-
e && (t.attrs.container = e), m[i] || (c.warn('Can not find a node with class name "' + i + '". Fallback to "Shape".'), i = "Shape");
|
|
2160
|
-
const h = m[i];
|
|
2161
|
-
if (r = new h(t.attrs), s)
|
|
2162
|
-
for (a = s.length, o = 0; o < a; o++)
|
|
2163
|
-
r.add(_._createNode(s[o]));
|
|
2164
|
-
return r;
|
|
2165
|
-
}
|
|
2166
|
-
}
|
|
2167
|
-
_.protoListenerMap = /* @__PURE__ */ new Map();
|
|
2168
|
-
_.prototype.nodeType = "Node";
|
|
2169
|
-
_.prototype._attrsAffectingSize = [];
|
|
2170
|
-
_.prototype.eventListeners = {};
|
|
2171
|
-
_.prototype.on(Ze, function() {
|
|
2172
|
-
if (this._batchingTransformChange) {
|
|
2173
|
-
this._needClearTransformCache = !0;
|
|
2174
|
-
return;
|
|
2175
|
-
}
|
|
2176
|
-
this._clearCache(O), this._clearSelfAndDescendantCache(T);
|
|
2177
|
-
});
|
|
2178
|
-
_.prototype.on("visibleChange.konva", function() {
|
|
2179
|
-
this._clearSelfAndDescendantCache(bt);
|
|
2180
|
-
});
|
|
2181
|
-
_.prototype.on("listeningChange.konva", function() {
|
|
2182
|
-
this._clearSelfAndDescendantCache(vt);
|
|
2183
|
-
});
|
|
2184
|
-
_.prototype.on("opacityChange.konva", function() {
|
|
2185
|
-
this._clearSelfAndDescendantCache(dt);
|
|
2186
|
-
});
|
|
2187
|
-
const S = g.addGetterSetter;
|
|
2188
|
-
S(_, "zIndex");
|
|
2189
|
-
S(_, "absolutePosition");
|
|
2190
|
-
S(_, "position");
|
|
2191
|
-
S(_, "x", 0, b());
|
|
2192
|
-
S(_, "y", 0, b());
|
|
2193
|
-
S(_, "globalCompositeOperation", "source-over", Y());
|
|
2194
|
-
S(_, "opacity", 1, b());
|
|
2195
|
-
S(_, "name", "", Y());
|
|
2196
|
-
S(_, "id", "", Y());
|
|
2197
|
-
S(_, "rotation", 0, b());
|
|
2198
|
-
g.addComponentsGetterSetter(_, "scale", ["x", "y"]);
|
|
2199
|
-
S(_, "scaleX", 1, b());
|
|
2200
|
-
S(_, "scaleY", 1, b());
|
|
2201
|
-
g.addComponentsGetterSetter(_, "skew", ["x", "y"]);
|
|
2202
|
-
S(_, "skewX", 0, b());
|
|
2203
|
-
S(_, "skewY", 0, b());
|
|
2204
|
-
g.addComponentsGetterSetter(_, "offset", ["x", "y"]);
|
|
2205
|
-
S(_, "offsetX", 0, b());
|
|
2206
|
-
S(_, "offsetY", 0, b());
|
|
2207
|
-
S(_, "dragDistance", void 0, b());
|
|
2208
|
-
S(_, "width", 0, b());
|
|
2209
|
-
S(_, "height", 0, b());
|
|
2210
|
-
S(_, "listening", !0, M());
|
|
2211
|
-
S(_, "preventDefault", !0, M());
|
|
2212
|
-
S(_, "filters", void 0, function(n) {
|
|
2213
|
-
return this._filterUpToDate = !1, n;
|
|
2214
|
-
});
|
|
2215
|
-
S(_, "visible", !0, M());
|
|
2216
|
-
S(_, "transformsEnabled", "all", Y());
|
|
2217
|
-
S(_, "size");
|
|
2218
|
-
S(_, "dragBoundFunc");
|
|
2219
|
-
S(_, "draggable", !1, M());
|
|
2220
|
-
g.backCompat(_, {
|
|
2221
|
-
rotateDeg: "rotate",
|
|
2222
|
-
setRotationDeg: "setRotation",
|
|
2223
|
-
getRotationDeg: "getRotation"
|
|
2224
|
-
});
|
|
2225
|
-
class k extends _ {
|
|
2226
|
-
constructor() {
|
|
2227
|
-
super(...arguments), this.children = [];
|
|
2228
|
-
}
|
|
2229
|
-
getChildren(t) {
|
|
2230
|
-
const e = this.children || [];
|
|
2231
|
-
return t ? e.filter(t) : e;
|
|
2232
|
-
}
|
|
2233
|
-
hasChildren() {
|
|
2234
|
-
return this.getChildren().length > 0;
|
|
2235
|
-
}
|
|
2236
|
-
removeChildren() {
|
|
2237
|
-
return this.getChildren().forEach((t) => {
|
|
2238
|
-
t.parent = null, t.index = 0, t.remove();
|
|
2239
|
-
}), this.children = [], this._requestDraw(), this;
|
|
2240
|
-
}
|
|
2241
|
-
destroyChildren() {
|
|
2242
|
-
return this.getChildren().forEach((t) => {
|
|
2243
|
-
t.parent = null, t.index = 0, t.destroy();
|
|
2244
|
-
}), this.children = [], this._requestDraw(), this;
|
|
2245
|
-
}
|
|
2246
|
-
add(...t) {
|
|
2247
|
-
if (t.length === 0)
|
|
2248
|
-
return this;
|
|
2249
|
-
if (t.length > 1) {
|
|
2250
|
-
for (let i = 0; i < t.length; i++)
|
|
2251
|
-
this.add(t[i]);
|
|
2252
|
-
return this;
|
|
2253
|
-
}
|
|
2254
|
-
const e = t[0];
|
|
2255
|
-
return e.getParent() ? (e.moveTo(this), this) : (this._validateAdd(e), e.index = this.getChildren().length, e.parent = this, e._clearCaches(), this.getChildren().push(e), this._fire("add", {
|
|
2256
|
-
child: e
|
|
2257
|
-
}), this._requestDraw(), this);
|
|
2258
|
-
}
|
|
2259
|
-
destroy() {
|
|
2260
|
-
return this.hasChildren() && this.destroyChildren(), super.destroy(), this;
|
|
2261
|
-
}
|
|
2262
|
-
find(t) {
|
|
2263
|
-
return this._generalFind(t, !1);
|
|
2264
|
-
}
|
|
2265
|
-
findOne(t) {
|
|
2266
|
-
const e = this._generalFind(t, !0);
|
|
2267
|
-
return e.length > 0 ? e[0] : void 0;
|
|
2268
|
-
}
|
|
2269
|
-
_generalFind(t, e) {
|
|
2270
|
-
const i = [];
|
|
2271
|
-
return this._descendants((s) => {
|
|
2272
|
-
const r = s._isMatch(t);
|
|
2273
|
-
return r && i.push(s), !!(r && e);
|
|
2274
|
-
}), i;
|
|
2275
|
-
}
|
|
2276
|
-
_descendants(t) {
|
|
2277
|
-
let e = !1;
|
|
2278
|
-
const i = this.getChildren();
|
|
2279
|
-
for (const s of i) {
|
|
2280
|
-
if (e = t(s), e)
|
|
2281
|
-
return !0;
|
|
2282
|
-
if (s.hasChildren() && (e = s._descendants(t), e))
|
|
2283
|
-
return !0;
|
|
2284
|
-
}
|
|
2285
|
-
return !1;
|
|
2286
|
-
}
|
|
2287
|
-
toObject() {
|
|
2288
|
-
const t = _.prototype.toObject.call(this);
|
|
2289
|
-
return t.children = [], this.getChildren().forEach((e) => {
|
|
2290
|
-
t.children.push(e.toObject());
|
|
2291
|
-
}), t;
|
|
2292
|
-
}
|
|
2293
|
-
isAncestorOf(t) {
|
|
2294
|
-
let e = t.getParent();
|
|
2295
|
-
for (; e; ) {
|
|
2296
|
-
if (e._id === this._id)
|
|
2297
|
-
return !0;
|
|
2298
|
-
e = e.getParent();
|
|
2299
|
-
}
|
|
2300
|
-
return !1;
|
|
2301
|
-
}
|
|
2302
|
-
clone(t) {
|
|
2303
|
-
const e = _.prototype.clone.call(this, t);
|
|
2304
|
-
return this.getChildren().forEach(function(i) {
|
|
2305
|
-
e.add(i.clone());
|
|
2306
|
-
}), e;
|
|
2307
|
-
}
|
|
2308
|
-
getAllIntersections(t) {
|
|
2309
|
-
const e = [];
|
|
2310
|
-
return this.find("Shape").forEach((i) => {
|
|
2311
|
-
i.isVisible() && i.intersects(t) && e.push(i);
|
|
2312
|
-
}), e;
|
|
2313
|
-
}
|
|
2314
|
-
_clearSelfAndDescendantCache(t) {
|
|
2315
|
-
var e;
|
|
2316
|
-
super._clearSelfAndDescendantCache(t), !this.isCached() && ((e = this.children) === null || e === void 0 || e.forEach(function(i) {
|
|
2317
|
-
i._clearSelfAndDescendantCache(t);
|
|
2318
|
-
}));
|
|
2319
|
-
}
|
|
2320
|
-
_setChildrenIndices() {
|
|
2321
|
-
var t;
|
|
2322
|
-
(t = this.children) === null || t === void 0 || t.forEach(function(e, i) {
|
|
2323
|
-
e.index = i;
|
|
2324
|
-
}), this._requestDraw();
|
|
2325
|
-
}
|
|
2326
|
-
drawScene(t, e, i) {
|
|
2327
|
-
const s = this.getLayer(), r = t || s && s.getCanvas(), a = r && r.getContext(), o = this._getCanvasCache(), h = o && o.scene, l = r && r.isCache;
|
|
2328
|
-
if (!this.isVisible() && !l)
|
|
2329
|
-
return this;
|
|
2330
|
-
if (h) {
|
|
2331
|
-
a.save();
|
|
2332
|
-
const d = this.getAbsoluteTransform(e).getMatrix();
|
|
2333
|
-
a.transform(d[0], d[1], d[2], d[3], d[4], d[5]), this._drawCachedSceneCanvas(a), a.restore();
|
|
2334
|
-
} else
|
|
2335
|
-
this._drawChildren("drawScene", r, e, i);
|
|
2336
|
-
return this;
|
|
2337
|
-
}
|
|
2338
|
-
drawHit(t, e) {
|
|
2339
|
-
if (!this.shouldDrawHit(e))
|
|
2340
|
-
return this;
|
|
2341
|
-
const i = this.getLayer(), s = t || i && i.hitCanvas, r = s && s.getContext(), a = this._getCanvasCache();
|
|
2342
|
-
if (a && a.hit) {
|
|
2343
|
-
r.save();
|
|
2344
|
-
const h = this.getAbsoluteTransform(e).getMatrix();
|
|
2345
|
-
r.transform(h[0], h[1], h[2], h[3], h[4], h[5]), this._drawCachedHitCanvas(r), r.restore();
|
|
2346
|
-
} else
|
|
2347
|
-
this._drawChildren("drawHit", s, e);
|
|
2348
|
-
return this;
|
|
2349
|
-
}
|
|
2350
|
-
_drawChildren(t, e, i, s) {
|
|
2351
|
-
var r;
|
|
2352
|
-
const a = e && e.getContext(), o = this.clipWidth(), h = this.clipHeight(), l = this.clipFunc(), d = typeof o == "number" && typeof h == "number" || l, u = i === this;
|
|
2353
|
-
if (d) {
|
|
2354
|
-
a.save();
|
|
2355
|
-
const C = this.getAbsoluteTransform(i);
|
|
2356
|
-
let y = C.getMatrix();
|
|
2357
|
-
a.transform(y[0], y[1], y[2], y[3], y[4], y[5]), a.beginPath();
|
|
2358
|
-
let P;
|
|
2359
|
-
if (l)
|
|
2360
|
-
P = l.call(this, a, this);
|
|
2361
|
-
else {
|
|
2362
|
-
const E = this.clipX(), x = this.clipY();
|
|
2363
|
-
a.rect(E || 0, x || 0, o, h);
|
|
2364
|
-
}
|
|
2365
|
-
a.clip.apply(a, P), y = C.copy().invert().getMatrix(), a.transform(y[0], y[1], y[2], y[3], y[4], y[5]);
|
|
2366
|
-
}
|
|
2367
|
-
const f = !u && this.globalCompositeOperation() !== "source-over" && t === "drawScene";
|
|
2368
|
-
f && (a.save(), a._applyGlobalCompositeOperation(this)), (r = this.children) === null || r === void 0 || r.forEach(function(C) {
|
|
2369
|
-
C[t](e, i, s);
|
|
2370
|
-
}), f && a.restore(), d && a.restore();
|
|
2371
|
-
}
|
|
2372
|
-
getClientRect(t = {}) {
|
|
2373
|
-
var e;
|
|
2374
|
-
const i = t.skipTransform, s = t.relativeTo;
|
|
2375
|
-
let r, a, o, h, l = {
|
|
2376
|
-
x: 1 / 0,
|
|
2377
|
-
y: 1 / 0,
|
|
2378
|
-
width: 0,
|
|
2379
|
-
height: 0
|
|
2380
|
-
};
|
|
2381
|
-
const d = this;
|
|
2382
|
-
(e = this.children) === null || e === void 0 || e.forEach(function(C) {
|
|
2383
|
-
if (!C.visible())
|
|
2384
|
-
return;
|
|
2385
|
-
const y = C.getClientRect({
|
|
2386
|
-
relativeTo: d,
|
|
2387
|
-
skipShadow: t.skipShadow,
|
|
2388
|
-
skipStroke: t.skipStroke
|
|
2389
|
-
});
|
|
2390
|
-
y.width === 0 && y.height === 0 || (r === void 0 ? (r = y.x, a = y.y, o = y.x + y.width, h = y.y + y.height) : (r = Math.min(r, y.x), a = Math.min(a, y.y), o = Math.max(o, y.x + y.width), h = Math.max(h, y.y + y.height)));
|
|
2391
|
-
});
|
|
2392
|
-
const u = this.find("Shape");
|
|
2393
|
-
let f = !1;
|
|
2394
|
-
for (let C = 0; C < u.length; C++)
|
|
2395
|
-
if (u[C]._isVisible(this)) {
|
|
2396
|
-
f = !0;
|
|
2397
|
-
break;
|
|
2398
|
-
}
|
|
2399
|
-
return f && r !== void 0 ? l = {
|
|
2400
|
-
x: r,
|
|
2401
|
-
y: a,
|
|
2402
|
-
width: o - r,
|
|
2403
|
-
height: h - a
|
|
2404
|
-
} : l = {
|
|
2405
|
-
x: 0,
|
|
2406
|
-
y: 0,
|
|
2407
|
-
width: 0,
|
|
2408
|
-
height: 0
|
|
2409
|
-
}, i ? l : this._transformedRect(l, s);
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
g.addComponentsGetterSetter(k, "clip", [
|
|
2413
|
-
"x",
|
|
2414
|
-
"y",
|
|
2415
|
-
"width",
|
|
2416
|
-
"height"
|
|
2417
|
-
]);
|
|
2418
|
-
g.addGetterSetter(k, "clipX", void 0, b());
|
|
2419
|
-
g.addGetterSetter(k, "clipY", void 0, b());
|
|
2420
|
-
g.addGetterSetter(k, "clipWidth", void 0, b());
|
|
2421
|
-
g.addGetterSetter(k, "clipHeight", void 0, b());
|
|
2422
|
-
g.addGetterSetter(k, "clipFunc");
|
|
2423
|
-
const it = /* @__PURE__ */ new Map(), jt = m._global.PointerEvent !== void 0;
|
|
2424
|
-
function mt(n) {
|
|
2425
|
-
return it.get(n);
|
|
2426
|
-
}
|
|
2427
|
-
function Pt(n) {
|
|
2428
|
-
return {
|
|
2429
|
-
evt: n,
|
|
2430
|
-
pointerId: n.pointerId
|
|
2431
|
-
};
|
|
2432
|
-
}
|
|
2433
|
-
function Kt(n, t) {
|
|
2434
|
-
return it.get(n) === t;
|
|
2435
|
-
}
|
|
2436
|
-
function qt(n, t) {
|
|
2437
|
-
Z(n), t.getStage() && (it.set(n, t), jt && t._fire("gotpointercapture", Pt(new PointerEvent("gotpointercapture"))));
|
|
2438
|
-
}
|
|
2439
|
-
function Z(n, t) {
|
|
2440
|
-
const e = it.get(n);
|
|
2441
|
-
if (!e)
|
|
2442
|
-
return;
|
|
2443
|
-
const i = e.getStage();
|
|
2444
|
-
i && i.content, it.delete(n), jt && e._fire("lostpointercapture", Pt(new PointerEvent("lostpointercapture")));
|
|
2445
|
-
}
|
|
2446
|
-
const ti = "Stage", ei = "string", Ht = "px", ii = "mouseout", zt = "mouseleave", Jt = "mouseover", $t = "mouseenter", Zt = "mousemove", Qt = "mousedown", te = "mouseup", K = "pointermove", q = "pointerdown", U = "pointerup", z = "pointercancel", ni = "lostpointercapture", ot = "pointerout", J = "pointerleave", ht = "pointerover", lt = "pointerenter", St = "contextmenu", ee = "touchstart", ie = "touchend", ne = "touchmove", se = "touchcancel", wt = "wheel", si = 5, ri = [
|
|
2447
|
-
[$t, "_pointerenter"],
|
|
2448
|
-
[Qt, "_pointerdown"],
|
|
2449
|
-
[Zt, "_pointermove"],
|
|
2450
|
-
[te, "_pointerup"],
|
|
2451
|
-
[zt, "_pointerleave"],
|
|
2452
|
-
[ee, "_pointerdown"],
|
|
2453
|
-
[ne, "_pointermove"],
|
|
2454
|
-
[ie, "_pointerup"],
|
|
2455
|
-
[se, "_pointercancel"],
|
|
2456
|
-
[Jt, "_pointerover"],
|
|
2457
|
-
[wt, "_wheel"],
|
|
2458
|
-
[St, "_contextmenu"],
|
|
2459
|
-
[q, "_pointerdown"],
|
|
2460
|
-
[K, "_pointermove"],
|
|
2461
|
-
[U, "_pointerup"],
|
|
2462
|
-
[z, "_pointercancel"],
|
|
2463
|
-
[J, "_pointerleave"],
|
|
2464
|
-
[ni, "_lostpointercapture"]
|
|
2465
|
-
], _t = {
|
|
2466
|
-
mouse: {
|
|
2467
|
-
[ot]: ii,
|
|
2468
|
-
[J]: zt,
|
|
2469
|
-
[ht]: Jt,
|
|
2470
|
-
[lt]: $t,
|
|
2471
|
-
[K]: Zt,
|
|
2472
|
-
[q]: Qt,
|
|
2473
|
-
[U]: te,
|
|
2474
|
-
[z]: "mousecancel",
|
|
2475
|
-
pointerclick: "click",
|
|
2476
|
-
pointerdblclick: "dblclick"
|
|
2477
|
-
},
|
|
2478
|
-
touch: {
|
|
2479
|
-
[ot]: "touchout",
|
|
2480
|
-
[J]: "touchleave",
|
|
2481
|
-
[ht]: "touchover",
|
|
2482
|
-
[lt]: "touchenter",
|
|
2483
|
-
[K]: ne,
|
|
2484
|
-
[q]: ee,
|
|
2485
|
-
[U]: ie,
|
|
2486
|
-
[z]: se,
|
|
2487
|
-
pointerclick: "tap",
|
|
2488
|
-
pointerdblclick: "dbltap"
|
|
2489
|
-
},
|
|
2490
|
-
pointer: {
|
|
2491
|
-
[ot]: ot,
|
|
2492
|
-
[J]: J,
|
|
2493
|
-
[ht]: ht,
|
|
2494
|
-
[lt]: lt,
|
|
2495
|
-
[K]: K,
|
|
2496
|
-
[q]: q,
|
|
2497
|
-
[U]: U,
|
|
2498
|
-
[z]: z,
|
|
2499
|
-
pointerclick: "pointerclick",
|
|
2500
|
-
pointerdblclick: "pointerdblclick"
|
|
2501
|
-
}
|
|
2502
|
-
}, $ = (n) => n.indexOf("pointer") >= 0 ? "pointer" : n.indexOf("touch") >= 0 ? "touch" : "mouse", H = (n) => {
|
|
2503
|
-
const t = $(n);
|
|
2504
|
-
if (t === "pointer")
|
|
2505
|
-
return m.pointerEventsEnabled && _t.pointer;
|
|
2506
|
-
if (t === "touch")
|
|
2507
|
-
return _t.touch;
|
|
2508
|
-
if (t === "mouse")
|
|
2509
|
-
return _t.mouse;
|
|
2510
|
-
};
|
|
2511
|
-
function Ut(n = {}) {
|
|
2512
|
-
return (n.clipFunc || n.clipWidth || n.clipHeight) && c.warn("Stage does not support clipping. Please use clip for Layers or Groups."), n;
|
|
2513
|
-
}
|
|
2514
|
-
const ai = "Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);", Q = [];
|
|
2515
|
-
class gt extends k {
|
|
2516
|
-
constructor(t) {
|
|
2517
|
-
super(Ut(t)), this._pointerPositions = [], this._changedPointerPositions = [], this._buildDOM(), this._bindContentEvents(), Q.push(this), this.on("widthChange.konva heightChange.konva", this._resizeDOM), this.on("visibleChange.konva", this._checkVisibility), this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva", () => {
|
|
2518
|
-
Ut(this.attrs);
|
|
2519
|
-
}), this._checkVisibility();
|
|
2520
|
-
}
|
|
2521
|
-
_validateAdd(t) {
|
|
2522
|
-
const e = t.getType() === "Layer", i = t.getType() === "FastLayer";
|
|
2523
|
-
e || i || c.throw("You may only add layers to the stage.");
|
|
2524
|
-
}
|
|
2525
|
-
_checkVisibility() {
|
|
2526
|
-
if (!this.content)
|
|
2527
|
-
return;
|
|
2528
|
-
const t = this.visible() ? "" : "none";
|
|
2529
|
-
this.content.style.display = t;
|
|
2530
|
-
}
|
|
2531
|
-
setContainer(t) {
|
|
2532
|
-
if (typeof t === ei) {
|
|
2533
|
-
let e;
|
|
2534
|
-
if (t.charAt(0) === ".") {
|
|
2535
|
-
const i = t.slice(1);
|
|
2536
|
-
t = document.getElementsByClassName(i)[0];
|
|
2537
|
-
} else
|
|
2538
|
-
t.charAt(0) !== "#" ? e = t : e = t.slice(1), t = document.getElementById(e);
|
|
2539
|
-
if (!t)
|
|
2540
|
-
throw "Can not find container in document with id " + e;
|
|
2541
|
-
}
|
|
2542
|
-
return this._setAttr("container", t), this.content && (this.content.parentElement && this.content.parentElement.removeChild(this.content), t.appendChild(this.content)), this;
|
|
2543
|
-
}
|
|
2544
|
-
shouldDrawHit() {
|
|
2545
|
-
return !0;
|
|
2546
|
-
}
|
|
2547
|
-
clear() {
|
|
2548
|
-
const t = this.children, e = t.length;
|
|
2549
|
-
for (let i = 0; i < e; i++)
|
|
2550
|
-
t[i].clear();
|
|
2551
|
-
return this;
|
|
2552
|
-
}
|
|
2553
|
-
clone(t) {
|
|
2554
|
-
return t || (t = {}), t.container = typeof document < "u" && document.createElement("div"), k.prototype.clone.call(this, t);
|
|
2555
|
-
}
|
|
2556
|
-
destroy() {
|
|
2557
|
-
super.destroy();
|
|
2558
|
-
const t = this.content;
|
|
2559
|
-
t && c._isInDocument(t) && this.container().removeChild(t);
|
|
2560
|
-
const e = Q.indexOf(this);
|
|
2561
|
-
return e > -1 && Q.splice(e, 1), c.releaseCanvas(this.bufferCanvas._canvas, this.bufferHitCanvas._canvas), this;
|
|
2562
|
-
}
|
|
2563
|
-
getPointerPosition() {
|
|
2564
|
-
const t = this._pointerPositions[0] || this._changedPointerPositions[0];
|
|
2565
|
-
return t ? {
|
|
2566
|
-
x: t.x,
|
|
2567
|
-
y: t.y
|
|
2568
|
-
} : (c.warn(ai), null);
|
|
2569
|
-
}
|
|
2570
|
-
_getPointerById(t) {
|
|
2571
|
-
return this._pointerPositions.find((e) => e.id === t);
|
|
2572
|
-
}
|
|
2573
|
-
getPointersPositions() {
|
|
2574
|
-
return this._pointerPositions;
|
|
2575
|
-
}
|
|
2576
|
-
getStage() {
|
|
2577
|
-
return this;
|
|
2578
|
-
}
|
|
2579
|
-
getContent() {
|
|
2580
|
-
return this.content;
|
|
2581
|
-
}
|
|
2582
|
-
_toKonvaCanvas(t) {
|
|
2583
|
-
t = { ...t }, t.x = t.x || 0, t.y = t.y || 0, t.width = t.width || this.width(), t.height = t.height || this.height();
|
|
2584
|
-
const e = new D({
|
|
2585
|
-
width: t.width,
|
|
2586
|
-
height: t.height,
|
|
2587
|
-
pixelRatio: t.pixelRatio || 1
|
|
2588
|
-
}), i = e.getContext()._context, s = this.children;
|
|
2589
|
-
return (t.x || t.y) && i.translate(-1 * t.x, -1 * t.y), s.forEach(function(r) {
|
|
2590
|
-
if (!r.isVisible())
|
|
2591
|
-
return;
|
|
2592
|
-
const a = r._toKonvaCanvas(t);
|
|
2593
|
-
i.drawImage(a._canvas, t.x, t.y, a.getWidth() / a.getPixelRatio(), a.getHeight() / a.getPixelRatio());
|
|
2594
|
-
}), e;
|
|
2595
|
-
}
|
|
2596
|
-
getIntersection(t) {
|
|
2597
|
-
if (!t)
|
|
2598
|
-
return null;
|
|
2599
|
-
const e = this.children, i = e.length, s = i - 1;
|
|
2600
|
-
for (let r = s; r >= 0; r--) {
|
|
2601
|
-
const a = e[r].getIntersection(t);
|
|
2602
|
-
if (a)
|
|
2603
|
-
return a;
|
|
2604
|
-
}
|
|
2605
|
-
return null;
|
|
2606
|
-
}
|
|
2607
|
-
_resizeDOM() {
|
|
2608
|
-
const t = this.width(), e = this.height();
|
|
2609
|
-
this.content && (this.content.style.width = t + Ht, this.content.style.height = e + Ht), this.bufferCanvas.setSize(t, e), this.bufferHitCanvas.setSize(t, e), this.children.forEach((i) => {
|
|
2610
|
-
i.setSize({ width: t, height: e }), i.draw();
|
|
2611
|
-
});
|
|
2612
|
-
}
|
|
2613
|
-
add(t, ...e) {
|
|
2614
|
-
if (arguments.length > 1) {
|
|
2615
|
-
for (let s = 0; s < arguments.length; s++)
|
|
2616
|
-
this.add(arguments[s]);
|
|
2617
|
-
return this;
|
|
2618
|
-
}
|
|
2619
|
-
super.add(t);
|
|
2620
|
-
const i = this.children.length;
|
|
2621
|
-
return i > si && c.warn("The stage has " + i + " layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."), t.setSize({ width: this.width(), height: this.height() }), t.draw(), m.isBrowser && this.content.appendChild(t.canvas._canvas), this;
|
|
2622
|
-
}
|
|
2623
|
-
getParent() {
|
|
2624
|
-
return null;
|
|
2625
|
-
}
|
|
2626
|
-
getLayer() {
|
|
2627
|
-
return null;
|
|
2628
|
-
}
|
|
2629
|
-
hasPointerCapture(t) {
|
|
2630
|
-
return Kt(t, this);
|
|
2631
|
-
}
|
|
2632
|
-
setPointerCapture(t) {
|
|
2633
|
-
qt(t, this);
|
|
2634
|
-
}
|
|
2635
|
-
releaseCapture(t) {
|
|
2636
|
-
Z(t);
|
|
2637
|
-
}
|
|
2638
|
-
getLayers() {
|
|
2639
|
-
return this.children;
|
|
2640
|
-
}
|
|
2641
|
-
_bindContentEvents() {
|
|
2642
|
-
m.isBrowser && ri.forEach(([t, e]) => {
|
|
2643
|
-
this.content.addEventListener(t, (i) => {
|
|
2644
|
-
this[e](i);
|
|
2645
|
-
}, { passive: !1 });
|
|
2646
|
-
});
|
|
2647
|
-
}
|
|
2648
|
-
_pointerenter(t) {
|
|
2649
|
-
this.setPointersPositions(t);
|
|
2650
|
-
const e = H(t.type);
|
|
2651
|
-
e && this._fire(e.pointerenter, {
|
|
2652
|
-
evt: t,
|
|
2653
|
-
target: this,
|
|
2654
|
-
currentTarget: this
|
|
2655
|
-
});
|
|
2656
|
-
}
|
|
2657
|
-
_pointerover(t) {
|
|
2658
|
-
this.setPointersPositions(t);
|
|
2659
|
-
const e = H(t.type);
|
|
2660
|
-
e && this._fire(e.pointerover, {
|
|
2661
|
-
evt: t,
|
|
2662
|
-
target: this,
|
|
2663
|
-
currentTarget: this
|
|
2664
|
-
});
|
|
2665
|
-
}
|
|
2666
|
-
_getTargetShape(t) {
|
|
2667
|
-
let e = this[t + "targetShape"];
|
|
2668
|
-
return e && !e.getStage() && (e = null), e;
|
|
2669
|
-
}
|
|
2670
|
-
_pointerleave(t) {
|
|
2671
|
-
const e = H(t.type), i = $(t.type);
|
|
2672
|
-
if (!e)
|
|
2673
|
-
return;
|
|
2674
|
-
this.setPointersPositions(t);
|
|
2675
|
-
const s = this._getTargetShape(i), r = !(m.isDragging() || m.isTransforming()) || m.hitOnDragEnabled;
|
|
2676
|
-
s && r ? (s._fireAndBubble(e.pointerout, { evt: t }), s._fireAndBubble(e.pointerleave, { evt: t }), this._fire(e.pointerleave, {
|
|
2677
|
-
evt: t,
|
|
2678
|
-
target: this,
|
|
2679
|
-
currentTarget: this
|
|
2680
|
-
}), this[i + "targetShape"] = null) : r && (this._fire(e.pointerleave, {
|
|
2681
|
-
evt: t,
|
|
2682
|
-
target: this,
|
|
2683
|
-
currentTarget: this
|
|
2684
|
-
}), this._fire(e.pointerout, {
|
|
2685
|
-
evt: t,
|
|
2686
|
-
target: this,
|
|
2687
|
-
currentTarget: this
|
|
2688
|
-
})), this.pointerPos = null, this._pointerPositions = [];
|
|
2689
|
-
}
|
|
2690
|
-
_pointerdown(t) {
|
|
2691
|
-
const e = H(t.type), i = $(t.type);
|
|
2692
|
-
if (!e)
|
|
2693
|
-
return;
|
|
2694
|
-
this.setPointersPositions(t);
|
|
2695
|
-
let s = !1;
|
|
2696
|
-
this._changedPointerPositions.forEach((r) => {
|
|
2697
|
-
const a = this.getIntersection(r);
|
|
2698
|
-
if (v.justDragged = !1, m["_" + i + "ListenClick"] = !0, !a || !a.isListening()) {
|
|
2699
|
-
this[i + "ClickStartShape"] = void 0;
|
|
2700
|
-
return;
|
|
2701
|
-
}
|
|
2702
|
-
m.capturePointerEventsEnabled && a.setPointerCapture(r.id), this[i + "ClickStartShape"] = a, a._fireAndBubble(e.pointerdown, {
|
|
2703
|
-
evt: t,
|
|
2704
|
-
pointerId: r.id
|
|
2705
|
-
}), s = !0;
|
|
2706
|
-
const o = t.type.indexOf("touch") >= 0;
|
|
2707
|
-
a.preventDefault() && t.cancelable && o && t.preventDefault();
|
|
2708
|
-
}), s || this._fire(e.pointerdown, {
|
|
2709
|
-
evt: t,
|
|
2710
|
-
target: this,
|
|
2711
|
-
currentTarget: this,
|
|
2712
|
-
pointerId: this._pointerPositions[0].id
|
|
2713
|
-
});
|
|
2714
|
-
}
|
|
2715
|
-
_pointermove(t) {
|
|
2716
|
-
const e = H(t.type), i = $(t.type);
|
|
2717
|
-
if (!e)
|
|
2718
|
-
return;
|
|
2719
|
-
const s = t.type.indexOf("touch") >= 0 || t.pointerType === "touch";
|
|
2720
|
-
if (m.isDragging() && v.node.preventDefault() && t.cancelable && s && t.preventDefault(), this.setPointersPositions(t), !(!(m.isDragging() || m.isTransforming()) || m.hitOnDragEnabled))
|
|
2721
|
-
return;
|
|
2722
|
-
const a = {};
|
|
2723
|
-
let o = !1;
|
|
2724
|
-
const h = this._getTargetShape(i);
|
|
2725
|
-
this._changedPointerPositions.forEach((l) => {
|
|
2726
|
-
const d = mt(l.id) || this.getIntersection(l), u = l.id, f = { evt: t, pointerId: u }, C = h !== d;
|
|
2727
|
-
if (C && h && (h._fireAndBubble(e.pointerout, { ...f }, d), h._fireAndBubble(e.pointerleave, { ...f }, d)), d) {
|
|
2728
|
-
if (a[d._id])
|
|
2729
|
-
return;
|
|
2730
|
-
a[d._id] = !0;
|
|
2731
|
-
}
|
|
2732
|
-
d && d.isListening() ? (o = !0, C && (d._fireAndBubble(e.pointerover, { ...f }, h), d._fireAndBubble(e.pointerenter, { ...f }, h), this[i + "targetShape"] = d), d._fireAndBubble(e.pointermove, { ...f })) : h && (this._fire(e.pointerover, {
|
|
2733
|
-
evt: t,
|
|
2734
|
-
target: this,
|
|
2735
|
-
currentTarget: this,
|
|
2736
|
-
pointerId: u
|
|
2737
|
-
}), this[i + "targetShape"] = null);
|
|
2738
|
-
}), o || this._fire(e.pointermove, {
|
|
2739
|
-
evt: t,
|
|
2740
|
-
target: this,
|
|
2741
|
-
currentTarget: this,
|
|
2742
|
-
pointerId: this._changedPointerPositions[0].id
|
|
2743
|
-
});
|
|
2744
|
-
}
|
|
2745
|
-
_pointerup(t) {
|
|
2746
|
-
const e = H(t.type), i = $(t.type);
|
|
2747
|
-
if (!e)
|
|
2748
|
-
return;
|
|
2749
|
-
this.setPointersPositions(t);
|
|
2750
|
-
const s = this[i + "ClickStartShape"], r = this[i + "ClickEndShape"], a = {};
|
|
2751
|
-
let o = !1;
|
|
2752
|
-
this._changedPointerPositions.forEach((h) => {
|
|
2753
|
-
const l = mt(h.id) || this.getIntersection(h);
|
|
2754
|
-
if (l) {
|
|
2755
|
-
if (l.releaseCapture(h.id), a[l._id])
|
|
2756
|
-
return;
|
|
2757
|
-
a[l._id] = !0;
|
|
2758
|
-
}
|
|
2759
|
-
const d = h.id, u = { evt: t, pointerId: d };
|
|
2760
|
-
let f = !1;
|
|
2761
|
-
m["_" + i + "InDblClickWindow"] ? (f = !0, clearTimeout(this[i + "DblTimeout"])) : v.justDragged || (m["_" + i + "InDblClickWindow"] = !0, clearTimeout(this[i + "DblTimeout"])), this[i + "DblTimeout"] = setTimeout(function() {
|
|
2762
|
-
m["_" + i + "InDblClickWindow"] = !1;
|
|
2763
|
-
}, m.dblClickWindow), l && l.isListening() ? (o = !0, this[i + "ClickEndShape"] = l, l._fireAndBubble(e.pointerup, { ...u }), m["_" + i + "ListenClick"] && s && s === l && (l._fireAndBubble(e.pointerclick, { ...u }), f && r && r === l && l._fireAndBubble(e.pointerdblclick, { ...u }))) : (this[i + "ClickEndShape"] = null, o || (this._fire(e.pointerup, {
|
|
2764
|
-
evt: t,
|
|
2765
|
-
target: this,
|
|
2766
|
-
currentTarget: this,
|
|
2767
|
-
pointerId: this._changedPointerPositions[0].id
|
|
2768
|
-
}), o = !0), m["_" + i + "ListenClick"] && this._fire(e.pointerclick, {
|
|
2769
|
-
evt: t,
|
|
2770
|
-
target: this,
|
|
2771
|
-
currentTarget: this,
|
|
2772
|
-
pointerId: d
|
|
2773
|
-
}), f && this._fire(e.pointerdblclick, {
|
|
2774
|
-
evt: t,
|
|
2775
|
-
target: this,
|
|
2776
|
-
currentTarget: this,
|
|
2777
|
-
pointerId: d
|
|
2778
|
-
}));
|
|
2779
|
-
}), o || this._fire(e.pointerup, {
|
|
2780
|
-
evt: t,
|
|
2781
|
-
target: this,
|
|
2782
|
-
currentTarget: this,
|
|
2783
|
-
pointerId: this._changedPointerPositions[0].id
|
|
2784
|
-
}), m["_" + i + "ListenClick"] = !1, t.cancelable && i !== "touch" && i !== "pointer" && t.preventDefault();
|
|
2785
|
-
}
|
|
2786
|
-
_contextmenu(t) {
|
|
2787
|
-
this.setPointersPositions(t);
|
|
2788
|
-
const e = this.getIntersection(this.getPointerPosition());
|
|
2789
|
-
e && e.isListening() ? e._fireAndBubble(St, { evt: t }) : this._fire(St, {
|
|
2790
|
-
evt: t,
|
|
2791
|
-
target: this,
|
|
2792
|
-
currentTarget: this
|
|
2793
|
-
});
|
|
2794
|
-
}
|
|
2795
|
-
_wheel(t) {
|
|
2796
|
-
this.setPointersPositions(t);
|
|
2797
|
-
const e = this.getIntersection(this.getPointerPosition());
|
|
2798
|
-
e && e.isListening() ? e._fireAndBubble(wt, { evt: t }) : this._fire(wt, {
|
|
2799
|
-
evt: t,
|
|
2800
|
-
target: this,
|
|
2801
|
-
currentTarget: this
|
|
2802
|
-
});
|
|
2803
|
-
}
|
|
2804
|
-
_pointercancel(t) {
|
|
2805
|
-
this.setPointersPositions(t);
|
|
2806
|
-
const e = mt(t.pointerId) || this.getIntersection(this.getPointerPosition());
|
|
2807
|
-
e && e._fireAndBubble(U, Pt(t)), Z(t.pointerId);
|
|
2808
|
-
}
|
|
2809
|
-
_lostpointercapture(t) {
|
|
2810
|
-
Z(t.pointerId);
|
|
2811
|
-
}
|
|
2812
|
-
setPointersPositions(t) {
|
|
2813
|
-
const e = this._getContentPosition();
|
|
2814
|
-
let i = null, s = null;
|
|
2815
|
-
t = t || window.event, t.touches !== void 0 ? (this._pointerPositions = [], this._changedPointerPositions = [], Array.prototype.forEach.call(t.touches, (r) => {
|
|
2816
|
-
this._pointerPositions.push({
|
|
2817
|
-
id: r.identifier,
|
|
2818
|
-
x: (r.clientX - e.left) / e.scaleX,
|
|
2819
|
-
y: (r.clientY - e.top) / e.scaleY
|
|
2820
|
-
});
|
|
2821
|
-
}), Array.prototype.forEach.call(t.changedTouches || t.touches, (r) => {
|
|
2822
|
-
this._changedPointerPositions.push({
|
|
2823
|
-
id: r.identifier,
|
|
2824
|
-
x: (r.clientX - e.left) / e.scaleX,
|
|
2825
|
-
y: (r.clientY - e.top) / e.scaleY
|
|
2826
|
-
});
|
|
2827
|
-
})) : (i = (t.clientX - e.left) / e.scaleX, s = (t.clientY - e.top) / e.scaleY, this.pointerPos = {
|
|
2828
|
-
x: i,
|
|
2829
|
-
y: s
|
|
2830
|
-
}, this._pointerPositions = [{ x: i, y: s, id: c._getFirstPointerId(t) }], this._changedPointerPositions = [
|
|
2831
|
-
{ x: i, y: s, id: c._getFirstPointerId(t) }
|
|
2832
|
-
]);
|
|
2833
|
-
}
|
|
2834
|
-
_setPointerPosition(t) {
|
|
2835
|
-
c.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'), this.setPointersPositions(t);
|
|
2836
|
-
}
|
|
2837
|
-
_getContentPosition() {
|
|
2838
|
-
if (!this.content || !this.content.getBoundingClientRect)
|
|
2839
|
-
return {
|
|
2840
|
-
top: 0,
|
|
2841
|
-
left: 0,
|
|
2842
|
-
scaleX: 1,
|
|
2843
|
-
scaleY: 1
|
|
2844
|
-
};
|
|
2845
|
-
const t = this.content.getBoundingClientRect();
|
|
2846
|
-
return {
|
|
2847
|
-
top: t.top,
|
|
2848
|
-
left: t.left,
|
|
2849
|
-
scaleX: t.width / this.content.clientWidth || 1,
|
|
2850
|
-
scaleY: t.height / this.content.clientHeight || 1
|
|
2851
|
-
};
|
|
2852
|
-
}
|
|
2853
|
-
_buildDOM() {
|
|
2854
|
-
if (this.bufferCanvas = new D({
|
|
2855
|
-
width: this.width(),
|
|
2856
|
-
height: this.height()
|
|
2857
|
-
}), this.bufferHitCanvas = new Et({
|
|
2858
|
-
pixelRatio: 1,
|
|
2859
|
-
width: this.width(),
|
|
2860
|
-
height: this.height()
|
|
2861
|
-
}), !m.isBrowser)
|
|
2862
|
-
return;
|
|
2863
|
-
const t = this.container();
|
|
2864
|
-
if (!t)
|
|
2865
|
-
throw "Stage has no container. A container is required.";
|
|
2866
|
-
t.innerHTML = "", this.content = document.createElement("div"), this.content.style.position = "relative", this.content.style.userSelect = "none", this.content.className = "konvajs-content", this.content.setAttribute("role", "presentation"), t.appendChild(this.content), this._resizeDOM();
|
|
2867
|
-
}
|
|
2868
|
-
cache() {
|
|
2869
|
-
return c.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."), this;
|
|
2870
|
-
}
|
|
2871
|
-
clearCache() {
|
|
2872
|
-
return this;
|
|
2873
|
-
}
|
|
2874
|
-
batchDraw() {
|
|
2875
|
-
return this.getChildren().forEach(function(t) {
|
|
2876
|
-
t.batchDraw();
|
|
2877
|
-
}), this;
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
gt.prototype.nodeType = ti;
|
|
2881
|
-
nt(gt);
|
|
2882
|
-
g.addGetterSetter(gt, "container");
|
|
2883
|
-
m.isBrowser && document.addEventListener("visibilitychange", () => {
|
|
2884
|
-
Q.forEach((n) => {
|
|
2885
|
-
n.batchDraw();
|
|
2886
|
-
});
|
|
2887
|
-
});
|
|
2888
|
-
const re = "hasShadow", ae = "shadowRGBA", oe = "patternImage", he = "linearGradient", le = "radialGradient";
|
|
2889
|
-
let ct;
|
|
2890
|
-
function yt() {
|
|
2891
|
-
return ct || (ct = c.createCanvasElement().getContext("2d"), ct);
|
|
2892
|
-
}
|
|
2893
|
-
const tt = {};
|
|
2894
|
-
function oi(n) {
|
|
2895
|
-
const t = this.attrs.fillRule;
|
|
2896
|
-
t ? n.fill(t) : n.fill();
|
|
2897
|
-
}
|
|
2898
|
-
function hi(n) {
|
|
2899
|
-
n.stroke();
|
|
2900
|
-
}
|
|
2901
|
-
function li(n) {
|
|
2902
|
-
const t = this.attrs.fillRule;
|
|
2903
|
-
t ? n.fill(t) : n.fill();
|
|
2904
|
-
}
|
|
2905
|
-
function ci(n) {
|
|
2906
|
-
n.stroke();
|
|
2907
|
-
}
|
|
2908
|
-
function di() {
|
|
2909
|
-
this._clearCache(re);
|
|
2910
|
-
}
|
|
2911
|
-
function ui() {
|
|
2912
|
-
this._clearCache(ae);
|
|
2913
|
-
}
|
|
2914
|
-
function fi() {
|
|
2915
|
-
this._clearCache(oe);
|
|
2916
|
-
}
|
|
2917
|
-
function gi() {
|
|
2918
|
-
this._clearCache(he);
|
|
2919
|
-
}
|
|
2920
|
-
function pi() {
|
|
2921
|
-
this._clearCache(le);
|
|
2922
|
-
}
|
|
2923
|
-
class p extends _ {
|
|
2924
|
-
constructor(t) {
|
|
2925
|
-
super(t);
|
|
2926
|
-
let e, i = 0;
|
|
2927
|
-
for (; e = c.getHitColor(), !(e && !(e in tt)); )
|
|
2928
|
-
if (i++, i >= 1e4) {
|
|
2929
|
-
c.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."), e = c.getRandomColor();
|
|
2930
|
-
break;
|
|
2931
|
-
}
|
|
2932
|
-
this.colorKey = e, tt[e] = this;
|
|
2933
|
-
}
|
|
2934
|
-
getContext() {
|
|
2935
|
-
return c.warn("shape.getContext() method is deprecated. Please do not use it."), this.getLayer().getContext();
|
|
2936
|
-
}
|
|
2937
|
-
getCanvas() {
|
|
2938
|
-
return c.warn("shape.getCanvas() method is deprecated. Please do not use it."), this.getLayer().getCanvas();
|
|
2939
|
-
}
|
|
2940
|
-
getSceneFunc() {
|
|
2941
|
-
return this.attrs.sceneFunc || this._sceneFunc;
|
|
2942
|
-
}
|
|
2943
|
-
getHitFunc() {
|
|
2944
|
-
return this.attrs.hitFunc || this._hitFunc;
|
|
2945
|
-
}
|
|
2946
|
-
hasShadow() {
|
|
2947
|
-
return this._getCache(re, this._hasShadow);
|
|
2948
|
-
}
|
|
2949
|
-
_hasShadow() {
|
|
2950
|
-
return this.shadowEnabled() && this.shadowOpacity() !== 0 && !!(this.shadowColor() || this.shadowBlur() || this.shadowOffsetX() || this.shadowOffsetY());
|
|
2951
|
-
}
|
|
2952
|
-
_getFillPattern() {
|
|
2953
|
-
return this._getCache(oe, this.__getFillPattern);
|
|
2954
|
-
}
|
|
2955
|
-
__getFillPattern() {
|
|
2956
|
-
if (this.fillPatternImage()) {
|
|
2957
|
-
const e = yt().createPattern(this.fillPatternImage(), this.fillPatternRepeat() || "repeat");
|
|
2958
|
-
if (e && e.setTransform) {
|
|
2959
|
-
const i = new L();
|
|
2960
|
-
i.translate(this.fillPatternX(), this.fillPatternY()), i.rotate(m.getAngle(this.fillPatternRotation())), i.scale(this.fillPatternScaleX(), this.fillPatternScaleY()), i.translate(-1 * this.fillPatternOffsetX(), -1 * this.fillPatternOffsetY());
|
|
2961
|
-
const s = i.getMatrix(), r = typeof DOMMatrix > "u" ? {
|
|
2962
|
-
a: s[0],
|
|
2963
|
-
b: s[1],
|
|
2964
|
-
c: s[2],
|
|
2965
|
-
d: s[3],
|
|
2966
|
-
e: s[4],
|
|
2967
|
-
f: s[5]
|
|
2968
|
-
} : new DOMMatrix(s);
|
|
2969
|
-
e.setTransform(r);
|
|
2970
|
-
}
|
|
2971
|
-
return e;
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
_getLinearGradient() {
|
|
2975
|
-
return this._getCache(he, this.__getLinearGradient);
|
|
2976
|
-
}
|
|
2977
|
-
__getLinearGradient() {
|
|
2978
|
-
const t = this.fillLinearGradientColorStops();
|
|
2979
|
-
if (t) {
|
|
2980
|
-
const e = yt(), i = this.fillLinearGradientStartPoint(), s = this.fillLinearGradientEndPoint(), r = e.createLinearGradient(i.x, i.y, s.x, s.y);
|
|
2981
|
-
for (let a = 0; a < t.length; a += 2)
|
|
2982
|
-
r.addColorStop(t[a], t[a + 1]);
|
|
2983
|
-
return r;
|
|
2984
|
-
}
|
|
2985
|
-
}
|
|
2986
|
-
_getRadialGradient() {
|
|
2987
|
-
return this._getCache(le, this.__getRadialGradient);
|
|
2988
|
-
}
|
|
2989
|
-
__getRadialGradient() {
|
|
2990
|
-
const t = this.fillRadialGradientColorStops();
|
|
2991
|
-
if (t) {
|
|
2992
|
-
const e = yt(), i = this.fillRadialGradientStartPoint(), s = this.fillRadialGradientEndPoint(), r = e.createRadialGradient(i.x, i.y, this.fillRadialGradientStartRadius(), s.x, s.y, this.fillRadialGradientEndRadius());
|
|
2993
|
-
for (let a = 0; a < t.length; a += 2)
|
|
2994
|
-
r.addColorStop(t[a], t[a + 1]);
|
|
2995
|
-
return r;
|
|
2996
|
-
}
|
|
2997
|
-
}
|
|
2998
|
-
getShadowRGBA() {
|
|
2999
|
-
return this._getCache(ae, this._getShadowRGBA);
|
|
3000
|
-
}
|
|
3001
|
-
_getShadowRGBA() {
|
|
3002
|
-
if (!this.hasShadow())
|
|
3003
|
-
return;
|
|
3004
|
-
const t = c.colorToRGBA(this.shadowColor());
|
|
3005
|
-
if (t)
|
|
3006
|
-
return "rgba(" + t.r + "," + t.g + "," + t.b + "," + t.a * (this.shadowOpacity() || 1) + ")";
|
|
3007
|
-
}
|
|
3008
|
-
hasFill() {
|
|
3009
|
-
return this._calculate("hasFill", [
|
|
3010
|
-
"fillEnabled",
|
|
3011
|
-
"fill",
|
|
3012
|
-
"fillPatternImage",
|
|
3013
|
-
"fillLinearGradientColorStops",
|
|
3014
|
-
"fillRadialGradientColorStops"
|
|
3015
|
-
], () => this.fillEnabled() && !!(this.fill() || this.fillPatternImage() || this.fillLinearGradientColorStops() || this.fillRadialGradientColorStops()));
|
|
3016
|
-
}
|
|
3017
|
-
hasStroke() {
|
|
3018
|
-
return this._calculate("hasStroke", [
|
|
3019
|
-
"strokeEnabled",
|
|
3020
|
-
"strokeWidth",
|
|
3021
|
-
"stroke",
|
|
3022
|
-
"strokeLinearGradientColorStops"
|
|
3023
|
-
], () => this.strokeEnabled() && this.strokeWidth() && !!(this.stroke() || this.strokeLinearGradientColorStops()));
|
|
3024
|
-
}
|
|
3025
|
-
hasHitStroke() {
|
|
3026
|
-
const t = this.hitStrokeWidth();
|
|
3027
|
-
return t === "auto" ? this.hasStroke() : this.strokeEnabled() && !!t;
|
|
3028
|
-
}
|
|
3029
|
-
intersects(t) {
|
|
3030
|
-
const e = this.getStage();
|
|
3031
|
-
if (!e)
|
|
3032
|
-
return !1;
|
|
3033
|
-
const i = e.bufferHitCanvas;
|
|
3034
|
-
return i.getContext().clear(), this.drawHit(i, void 0, !0), i.context.getImageData(Math.round(t.x), Math.round(t.y), 1, 1).data[3] > 0;
|
|
3035
|
-
}
|
|
3036
|
-
destroy() {
|
|
3037
|
-
return _.prototype.destroy.call(this), delete tt[this.colorKey], delete this.colorKey, this;
|
|
3038
|
-
}
|
|
3039
|
-
_useBufferCanvas(t) {
|
|
3040
|
-
var e;
|
|
3041
|
-
if (!((e = this.attrs.perfectDrawEnabled) !== null && e !== void 0 ? e : !0))
|
|
3042
|
-
return !1;
|
|
3043
|
-
const s = t || this.hasFill(), r = this.hasStroke(), a = this.getAbsoluteOpacity() !== 1;
|
|
3044
|
-
if (s && r && a)
|
|
3045
|
-
return !0;
|
|
3046
|
-
const o = this.hasShadow(), h = this.shadowForStrokeEnabled();
|
|
3047
|
-
return !!(s && r && o && h);
|
|
3048
|
-
}
|
|
3049
|
-
setStrokeHitEnabled(t) {
|
|
3050
|
-
c.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."), t ? this.hitStrokeWidth("auto") : this.hitStrokeWidth(0);
|
|
3051
|
-
}
|
|
3052
|
-
getStrokeHitEnabled() {
|
|
3053
|
-
return this.hitStrokeWidth() !== 0;
|
|
3054
|
-
}
|
|
3055
|
-
getSelfRect() {
|
|
3056
|
-
const t = this.size();
|
|
3057
|
-
return {
|
|
3058
|
-
x: this._centroid ? -t.width / 2 : 0,
|
|
3059
|
-
y: this._centroid ? -t.height / 2 : 0,
|
|
3060
|
-
width: t.width,
|
|
3061
|
-
height: t.height
|
|
3062
|
-
};
|
|
3063
|
-
}
|
|
3064
|
-
getClientRect(t = {}) {
|
|
3065
|
-
let e = !1, i = this.getParent();
|
|
3066
|
-
for (; i; ) {
|
|
3067
|
-
if (i.isCached()) {
|
|
3068
|
-
e = !0;
|
|
3069
|
-
break;
|
|
3070
|
-
}
|
|
3071
|
-
i = i.getParent();
|
|
3072
|
-
}
|
|
3073
|
-
const s = t.skipTransform, r = t.relativeTo || e && this.getStage() || void 0, a = this.getSelfRect(), h = !t.skipStroke && this.hasStroke() && this.strokeWidth() || 0, l = a.width + h, d = a.height + h, u = !t.skipShadow && this.hasShadow(), f = u ? this.shadowOffsetX() : 0, C = u ? this.shadowOffsetY() : 0, y = l + Math.abs(f), P = d + Math.abs(C), E = u && this.shadowBlur() || 0, x = y + E * 2, A = P + E * 2, G = {
|
|
3074
|
-
width: x,
|
|
3075
|
-
height: A,
|
|
3076
|
-
x: -(h / 2 + E) + Math.min(f, 0) + a.x,
|
|
3077
|
-
y: -(h / 2 + E) + Math.min(C, 0) + a.y
|
|
3078
|
-
};
|
|
3079
|
-
return s ? G : this._transformedRect(G, r);
|
|
3080
|
-
}
|
|
3081
|
-
drawScene(t, e, i) {
|
|
3082
|
-
const s = this.getLayer(), r = t || s.getCanvas(), a = r.getContext(), o = this._getCanvasCache(), h = this.getSceneFunc(), l = this.hasShadow();
|
|
3083
|
-
let d;
|
|
3084
|
-
const u = e === this;
|
|
3085
|
-
if (!this.isVisible() && !u)
|
|
3086
|
-
return this;
|
|
3087
|
-
if (o) {
|
|
3088
|
-
a.save();
|
|
3089
|
-
const f = this.getAbsoluteTransform(e).getMatrix();
|
|
3090
|
-
return a.transform(f[0], f[1], f[2], f[3], f[4], f[5]), this._drawCachedSceneCanvas(a), a.restore(), this;
|
|
3091
|
-
}
|
|
3092
|
-
if (!h)
|
|
3093
|
-
return this;
|
|
3094
|
-
if (a.save(), this._useBufferCanvas()) {
|
|
3095
|
-
d = this.getStage();
|
|
3096
|
-
const f = i || d.bufferCanvas, C = f.getContext();
|
|
3097
|
-
i ? (C.save(), C.setTransform(1, 0, 0, 1, 0, 0), C.clearRect(0, 0, f.width, f.height), C.restore()) : C.clear(), C.save(), C._applyLineJoin(this), C._applyMiterLimit(this);
|
|
3098
|
-
const y = this.getAbsoluteTransform(e).getMatrix();
|
|
3099
|
-
C.transform(y[0], y[1], y[2], y[3], y[4], y[5]), h.call(this, C, this), C.restore();
|
|
3100
|
-
const P = f.pixelRatio;
|
|
3101
|
-
l && a._applyShadow(this), u || (a._applyOpacity(this), a._applyGlobalCompositeOperation(this)), a.drawImage(f._canvas, f.x || 0, f.y || 0, f.width / P, f.height / P);
|
|
3102
|
-
} else {
|
|
3103
|
-
if (a._applyLineJoin(this), a._applyMiterLimit(this), !u) {
|
|
3104
|
-
const f = this.getAbsoluteTransform(e).getMatrix();
|
|
3105
|
-
a.transform(f[0], f[1], f[2], f[3], f[4], f[5]), a._applyOpacity(this), a._applyGlobalCompositeOperation(this);
|
|
3106
|
-
}
|
|
3107
|
-
l && a._applyShadow(this), h.call(this, a, this);
|
|
3108
|
-
}
|
|
3109
|
-
return a.restore(), this;
|
|
3110
|
-
}
|
|
3111
|
-
drawHit(t, e, i = !1) {
|
|
3112
|
-
if (!this.shouldDrawHit(e, i))
|
|
3113
|
-
return this;
|
|
3114
|
-
const s = this.getLayer(), r = t || s.hitCanvas, a = r && r.getContext(), o = this.hitFunc() || this.sceneFunc(), h = this._getCanvasCache(), l = h && h.hit;
|
|
3115
|
-
if (this.colorKey || c.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()"), l) {
|
|
3116
|
-
a.save();
|
|
3117
|
-
const u = this.getAbsoluteTransform(e).getMatrix();
|
|
3118
|
-
return a.transform(u[0], u[1], u[2], u[3], u[4], u[5]), this._drawCachedHitCanvas(a), a.restore(), this;
|
|
3119
|
-
}
|
|
3120
|
-
if (!o)
|
|
3121
|
-
return this;
|
|
3122
|
-
if (a.save(), a._applyLineJoin(this), a._applyMiterLimit(this), !(this === e)) {
|
|
3123
|
-
const u = this.getAbsoluteTransform(e).getMatrix();
|
|
3124
|
-
a.transform(u[0], u[1], u[2], u[3], u[4], u[5]);
|
|
3125
|
-
}
|
|
3126
|
-
return o.call(this, a, this), a.restore(), this;
|
|
3127
|
-
}
|
|
3128
|
-
drawHitFromCache(t = 0) {
|
|
3129
|
-
const e = this._getCanvasCache(), i = this._getCachedSceneCanvas(), s = e.hit, r = s.getContext(), a = s.getWidth(), o = s.getHeight();
|
|
3130
|
-
r.clear(), r.drawImage(i._canvas, 0, 0, a, o);
|
|
3131
|
-
try {
|
|
3132
|
-
const h = r.getImageData(0, 0, a, o), l = h.data, d = l.length, u = c._hexToRgb(this.colorKey);
|
|
3133
|
-
for (let f = 0; f < d; f += 4)
|
|
3134
|
-
l[f + 3] > t ? (l[f] = u.r, l[f + 1] = u.g, l[f + 2] = u.b, l[f + 3] = 255) : l[f + 3] = 0;
|
|
3135
|
-
r.putImageData(h, 0, 0);
|
|
3136
|
-
} catch (h) {
|
|
3137
|
-
c.error("Unable to draw hit graph from cached scene canvas. " + h.message);
|
|
3138
|
-
}
|
|
3139
|
-
return this;
|
|
3140
|
-
}
|
|
3141
|
-
hasPointerCapture(t) {
|
|
3142
|
-
return Kt(t, this);
|
|
3143
|
-
}
|
|
3144
|
-
setPointerCapture(t) {
|
|
3145
|
-
qt(t, this);
|
|
3146
|
-
}
|
|
3147
|
-
releaseCapture(t) {
|
|
3148
|
-
Z(t);
|
|
3149
|
-
}
|
|
3150
|
-
}
|
|
3151
|
-
p.prototype._fillFunc = oi;
|
|
3152
|
-
p.prototype._strokeFunc = hi;
|
|
3153
|
-
p.prototype._fillFuncHit = li;
|
|
3154
|
-
p.prototype._strokeFuncHit = ci;
|
|
3155
|
-
p.prototype._centroid = !1;
|
|
3156
|
-
p.prototype.nodeType = "Shape";
|
|
3157
|
-
nt(p);
|
|
3158
|
-
p.prototype.eventListeners = {};
|
|
3159
|
-
p.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", di);
|
|
3160
|
-
p.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", ui);
|
|
3161
|
-
p.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva", fi);
|
|
3162
|
-
p.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva", gi);
|
|
3163
|
-
p.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva", pi);
|
|
3164
|
-
g.addGetterSetter(p, "stroke", void 0, Wt());
|
|
3165
|
-
g.addGetterSetter(p, "strokeWidth", 2, b());
|
|
3166
|
-
g.addGetterSetter(p, "fillAfterStrokeEnabled", !1);
|
|
3167
|
-
g.addGetterSetter(p, "hitStrokeWidth", "auto", Ne());
|
|
3168
|
-
g.addGetterSetter(p, "strokeHitEnabled", !0, M());
|
|
3169
|
-
g.addGetterSetter(p, "perfectDrawEnabled", !0, M());
|
|
3170
|
-
g.addGetterSetter(p, "shadowForStrokeEnabled", !0, M());
|
|
3171
|
-
g.addGetterSetter(p, "lineJoin");
|
|
3172
|
-
g.addGetterSetter(p, "lineCap");
|
|
3173
|
-
g.addGetterSetter(p, "miterLimit");
|
|
3174
|
-
g.addGetterSetter(p, "sceneFunc");
|
|
3175
|
-
g.addGetterSetter(p, "hitFunc");
|
|
3176
|
-
g.addGetterSetter(p, "dash");
|
|
3177
|
-
g.addGetterSetter(p, "dashOffset", 0, b());
|
|
3178
|
-
g.addGetterSetter(p, "shadowColor", void 0, Y());
|
|
3179
|
-
g.addGetterSetter(p, "shadowBlur", 0, b());
|
|
3180
|
-
g.addGetterSetter(p, "shadowOpacity", 1, b());
|
|
3181
|
-
g.addComponentsGetterSetter(p, "shadowOffset", ["x", "y"]);
|
|
3182
|
-
g.addGetterSetter(p, "shadowOffsetX", 0, b());
|
|
3183
|
-
g.addGetterSetter(p, "shadowOffsetY", 0, b());
|
|
3184
|
-
g.addGetterSetter(p, "fillPatternImage");
|
|
3185
|
-
g.addGetterSetter(p, "fill", void 0, Wt());
|
|
3186
|
-
g.addGetterSetter(p, "fillPatternX", 0, b());
|
|
3187
|
-
g.addGetterSetter(p, "fillPatternY", 0, b());
|
|
3188
|
-
g.addGetterSetter(p, "fillLinearGradientColorStops");
|
|
3189
|
-
g.addGetterSetter(p, "strokeLinearGradientColorStops");
|
|
3190
|
-
g.addGetterSetter(p, "fillRadialGradientStartRadius", 0);
|
|
3191
|
-
g.addGetterSetter(p, "fillRadialGradientEndRadius", 0);
|
|
3192
|
-
g.addGetterSetter(p, "fillRadialGradientColorStops");
|
|
3193
|
-
g.addGetterSetter(p, "fillPatternRepeat", "repeat");
|
|
3194
|
-
g.addGetterSetter(p, "fillEnabled", !0);
|
|
3195
|
-
g.addGetterSetter(p, "strokeEnabled", !0);
|
|
3196
|
-
g.addGetterSetter(p, "shadowEnabled", !0);
|
|
3197
|
-
g.addGetterSetter(p, "dashEnabled", !0);
|
|
3198
|
-
g.addGetterSetter(p, "strokeScaleEnabled", !0);
|
|
3199
|
-
g.addGetterSetter(p, "fillPriority", "color");
|
|
3200
|
-
g.addComponentsGetterSetter(p, "fillPatternOffset", ["x", "y"]);
|
|
3201
|
-
g.addGetterSetter(p, "fillPatternOffsetX", 0, b());
|
|
3202
|
-
g.addGetterSetter(p, "fillPatternOffsetY", 0, b());
|
|
3203
|
-
g.addComponentsGetterSetter(p, "fillPatternScale", ["x", "y"]);
|
|
3204
|
-
g.addGetterSetter(p, "fillPatternScaleX", 1, b());
|
|
3205
|
-
g.addGetterSetter(p, "fillPatternScaleY", 1, b());
|
|
3206
|
-
g.addComponentsGetterSetter(p, "fillLinearGradientStartPoint", [
|
|
3207
|
-
"x",
|
|
3208
|
-
"y"
|
|
3209
|
-
]);
|
|
3210
|
-
g.addComponentsGetterSetter(p, "strokeLinearGradientStartPoint", [
|
|
3211
|
-
"x",
|
|
3212
|
-
"y"
|
|
3213
|
-
]);
|
|
3214
|
-
g.addGetterSetter(p, "fillLinearGradientStartPointX", 0);
|
|
3215
|
-
g.addGetterSetter(p, "strokeLinearGradientStartPointX", 0);
|
|
3216
|
-
g.addGetterSetter(p, "fillLinearGradientStartPointY", 0);
|
|
3217
|
-
g.addGetterSetter(p, "strokeLinearGradientStartPointY", 0);
|
|
3218
|
-
g.addComponentsGetterSetter(p, "fillLinearGradientEndPoint", [
|
|
3219
|
-
"x",
|
|
3220
|
-
"y"
|
|
3221
|
-
]);
|
|
3222
|
-
g.addComponentsGetterSetter(p, "strokeLinearGradientEndPoint", [
|
|
3223
|
-
"x",
|
|
3224
|
-
"y"
|
|
3225
|
-
]);
|
|
3226
|
-
g.addGetterSetter(p, "fillLinearGradientEndPointX", 0);
|
|
3227
|
-
g.addGetterSetter(p, "strokeLinearGradientEndPointX", 0);
|
|
3228
|
-
g.addGetterSetter(p, "fillLinearGradientEndPointY", 0);
|
|
3229
|
-
g.addGetterSetter(p, "strokeLinearGradientEndPointY", 0);
|
|
3230
|
-
g.addComponentsGetterSetter(p, "fillRadialGradientStartPoint", [
|
|
3231
|
-
"x",
|
|
3232
|
-
"y"
|
|
3233
|
-
]);
|
|
3234
|
-
g.addGetterSetter(p, "fillRadialGradientStartPointX", 0);
|
|
3235
|
-
g.addGetterSetter(p, "fillRadialGradientStartPointY", 0);
|
|
3236
|
-
g.addComponentsGetterSetter(p, "fillRadialGradientEndPoint", [
|
|
3237
|
-
"x",
|
|
3238
|
-
"y"
|
|
3239
|
-
]);
|
|
3240
|
-
g.addGetterSetter(p, "fillRadialGradientEndPointX", 0);
|
|
3241
|
-
g.addGetterSetter(p, "fillRadialGradientEndPointY", 0);
|
|
3242
|
-
g.addGetterSetter(p, "fillPatternRotation", 0);
|
|
3243
|
-
g.addGetterSetter(p, "fillRule", void 0, Y());
|
|
3244
|
-
g.backCompat(p, {
|
|
3245
|
-
dashArray: "dash",
|
|
3246
|
-
getDashArray: "getDash",
|
|
3247
|
-
setDashArray: "getDash",
|
|
3248
|
-
drawFunc: "sceneFunc",
|
|
3249
|
-
getDrawFunc: "getSceneFunc",
|
|
3250
|
-
setDrawFunc: "setSceneFunc",
|
|
3251
|
-
drawHitFunc: "hitFunc",
|
|
3252
|
-
getDrawHitFunc: "getHitFunc",
|
|
3253
|
-
setDrawHitFunc: "setHitFunc"
|
|
3254
|
-
});
|
|
3255
|
-
const mi = "beforeDraw", _i = "draw", ce = [
|
|
3256
|
-
{ x: 0, y: 0 },
|
|
3257
|
-
{ x: -1, y: -1 },
|
|
3258
|
-
{ x: 1, y: -1 },
|
|
3259
|
-
{ x: 1, y: 1 },
|
|
3260
|
-
{ x: -1, y: 1 }
|
|
3261
|
-
], yi = ce.length;
|
|
3262
|
-
class N extends k {
|
|
3263
|
-
constructor(t) {
|
|
3264
|
-
super(t), this.canvas = new D(), this.hitCanvas = new Et({
|
|
3265
|
-
pixelRatio: 1
|
|
3266
|
-
}), this._waitingForDraw = !1, this.on("visibleChange.konva", this._checkVisibility), this._checkVisibility(), this.on("imageSmoothingEnabledChange.konva", this._setSmoothEnabled), this._setSmoothEnabled();
|
|
3267
|
-
}
|
|
3268
|
-
createPNGStream() {
|
|
3269
|
-
return this.canvas._canvas.createPNGStream();
|
|
3270
|
-
}
|
|
3271
|
-
getCanvas() {
|
|
3272
|
-
return this.canvas;
|
|
3273
|
-
}
|
|
3274
|
-
getNativeCanvasElement() {
|
|
3275
|
-
return this.canvas._canvas;
|
|
3276
|
-
}
|
|
3277
|
-
getHitCanvas() {
|
|
3278
|
-
return this.hitCanvas;
|
|
3279
|
-
}
|
|
3280
|
-
getContext() {
|
|
3281
|
-
return this.getCanvas().getContext();
|
|
3282
|
-
}
|
|
3283
|
-
clear(t) {
|
|
3284
|
-
return this.getContext().clear(t), this.getHitCanvas().getContext().clear(t), this;
|
|
3285
|
-
}
|
|
3286
|
-
setZIndex(t) {
|
|
3287
|
-
super.setZIndex(t);
|
|
3288
|
-
const e = this.getStage();
|
|
3289
|
-
return e && e.content && (e.content.removeChild(this.getNativeCanvasElement()), t < e.children.length - 1 ? e.content.insertBefore(this.getNativeCanvasElement(), e.children[t + 1].getCanvas()._canvas) : e.content.appendChild(this.getNativeCanvasElement())), this;
|
|
3290
|
-
}
|
|
3291
|
-
moveToTop() {
|
|
3292
|
-
_.prototype.moveToTop.call(this);
|
|
3293
|
-
const t = this.getStage();
|
|
3294
|
-
return t && t.content && (t.content.removeChild(this.getNativeCanvasElement()), t.content.appendChild(this.getNativeCanvasElement())), !0;
|
|
3295
|
-
}
|
|
3296
|
-
moveUp() {
|
|
3297
|
-
if (!_.prototype.moveUp.call(this))
|
|
3298
|
-
return !1;
|
|
3299
|
-
const e = this.getStage();
|
|
3300
|
-
return !e || !e.content ? !1 : (e.content.removeChild(this.getNativeCanvasElement()), this.index < e.children.length - 1 ? e.content.insertBefore(this.getNativeCanvasElement(), e.children[this.index + 1].getCanvas()._canvas) : e.content.appendChild(this.getNativeCanvasElement()), !0);
|
|
3301
|
-
}
|
|
3302
|
-
moveDown() {
|
|
3303
|
-
if (_.prototype.moveDown.call(this)) {
|
|
3304
|
-
const t = this.getStage();
|
|
3305
|
-
if (t) {
|
|
3306
|
-
const e = t.children;
|
|
3307
|
-
t.content && (t.content.removeChild(this.getNativeCanvasElement()), t.content.insertBefore(this.getNativeCanvasElement(), e[this.index + 1].getCanvas()._canvas));
|
|
3308
|
-
}
|
|
3309
|
-
return !0;
|
|
3310
|
-
}
|
|
3311
|
-
return !1;
|
|
3312
|
-
}
|
|
3313
|
-
moveToBottom() {
|
|
3314
|
-
if (_.prototype.moveToBottom.call(this)) {
|
|
3315
|
-
const t = this.getStage();
|
|
3316
|
-
if (t) {
|
|
3317
|
-
const e = t.children;
|
|
3318
|
-
t.content && (t.content.removeChild(this.getNativeCanvasElement()), t.content.insertBefore(this.getNativeCanvasElement(), e[1].getCanvas()._canvas));
|
|
3319
|
-
}
|
|
3320
|
-
return !0;
|
|
3321
|
-
}
|
|
3322
|
-
return !1;
|
|
3323
|
-
}
|
|
3324
|
-
getLayer() {
|
|
3325
|
-
return this;
|
|
3326
|
-
}
|
|
3327
|
-
remove() {
|
|
3328
|
-
const t = this.getNativeCanvasElement();
|
|
3329
|
-
return _.prototype.remove.call(this), t && t.parentNode && c._isInDocument(t) && t.parentNode.removeChild(t), this;
|
|
3330
|
-
}
|
|
3331
|
-
getStage() {
|
|
3332
|
-
return this.parent;
|
|
3333
|
-
}
|
|
3334
|
-
setSize({ width: t, height: e }) {
|
|
3335
|
-
return this.canvas.setSize(t, e), this.hitCanvas.setSize(t, e), this._setSmoothEnabled(), this;
|
|
3336
|
-
}
|
|
3337
|
-
_validateAdd(t) {
|
|
3338
|
-
const e = t.getType();
|
|
3339
|
-
e !== "Group" && e !== "Shape" && c.throw("You may only add groups and shapes to a layer.");
|
|
3340
|
-
}
|
|
3341
|
-
_toKonvaCanvas(t) {
|
|
3342
|
-
return t = { ...t }, t.width = t.width || this.getWidth(), t.height = t.height || this.getHeight(), t.x = t.x !== void 0 ? t.x : this.x(), t.y = t.y !== void 0 ? t.y : this.y(), _.prototype._toKonvaCanvas.call(this, t);
|
|
3343
|
-
}
|
|
3344
|
-
_checkVisibility() {
|
|
3345
|
-
this.visible() ? this.canvas._canvas.style.display = "block" : this.canvas._canvas.style.display = "none";
|
|
3346
|
-
}
|
|
3347
|
-
_setSmoothEnabled() {
|
|
3348
|
-
this.getContext()._context.imageSmoothingEnabled = this.imageSmoothingEnabled();
|
|
3349
|
-
}
|
|
3350
|
-
getWidth() {
|
|
3351
|
-
if (this.parent)
|
|
3352
|
-
return this.parent.width();
|
|
3353
|
-
}
|
|
3354
|
-
setWidth() {
|
|
3355
|
-
c.warn('Can not change width of layer. Use "stage.width(value)" function instead.');
|
|
3356
|
-
}
|
|
3357
|
-
getHeight() {
|
|
3358
|
-
if (this.parent)
|
|
3359
|
-
return this.parent.height();
|
|
3360
|
-
}
|
|
3361
|
-
setHeight() {
|
|
3362
|
-
c.warn('Can not change height of layer. Use "stage.height(value)" function instead.');
|
|
3363
|
-
}
|
|
3364
|
-
batchDraw() {
|
|
3365
|
-
return this._waitingForDraw || (this._waitingForDraw = !0, c.requestAnimFrame(() => {
|
|
3366
|
-
this.draw(), this._waitingForDraw = !1;
|
|
3367
|
-
})), this;
|
|
3368
|
-
}
|
|
3369
|
-
getIntersection(t) {
|
|
3370
|
-
if (!this.isListening() || !this.isVisible())
|
|
3371
|
-
return null;
|
|
3372
|
-
let e = 1, i = !1;
|
|
3373
|
-
for (; ; ) {
|
|
3374
|
-
for (let s = 0; s < yi; s++) {
|
|
3375
|
-
const r = ce[s], a = this._getIntersection({
|
|
3376
|
-
x: t.x + r.x * e,
|
|
3377
|
-
y: t.y + r.y * e
|
|
3378
|
-
}), o = a.shape;
|
|
3379
|
-
if (o)
|
|
3380
|
-
return o;
|
|
3381
|
-
if (i = !!a.antialiased, !a.antialiased)
|
|
3382
|
-
break;
|
|
3383
|
-
}
|
|
3384
|
-
if (i)
|
|
3385
|
-
e += 1;
|
|
3386
|
-
else
|
|
3387
|
-
return null;
|
|
3388
|
-
}
|
|
3389
|
-
}
|
|
3390
|
-
_getIntersection(t) {
|
|
3391
|
-
const e = this.hitCanvas.pixelRatio, i = this.hitCanvas.context.getImageData(Math.round(t.x * e), Math.round(t.y * e), 1, 1).data, s = i[3];
|
|
3392
|
-
if (s === 255) {
|
|
3393
|
-
const r = c.getHitColorKey(i[0], i[1], i[2]), a = tt[r];
|
|
3394
|
-
return a ? {
|
|
3395
|
-
shape: a
|
|
3396
|
-
} : {
|
|
3397
|
-
antialiased: !0
|
|
3398
|
-
};
|
|
3399
|
-
} else if (s > 0)
|
|
3400
|
-
return {
|
|
3401
|
-
antialiased: !0
|
|
3402
|
-
};
|
|
3403
|
-
return {};
|
|
3404
|
-
}
|
|
3405
|
-
drawScene(t, e, i) {
|
|
3406
|
-
const s = this.getLayer(), r = t || s && s.getCanvas();
|
|
3407
|
-
return this._fire(mi, {
|
|
3408
|
-
node: this
|
|
3409
|
-
}), this.clearBeforeDraw() && r.getContext().clear(), k.prototype.drawScene.call(this, r, e, i), this._fire(_i, {
|
|
3410
|
-
node: this
|
|
3411
|
-
}), this;
|
|
3412
|
-
}
|
|
3413
|
-
drawHit(t, e) {
|
|
3414
|
-
const i = this.getLayer(), s = t || i && i.hitCanvas;
|
|
3415
|
-
return i && i.clearBeforeDraw() && i.getHitCanvas().getContext().clear(), k.prototype.drawHit.call(this, s, e), this;
|
|
3416
|
-
}
|
|
3417
|
-
enableHitGraph() {
|
|
3418
|
-
return this.hitGraphEnabled(!0), this;
|
|
3419
|
-
}
|
|
3420
|
-
disableHitGraph() {
|
|
3421
|
-
return this.hitGraphEnabled(!1), this;
|
|
3422
|
-
}
|
|
3423
|
-
setHitGraphEnabled(t) {
|
|
3424
|
-
c.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."), this.listening(t);
|
|
3425
|
-
}
|
|
3426
|
-
getHitGraphEnabled(t) {
|
|
3427
|
-
return c.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."), this.listening();
|
|
3428
|
-
}
|
|
3429
|
-
toggleHitCanvas() {
|
|
3430
|
-
if (!this.parent || !this.parent.content)
|
|
3431
|
-
return;
|
|
3432
|
-
const t = this.parent;
|
|
3433
|
-
!!this.hitCanvas._canvas.parentNode ? t.content.removeChild(this.hitCanvas._canvas) : t.content.appendChild(this.hitCanvas._canvas);
|
|
3434
|
-
}
|
|
3435
|
-
destroy() {
|
|
3436
|
-
return c.releaseCanvas(this.getNativeCanvasElement(), this.getHitCanvas()._canvas), super.destroy();
|
|
3437
|
-
}
|
|
3438
|
-
}
|
|
3439
|
-
N.prototype.nodeType = "Layer";
|
|
3440
|
-
nt(N);
|
|
3441
|
-
g.addGetterSetter(N, "imageSmoothingEnabled", !0);
|
|
3442
|
-
g.addGetterSetter(N, "clearBeforeDraw", !0);
|
|
3443
|
-
g.addGetterSetter(N, "hitGraphEnabled", !0, M());
|
|
3444
|
-
class kt extends N {
|
|
3445
|
-
constructor(t) {
|
|
3446
|
-
super(t), this.listening(!1), c.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.');
|
|
3447
|
-
}
|
|
3448
|
-
}
|
|
3449
|
-
kt.prototype.nodeType = "FastLayer";
|
|
3450
|
-
nt(kt);
|
|
3451
|
-
class Rt extends k {
|
|
3452
|
-
_validateAdd(t) {
|
|
3453
|
-
const e = t.getType();
|
|
3454
|
-
e !== "Group" && e !== "Shape" && c.throw("You may only add groups and shapes to groups.");
|
|
3455
|
-
}
|
|
3456
|
-
}
|
|
3457
|
-
Rt.prototype.nodeType = "Group";
|
|
3458
|
-
nt(Rt);
|
|
3459
|
-
const Ct = (function() {
|
|
3460
|
-
return B.performance && B.performance.now ? function() {
|
|
3461
|
-
return B.performance.now();
|
|
3462
|
-
} : function() {
|
|
3463
|
-
return (/* @__PURE__ */ new Date()).getTime();
|
|
3464
|
-
};
|
|
3465
|
-
})();
|
|
3466
|
-
class R {
|
|
3467
|
-
constructor(t, e) {
|
|
3468
|
-
this.id = R.animIdCounter++, this.frame = {
|
|
3469
|
-
time: 0,
|
|
3470
|
-
timeDiff: 0,
|
|
3471
|
-
lastTime: Ct(),
|
|
3472
|
-
frameRate: 0
|
|
3473
|
-
}, this.func = t, this.setLayers(e);
|
|
3474
|
-
}
|
|
3475
|
-
setLayers(t) {
|
|
3476
|
-
let e = [];
|
|
3477
|
-
return t && (e = Array.isArray(t) ? t : [t]), this.layers = e, this;
|
|
3478
|
-
}
|
|
3479
|
-
getLayers() {
|
|
3480
|
-
return this.layers;
|
|
3481
|
-
}
|
|
3482
|
-
addLayer(t) {
|
|
3483
|
-
const e = this.layers, i = e.length;
|
|
3484
|
-
for (let s = 0; s < i; s++)
|
|
3485
|
-
if (e[s]._id === t._id)
|
|
3486
|
-
return !1;
|
|
3487
|
-
return this.layers.push(t), !0;
|
|
3488
|
-
}
|
|
3489
|
-
isRunning() {
|
|
3490
|
-
const e = R.animations, i = e.length;
|
|
3491
|
-
for (let s = 0; s < i; s++)
|
|
3492
|
-
if (e[s].id === this.id)
|
|
3493
|
-
return !0;
|
|
3494
|
-
return !1;
|
|
3495
|
-
}
|
|
3496
|
-
start() {
|
|
3497
|
-
return this.stop(), this.frame.timeDiff = 0, this.frame.lastTime = Ct(), R._addAnimation(this), this;
|
|
3498
|
-
}
|
|
3499
|
-
stop() {
|
|
3500
|
-
return R._removeAnimation(this), this;
|
|
3501
|
-
}
|
|
3502
|
-
_updateFrameObject(t) {
|
|
3503
|
-
this.frame.timeDiff = t - this.frame.lastTime, this.frame.lastTime = t, this.frame.time += this.frame.timeDiff, this.frame.frameRate = 1e3 / this.frame.timeDiff;
|
|
3504
|
-
}
|
|
3505
|
-
static _addAnimation(t) {
|
|
3506
|
-
this.animations.push(t), this._handleAnimation();
|
|
3507
|
-
}
|
|
3508
|
-
static _removeAnimation(t) {
|
|
3509
|
-
const e = t.id, i = this.animations, s = i.length;
|
|
3510
|
-
for (let r = 0; r < s; r++)
|
|
3511
|
-
if (i[r].id === e) {
|
|
3512
|
-
this.animations.splice(r, 1);
|
|
3513
|
-
break;
|
|
3514
|
-
}
|
|
3515
|
-
}
|
|
3516
|
-
static _runFrames() {
|
|
3517
|
-
const t = {}, e = this.animations;
|
|
3518
|
-
for (let i = 0; i < e.length; i++) {
|
|
3519
|
-
const s = e[i], r = s.layers, a = s.func;
|
|
3520
|
-
s._updateFrameObject(Ct());
|
|
3521
|
-
const o = r.length;
|
|
3522
|
-
let h;
|
|
3523
|
-
if (a ? h = a.call(s, s.frame) !== !1 : h = !0, !!h)
|
|
3524
|
-
for (let l = 0; l < o; l++) {
|
|
3525
|
-
const d = r[l];
|
|
3526
|
-
d._id !== void 0 && (t[d._id] = d);
|
|
3527
|
-
}
|
|
3528
|
-
}
|
|
3529
|
-
for (const i in t)
|
|
3530
|
-
t.hasOwnProperty(i) && t[i].batchDraw();
|
|
3531
|
-
}
|
|
3532
|
-
static _animationLoop() {
|
|
3533
|
-
const t = R;
|
|
3534
|
-
t.animations.length ? (t._runFrames(), c.requestAnimFrame(t._animationLoop)) : t.animRunning = !1;
|
|
3535
|
-
}
|
|
3536
|
-
static _handleAnimation() {
|
|
3537
|
-
this.animRunning || (this.animRunning = !0, c.requestAnimFrame(this._animationLoop));
|
|
3538
|
-
}
|
|
3539
|
-
}
|
|
3540
|
-
R.animations = [];
|
|
3541
|
-
R.animIdCounter = 0;
|
|
3542
|
-
R.animRunning = !1;
|
|
3543
|
-
const Ci = {
|
|
3544
|
-
node: 1,
|
|
3545
|
-
duration: 1,
|
|
3546
|
-
easing: 1,
|
|
3547
|
-
onFinish: 1,
|
|
3548
|
-
yoyo: 1
|
|
3549
|
-
}, vi = 1, Yt = 2, Xt = 3, Vt = ["fill", "stroke", "shadowColor"];
|
|
3550
|
-
let bi = 0;
|
|
3551
|
-
class Si {
|
|
3552
|
-
constructor(t, e, i, s, r, a, o) {
|
|
3553
|
-
this.prop = t, this.propFunc = e, this.begin = s, this._pos = s, this.duration = a, this._change = 0, this.prevPos = 0, this.yoyo = o, this._time = 0, this._position = 0, this._startTime = 0, this._finish = 0, this.func = i, this._change = r - this.begin, this.pause();
|
|
3554
|
-
}
|
|
3555
|
-
fire(t) {
|
|
3556
|
-
const e = this[t];
|
|
3557
|
-
e && e();
|
|
3558
|
-
}
|
|
3559
|
-
setTime(t) {
|
|
3560
|
-
t > this.duration ? this.yoyo ? (this._time = this.duration, this.reverse()) : this.finish() : t < 0 ? this.yoyo ? (this._time = 0, this.play()) : this.reset() : (this._time = t, this.update());
|
|
3561
|
-
}
|
|
3562
|
-
getTime() {
|
|
3563
|
-
return this._time;
|
|
3564
|
-
}
|
|
3565
|
-
setPosition(t) {
|
|
3566
|
-
this.prevPos = this._pos, this.propFunc(t), this._pos = t;
|
|
3567
|
-
}
|
|
3568
|
-
getPosition(t) {
|
|
3569
|
-
return t === void 0 && (t = this._time), this.func(t, this.begin, this._change, this.duration);
|
|
3570
|
-
}
|
|
3571
|
-
play() {
|
|
3572
|
-
this.state = Yt, this._startTime = this.getTimer() - this._time, this.onEnterFrame(), this.fire("onPlay");
|
|
3573
|
-
}
|
|
3574
|
-
reverse() {
|
|
3575
|
-
this.state = Xt, this._time = this.duration - this._time, this._startTime = this.getTimer() - this._time, this.onEnterFrame(), this.fire("onReverse");
|
|
3576
|
-
}
|
|
3577
|
-
seek(t) {
|
|
3578
|
-
this.pause(), this._time = t, this.update(), this.fire("onSeek");
|
|
3579
|
-
}
|
|
3580
|
-
reset() {
|
|
3581
|
-
this.pause(), this._time = 0, this.update(), this.fire("onReset");
|
|
3582
|
-
}
|
|
3583
|
-
finish() {
|
|
3584
|
-
this.pause(), this._time = this.duration, this.update(), this.fire("onFinish");
|
|
3585
|
-
}
|
|
3586
|
-
update() {
|
|
3587
|
-
this.setPosition(this.getPosition(this._time)), this.fire("onUpdate");
|
|
3588
|
-
}
|
|
3589
|
-
onEnterFrame() {
|
|
3590
|
-
const t = this.getTimer() - this._startTime;
|
|
3591
|
-
this.state === Yt ? this.setTime(t) : this.state === Xt && this.setTime(this.duration - t);
|
|
3592
|
-
}
|
|
3593
|
-
pause() {
|
|
3594
|
-
this.state = vi, this.fire("onPause");
|
|
3595
|
-
}
|
|
3596
|
-
getTimer() {
|
|
3597
|
-
return (/* @__PURE__ */ new Date()).getTime();
|
|
3598
|
-
}
|
|
3599
|
-
}
|
|
3600
|
-
class w {
|
|
3601
|
-
constructor(t) {
|
|
3602
|
-
const e = this, i = t.node, s = i._id, r = t.easing || et.Linear, a = !!t.yoyo;
|
|
3603
|
-
let o, h;
|
|
3604
|
-
typeof t.duration > "u" ? o = 0.3 : t.duration === 0 ? o = 1e-3 : o = t.duration, this.node = i, this._id = bi++;
|
|
3605
|
-
const l = i.getLayer() || (i instanceof m.Stage ? i.getLayers() : null);
|
|
3606
|
-
l || c.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."), this.anim = new R(function() {
|
|
3607
|
-
e.tween.onEnterFrame();
|
|
3608
|
-
}, l), this.tween = new Si(h, function(d) {
|
|
3609
|
-
e._tweenFunc(d);
|
|
3610
|
-
}, r, 0, 1, o * 1e3, a), this._addListeners(), w.attrs[s] || (w.attrs[s] = {}), w.attrs[s][this._id] || (w.attrs[s][this._id] = {}), w.tweens[s] || (w.tweens[s] = {});
|
|
3611
|
-
for (h in t)
|
|
3612
|
-
Ci[h] === void 0 && this._addAttr(h, t[h]);
|
|
3613
|
-
this.reset(), this.onFinish = t.onFinish, this.onReset = t.onReset, this.onUpdate = t.onUpdate;
|
|
3614
|
-
}
|
|
3615
|
-
_addAttr(t, e) {
|
|
3616
|
-
const i = this.node, s = i._id;
|
|
3617
|
-
let r, a, o, h, l;
|
|
3618
|
-
const d = w.tweens[s][t];
|
|
3619
|
-
d && delete w.attrs[s][d][t];
|
|
3620
|
-
let u = i.getAttr(t);
|
|
3621
|
-
if (c._isArray(e))
|
|
3622
|
-
if (r = [], a = Math.max(e.length, u.length), t === "points" && e.length !== u.length && (e.length > u.length ? (h = u, u = c._prepareArrayForTween(u, e, i.closed())) : (o = e, e = c._prepareArrayForTween(e, u, i.closed()))), t.indexOf("fill") === 0)
|
|
3623
|
-
for (let f = 0; f < a; f++)
|
|
3624
|
-
if (f % 2 === 0)
|
|
3625
|
-
r.push(e[f] - u[f]);
|
|
3626
|
-
else {
|
|
3627
|
-
const C = c.colorToRGBA(u[f]);
|
|
3628
|
-
l = c.colorToRGBA(e[f]), u[f] = C, r.push({
|
|
3629
|
-
r: l.r - C.r,
|
|
3630
|
-
g: l.g - C.g,
|
|
3631
|
-
b: l.b - C.b,
|
|
3632
|
-
a: l.a - C.a
|
|
3633
|
-
});
|
|
3634
|
-
}
|
|
3635
|
-
else
|
|
3636
|
-
for (let f = 0; f < a; f++)
|
|
3637
|
-
r.push(e[f] - u[f]);
|
|
3638
|
-
else Vt.indexOf(t) !== -1 ? (u = c.colorToRGBA(u), l = c.colorToRGBA(e), r = {
|
|
3639
|
-
r: l.r - u.r,
|
|
3640
|
-
g: l.g - u.g,
|
|
3641
|
-
b: l.b - u.b,
|
|
3642
|
-
a: l.a - u.a
|
|
3643
|
-
}) : r = e - u;
|
|
3644
|
-
w.attrs[s][this._id][t] = {
|
|
3645
|
-
start: u,
|
|
3646
|
-
diff: r,
|
|
3647
|
-
end: e,
|
|
3648
|
-
trueEnd: o,
|
|
3649
|
-
trueStart: h
|
|
3650
|
-
}, w.tweens[s][t] = this._id;
|
|
3651
|
-
}
|
|
3652
|
-
_tweenFunc(t) {
|
|
3653
|
-
const e = this.node, i = w.attrs[e._id][this._id];
|
|
3654
|
-
let s, r, a, o, h, l, d, u;
|
|
3655
|
-
for (s in i) {
|
|
3656
|
-
if (r = i[s], a = r.start, o = r.diff, u = r.end, c._isArray(a))
|
|
3657
|
-
if (h = [], d = Math.max(a.length, u.length), s.indexOf("fill") === 0)
|
|
3658
|
-
for (l = 0; l < d; l++)
|
|
3659
|
-
l % 2 === 0 ? h.push((a[l] || 0) + o[l] * t) : h.push("rgba(" + Math.round(a[l].r + o[l].r * t) + "," + Math.round(a[l].g + o[l].g * t) + "," + Math.round(a[l].b + o[l].b * t) + "," + (a[l].a + o[l].a * t) + ")");
|
|
3660
|
-
else
|
|
3661
|
-
for (l = 0; l < d; l++)
|
|
3662
|
-
h.push((a[l] || 0) + o[l] * t);
|
|
3663
|
-
else Vt.indexOf(s) !== -1 ? h = "rgba(" + Math.round(a.r + o.r * t) + "," + Math.round(a.g + o.g * t) + "," + Math.round(a.b + o.b * t) + "," + (a.a + o.a * t) + ")" : h = a + o * t;
|
|
3664
|
-
e.setAttr(s, h);
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
_addListeners() {
|
|
3668
|
-
this.tween.onPlay = () => {
|
|
3669
|
-
this.anim.start();
|
|
3670
|
-
}, this.tween.onReverse = () => {
|
|
3671
|
-
this.anim.start();
|
|
3672
|
-
}, this.tween.onPause = () => {
|
|
3673
|
-
this.anim.stop();
|
|
3674
|
-
}, this.tween.onFinish = () => {
|
|
3675
|
-
const t = this.node, e = w.attrs[t._id][this._id];
|
|
3676
|
-
e.points && e.points.trueEnd && t.setAttr("points", e.points.trueEnd), this.onFinish && this.onFinish.call(this);
|
|
3677
|
-
}, this.tween.onReset = () => {
|
|
3678
|
-
const t = this.node, e = w.attrs[t._id][this._id];
|
|
3679
|
-
e.points && e.points.trueStart && t.points(e.points.trueStart), this.onReset && this.onReset();
|
|
3680
|
-
}, this.tween.onUpdate = () => {
|
|
3681
|
-
this.onUpdate && this.onUpdate.call(this);
|
|
3682
|
-
};
|
|
3683
|
-
}
|
|
3684
|
-
play() {
|
|
3685
|
-
return this.tween.play(), this;
|
|
3686
|
-
}
|
|
3687
|
-
reverse() {
|
|
3688
|
-
return this.tween.reverse(), this;
|
|
3689
|
-
}
|
|
3690
|
-
reset() {
|
|
3691
|
-
return this.tween.reset(), this;
|
|
3692
|
-
}
|
|
3693
|
-
seek(t) {
|
|
3694
|
-
return this.tween.seek(t * 1e3), this;
|
|
3695
|
-
}
|
|
3696
|
-
pause() {
|
|
3697
|
-
return this.tween.pause(), this;
|
|
3698
|
-
}
|
|
3699
|
-
finish() {
|
|
3700
|
-
return this.tween.finish(), this;
|
|
3701
|
-
}
|
|
3702
|
-
destroy() {
|
|
3703
|
-
const t = this.node._id, e = this._id, i = w.tweens[t];
|
|
3704
|
-
this.pause(), this.anim && this.anim.stop();
|
|
3705
|
-
for (const s in i)
|
|
3706
|
-
delete w.tweens[t][s];
|
|
3707
|
-
delete w.attrs[t][e], w.tweens[t] && (Object.keys(w.tweens[t]).length === 0 && delete w.tweens[t], Object.keys(w.attrs[t]).length === 0 && delete w.attrs[t]);
|
|
3708
|
-
}
|
|
3709
|
-
}
|
|
3710
|
-
w.attrs = {};
|
|
3711
|
-
w.tweens = {};
|
|
3712
|
-
_.prototype.to = function(n) {
|
|
3713
|
-
const t = n.onFinish;
|
|
3714
|
-
n.node = this, n.onFinish = function() {
|
|
3715
|
-
this.destroy(), t && t();
|
|
3716
|
-
}, new w(n).play();
|
|
3717
|
-
};
|
|
3718
|
-
const et = {
|
|
3719
|
-
BackEaseIn(n, t, e, i) {
|
|
3720
|
-
return e * (n /= i) * n * ((1.70158 + 1) * n - 1.70158) + t;
|
|
3721
|
-
},
|
|
3722
|
-
BackEaseOut(n, t, e, i) {
|
|
3723
|
-
return e * ((n = n / i - 1) * n * ((1.70158 + 1) * n + 1.70158) + 1) + t;
|
|
3724
|
-
},
|
|
3725
|
-
BackEaseInOut(n, t, e, i) {
|
|
3726
|
-
let s = 1.70158;
|
|
3727
|
-
return (n /= i / 2) < 1 ? e / 2 * (n * n * (((s *= 1.525) + 1) * n - s)) + t : e / 2 * ((n -= 2) * n * (((s *= 1.525) + 1) * n + s) + 2) + t;
|
|
3728
|
-
},
|
|
3729
|
-
ElasticEaseIn(n, t, e, i, s, r) {
|
|
3730
|
-
let a = 0;
|
|
3731
|
-
return n === 0 ? t : (n /= i) === 1 ? t + e : (r || (r = i * 0.3), !s || s < Math.abs(e) ? (s = e, a = r / 4) : a = r / (2 * Math.PI) * Math.asin(e / s), -(s * Math.pow(2, 10 * (n -= 1)) * Math.sin((n * i - a) * (2 * Math.PI) / r)) + t);
|
|
3732
|
-
},
|
|
3733
|
-
ElasticEaseOut(n, t, e, i, s, r) {
|
|
3734
|
-
let a = 0;
|
|
3735
|
-
return n === 0 ? t : (n /= i) === 1 ? t + e : (r || (r = i * 0.3), !s || s < Math.abs(e) ? (s = e, a = r / 4) : a = r / (2 * Math.PI) * Math.asin(e / s), s * Math.pow(2, -10 * n) * Math.sin((n * i - a) * (2 * Math.PI) / r) + e + t);
|
|
3736
|
-
},
|
|
3737
|
-
ElasticEaseInOut(n, t, e, i, s, r) {
|
|
3738
|
-
let a = 0;
|
|
3739
|
-
return n === 0 ? t : (n /= i / 2) === 2 ? t + e : (r || (r = i * (0.3 * 1.5)), !s || s < Math.abs(e) ? (s = e, a = r / 4) : a = r / (2 * Math.PI) * Math.asin(e / s), n < 1 ? -0.5 * (s * Math.pow(2, 10 * (n -= 1)) * Math.sin((n * i - a) * (2 * Math.PI) / r)) + t : s * Math.pow(2, -10 * (n -= 1)) * Math.sin((n * i - a) * (2 * Math.PI) / r) * 0.5 + e + t);
|
|
3740
|
-
},
|
|
3741
|
-
BounceEaseOut(n, t, e, i) {
|
|
3742
|
-
return (n /= i) < 1 / 2.75 ? e * (7.5625 * n * n) + t : n < 2 / 2.75 ? e * (7.5625 * (n -= 1.5 / 2.75) * n + 0.75) + t : n < 2.5 / 2.75 ? e * (7.5625 * (n -= 2.25 / 2.75) * n + 0.9375) + t : e * (7.5625 * (n -= 2.625 / 2.75) * n + 0.984375) + t;
|
|
3743
|
-
},
|
|
3744
|
-
BounceEaseIn(n, t, e, i) {
|
|
3745
|
-
return e - et.BounceEaseOut(i - n, 0, e, i) + t;
|
|
3746
|
-
},
|
|
3747
|
-
BounceEaseInOut(n, t, e, i) {
|
|
3748
|
-
return n < i / 2 ? et.BounceEaseIn(n * 2, 0, e, i) * 0.5 + t : et.BounceEaseOut(n * 2 - i, 0, e, i) * 0.5 + e * 0.5 + t;
|
|
3749
|
-
},
|
|
3750
|
-
EaseIn(n, t, e, i) {
|
|
3751
|
-
return e * (n /= i) * n + t;
|
|
3752
|
-
},
|
|
3753
|
-
EaseOut(n, t, e, i) {
|
|
3754
|
-
return -e * (n /= i) * (n - 2) + t;
|
|
3755
|
-
},
|
|
3756
|
-
EaseInOut(n, t, e, i) {
|
|
3757
|
-
return (n /= i / 2) < 1 ? e / 2 * n * n + t : -e / 2 * (--n * (n - 2) - 1) + t;
|
|
3758
|
-
},
|
|
3759
|
-
StrongEaseIn(n, t, e, i) {
|
|
3760
|
-
return e * (n /= i) * n * n * n * n + t;
|
|
3761
|
-
},
|
|
3762
|
-
StrongEaseOut(n, t, e, i) {
|
|
3763
|
-
return e * ((n = n / i - 1) * n * n * n * n + 1) + t;
|
|
3764
|
-
},
|
|
3765
|
-
StrongEaseInOut(n, t, e, i) {
|
|
3766
|
-
return (n /= i / 2) < 1 ? e / 2 * n * n * n * n * n + t : e / 2 * ((n -= 2) * n * n * n * n + 2) + t;
|
|
3767
|
-
},
|
|
3768
|
-
Linear(n, t, e, i) {
|
|
3769
|
-
return e * n / i + t;
|
|
3770
|
-
}
|
|
3771
|
-
}, Pi = c._assign(m, {
|
|
3772
|
-
Util: c,
|
|
3773
|
-
Transform: L,
|
|
3774
|
-
Node: _,
|
|
3775
|
-
Container: k,
|
|
3776
|
-
Stage: gt,
|
|
3777
|
-
stages: Q,
|
|
3778
|
-
Layer: N,
|
|
3779
|
-
FastLayer: kt,
|
|
3780
|
-
Group: Rt,
|
|
3781
|
-
DD: v,
|
|
3782
|
-
Shape: p,
|
|
3783
|
-
shapes: tt,
|
|
3784
|
-
Animation: R,
|
|
3785
|
-
Tween: w,
|
|
3786
|
-
Easings: et,
|
|
3787
|
-
Context: ft,
|
|
3788
|
-
Canvas: xt
|
|
3789
|
-
});
|
|
3790
|
-
export {
|
|
3791
|
-
R as A,
|
|
3792
|
-
g as F,
|
|
3793
|
-
Rt as G,
|
|
3794
|
-
m as K,
|
|
3795
|
-
_ as N,
|
|
3796
|
-
wi as R,
|
|
3797
|
-
p as S,
|
|
3798
|
-
L as T,
|
|
3799
|
-
c as U,
|
|
3800
|
-
nt as _,
|
|
3801
|
-
M as a,
|
|
3802
|
-
Ei as b,
|
|
3803
|
-
xi as c,
|
|
3804
|
-
Ne as d,
|
|
3805
|
-
Y as e,
|
|
3806
|
-
Pi as f,
|
|
3807
|
-
b as g
|
|
3808
|
-
};
|