@linker-design-plus/timeline-track 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/components/Timeline.d.ts +20 -0
- package/dist/components/VideoTrack.d.ts +12 -1
- package/dist/core/timelineManager.d.ts +14 -0
- package/dist/core/types.d.ts +5 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +1131 -966
- package/package.json +3 -2
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var $i = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
2
|
+
var Zi = (o, t, e) => t in o ? $i(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var T = (o, t, e) => Zi(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
const ke = {
|
|
5
5
|
background: "#000000",
|
|
6
6
|
border: "#333333",
|
|
@@ -145,20 +145,20 @@ class N {
|
|
|
145
145
|
/**
|
|
146
146
|
* 刻度类型
|
|
147
147
|
*/
|
|
148
|
-
|
|
149
|
-
const
|
|
148
|
+
T(N, "TICK_TYPE_MAJOR", "major"), T(N, "TICK_TYPE_MINOR", "minor");
|
|
149
|
+
const Ki = Math.PI / 180;
|
|
150
150
|
function Ji() {
|
|
151
151
|
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
_global:
|
|
153
|
+
const Et = typeof global < "u" ? global : typeof window < "u" ? window : typeof WorkerGlobalScope < "u" ? self : {}, A = {
|
|
154
|
+
_global: Et,
|
|
155
155
|
version: "10.2.0",
|
|
156
156
|
isBrowser: Ji(),
|
|
157
157
|
isUnminified: /param/.test((function(o) {
|
|
158
158
|
}).toString()),
|
|
159
159
|
dblClickWindow: 400,
|
|
160
160
|
getAngle(o) {
|
|
161
|
-
return
|
|
161
|
+
return A.angleDeg ? o * Ki : o;
|
|
162
162
|
},
|
|
163
163
|
enableTrace: !1,
|
|
164
164
|
pointerEventsEnabled: !0,
|
|
@@ -182,24 +182,24 @@ const kt = typeof global < "u" ? global : typeof window < "u" ? window : typeof
|
|
|
182
182
|
showWarnings: !0,
|
|
183
183
|
dragButtons: [0, 1],
|
|
184
184
|
isDragging() {
|
|
185
|
-
return
|
|
185
|
+
return A.DD.isDragging;
|
|
186
186
|
},
|
|
187
187
|
isTransforming() {
|
|
188
188
|
var o, t;
|
|
189
|
-
return (t = (o =
|
|
189
|
+
return (t = (o = A.Transformer) === null || o === void 0 ? void 0 : o.isTransforming()) !== null && t !== void 0 ? t : !1;
|
|
190
190
|
},
|
|
191
191
|
isDragReady() {
|
|
192
|
-
return !!
|
|
192
|
+
return !!A.DD.node;
|
|
193
193
|
},
|
|
194
194
|
releaseCanvasOnDestroy: !0,
|
|
195
|
-
document:
|
|
195
|
+
document: Et.document,
|
|
196
196
|
_injectGlobal(o) {
|
|
197
|
-
typeof
|
|
197
|
+
typeof Et.Konva < "u" && console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."), Et.Konva = o;
|
|
198
198
|
}
|
|
199
199
|
}, tt = (o) => {
|
|
200
|
-
|
|
200
|
+
A[o.prototype.getClassName()] = o;
|
|
201
201
|
};
|
|
202
|
-
|
|
202
|
+
A._injectGlobal(A);
|
|
203
203
|
const Qi = `Konva.js unsupported environment.
|
|
204
204
|
|
|
205
205
|
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
@@ -213,7 +213,7 @@ or
|
|
|
213
213
|
|
|
214
214
|
bash: npm install skia-canvas
|
|
215
215
|
js: import "konva/skia-backend";
|
|
216
|
-
`,
|
|
216
|
+
`, Ve = () => {
|
|
217
217
|
if (typeof document > "u")
|
|
218
218
|
throw new Error(Qi);
|
|
219
219
|
};
|
|
@@ -288,7 +288,7 @@ class at {
|
|
|
288
288
|
return h.rotation = m._getRotation(h.rotation), h;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
const ts = "[object Array]", es = "[object Number]", is = "[object String]", ss = "[object Boolean]", ns = Math.PI / 180, rs = 180 / Math.PI, Ft = "#", as = "", os = "0", hs = "Konva warning: ",
|
|
291
|
+
const ts = "[object Array]", es = "[object Number]", is = "[object String]", ss = "[object Boolean]", ns = Math.PI / 180, rs = 180 / Math.PI, Ft = "#", as = "", os = "0", hs = "Konva warning: ", Ue = "Konva error: ", ls = "rgb(", ye = {
|
|
292
292
|
aliceblue: [240, 248, 255],
|
|
293
293
|
antiquewhite: [250, 235, 215],
|
|
294
294
|
aqua: [0, 255, 255],
|
|
@@ -485,7 +485,7 @@ const ds = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
|
|
|
485
485
|
});
|
|
486
486
|
},
|
|
487
487
|
createCanvasElement() {
|
|
488
|
-
|
|
488
|
+
Ve();
|
|
489
489
|
const o = document.createElement("canvas");
|
|
490
490
|
try {
|
|
491
491
|
o.style = o.style || {};
|
|
@@ -494,7 +494,7 @@ const ds = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
|
|
|
494
494
|
return o;
|
|
495
495
|
},
|
|
496
496
|
createImageElement() {
|
|
497
|
-
return
|
|
497
|
+
return Ve(), document.createElement("img");
|
|
498
498
|
},
|
|
499
499
|
_isInDocument(o) {
|
|
500
500
|
for (; o = o.parentNode; )
|
|
@@ -693,19 +693,19 @@ const ds = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
|
|
|
693
693
|
return m.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."), m.radToDeg(o);
|
|
694
694
|
},
|
|
695
695
|
_getRotation(o) {
|
|
696
|
-
return
|
|
696
|
+
return A.angleDeg ? m.radToDeg(o) : o;
|
|
697
697
|
},
|
|
698
698
|
_capitalize(o) {
|
|
699
699
|
return o.charAt(0).toUpperCase() + o.slice(1);
|
|
700
700
|
},
|
|
701
701
|
throw(o) {
|
|
702
|
-
throw new Error(
|
|
702
|
+
throw new Error(Ue + o);
|
|
703
703
|
},
|
|
704
704
|
error(o) {
|
|
705
|
-
console.error(
|
|
705
|
+
console.error(Ue + o);
|
|
706
706
|
},
|
|
707
707
|
warn(o) {
|
|
708
|
-
|
|
708
|
+
A.showWarnings && console.warn(hs + o);
|
|
709
709
|
},
|
|
710
710
|
each(o, t) {
|
|
711
711
|
for (const e in o)
|
|
@@ -784,7 +784,7 @@ const ds = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
|
|
|
784
784
|
return o.touches ? o.changedTouches[0].identifier : o.pointerId || 999;
|
|
785
785
|
},
|
|
786
786
|
releaseCanvas(...o) {
|
|
787
|
-
|
|
787
|
+
A.releaseCanvasOnDestroy && o.forEach((t) => {
|
|
788
788
|
t.width = 0, t.height = 0;
|
|
789
789
|
});
|
|
790
790
|
},
|
|
@@ -800,12 +800,12 @@ const ds = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
|
|
|
800
800
|
const r = t[(n - 1 + e) % e], a = t[n], h = t[(n + 1) % e], l = { x: a.x - r.x, y: a.y - r.y }, c = { x: h.x - a.x, y: h.y - a.y }, u = Math.hypot(l.x, l.y), d = Math.hypot(c.x, c.y);
|
|
801
801
|
let g;
|
|
802
802
|
typeof s == "number" ? g = s : g = n < s.length ? s[n] : 0, g = i * Math.cos(Math.PI / e) * Math.min(1, g / i * 2);
|
|
803
|
-
const
|
|
804
|
-
x: a.x -
|
|
805
|
-
y: a.y -
|
|
803
|
+
const S = { x: l.x / u, y: l.y / u }, C = { x: c.x / d, y: c.y / d }, y = {
|
|
804
|
+
x: a.x - S.x * g,
|
|
805
|
+
y: a.y - S.y * g
|
|
806
806
|
}, _ = {
|
|
807
|
-
x: a.x +
|
|
808
|
-
y: a.y +
|
|
807
|
+
x: a.x + C.x * g,
|
|
808
|
+
y: a.y + C.y * g
|
|
809
809
|
};
|
|
810
810
|
n === 0 ? o.moveTo(y.x, y.y) : o.lineTo(y.x, y.y), o.arcTo(a.x, a.y, _.x, _.y, g);
|
|
811
811
|
}
|
|
@@ -819,7 +819,7 @@ function us(o) {
|
|
|
819
819
|
}
|
|
820
820
|
return t;
|
|
821
821
|
}
|
|
822
|
-
const Ye = ",", fs = "(", gs = ")", ps = "([", ms = "])", ys = ";", _s = "()",
|
|
822
|
+
const Ye = ",", fs = "(", gs = ")", ps = "([", ms = "])", ys = ";", _s = "()", Ss = "=", je = [
|
|
823
823
|
"arc",
|
|
824
824
|
"arcTo",
|
|
825
825
|
"beginPath",
|
|
@@ -852,7 +852,7 @@ const Ye = ",", fs = "(", gs = ")", ps = "([", ms = "])", ys = ";", _s = "()", C
|
|
|
852
852
|
"strokeText",
|
|
853
853
|
"transform",
|
|
854
854
|
"translate"
|
|
855
|
-
],
|
|
855
|
+
], Cs = [
|
|
856
856
|
"fillStyle",
|
|
857
857
|
"strokeStyle",
|
|
858
858
|
"shadowColor",
|
|
@@ -887,7 +887,7 @@ function qe() {
|
|
|
887
887
|
}
|
|
888
888
|
class ge {
|
|
889
889
|
constructor(t) {
|
|
890
|
-
this.canvas = t,
|
|
890
|
+
this.canvas = t, A.enableTrace && (this.traceArr = [], this._enableTrace());
|
|
891
891
|
}
|
|
892
892
|
fillShape(t) {
|
|
893
893
|
t.fillEnabled() && this._fill(t);
|
|
@@ -905,7 +905,7 @@ class ge {
|
|
|
905
905
|
getTrace(t, e) {
|
|
906
906
|
let i = this.traceArr, s = i.length, n = "", r, a, h, l;
|
|
907
907
|
for (r = 0; r < s; r++)
|
|
908
|
-
a = i[r], h = a.method, h ? (l = a.args, n += h, t ? n += _s : m._isArray(l[0]) ? n += ps + l.join(Ye) + ms : (e && (l = l.map((c) => typeof c == "number" ? Math.floor(c) : c)), n += fs + l.join(Ye) + gs)) : (n += a.property, t || (n +=
|
|
908
|
+
a = i[r], h = a.method, h ? (l = a.args, n += h, t ? n += _s : m._isArray(l[0]) ? n += ps + l.join(Ye) + ms : (e && (l = l.map((c) => typeof c == "number" ? Math.floor(c) : c)), n += fs + l.join(Ye) + gs)) : (n += a.property, t || (n += Ss + a.val)), n += ys;
|
|
909
909
|
return n;
|
|
910
910
|
}
|
|
911
911
|
clearTrace() {
|
|
@@ -1089,7 +1089,7 @@ class ge {
|
|
|
1089
1089
|
!e || e === "source-over" || this.setAttr("globalCompositeOperation", e);
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
|
-
|
|
1092
|
+
Cs.forEach(function(o) {
|
|
1093
1093
|
Object.defineProperty(ge.prototype, o, {
|
|
1094
1094
|
get() {
|
|
1095
1095
|
return this._context[o];
|
|
@@ -1198,19 +1198,19 @@ class Ts extends ge {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
1200
|
let se;
|
|
1201
|
-
function
|
|
1201
|
+
function ws() {
|
|
1202
1202
|
if (se)
|
|
1203
1203
|
return se;
|
|
1204
1204
|
const o = m.createCanvasElement(), t = o.getContext("2d");
|
|
1205
1205
|
return se = function() {
|
|
1206
|
-
const e =
|
|
1206
|
+
const e = A._global.devicePixelRatio || 1, i = t.webkitBackingStorePixelRatio || t.mozBackingStorePixelRatio || t.msBackingStorePixelRatio || t.oBackingStorePixelRatio || t.backingStorePixelRatio || 1;
|
|
1207
1207
|
return e / i;
|
|
1208
1208
|
}(), m.releaseCanvas(o), se;
|
|
1209
1209
|
}
|
|
1210
1210
|
class Fe {
|
|
1211
1211
|
constructor(t) {
|
|
1212
1212
|
this.pixelRatio = 1, this.width = 0, this.height = 0, this.isCache = !1;
|
|
1213
|
-
const i = (t || {}).pixelRatio ||
|
|
1213
|
+
const i = (t || {}).pixelRatio || A.pixelRatio || ws();
|
|
1214
1214
|
this.pixelRatio = i, this._canvas = m.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";
|
|
1215
1215
|
}
|
|
1216
1216
|
getContext() {
|
|
@@ -1254,7 +1254,7 @@ class Fe {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
class
|
|
1257
|
+
class bt extends Fe {
|
|
1258
1258
|
constructor(t = { width: 0, height: 0, willReadFrequently: !1 }) {
|
|
1259
1259
|
super(t), this.context = new vs(this, {
|
|
1260
1260
|
willReadFrequently: t.willReadFrequently
|
|
@@ -1266,24 +1266,24 @@ class Ne extends Fe {
|
|
|
1266
1266
|
super(t), this.hitCanvas = !0, this.context = new Ts(this), this.setSize(t.width, t.height);
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
|
-
const
|
|
1269
|
+
const V = {
|
|
1270
1270
|
get isDragging() {
|
|
1271
1271
|
let o = !1;
|
|
1272
|
-
return
|
|
1272
|
+
return V._dragElements.forEach((t) => {
|
|
1273
1273
|
t.dragStatus === "dragging" && (o = !0);
|
|
1274
1274
|
}), o;
|
|
1275
1275
|
},
|
|
1276
1276
|
justDragged: !1,
|
|
1277
1277
|
get node() {
|
|
1278
1278
|
let o;
|
|
1279
|
-
return
|
|
1279
|
+
return V._dragElements.forEach((t) => {
|
|
1280
1280
|
o = t.node;
|
|
1281
1281
|
}), o;
|
|
1282
1282
|
},
|
|
1283
1283
|
_dragElements: /* @__PURE__ */ new Map(),
|
|
1284
1284
|
_drag(o) {
|
|
1285
1285
|
const t = [];
|
|
1286
|
-
|
|
1286
|
+
V._dragElements.forEach((e, i) => {
|
|
1287
1287
|
const { node: s } = e, n = s.getStage();
|
|
1288
1288
|
n.setPointersPositions(o), e.pointerId === void 0 && (e.pointerId = m._getFirstPointerId(o));
|
|
1289
1289
|
const r = n._changedPointerPositions.find((a) => a.id === e.pointerId);
|
|
@@ -1305,85 +1305,85 @@ const U = {
|
|
|
1305
1305
|
},
|
|
1306
1306
|
_endDragBefore(o) {
|
|
1307
1307
|
const t = [];
|
|
1308
|
-
|
|
1308
|
+
V._dragElements.forEach((e) => {
|
|
1309
1309
|
const { node: i } = e, s = i.getStage();
|
|
1310
1310
|
if (o && s.setPointersPositions(o), !s._changedPointerPositions.find((a) => a.id === e.pointerId))
|
|
1311
1311
|
return;
|
|
1312
|
-
(e.dragStatus === "dragging" || e.dragStatus === "stopped") && (
|
|
1313
|
-
const r = e.node.getLayer() || e.node instanceof
|
|
1312
|
+
(e.dragStatus === "dragging" || e.dragStatus === "stopped") && (V.justDragged = !0, A._mouseListenClick = !1, A._touchListenClick = !1, A._pointerListenClick = !1, e.dragStatus = "stopped");
|
|
1313
|
+
const r = e.node.getLayer() || e.node instanceof A.Stage && e.node;
|
|
1314
1314
|
r && t.indexOf(r) === -1 && t.push(r);
|
|
1315
1315
|
}), t.forEach((e) => {
|
|
1316
1316
|
e.draw();
|
|
1317
1317
|
});
|
|
1318
1318
|
},
|
|
1319
1319
|
_endDragAfter(o) {
|
|
1320
|
-
|
|
1320
|
+
V._dragElements.forEach((t, e) => {
|
|
1321
1321
|
t.dragStatus === "stopped" && t.node.fire("dragend", {
|
|
1322
1322
|
type: "dragend",
|
|
1323
1323
|
target: t.node,
|
|
1324
1324
|
evt: o
|
|
1325
|
-
}, !0), t.dragStatus !== "dragging" &&
|
|
1325
|
+
}, !0), t.dragStatus !== "dragging" && V._dragElements.delete(e);
|
|
1326
1326
|
});
|
|
1327
1327
|
}
|
|
1328
1328
|
};
|
|
1329
|
-
|
|
1330
|
-
function
|
|
1329
|
+
A.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));
|
|
1330
|
+
function vt(o) {
|
|
1331
1331
|
return m._isString(o) ? '"' + o + '"' : Object.prototype.toString.call(o) === "[object Number]" || m._isBoolean(o) ? o : Object.prototype.toString.call(o);
|
|
1332
1332
|
}
|
|
1333
1333
|
function yi(o) {
|
|
1334
1334
|
return o > 255 ? 255 : o < 0 ? 0 : Math.round(o);
|
|
1335
1335
|
}
|
|
1336
|
-
function
|
|
1337
|
-
if (
|
|
1336
|
+
function P() {
|
|
1337
|
+
if (A.isUnminified)
|
|
1338
1338
|
return function(o, t) {
|
|
1339
|
-
return m._isNumber(o) || m.warn(
|
|
1339
|
+
return m._isNumber(o) || m.warn(vt(o) + ' is a not valid value for "' + t + '" attribute. The value should be a number.'), o;
|
|
1340
1340
|
};
|
|
1341
1341
|
}
|
|
1342
1342
|
function pe(o) {
|
|
1343
|
-
if (
|
|
1343
|
+
if (A.isUnminified)
|
|
1344
1344
|
return function(t, e) {
|
|
1345
1345
|
let i = m._isNumber(t), s = m._isArray(t) && t.length == o;
|
|
1346
|
-
return !i && !s && m.warn(
|
|
1346
|
+
return !i && !s && m.warn(vt(t) + ' is a not valid value for "' + e + '" attribute. The value should be a number or Array<number>(' + o + ")"), t;
|
|
1347
1347
|
};
|
|
1348
1348
|
}
|
|
1349
1349
|
function ze() {
|
|
1350
|
-
if (
|
|
1350
|
+
if (A.isUnminified)
|
|
1351
1351
|
return function(o, t) {
|
|
1352
|
-
return m._isNumber(o) || o === "auto" || m.warn(
|
|
1352
|
+
return m._isNumber(o) || o === "auto" || m.warn(vt(o) + ' is a not valid value for "' + t + '" attribute. The value should be a number or "auto".'), o;
|
|
1353
1353
|
};
|
|
1354
1354
|
}
|
|
1355
|
-
function
|
|
1356
|
-
if (
|
|
1355
|
+
function Pt() {
|
|
1356
|
+
if (A.isUnminified)
|
|
1357
1357
|
return function(o, t) {
|
|
1358
|
-
return m._isString(o) || m.warn(
|
|
1358
|
+
return m._isString(o) || m.warn(vt(o) + ' is a not valid value for "' + t + '" attribute. The value should be a string.'), o;
|
|
1359
1359
|
};
|
|
1360
1360
|
}
|
|
1361
1361
|
function _i() {
|
|
1362
|
-
if (
|
|
1362
|
+
if (A.isUnminified)
|
|
1363
1363
|
return function(o, t) {
|
|
1364
1364
|
const e = m._isString(o), i = Object.prototype.toString.call(o) === "[object CanvasGradient]" || o && o.addColorStop;
|
|
1365
|
-
return e || i || m.warn(
|
|
1365
|
+
return e || i || m.warn(vt(o) + ' is a not valid value for "' + t + '" attribute. The value should be a string or a native gradient.'), o;
|
|
1366
1366
|
};
|
|
1367
1367
|
}
|
|
1368
|
-
function
|
|
1369
|
-
if (
|
|
1368
|
+
function xs() {
|
|
1369
|
+
if (A.isUnminified)
|
|
1370
1370
|
return function(o, t) {
|
|
1371
1371
|
const e = Int8Array ? Object.getPrototypeOf(Int8Array) : null;
|
|
1372
1372
|
return e && o instanceof e || (m._isArray(o) ? o.forEach(function(i) {
|
|
1373
1373
|
m._isNumber(i) || m.warn('"' + t + '" attribute has non numeric element ' + i + ". Make sure that all elements are numbers.");
|
|
1374
|
-
}) : m.warn(
|
|
1374
|
+
}) : m.warn(vt(o) + ' is a not valid value for "' + t + '" attribute. The value should be a array of numbers.')), o;
|
|
1375
1375
|
};
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1378
|
-
if (
|
|
1377
|
+
function dt() {
|
|
1378
|
+
if (A.isUnminified)
|
|
1379
1379
|
return function(o, t) {
|
|
1380
|
-
return o === !0 || o === !1 || m.warn(
|
|
1380
|
+
return o === !0 || o === !1 || m.warn(vt(o) + ' is a not valid value for "' + t + '" attribute. The value should be a boolean.'), o;
|
|
1381
1381
|
};
|
|
1382
1382
|
}
|
|
1383
1383
|
function ks(o) {
|
|
1384
|
-
if (
|
|
1384
|
+
if (A.isUnminified)
|
|
1385
1385
|
return function(t, e) {
|
|
1386
|
-
return t == null || m.isObject(t) || m.warn(
|
|
1386
|
+
return t == null || m.isObject(t) || m.warn(vt(t) + ' is a not valid value for "' + e + '" attribute. The value should be an object with properties ' + o), t;
|
|
1387
1387
|
};
|
|
1388
1388
|
}
|
|
1389
1389
|
const zt = "get", Ht = "set", p = {
|
|
@@ -1468,7 +1468,7 @@ function Es(o) {
|
|
|
1468
1468
|
const n = parseFloat(s.replace("px", ""));
|
|
1469
1469
|
return function(r) {
|
|
1470
1470
|
this.blurRadius(n * 0.5);
|
|
1471
|
-
const a =
|
|
1471
|
+
const a = A.Filters;
|
|
1472
1472
|
a && a.Blur && a.Blur.call(this, r);
|
|
1473
1473
|
};
|
|
1474
1474
|
}
|
|
@@ -1476,7 +1476,7 @@ function Es(o) {
|
|
|
1476
1476
|
const n = s.includes("%") ? parseFloat(s) / 100 : parseFloat(s);
|
|
1477
1477
|
return function(r) {
|
|
1478
1478
|
this.brightness(n);
|
|
1479
|
-
const a =
|
|
1479
|
+
const a = A.Filters;
|
|
1480
1480
|
a && a.Brightness && a.Brightness.call(this, r);
|
|
1481
1481
|
};
|
|
1482
1482
|
}
|
|
@@ -1485,23 +1485,23 @@ function Es(o) {
|
|
|
1485
1485
|
return function(r) {
|
|
1486
1486
|
const a = 100 * (Math.sqrt(n) - 1);
|
|
1487
1487
|
this.contrast(a);
|
|
1488
|
-
const h =
|
|
1488
|
+
const h = A.Filters;
|
|
1489
1489
|
h && h.Contrast && h.Contrast.call(this, r);
|
|
1490
1490
|
};
|
|
1491
1491
|
}
|
|
1492
1492
|
case "grayscale":
|
|
1493
1493
|
return function(n) {
|
|
1494
|
-
const r =
|
|
1494
|
+
const r = A.Filters;
|
|
1495
1495
|
r && r.Grayscale && r.Grayscale.call(this, n);
|
|
1496
1496
|
};
|
|
1497
1497
|
case "sepia":
|
|
1498
1498
|
return function(n) {
|
|
1499
|
-
const r =
|
|
1499
|
+
const r = A.Filters;
|
|
1500
1500
|
r && r.Sepia && r.Sepia.call(this, n);
|
|
1501
1501
|
};
|
|
1502
1502
|
case "invert":
|
|
1503
1503
|
return function(n) {
|
|
1504
|
-
const r =
|
|
1504
|
+
const r = A.Filters;
|
|
1505
1505
|
r && r.Invert && r.Invert.call(this, n);
|
|
1506
1506
|
};
|
|
1507
1507
|
default:
|
|
@@ -1512,7 +1512,7 @@ function Es(o) {
|
|
|
1512
1512
|
return () => {
|
|
1513
1513
|
};
|
|
1514
1514
|
}
|
|
1515
|
-
const de = "absoluteOpacity", $e = "allEventListeners",
|
|
1515
|
+
const de = "absoluteOpacity", $e = "allEventListeners", gt = "absoluteTransform", Ze = "absoluteScale", kt = "canvas", Ps = "Change", As = "children", Ms = "konva", Ee = "listening", Rs = "mouseenter", Ls = "mouseleave", Ds = "pointerenter", Is = "pointerleave", Gs = "touchenter", Os = "touchleave", Ke = "set", Je = "Shape", ue = " ", Qe = "stage", _t = "transform", Bs = "Stage", Pe = "visible", Fs = [
|
|
1516
1516
|
"xChange.konva",
|
|
1517
1517
|
"yChange.konva",
|
|
1518
1518
|
"scaleXChange.konva",
|
|
@@ -1533,11 +1533,11 @@ class k {
|
|
|
1533
1533
|
return !1;
|
|
1534
1534
|
}
|
|
1535
1535
|
_clearCache(t) {
|
|
1536
|
-
(t === _t || t ===
|
|
1536
|
+
(t === _t || t === gt) && this._cache.get(t) ? this._cache.get(t).dirty = !0 : t ? this._cache.delete(t) : this._cache.clear();
|
|
1537
1537
|
}
|
|
1538
1538
|
_getCache(t, e) {
|
|
1539
1539
|
let i = this._cache.get(t);
|
|
1540
|
-
return (i === void 0 || (t === _t || t ===
|
|
1540
|
+
return (i === void 0 || (t === _t || t === gt) && i.dirty === !0) && (i = e.call(this), this._cache.set(t, i)), i;
|
|
1541
1541
|
}
|
|
1542
1542
|
_calculate(t, e, i) {
|
|
1543
1543
|
if (!this._attachedDepsListeners.get(t)) {
|
|
@@ -1549,15 +1549,15 @@ class k {
|
|
|
1549
1549
|
return this._getCache(t, i);
|
|
1550
1550
|
}
|
|
1551
1551
|
_getCanvasCache() {
|
|
1552
|
-
return this._cache.get(
|
|
1552
|
+
return this._cache.get(kt);
|
|
1553
1553
|
}
|
|
1554
1554
|
_clearSelfAndDescendantCache(t) {
|
|
1555
|
-
this._clearCache(t), t ===
|
|
1555
|
+
this._clearCache(t), t === gt && this.fire("absoluteTransformChange");
|
|
1556
1556
|
}
|
|
1557
1557
|
clearCache() {
|
|
1558
|
-
if (this._cache.has(
|
|
1559
|
-
const { scene: t, filter: e, hit: i } = this._cache.get(
|
|
1560
|
-
m.releaseCanvas(t._canvas, e._canvas, i._canvas), this._cache.delete(
|
|
1558
|
+
if (this._cache.has(kt)) {
|
|
1559
|
+
const { scene: t, filter: e, hit: i } = this._cache.get(kt);
|
|
1560
|
+
m.releaseCanvas(t._canvas, e._canvas, i._canvas), this._cache.delete(kt);
|
|
1561
1561
|
}
|
|
1562
1562
|
return this._clearSelfAndDescendantCache(), this._requestDraw(), this;
|
|
1563
1563
|
}
|
|
@@ -1575,34 +1575,34 @@ class k {
|
|
|
1575
1575
|
}
|
|
1576
1576
|
const d = Math.abs(Math.round(i.x) - a) > 0.5 ? 1 : 0, g = Math.abs(Math.round(i.y) - h) > 0.5 ? 1 : 0;
|
|
1577
1577
|
s += l * 2 + d, n += l * 2 + g, a -= l, h -= l;
|
|
1578
|
-
const f = new
|
|
1578
|
+
const f = new bt({
|
|
1579
1579
|
pixelRatio: r,
|
|
1580
1580
|
width: s,
|
|
1581
1581
|
height: n
|
|
1582
|
-
}),
|
|
1582
|
+
}), S = new bt({
|
|
1583
1583
|
pixelRatio: r,
|
|
1584
1584
|
width: 0,
|
|
1585
1585
|
height: 0,
|
|
1586
1586
|
willReadFrequently: !0
|
|
1587
|
-
}),
|
|
1587
|
+
}), C = new Ne({
|
|
1588
1588
|
pixelRatio: u,
|
|
1589
1589
|
width: s,
|
|
1590
1590
|
height: n
|
|
1591
|
-
}), y = f.getContext(), _ =
|
|
1591
|
+
}), y = f.getContext(), _ = C.getContext(), v = new bt({
|
|
1592
1592
|
width: f.width / f.pixelRatio + Math.abs(a),
|
|
1593
1593
|
height: f.height / f.pixelRatio + Math.abs(h),
|
|
1594
1594
|
pixelRatio: f.pixelRatio
|
|
1595
1595
|
}), b = v.getContext();
|
|
1596
|
-
return
|
|
1596
|
+
return C.isCache = !0, f.isCache = !0, this._cache.delete(kt), this._filterUpToDate = !1, e.imageSmoothingEnabled === !1 && (f.getContext()._context.imageSmoothingEnabled = !1, S.getContext()._context.imageSmoothingEnabled = !1), y.save(), _.save(), b.save(), y.translate(-a, -h), _.translate(-a, -h), b.translate(-a, -h), v.x = a, v.y = h, this._isUnderCache = !0, this._clearSelfAndDescendantCache(de), this._clearSelfAndDescendantCache(Ze), this.drawScene(f, this, v), this.drawHit(C, this), this._isUnderCache = !1, y.restore(), _.restore(), c && (y.save(), y.beginPath(), y.rect(0, 0, s, n), y.closePath(), y.setAttr("strokeStyle", "red"), y.setAttr("lineWidth", 5), y.stroke(), y.restore()), m.releaseCanvas(v._canvas), this._cache.set(kt, {
|
|
1597
1597
|
scene: f,
|
|
1598
|
-
filter:
|
|
1599
|
-
hit:
|
|
1598
|
+
filter: S,
|
|
1599
|
+
hit: C,
|
|
1600
1600
|
x: a,
|
|
1601
1601
|
y: h
|
|
1602
1602
|
}), this._requestDraw(), this;
|
|
1603
1603
|
}
|
|
1604
1604
|
isCached() {
|
|
1605
|
-
return this._cache.has(
|
|
1605
|
+
return this._cache.has(kt);
|
|
1606
1606
|
}
|
|
1607
1607
|
getClientRect(t) {
|
|
1608
1608
|
throw new Error('abstract "getClientRect" method call');
|
|
@@ -1710,10 +1710,10 @@ class k {
|
|
|
1710
1710
|
});
|
|
1711
1711
|
}
|
|
1712
1712
|
remove() {
|
|
1713
|
-
return this.isDragging() && this.stopDrag(),
|
|
1713
|
+
return this.isDragging() && this.stopDrag(), V._dragElements.delete(this._id), this._remove(), this;
|
|
1714
1714
|
}
|
|
1715
1715
|
_clearCaches() {
|
|
1716
|
-
this._clearSelfAndDescendantCache(
|
|
1716
|
+
this._clearSelfAndDescendantCache(gt), this._clearSelfAndDescendantCache(de), this._clearSelfAndDescendantCache(Ze), this._clearSelfAndDescendantCache(Qe), this._clearSelfAndDescendantCache(Pe), this._clearSelfAndDescendantCache(Ee);
|
|
1717
1717
|
}
|
|
1718
1718
|
_remove() {
|
|
1719
1719
|
this._clearCaches();
|
|
@@ -1742,7 +1742,7 @@ class k {
|
|
|
1742
1742
|
if (!t)
|
|
1743
1743
|
return this;
|
|
1744
1744
|
for (e in t)
|
|
1745
|
-
e !==
|
|
1745
|
+
e !== As && (i = Ke + m._capitalize(e), m._isFunction(this[i]) ? this[i](t[e]) : this._setAttr(e, t[e]));
|
|
1746
1746
|
}), this;
|
|
1747
1747
|
}
|
|
1748
1748
|
isListening() {
|
|
@@ -1755,7 +1755,7 @@ class k {
|
|
|
1755
1755
|
return i && i !== t && this !== t ? i._isListening(t) : !0;
|
|
1756
1756
|
}
|
|
1757
1757
|
isVisible() {
|
|
1758
|
-
return this._getCache(
|
|
1758
|
+
return this._getCache(Pe, this._isVisible);
|
|
1759
1759
|
}
|
|
1760
1760
|
_isVisible(t) {
|
|
1761
1761
|
if (!this.visible())
|
|
@@ -1768,10 +1768,10 @@ class k {
|
|
|
1768
1768
|
return this._isVisible(t) && this._isListening(t);
|
|
1769
1769
|
const i = this.getLayer();
|
|
1770
1770
|
let s = !1;
|
|
1771
|
-
|
|
1771
|
+
V._dragElements.forEach((r) => {
|
|
1772
1772
|
r.dragStatus === "dragging" && (r.node.nodeType === "Stage" || r.node.getLayer() === i) && (s = !0);
|
|
1773
1773
|
});
|
|
1774
|
-
const n = !e && !
|
|
1774
|
+
const n = !e && !A.hitOnDragEnabled && (s || A.isTransforming());
|
|
1775
1775
|
return this.isListening() && this.isVisible() && !n;
|
|
1776
1776
|
}
|
|
1777
1777
|
show() {
|
|
@@ -1800,7 +1800,7 @@ class k {
|
|
|
1800
1800
|
return t;
|
|
1801
1801
|
}
|
|
1802
1802
|
_batchTransformChanges(t) {
|
|
1803
|
-
this._batchingTransformChange = !0, t(), this._batchingTransformChange = !1, this._needClearTransformCache && (this._clearCache(_t), this._clearSelfAndDescendantCache(
|
|
1803
|
+
this._batchingTransformChange = !0, t(), this._batchingTransformChange = !1, this._needClearTransformCache && (this._clearCache(_t), this._clearSelfAndDescendantCache(gt)), this._needClearTransformCache = !1;
|
|
1804
1804
|
}
|
|
1805
1805
|
setPosition(t) {
|
|
1806
1806
|
return this._batchTransformChanges(() => {
|
|
@@ -1843,7 +1843,7 @@ class k {
|
|
|
1843
1843
|
return n.invert(), n.translate(t.x, t.y), t = {
|
|
1844
1844
|
x: this.attrs.x + n.getTranslation().x,
|
|
1845
1845
|
y: this.attrs.y + n.getTranslation().y
|
|
1846
|
-
}, this._setTransform(s), this.setPosition({ x: t.x, y: t.y }), this._clearCache(_t), this._clearSelfAndDescendantCache(
|
|
1846
|
+
}, this._setTransform(s), this.setPosition({ x: t.x, y: t.y }), this._clearCache(_t), this._clearSelfAndDescendantCache(gt), this;
|
|
1847
1847
|
}
|
|
1848
1848
|
_setTransform(t) {
|
|
1849
1849
|
let e;
|
|
@@ -1987,7 +1987,7 @@ class k {
|
|
|
1987
1987
|
return e.target = e.target || this, i ? this._fireAndBubble(t, e) : this._fire(t, e), this;
|
|
1988
1988
|
}
|
|
1989
1989
|
getAbsoluteTransform(t) {
|
|
1990
|
-
return t ? this._getAbsoluteTransform(t) : this._getCache(
|
|
1990
|
+
return t ? this._getAbsoluteTransform(t) : this._getCache(gt, this._getAbsoluteTransform);
|
|
1991
1991
|
}
|
|
1992
1992
|
_getAbsoluteTransform(t) {
|
|
1993
1993
|
let e;
|
|
@@ -1997,7 +1997,7 @@ class k {
|
|
|
1997
1997
|
s === "all" ? e.multiply(i.getTransform()) : s === "position" && e.translate(i.x() - i.offsetX(), i.y() - i.offsetY());
|
|
1998
1998
|
}, t), e;
|
|
1999
1999
|
{
|
|
2000
|
-
e = this._cache.get(
|
|
2000
|
+
e = this._cache.get(gt) || new at(), this.parent ? this.parent.getAbsoluteTransform().copyInto(e) : e.reset();
|
|
2001
2001
|
const i = this.transformsEnabled();
|
|
2002
2002
|
if (i === "all")
|
|
2003
2003
|
e.multiply(this.getTransform());
|
|
@@ -2028,7 +2028,7 @@ class k {
|
|
|
2028
2028
|
var t, e;
|
|
2029
2029
|
const i = this._cache.get(_t) || new at();
|
|
2030
2030
|
i.reset();
|
|
2031
|
-
const s = this.x(), n = this.y(), r =
|
|
2031
|
+
const s = this.x(), n = this.y(), r = A.getAngle(this.rotation()), a = (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, c = this.attrs.skewY || 0, u = this.attrs.offsetX || 0, d = this.attrs.offsetY || 0;
|
|
2032
2032
|
return (s !== 0 || n !== 0) && i.translate(s, n), r !== 0 && i.rotate(r), (l !== 0 || c !== 0) && i.skew(l, c), (a !== 1 || h !== 1) && i.scale(a, h), (u !== 0 || d !== 0) && i.translate(-1 * u, -1 * d), i.dirty = !1, i;
|
|
2033
2033
|
}
|
|
2034
2034
|
clone(t) {
|
|
@@ -2043,11 +2043,11 @@ class k {
|
|
|
2043
2043
|
}
|
|
2044
2044
|
_toKonvaCanvas(t) {
|
|
2045
2045
|
t = t || {};
|
|
2046
|
-
const e = this.getClientRect(), i = this.getStage(), s = t.x !== void 0 ? t.x : Math.floor(e.x), n = t.y !== void 0 ? t.y : Math.floor(e.y), r = t.pixelRatio || 1, a = new
|
|
2046
|
+
const e = this.getClientRect(), i = this.getStage(), s = t.x !== void 0 ? t.x : Math.floor(e.x), n = t.y !== void 0 ? t.y : Math.floor(e.y), r = t.pixelRatio || 1, a = new bt({
|
|
2047
2047
|
width: t.width || Math.ceil(e.width) || (i ? i.width() : 0),
|
|
2048
2048
|
height: t.height || Math.ceil(e.height) || (i ? i.height() : 0),
|
|
2049
2049
|
pixelRatio: r
|
|
2050
|
-
}), h = a.getContext(), l = new
|
|
2050
|
+
}), h = a.getContext(), l = new bt({
|
|
2051
2051
|
width: a.width / a.pixelRatio + Math.abs(s),
|
|
2052
2052
|
height: a.height / a.pixelRatio + Math.abs(n),
|
|
2053
2053
|
pixelRatio: a.pixelRatio
|
|
@@ -2102,7 +2102,7 @@ class k {
|
|
|
2102
2102
|
return this.nodeType;
|
|
2103
2103
|
}
|
|
2104
2104
|
getDragDistance() {
|
|
2105
|
-
return this.attrs.dragDistance !== void 0 ? this.attrs.dragDistance : this.parent ? this.parent.getDragDistance() :
|
|
2105
|
+
return this.attrs.dragDistance !== void 0 ? this.attrs.dragDistance : this.parent ? this.parent.getDragDistance() : A.dragDistance;
|
|
2106
2106
|
}
|
|
2107
2107
|
_off(t, e, i) {
|
|
2108
2108
|
let s = this.eventListeners[t], n, r, a;
|
|
@@ -2116,7 +2116,7 @@ class k {
|
|
|
2116
2116
|
}
|
|
2117
2117
|
}
|
|
2118
2118
|
_fireChangeEvent(t, e, i) {
|
|
2119
|
-
this._fire(t +
|
|
2119
|
+
this._fire(t + Ps, {
|
|
2120
2120
|
oldVal: e,
|
|
2121
2121
|
newVal: i
|
|
2122
2122
|
});
|
|
@@ -2139,11 +2139,11 @@ class k {
|
|
|
2139
2139
|
return i !== -1 && (e.splice(i, 1), this.name(e.join(" "))), this;
|
|
2140
2140
|
}
|
|
2141
2141
|
setAttr(t, e) {
|
|
2142
|
-
const i = this[
|
|
2142
|
+
const i = this[Ke + m._capitalize(t)];
|
|
2143
2143
|
return m._isFunction(i) ? i.call(this, e) : this._setAttr(t, e), this;
|
|
2144
2144
|
}
|
|
2145
2145
|
_requestDraw() {
|
|
2146
|
-
if (
|
|
2146
|
+
if (A.autoDrawEnabled) {
|
|
2147
2147
|
const t = this.getLayer() || this.getStage();
|
|
2148
2148
|
t == null || t.batchDraw();
|
|
2149
2149
|
}
|
|
@@ -2206,7 +2206,7 @@ class k {
|
|
|
2206
2206
|
if (!i)
|
|
2207
2207
|
return;
|
|
2208
2208
|
const n = i._getPointerById(e) || i._changedPointerPositions[0] || s;
|
|
2209
|
-
|
|
2209
|
+
V._dragElements.set(this._id, {
|
|
2210
2210
|
node: this,
|
|
2211
2211
|
startPointerPos: n,
|
|
2212
2212
|
offset: {
|
|
@@ -2218,8 +2218,8 @@ class k {
|
|
|
2218
2218
|
});
|
|
2219
2219
|
}
|
|
2220
2220
|
startDrag(t, e = !0) {
|
|
2221
|
-
|
|
2222
|
-
const i =
|
|
2221
|
+
V._dragElements.has(this._id) || this._createDragElement(t);
|
|
2222
|
+
const i = V._dragElements.get(this._id);
|
|
2223
2223
|
i.dragStatus = "dragging", this.fire("dragstart", {
|
|
2224
2224
|
type: "dragstart",
|
|
2225
2225
|
target: this,
|
|
@@ -2242,22 +2242,22 @@ class k {
|
|
|
2242
2242
|
(!this._lastPos || this._lastPos.x !== s.x || this._lastPos.y !== s.y) && (this.setAbsolutePosition(s), this._requestDraw()), this._lastPos = s;
|
|
2243
2243
|
}
|
|
2244
2244
|
stopDrag(t) {
|
|
2245
|
-
const e =
|
|
2246
|
-
e && (e.dragStatus = "stopped"),
|
|
2245
|
+
const e = V._dragElements.get(this._id);
|
|
2246
|
+
e && (e.dragStatus = "stopped"), V._endDragBefore(t), V._endDragAfter(t);
|
|
2247
2247
|
}
|
|
2248
2248
|
setDraggable(t) {
|
|
2249
2249
|
this._setAttr("draggable", t), this._dragChange();
|
|
2250
2250
|
}
|
|
2251
2251
|
isDragging() {
|
|
2252
|
-
const t =
|
|
2252
|
+
const t = V._dragElements.get(this._id);
|
|
2253
2253
|
return t ? t.dragStatus === "dragging" : !1;
|
|
2254
2254
|
}
|
|
2255
2255
|
_listenDrag() {
|
|
2256
2256
|
this._dragCleanup(), this.on("mousedown.konva touchstart.konva", function(t) {
|
|
2257
|
-
if (!(!(t.evt.button !== void 0) ||
|
|
2257
|
+
if (!(!(t.evt.button !== void 0) || A.dragButtons.indexOf(t.evt.button) >= 0) || this.isDragging())
|
|
2258
2258
|
return;
|
|
2259
2259
|
let s = !1;
|
|
2260
|
-
|
|
2260
|
+
V._dragElements.forEach((n) => {
|
|
2261
2261
|
this.isAncestorOf(n.node) && (s = !0);
|
|
2262
2262
|
}), s || this._createDragElement(t);
|
|
2263
2263
|
});
|
|
@@ -2268,8 +2268,8 @@ class k {
|
|
|
2268
2268
|
else {
|
|
2269
2269
|
if (this._dragCleanup(), !this.getStage())
|
|
2270
2270
|
return;
|
|
2271
|
-
const e =
|
|
2272
|
-
i ? this.stopDrag() : s &&
|
|
2271
|
+
const e = V._dragElements.get(this._id), i = e && e.dragStatus === "dragging", s = e && e.dragStatus === "ready";
|
|
2272
|
+
i ? this.stopDrag() : s && V._dragElements.delete(this._id);
|
|
2273
2273
|
}
|
|
2274
2274
|
}
|
|
2275
2275
|
_dragCleanup() {
|
|
@@ -2292,8 +2292,8 @@ class k {
|
|
|
2292
2292
|
}
|
|
2293
2293
|
static _createNode(t, e) {
|
|
2294
2294
|
let i = k.prototype.getClassName.call(t), s = t.children, n, r, a;
|
|
2295
|
-
e && (t.attrs.container = e),
|
|
2296
|
-
const h =
|
|
2295
|
+
e && (t.attrs.container = e), A[i] || (m.warn('Can not find a node with class name "' + i + '". Fallback to "Shape".'), i = "Shape");
|
|
2296
|
+
const h = A[i];
|
|
2297
2297
|
if (n = new h(t.attrs), s)
|
|
2298
2298
|
for (r = s.length, a = 0; a < r; a++)
|
|
2299
2299
|
n.add(k._createNode(s[a]));
|
|
@@ -2309,10 +2309,10 @@ k.prototype.on.call(k.prototype, Fs, function() {
|
|
|
2309
2309
|
this._needClearTransformCache = !0;
|
|
2310
2310
|
return;
|
|
2311
2311
|
}
|
|
2312
|
-
this._clearCache(_t), this._clearSelfAndDescendantCache(
|
|
2312
|
+
this._clearCache(_t), this._clearSelfAndDescendantCache(gt);
|
|
2313
2313
|
});
|
|
2314
2314
|
k.prototype.on.call(k.prototype, "visibleChange.konva", function() {
|
|
2315
|
-
this._clearSelfAndDescendantCache(
|
|
2315
|
+
this._clearSelfAndDescendantCache(Pe);
|
|
2316
2316
|
});
|
|
2317
2317
|
k.prototype.on.call(k.prototype, "listeningChange.konva", function() {
|
|
2318
2318
|
this._clearSelfAndDescendantCache(Ee);
|
|
@@ -2324,41 +2324,41 @@ const j = p.addGetterSetter;
|
|
|
2324
2324
|
j(k, "zIndex");
|
|
2325
2325
|
j(k, "absolutePosition");
|
|
2326
2326
|
j(k, "position");
|
|
2327
|
-
j(k, "x", 0,
|
|
2328
|
-
j(k, "y", 0,
|
|
2329
|
-
j(k, "globalCompositeOperation", "source-over",
|
|
2330
|
-
j(k, "opacity", 1,
|
|
2331
|
-
j(k, "name", "",
|
|
2332
|
-
j(k, "id", "",
|
|
2333
|
-
j(k, "rotation", 0,
|
|
2327
|
+
j(k, "x", 0, P());
|
|
2328
|
+
j(k, "y", 0, P());
|
|
2329
|
+
j(k, "globalCompositeOperation", "source-over", Pt());
|
|
2330
|
+
j(k, "opacity", 1, P());
|
|
2331
|
+
j(k, "name", "", Pt());
|
|
2332
|
+
j(k, "id", "", Pt());
|
|
2333
|
+
j(k, "rotation", 0, P());
|
|
2334
2334
|
p.addComponentsGetterSetter(k, "scale", ["x", "y"]);
|
|
2335
|
-
j(k, "scaleX", 1,
|
|
2336
|
-
j(k, "scaleY", 1,
|
|
2335
|
+
j(k, "scaleX", 1, P());
|
|
2336
|
+
j(k, "scaleY", 1, P());
|
|
2337
2337
|
p.addComponentsGetterSetter(k, "skew", ["x", "y"]);
|
|
2338
|
-
j(k, "skewX", 0,
|
|
2339
|
-
j(k, "skewY", 0,
|
|
2338
|
+
j(k, "skewX", 0, P());
|
|
2339
|
+
j(k, "skewY", 0, P());
|
|
2340
2340
|
p.addComponentsGetterSetter(k, "offset", ["x", "y"]);
|
|
2341
|
-
j(k, "offsetX", 0,
|
|
2342
|
-
j(k, "offsetY", 0,
|
|
2343
|
-
j(k, "dragDistance", void 0,
|
|
2344
|
-
j(k, "width", 0,
|
|
2345
|
-
j(k, "height", 0,
|
|
2346
|
-
j(k, "listening", !0,
|
|
2347
|
-
j(k, "preventDefault", !0,
|
|
2341
|
+
j(k, "offsetX", 0, P());
|
|
2342
|
+
j(k, "offsetY", 0, P());
|
|
2343
|
+
j(k, "dragDistance", void 0, P());
|
|
2344
|
+
j(k, "width", 0, P());
|
|
2345
|
+
j(k, "height", 0, P());
|
|
2346
|
+
j(k, "listening", !0, dt());
|
|
2347
|
+
j(k, "preventDefault", !0, dt());
|
|
2348
2348
|
j(k, "filters", void 0, function(o) {
|
|
2349
2349
|
return this._filterUpToDate = !1, o;
|
|
2350
2350
|
});
|
|
2351
|
-
j(k, "visible", !0,
|
|
2352
|
-
j(k, "transformsEnabled", "all",
|
|
2351
|
+
j(k, "visible", !0, dt());
|
|
2352
|
+
j(k, "transformsEnabled", "all", Pt());
|
|
2353
2353
|
j(k, "size");
|
|
2354
2354
|
j(k, "dragBoundFunc");
|
|
2355
|
-
j(k, "draggable", !1,
|
|
2355
|
+
j(k, "draggable", !1, dt());
|
|
2356
2356
|
p.backCompat(k, {
|
|
2357
2357
|
rotateDeg: "rotate",
|
|
2358
2358
|
setRotationDeg: "setRotation",
|
|
2359
2359
|
getRotationDeg: "getRotation"
|
|
2360
2360
|
});
|
|
2361
|
-
class
|
|
2361
|
+
class ht extends k {
|
|
2362
2362
|
constructor() {
|
|
2363
2363
|
super(...arguments), this.children = [];
|
|
2364
2364
|
}
|
|
@@ -2491,14 +2491,14 @@ class ot extends k {
|
|
|
2491
2491
|
const g = this.getAbsoluteTransform(i);
|
|
2492
2492
|
let f = g.getMatrix();
|
|
2493
2493
|
r.transform(f[0], f[1], f[2], f[3], f[4], f[5]), r.beginPath();
|
|
2494
|
-
let
|
|
2494
|
+
let S;
|
|
2495
2495
|
if (l)
|
|
2496
|
-
|
|
2496
|
+
S = l.call(this, r, this);
|
|
2497
2497
|
else {
|
|
2498
|
-
const
|
|
2499
|
-
r.rect(
|
|
2498
|
+
const C = this.clipX(), y = this.clipY();
|
|
2499
|
+
r.rect(C || 0, y || 0, a, h);
|
|
2500
2500
|
}
|
|
2501
|
-
r.clip.apply(r,
|
|
2501
|
+
r.clip.apply(r, S), f = g.copy().invert().getMatrix(), r.transform(f[0], f[1], f[2], f[3], f[4], f[5]);
|
|
2502
2502
|
}
|
|
2503
2503
|
const d = !u && this.globalCompositeOperation() !== "source-over" && t === "drawScene";
|
|
2504
2504
|
d && (r.save(), r._applyGlobalCompositeOperation(this)), (n = this.children) === null || n === void 0 || n.forEach(function(g) {
|
|
@@ -2545,18 +2545,18 @@ class ot extends k {
|
|
|
2545
2545
|
}, i ? l : this._transformedRect(l, s);
|
|
2546
2546
|
}
|
|
2547
2547
|
}
|
|
2548
|
-
p.addComponentsGetterSetter(
|
|
2548
|
+
p.addComponentsGetterSetter(ht, "clip", [
|
|
2549
2549
|
"x",
|
|
2550
2550
|
"y",
|
|
2551
2551
|
"width",
|
|
2552
2552
|
"height"
|
|
2553
2553
|
]);
|
|
2554
|
-
p.addGetterSetter(
|
|
2555
|
-
p.addGetterSetter(
|
|
2556
|
-
p.addGetterSetter(
|
|
2557
|
-
p.addGetterSetter(
|
|
2558
|
-
p.addGetterSetter(
|
|
2559
|
-
const Qt = /* @__PURE__ */ new Map(),
|
|
2554
|
+
p.addGetterSetter(ht, "clipX", void 0, P());
|
|
2555
|
+
p.addGetterSetter(ht, "clipY", void 0, P());
|
|
2556
|
+
p.addGetterSetter(ht, "clipWidth", void 0, P());
|
|
2557
|
+
p.addGetterSetter(ht, "clipHeight", void 0, P());
|
|
2558
|
+
p.addGetterSetter(ht, "clipFunc");
|
|
2559
|
+
const Qt = /* @__PURE__ */ new Map(), Si = A._global.PointerEvent !== void 0;
|
|
2560
2560
|
function _e(o) {
|
|
2561
2561
|
return Qt.get(o);
|
|
2562
2562
|
}
|
|
@@ -2566,47 +2566,47 @@ function He(o) {
|
|
|
2566
2566
|
pointerId: o.pointerId
|
|
2567
2567
|
};
|
|
2568
2568
|
}
|
|
2569
|
-
function
|
|
2569
|
+
function Ci(o, t) {
|
|
2570
2570
|
return Qt.get(o) === t;
|
|
2571
2571
|
}
|
|
2572
2572
|
function bi(o, t) {
|
|
2573
|
-
$t(o), t.getStage() && (Qt.set(o, t),
|
|
2573
|
+
$t(o), t.getStage() && (Qt.set(o, t), Si && t._fire("gotpointercapture", He(new PointerEvent("gotpointercapture"))));
|
|
2574
2574
|
}
|
|
2575
2575
|
function $t(o, t) {
|
|
2576
2576
|
const e = Qt.get(o);
|
|
2577
2577
|
if (!e)
|
|
2578
2578
|
return;
|
|
2579
2579
|
const i = e.getStage();
|
|
2580
|
-
i && i.content, Qt.delete(o),
|
|
2580
|
+
i && i.content, Qt.delete(o), Si && e._fire("lostpointercapture", He(new PointerEvent("lostpointercapture")));
|
|
2581
2581
|
}
|
|
2582
|
-
const zs = "Stage", Hs = "string", ti = "px", Ws = "mouseout", vi = "mouseleave", Ti = "mouseover",
|
|
2583
|
-
[
|
|
2582
|
+
const zs = "Stage", Hs = "string", ti = "px", Ws = "mouseout", vi = "mouseleave", Ti = "mouseover", wi = "mouseenter", xi = "mousemove", ki = "mousedown", Ei = "mouseup", Vt = "pointermove", Ut = "pointerdown", Gt = "pointerup", Yt = "pointercancel", Xs = "lostpointercapture", ne = "pointerout", jt = "pointerleave", re = "pointerover", ae = "pointerenter", Ae = "contextmenu", Pi = "touchstart", Ai = "touchend", Mi = "touchmove", Ri = "touchcancel", Me = "wheel", Vs = 5, Us = [
|
|
2583
|
+
[wi, "_pointerenter"],
|
|
2584
2584
|
[ki, "_pointerdown"],
|
|
2585
|
-
[
|
|
2585
|
+
[xi, "_pointermove"],
|
|
2586
2586
|
[Ei, "_pointerup"],
|
|
2587
2587
|
[vi, "_pointerleave"],
|
|
2588
|
-
[
|
|
2588
|
+
[Pi, "_pointerdown"],
|
|
2589
2589
|
[Mi, "_pointermove"],
|
|
2590
|
-
[
|
|
2590
|
+
[Ai, "_pointerup"],
|
|
2591
2591
|
[Ri, "_pointercancel"],
|
|
2592
2592
|
[Ti, "_pointerover"],
|
|
2593
2593
|
[Me, "_wheel"],
|
|
2594
|
-
[
|
|
2595
|
-
[
|
|
2596
|
-
[
|
|
2597
|
-
[
|
|
2594
|
+
[Ae, "_contextmenu"],
|
|
2595
|
+
[Ut, "_pointerdown"],
|
|
2596
|
+
[Vt, "_pointermove"],
|
|
2597
|
+
[Gt, "_pointerup"],
|
|
2598
2598
|
[Yt, "_pointercancel"],
|
|
2599
2599
|
[jt, "_pointerleave"],
|
|
2600
2600
|
[Xs, "_lostpointercapture"]
|
|
2601
|
-
],
|
|
2601
|
+
], Se = {
|
|
2602
2602
|
mouse: {
|
|
2603
2603
|
[ne]: Ws,
|
|
2604
2604
|
[jt]: vi,
|
|
2605
2605
|
[re]: Ti,
|
|
2606
|
-
[ae]:
|
|
2607
|
-
[
|
|
2608
|
-
[
|
|
2609
|
-
[
|
|
2606
|
+
[ae]: wi,
|
|
2607
|
+
[Vt]: xi,
|
|
2608
|
+
[Ut]: ki,
|
|
2609
|
+
[Gt]: Ei,
|
|
2610
2610
|
[Yt]: "mousecancel",
|
|
2611
2611
|
pointerclick: "click",
|
|
2612
2612
|
pointerdblclick: "dblclick"
|
|
@@ -2616,9 +2616,9 @@ const zs = "Stage", Hs = "string", ti = "px", Ws = "mouseout", vi = "mouseleave"
|
|
|
2616
2616
|
[jt]: "touchleave",
|
|
2617
2617
|
[re]: "touchover",
|
|
2618
2618
|
[ae]: "touchenter",
|
|
2619
|
-
[
|
|
2620
|
-
[
|
|
2621
|
-
[
|
|
2619
|
+
[Vt]: Mi,
|
|
2620
|
+
[Ut]: Pi,
|
|
2621
|
+
[Gt]: Ai,
|
|
2622
2622
|
[Yt]: Ri,
|
|
2623
2623
|
pointerclick: "tap",
|
|
2624
2624
|
pointerdblclick: "dbltap"
|
|
@@ -2628,29 +2628,29 @@ const zs = "Stage", Hs = "string", ti = "px", Ws = "mouseout", vi = "mouseleave"
|
|
|
2628
2628
|
[jt]: jt,
|
|
2629
2629
|
[re]: re,
|
|
2630
2630
|
[ae]: ae,
|
|
2631
|
-
[Ut]: Ut,
|
|
2632
2631
|
[Vt]: Vt,
|
|
2633
|
-
[
|
|
2632
|
+
[Ut]: Ut,
|
|
2633
|
+
[Gt]: Gt,
|
|
2634
2634
|
[Yt]: Yt,
|
|
2635
2635
|
pointerclick: "pointerclick",
|
|
2636
2636
|
pointerdblclick: "pointerdblclick"
|
|
2637
2637
|
}
|
|
2638
|
-
}, qt = (o) => o.indexOf("pointer") >= 0 ? "pointer" : o.indexOf("touch") >= 0 ? "touch" : "mouse",
|
|
2638
|
+
}, qt = (o) => o.indexOf("pointer") >= 0 ? "pointer" : o.indexOf("touch") >= 0 ? "touch" : "mouse", Dt = (o) => {
|
|
2639
2639
|
const t = qt(o);
|
|
2640
2640
|
if (t === "pointer")
|
|
2641
|
-
return
|
|
2641
|
+
return A.pointerEventsEnabled && Se.pointer;
|
|
2642
2642
|
if (t === "touch")
|
|
2643
|
-
return
|
|
2643
|
+
return Se.touch;
|
|
2644
2644
|
if (t === "mouse")
|
|
2645
|
-
return
|
|
2645
|
+
return Se.mouse;
|
|
2646
2646
|
};
|
|
2647
2647
|
function ei(o = {}) {
|
|
2648
2648
|
return (o.clipFunc || o.clipWidth || o.clipHeight) && m.warn("Stage does not support clipping. Please use clip for Layers or Groups."), o;
|
|
2649
2649
|
}
|
|
2650
|
-
const Ys = "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);",
|
|
2651
|
-
class me extends
|
|
2650
|
+
const Ys = "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);", Zt = [];
|
|
2651
|
+
class me extends ht {
|
|
2652
2652
|
constructor(t) {
|
|
2653
|
-
super(ei(t)), this._pointerPositions = [], this._changedPointerPositions = [], this._buildDOM(), this._bindContentEvents(),
|
|
2653
|
+
super(ei(t)), this._pointerPositions = [], this._changedPointerPositions = [], this._buildDOM(), this._bindContentEvents(), Zt.push(this), this.on("widthChange.konva heightChange.konva", this._resizeDOM), this.on("visibleChange.konva", this._checkVisibility), this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva", () => {
|
|
2654
2654
|
ei(this.attrs);
|
|
2655
2655
|
}), this._checkVisibility();
|
|
2656
2656
|
}
|
|
@@ -2687,14 +2687,14 @@ class me extends ot {
|
|
|
2687
2687
|
return this;
|
|
2688
2688
|
}
|
|
2689
2689
|
clone(t) {
|
|
2690
|
-
return t || (t = {}), t.container = typeof document < "u" && document.createElement("div"),
|
|
2690
|
+
return t || (t = {}), t.container = typeof document < "u" && document.createElement("div"), ht.prototype.clone.call(this, t);
|
|
2691
2691
|
}
|
|
2692
2692
|
destroy() {
|
|
2693
2693
|
super.destroy();
|
|
2694
2694
|
const t = this.content;
|
|
2695
2695
|
t && m._isInDocument(t) && this.container().removeChild(t);
|
|
2696
|
-
const e =
|
|
2697
|
-
return e > -1 &&
|
|
2696
|
+
const e = Zt.indexOf(this);
|
|
2697
|
+
return e > -1 && Zt.splice(e, 1), m.releaseCanvas(this.bufferCanvas._canvas, this.bufferHitCanvas._canvas), this;
|
|
2698
2698
|
}
|
|
2699
2699
|
getPointerPosition() {
|
|
2700
2700
|
const t = this._pointerPositions[0] || this._changedPointerPositions[0];
|
|
@@ -2717,7 +2717,7 @@ class me extends ot {
|
|
|
2717
2717
|
}
|
|
2718
2718
|
_toKonvaCanvas(t) {
|
|
2719
2719
|
t = { ...t }, t.x = t.x || 0, t.y = t.y || 0, t.width = t.width || this.width(), t.height = t.height || this.height();
|
|
2720
|
-
const e = new
|
|
2720
|
+
const e = new bt({
|
|
2721
2721
|
width: t.width,
|
|
2722
2722
|
height: t.height,
|
|
2723
2723
|
pixelRatio: t.pixelRatio || 1
|
|
@@ -2754,7 +2754,7 @@ class me extends ot {
|
|
|
2754
2754
|
}
|
|
2755
2755
|
super.add(t);
|
|
2756
2756
|
const i = this.children.length;
|
|
2757
|
-
return i >
|
|
2757
|
+
return i > Vs && m.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(), A.isBrowser && this.content.appendChild(t.canvas._canvas), this;
|
|
2758
2758
|
}
|
|
2759
2759
|
getParent() {
|
|
2760
2760
|
return null;
|
|
@@ -2763,7 +2763,7 @@ class me extends ot {
|
|
|
2763
2763
|
return null;
|
|
2764
2764
|
}
|
|
2765
2765
|
hasPointerCapture(t) {
|
|
2766
|
-
return
|
|
2766
|
+
return Ci(t, this);
|
|
2767
2767
|
}
|
|
2768
2768
|
setPointerCapture(t) {
|
|
2769
2769
|
bi(t, this);
|
|
@@ -2775,7 +2775,7 @@ class me extends ot {
|
|
|
2775
2775
|
return this.children;
|
|
2776
2776
|
}
|
|
2777
2777
|
_bindContentEvents() {
|
|
2778
|
-
|
|
2778
|
+
A.isBrowser && Us.forEach(([t, e]) => {
|
|
2779
2779
|
this.content.addEventListener(t, (i) => {
|
|
2780
2780
|
this[e](i);
|
|
2781
2781
|
}, { passive: !1 });
|
|
@@ -2783,7 +2783,7 @@ class me extends ot {
|
|
|
2783
2783
|
}
|
|
2784
2784
|
_pointerenter(t) {
|
|
2785
2785
|
this.setPointersPositions(t);
|
|
2786
|
-
const e =
|
|
2786
|
+
const e = Dt(t.type);
|
|
2787
2787
|
e && this._fire(e.pointerenter, {
|
|
2788
2788
|
evt: t,
|
|
2789
2789
|
target: this,
|
|
@@ -2792,7 +2792,7 @@ class me extends ot {
|
|
|
2792
2792
|
}
|
|
2793
2793
|
_pointerover(t) {
|
|
2794
2794
|
this.setPointersPositions(t);
|
|
2795
|
-
const e =
|
|
2795
|
+
const e = Dt(t.type);
|
|
2796
2796
|
e && this._fire(e.pointerover, {
|
|
2797
2797
|
evt: t,
|
|
2798
2798
|
target: this,
|
|
@@ -2804,11 +2804,11 @@ class me extends ot {
|
|
|
2804
2804
|
return e && !e.getStage() && (e = null), e;
|
|
2805
2805
|
}
|
|
2806
2806
|
_pointerleave(t) {
|
|
2807
|
-
const e =
|
|
2807
|
+
const e = Dt(t.type), i = qt(t.type);
|
|
2808
2808
|
if (!e)
|
|
2809
2809
|
return;
|
|
2810
2810
|
this.setPointersPositions(t);
|
|
2811
|
-
const s = this._getTargetShape(i), n = !(
|
|
2811
|
+
const s = this._getTargetShape(i), n = !(A.isDragging() || A.isTransforming()) || A.hitOnDragEnabled;
|
|
2812
2812
|
s && n ? (s._fireAndBubble(e.pointerout, { evt: t }), s._fireAndBubble(e.pointerleave, { evt: t }), this._fire(e.pointerleave, {
|
|
2813
2813
|
evt: t,
|
|
2814
2814
|
target: this,
|
|
@@ -2824,18 +2824,18 @@ class me extends ot {
|
|
|
2824
2824
|
})), this.pointerPos = null, this._pointerPositions = [];
|
|
2825
2825
|
}
|
|
2826
2826
|
_pointerdown(t) {
|
|
2827
|
-
const e =
|
|
2827
|
+
const e = Dt(t.type), i = qt(t.type);
|
|
2828
2828
|
if (!e)
|
|
2829
2829
|
return;
|
|
2830
2830
|
this.setPointersPositions(t);
|
|
2831
2831
|
let s = !1;
|
|
2832
2832
|
this._changedPointerPositions.forEach((n) => {
|
|
2833
2833
|
const r = this.getIntersection(n);
|
|
2834
|
-
if (
|
|
2834
|
+
if (V.justDragged = !1, A["_" + i + "ListenClick"] = !0, !r || !r.isListening()) {
|
|
2835
2835
|
this[i + "ClickStartShape"] = void 0;
|
|
2836
2836
|
return;
|
|
2837
2837
|
}
|
|
2838
|
-
|
|
2838
|
+
A.capturePointerEventsEnabled && r.setPointerCapture(n.id), this[i + "ClickStartShape"] = r, r._fireAndBubble(e.pointerdown, {
|
|
2839
2839
|
evt: t,
|
|
2840
2840
|
pointerId: n.id
|
|
2841
2841
|
}), s = !0;
|
|
@@ -2849,11 +2849,11 @@ class me extends ot {
|
|
|
2849
2849
|
});
|
|
2850
2850
|
}
|
|
2851
2851
|
_pointermove(t) {
|
|
2852
|
-
const e =
|
|
2852
|
+
const e = Dt(t.type), i = qt(t.type);
|
|
2853
2853
|
if (!e)
|
|
2854
2854
|
return;
|
|
2855
2855
|
const s = t.type.indexOf("touch") >= 0 || t.pointerType === "touch";
|
|
2856
|
-
if (
|
|
2856
|
+
if (A.isDragging() && V.node.preventDefault() && t.cancelable && s && t.preventDefault(), this.setPointersPositions(t), !(!(A.isDragging() || A.isTransforming()) || A.hitOnDragEnabled))
|
|
2857
2857
|
return;
|
|
2858
2858
|
const r = {};
|
|
2859
2859
|
let a = !1;
|
|
@@ -2879,7 +2879,7 @@ class me extends ot {
|
|
|
2879
2879
|
});
|
|
2880
2880
|
}
|
|
2881
2881
|
_pointerup(t) {
|
|
2882
|
-
const e =
|
|
2882
|
+
const e = Dt(t.type), i = qt(t.type);
|
|
2883
2883
|
if (!e)
|
|
2884
2884
|
return;
|
|
2885
2885
|
this.setPointersPositions(t);
|
|
@@ -2894,14 +2894,14 @@ class me extends ot {
|
|
|
2894
2894
|
}
|
|
2895
2895
|
const c = h.id, u = { evt: t, pointerId: c };
|
|
2896
2896
|
let d = !1;
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
},
|
|
2897
|
+
A["_" + i + "InDblClickWindow"] ? (d = !0, clearTimeout(this[i + "DblTimeout"])) : V.justDragged || (A["_" + i + "InDblClickWindow"] = !0, clearTimeout(this[i + "DblTimeout"])), this[i + "DblTimeout"] = setTimeout(function() {
|
|
2898
|
+
A["_" + i + "InDblClickWindow"] = !1;
|
|
2899
|
+
}, A.dblClickWindow), l && l.isListening() ? (a = !0, this[i + "ClickEndShape"] = l, l._fireAndBubble(e.pointerup, { ...u }), A["_" + i + "ListenClick"] && s && s === l && (l._fireAndBubble(e.pointerclick, { ...u }), d && n && n === l && l._fireAndBubble(e.pointerdblclick, { ...u }))) : (this[i + "ClickEndShape"] = null, a || (this._fire(e.pointerup, {
|
|
2900
2900
|
evt: t,
|
|
2901
2901
|
target: this,
|
|
2902
2902
|
currentTarget: this,
|
|
2903
2903
|
pointerId: this._changedPointerPositions[0].id
|
|
2904
|
-
}), a = !0),
|
|
2904
|
+
}), a = !0), A["_" + i + "ListenClick"] && this._fire(e.pointerclick, {
|
|
2905
2905
|
evt: t,
|
|
2906
2906
|
target: this,
|
|
2907
2907
|
currentTarget: this,
|
|
@@ -2917,12 +2917,12 @@ class me extends ot {
|
|
|
2917
2917
|
target: this,
|
|
2918
2918
|
currentTarget: this,
|
|
2919
2919
|
pointerId: this._changedPointerPositions[0].id
|
|
2920
|
-
}),
|
|
2920
|
+
}), A["_" + i + "ListenClick"] = !1, t.cancelable && i !== "touch" && i !== "pointer" && t.preventDefault();
|
|
2921
2921
|
}
|
|
2922
2922
|
_contextmenu(t) {
|
|
2923
2923
|
this.setPointersPositions(t);
|
|
2924
2924
|
const e = this.getIntersection(this.getPointerPosition());
|
|
2925
|
-
e && e.isListening() ? e._fireAndBubble(
|
|
2925
|
+
e && e.isListening() ? e._fireAndBubble(Ae, { evt: t }) : this._fire(Ae, {
|
|
2926
2926
|
evt: t,
|
|
2927
2927
|
target: this,
|
|
2928
2928
|
currentTarget: this
|
|
@@ -2940,7 +2940,7 @@ class me extends ot {
|
|
|
2940
2940
|
_pointercancel(t) {
|
|
2941
2941
|
this.setPointersPositions(t);
|
|
2942
2942
|
const e = _e(t.pointerId) || this.getIntersection(this.getPointerPosition());
|
|
2943
|
-
e && e._fireAndBubble(
|
|
2943
|
+
e && e._fireAndBubble(Gt, He(t)), $t(t.pointerId);
|
|
2944
2944
|
}
|
|
2945
2945
|
_lostpointercapture(t) {
|
|
2946
2946
|
$t(t.pointerId);
|
|
@@ -2987,14 +2987,14 @@ class me extends ot {
|
|
|
2987
2987
|
};
|
|
2988
2988
|
}
|
|
2989
2989
|
_buildDOM() {
|
|
2990
|
-
if (this.bufferCanvas = new
|
|
2990
|
+
if (this.bufferCanvas = new bt({
|
|
2991
2991
|
width: this.width(),
|
|
2992
2992
|
height: this.height()
|
|
2993
2993
|
}), this.bufferHitCanvas = new Ne({
|
|
2994
2994
|
pixelRatio: 1,
|
|
2995
2995
|
width: this.width(),
|
|
2996
2996
|
height: this.height()
|
|
2997
|
-
}), !
|
|
2997
|
+
}), !A.isBrowser)
|
|
2998
2998
|
return;
|
|
2999
2999
|
const t = this.container();
|
|
3000
3000
|
if (!t)
|
|
@@ -3016,17 +3016,17 @@ class me extends ot {
|
|
|
3016
3016
|
me.prototype.nodeType = zs;
|
|
3017
3017
|
tt(me);
|
|
3018
3018
|
p.addGetterSetter(me, "container");
|
|
3019
|
-
|
|
3020
|
-
|
|
3019
|
+
A.isBrowser && document.addEventListener("visibilitychange", () => {
|
|
3020
|
+
Zt.forEach((o) => {
|
|
3021
3021
|
o.batchDraw();
|
|
3022
3022
|
});
|
|
3023
3023
|
});
|
|
3024
3024
|
const Li = "hasShadow", Di = "shadowRGBA", Ii = "patternImage", Gi = "linearGradient", Oi = "radialGradient";
|
|
3025
3025
|
let oe;
|
|
3026
|
-
function
|
|
3026
|
+
function Ce() {
|
|
3027
3027
|
return oe || (oe = m.createCanvasElement().getContext("2d"), oe);
|
|
3028
3028
|
}
|
|
3029
|
-
const
|
|
3029
|
+
const Kt = {};
|
|
3030
3030
|
function js(o) {
|
|
3031
3031
|
const t = this.attrs.fillRule;
|
|
3032
3032
|
t ? o.fill(t) : o.fill();
|
|
@@ -3038,10 +3038,10 @@ function $s(o) {
|
|
|
3038
3038
|
const t = this.attrs.fillRule;
|
|
3039
3039
|
t ? o.fill(t) : o.fill();
|
|
3040
3040
|
}
|
|
3041
|
-
function
|
|
3041
|
+
function Zs(o) {
|
|
3042
3042
|
o.stroke();
|
|
3043
3043
|
}
|
|
3044
|
-
function
|
|
3044
|
+
function Ks() {
|
|
3045
3045
|
this._clearCache(Li);
|
|
3046
3046
|
}
|
|
3047
3047
|
function Js() {
|
|
@@ -3056,16 +3056,16 @@ function tn() {
|
|
|
3056
3056
|
function en() {
|
|
3057
3057
|
this._clearCache(Oi);
|
|
3058
3058
|
}
|
|
3059
|
-
class
|
|
3059
|
+
class x extends k {
|
|
3060
3060
|
constructor(t) {
|
|
3061
3061
|
super(t);
|
|
3062
3062
|
let e, i = 0;
|
|
3063
|
-
for (; e = m.getHitColor(), !(e && !(e in
|
|
3063
|
+
for (; e = m.getHitColor(), !(e && !(e in Kt)); )
|
|
3064
3064
|
if (i++, i >= 1e4) {
|
|
3065
3065
|
m.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 = m.getRandomColor();
|
|
3066
3066
|
break;
|
|
3067
3067
|
}
|
|
3068
|
-
this.colorKey = e,
|
|
3068
|
+
this.colorKey = e, Kt[e] = this;
|
|
3069
3069
|
}
|
|
3070
3070
|
getContext() {
|
|
3071
3071
|
return m.warn("shape.getContext() method is deprecated. Please do not use it."), this.getLayer().getContext();
|
|
@@ -3090,10 +3090,10 @@ class w extends k {
|
|
|
3090
3090
|
}
|
|
3091
3091
|
__getFillPattern() {
|
|
3092
3092
|
if (this.fillPatternImage()) {
|
|
3093
|
-
const e =
|
|
3093
|
+
const e = Ce().createPattern(this.fillPatternImage(), this.fillPatternRepeat() || "repeat");
|
|
3094
3094
|
if (e && e.setTransform) {
|
|
3095
3095
|
const i = new at();
|
|
3096
|
-
i.translate(this.fillPatternX(), this.fillPatternY()), i.rotate(
|
|
3096
|
+
i.translate(this.fillPatternX(), this.fillPatternY()), i.rotate(A.getAngle(this.fillPatternRotation())), i.scale(this.fillPatternScaleX(), this.fillPatternScaleY()), i.translate(-1 * this.fillPatternOffsetX(), -1 * this.fillPatternOffsetY());
|
|
3097
3097
|
const s = i.getMatrix(), n = typeof DOMMatrix > "u" ? {
|
|
3098
3098
|
a: s[0],
|
|
3099
3099
|
b: s[1],
|
|
@@ -3113,7 +3113,7 @@ class w extends k {
|
|
|
3113
3113
|
__getLinearGradient() {
|
|
3114
3114
|
const t = this.fillLinearGradientColorStops();
|
|
3115
3115
|
if (t) {
|
|
3116
|
-
const e =
|
|
3116
|
+
const e = Ce(), i = this.fillLinearGradientStartPoint(), s = this.fillLinearGradientEndPoint(), n = e.createLinearGradient(i.x, i.y, s.x, s.y);
|
|
3117
3117
|
for (let r = 0; r < t.length; r += 2)
|
|
3118
3118
|
n.addColorStop(t[r], t[r + 1]);
|
|
3119
3119
|
return n;
|
|
@@ -3125,7 +3125,7 @@ class w extends k {
|
|
|
3125
3125
|
__getRadialGradient() {
|
|
3126
3126
|
const t = this.fillRadialGradientColorStops();
|
|
3127
3127
|
if (t) {
|
|
3128
|
-
const e =
|
|
3128
|
+
const e = Ce(), i = this.fillRadialGradientStartPoint(), s = this.fillRadialGradientEndPoint(), n = e.createRadialGradient(i.x, i.y, this.fillRadialGradientStartRadius(), s.x, s.y, this.fillRadialGradientEndRadius());
|
|
3129
3129
|
for (let r = 0; r < t.length; r += 2)
|
|
3130
3130
|
n.addColorStop(t[r], t[r + 1]);
|
|
3131
3131
|
return n;
|
|
@@ -3170,7 +3170,7 @@ class w extends k {
|
|
|
3170
3170
|
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;
|
|
3171
3171
|
}
|
|
3172
3172
|
destroy() {
|
|
3173
|
-
return k.prototype.destroy.call(this), delete
|
|
3173
|
+
return k.prototype.destroy.call(this), delete Kt[this.colorKey], delete this.colorKey, this;
|
|
3174
3174
|
}
|
|
3175
3175
|
_useBufferCanvas(t) {
|
|
3176
3176
|
var e;
|
|
@@ -3206,11 +3206,11 @@ class w extends k {
|
|
|
3206
3206
|
}
|
|
3207
3207
|
i = i.getParent();
|
|
3208
3208
|
}
|
|
3209
|
-
const s = t.skipTransform, n = t.relativeTo || e && this.getStage() || void 0, r = this.getSelfRect(), h = !t.skipStroke && this.hasStroke() && this.strokeWidth() || 0, l = r.width + h, c = r.height + h, u = !t.skipShadow && this.hasShadow(), d = u ? this.shadowOffsetX() : 0, g = u ? this.shadowOffsetY() : 0, f = l + Math.abs(d),
|
|
3209
|
+
const s = t.skipTransform, n = t.relativeTo || e && this.getStage() || void 0, r = this.getSelfRect(), h = !t.skipStroke && this.hasStroke() && this.strokeWidth() || 0, l = r.width + h, c = r.height + h, u = !t.skipShadow && this.hasShadow(), d = u ? this.shadowOffsetX() : 0, g = u ? this.shadowOffsetY() : 0, f = l + Math.abs(d), S = c + Math.abs(g), C = u && this.shadowBlur() || 0, y = f + C * 2, _ = S + C * 2, v = {
|
|
3210
3210
|
width: y,
|
|
3211
3211
|
height: _,
|
|
3212
|
-
x: -(h / 2 +
|
|
3213
|
-
y: -(h / 2 +
|
|
3212
|
+
x: -(h / 2 + C) + Math.min(d, 0) + r.x,
|
|
3213
|
+
y: -(h / 2 + C) + Math.min(g, 0) + r.y
|
|
3214
3214
|
};
|
|
3215
3215
|
return s ? v : this._transformedRect(v, n);
|
|
3216
3216
|
}
|
|
@@ -3233,8 +3233,8 @@ class w extends k {
|
|
|
3233
3233
|
i ? (g.save(), g.setTransform(1, 0, 0, 1, 0, 0), g.clearRect(0, 0, d.width, d.height), g.restore()) : g.clear(), g.save(), g._applyLineJoin(this), g._applyMiterLimit(this);
|
|
3234
3234
|
const f = this.getAbsoluteTransform(e).getMatrix();
|
|
3235
3235
|
g.transform(f[0], f[1], f[2], f[3], f[4], f[5]), h.call(this, g, this), g.restore();
|
|
3236
|
-
const
|
|
3237
|
-
l && r._applyShadow(this), u || (r._applyOpacity(this), r._applyGlobalCompositeOperation(this)), r.drawImage(d._canvas, d.x || 0, d.y || 0, d.width /
|
|
3236
|
+
const S = d.pixelRatio;
|
|
3237
|
+
l && r._applyShadow(this), u || (r._applyOpacity(this), r._applyGlobalCompositeOperation(this)), r.drawImage(d._canvas, d.x || 0, d.y || 0, d.width / S, d.height / S);
|
|
3238
3238
|
} else {
|
|
3239
3239
|
if (r._applyLineJoin(this), r._applyMiterLimit(this), !u) {
|
|
3240
3240
|
const d = this.getAbsoluteTransform(e).getMatrix();
|
|
@@ -3275,7 +3275,7 @@ class w extends k {
|
|
|
3275
3275
|
return this;
|
|
3276
3276
|
}
|
|
3277
3277
|
hasPointerCapture(t) {
|
|
3278
|
-
return
|
|
3278
|
+
return Ci(t, this);
|
|
3279
3279
|
}
|
|
3280
3280
|
setPointerCapture(t) {
|
|
3281
3281
|
bi(t, this);
|
|
@@ -3284,100 +3284,100 @@ class w extends k {
|
|
|
3284
3284
|
$t(t);
|
|
3285
3285
|
}
|
|
3286
3286
|
}
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
tt(
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
p.addGetterSetter(
|
|
3301
|
-
p.addGetterSetter(
|
|
3302
|
-
p.addGetterSetter(
|
|
3303
|
-
p.addGetterSetter(
|
|
3304
|
-
p.addGetterSetter(
|
|
3305
|
-
p.addGetterSetter(
|
|
3306
|
-
p.addGetterSetter(
|
|
3307
|
-
p.addGetterSetter(
|
|
3308
|
-
p.addGetterSetter(
|
|
3309
|
-
p.addGetterSetter(
|
|
3310
|
-
p.addGetterSetter(
|
|
3311
|
-
p.addGetterSetter(
|
|
3312
|
-
p.addGetterSetter(
|
|
3313
|
-
p.addGetterSetter(
|
|
3314
|
-
p.addGetterSetter(
|
|
3315
|
-
p.addGetterSetter(
|
|
3316
|
-
p.addGetterSetter(
|
|
3317
|
-
p.addComponentsGetterSetter(
|
|
3318
|
-
p.addGetterSetter(
|
|
3319
|
-
p.addGetterSetter(
|
|
3320
|
-
p.addGetterSetter(
|
|
3321
|
-
p.addGetterSetter(
|
|
3322
|
-
p.addGetterSetter(
|
|
3323
|
-
p.addGetterSetter(
|
|
3324
|
-
p.addGetterSetter(
|
|
3325
|
-
p.addGetterSetter(
|
|
3326
|
-
p.addGetterSetter(
|
|
3327
|
-
p.addGetterSetter(
|
|
3328
|
-
p.addGetterSetter(
|
|
3329
|
-
p.addGetterSetter(
|
|
3330
|
-
p.addGetterSetter(
|
|
3331
|
-
p.addGetterSetter(
|
|
3332
|
-
p.addGetterSetter(
|
|
3333
|
-
p.addGetterSetter(
|
|
3334
|
-
p.addGetterSetter(
|
|
3335
|
-
p.addGetterSetter(
|
|
3336
|
-
p.addComponentsGetterSetter(
|
|
3337
|
-
p.addGetterSetter(
|
|
3338
|
-
p.addGetterSetter(
|
|
3339
|
-
p.addComponentsGetterSetter(
|
|
3340
|
-
p.addGetterSetter(
|
|
3341
|
-
p.addGetterSetter(
|
|
3342
|
-
p.addComponentsGetterSetter(
|
|
3287
|
+
x.prototype._fillFunc = js;
|
|
3288
|
+
x.prototype._strokeFunc = qs;
|
|
3289
|
+
x.prototype._fillFuncHit = $s;
|
|
3290
|
+
x.prototype._strokeFuncHit = Zs;
|
|
3291
|
+
x.prototype._centroid = !1;
|
|
3292
|
+
x.prototype.nodeType = "Shape";
|
|
3293
|
+
tt(x);
|
|
3294
|
+
x.prototype.eventListeners = {};
|
|
3295
|
+
x.prototype.on.call(x.prototype, "shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", Ks);
|
|
3296
|
+
x.prototype.on.call(x.prototype, "shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", Js);
|
|
3297
|
+
x.prototype.on.call(x.prototype, "fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva", Qs);
|
|
3298
|
+
x.prototype.on.call(x.prototype, "fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva", tn);
|
|
3299
|
+
x.prototype.on.call(x.prototype, "fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva", en);
|
|
3300
|
+
p.addGetterSetter(x, "stroke", void 0, _i());
|
|
3301
|
+
p.addGetterSetter(x, "strokeWidth", 2, P());
|
|
3302
|
+
p.addGetterSetter(x, "fillAfterStrokeEnabled", !1);
|
|
3303
|
+
p.addGetterSetter(x, "hitStrokeWidth", "auto", ze());
|
|
3304
|
+
p.addGetterSetter(x, "strokeHitEnabled", !0, dt());
|
|
3305
|
+
p.addGetterSetter(x, "perfectDrawEnabled", !0, dt());
|
|
3306
|
+
p.addGetterSetter(x, "shadowForStrokeEnabled", !0, dt());
|
|
3307
|
+
p.addGetterSetter(x, "lineJoin");
|
|
3308
|
+
p.addGetterSetter(x, "lineCap");
|
|
3309
|
+
p.addGetterSetter(x, "miterLimit");
|
|
3310
|
+
p.addGetterSetter(x, "sceneFunc");
|
|
3311
|
+
p.addGetterSetter(x, "hitFunc");
|
|
3312
|
+
p.addGetterSetter(x, "dash");
|
|
3313
|
+
p.addGetterSetter(x, "dashOffset", 0, P());
|
|
3314
|
+
p.addGetterSetter(x, "shadowColor", void 0, Pt());
|
|
3315
|
+
p.addGetterSetter(x, "shadowBlur", 0, P());
|
|
3316
|
+
p.addGetterSetter(x, "shadowOpacity", 1, P());
|
|
3317
|
+
p.addComponentsGetterSetter(x, "shadowOffset", ["x", "y"]);
|
|
3318
|
+
p.addGetterSetter(x, "shadowOffsetX", 0, P());
|
|
3319
|
+
p.addGetterSetter(x, "shadowOffsetY", 0, P());
|
|
3320
|
+
p.addGetterSetter(x, "fillPatternImage");
|
|
3321
|
+
p.addGetterSetter(x, "fill", void 0, _i());
|
|
3322
|
+
p.addGetterSetter(x, "fillPatternX", 0, P());
|
|
3323
|
+
p.addGetterSetter(x, "fillPatternY", 0, P());
|
|
3324
|
+
p.addGetterSetter(x, "fillLinearGradientColorStops");
|
|
3325
|
+
p.addGetterSetter(x, "strokeLinearGradientColorStops");
|
|
3326
|
+
p.addGetterSetter(x, "fillRadialGradientStartRadius", 0);
|
|
3327
|
+
p.addGetterSetter(x, "fillRadialGradientEndRadius", 0);
|
|
3328
|
+
p.addGetterSetter(x, "fillRadialGradientColorStops");
|
|
3329
|
+
p.addGetterSetter(x, "fillPatternRepeat", "repeat");
|
|
3330
|
+
p.addGetterSetter(x, "fillEnabled", !0);
|
|
3331
|
+
p.addGetterSetter(x, "strokeEnabled", !0);
|
|
3332
|
+
p.addGetterSetter(x, "shadowEnabled", !0);
|
|
3333
|
+
p.addGetterSetter(x, "dashEnabled", !0);
|
|
3334
|
+
p.addGetterSetter(x, "strokeScaleEnabled", !0);
|
|
3335
|
+
p.addGetterSetter(x, "fillPriority", "color");
|
|
3336
|
+
p.addComponentsGetterSetter(x, "fillPatternOffset", ["x", "y"]);
|
|
3337
|
+
p.addGetterSetter(x, "fillPatternOffsetX", 0, P());
|
|
3338
|
+
p.addGetterSetter(x, "fillPatternOffsetY", 0, P());
|
|
3339
|
+
p.addComponentsGetterSetter(x, "fillPatternScale", ["x", "y"]);
|
|
3340
|
+
p.addGetterSetter(x, "fillPatternScaleX", 1, P());
|
|
3341
|
+
p.addGetterSetter(x, "fillPatternScaleY", 1, P());
|
|
3342
|
+
p.addComponentsGetterSetter(x, "fillLinearGradientStartPoint", [
|
|
3343
3343
|
"x",
|
|
3344
3344
|
"y"
|
|
3345
3345
|
]);
|
|
3346
|
-
p.addComponentsGetterSetter(
|
|
3346
|
+
p.addComponentsGetterSetter(x, "strokeLinearGradientStartPoint", [
|
|
3347
3347
|
"x",
|
|
3348
3348
|
"y"
|
|
3349
3349
|
]);
|
|
3350
|
-
p.addGetterSetter(
|
|
3351
|
-
p.addGetterSetter(
|
|
3352
|
-
p.addGetterSetter(
|
|
3353
|
-
p.addGetterSetter(
|
|
3354
|
-
p.addComponentsGetterSetter(
|
|
3350
|
+
p.addGetterSetter(x, "fillLinearGradientStartPointX", 0);
|
|
3351
|
+
p.addGetterSetter(x, "strokeLinearGradientStartPointX", 0);
|
|
3352
|
+
p.addGetterSetter(x, "fillLinearGradientStartPointY", 0);
|
|
3353
|
+
p.addGetterSetter(x, "strokeLinearGradientStartPointY", 0);
|
|
3354
|
+
p.addComponentsGetterSetter(x, "fillLinearGradientEndPoint", [
|
|
3355
3355
|
"x",
|
|
3356
3356
|
"y"
|
|
3357
3357
|
]);
|
|
3358
|
-
p.addComponentsGetterSetter(
|
|
3358
|
+
p.addComponentsGetterSetter(x, "strokeLinearGradientEndPoint", [
|
|
3359
3359
|
"x",
|
|
3360
3360
|
"y"
|
|
3361
3361
|
]);
|
|
3362
|
-
p.addGetterSetter(
|
|
3363
|
-
p.addGetterSetter(
|
|
3364
|
-
p.addGetterSetter(
|
|
3365
|
-
p.addGetterSetter(
|
|
3366
|
-
p.addComponentsGetterSetter(
|
|
3362
|
+
p.addGetterSetter(x, "fillLinearGradientEndPointX", 0);
|
|
3363
|
+
p.addGetterSetter(x, "strokeLinearGradientEndPointX", 0);
|
|
3364
|
+
p.addGetterSetter(x, "fillLinearGradientEndPointY", 0);
|
|
3365
|
+
p.addGetterSetter(x, "strokeLinearGradientEndPointY", 0);
|
|
3366
|
+
p.addComponentsGetterSetter(x, "fillRadialGradientStartPoint", [
|
|
3367
3367
|
"x",
|
|
3368
3368
|
"y"
|
|
3369
3369
|
]);
|
|
3370
|
-
p.addGetterSetter(
|
|
3371
|
-
p.addGetterSetter(
|
|
3372
|
-
p.addComponentsGetterSetter(
|
|
3370
|
+
p.addGetterSetter(x, "fillRadialGradientStartPointX", 0);
|
|
3371
|
+
p.addGetterSetter(x, "fillRadialGradientStartPointY", 0);
|
|
3372
|
+
p.addComponentsGetterSetter(x, "fillRadialGradientEndPoint", [
|
|
3373
3373
|
"x",
|
|
3374
3374
|
"y"
|
|
3375
3375
|
]);
|
|
3376
|
-
p.addGetterSetter(
|
|
3377
|
-
p.addGetterSetter(
|
|
3378
|
-
p.addGetterSetter(
|
|
3379
|
-
p.addGetterSetter(
|
|
3380
|
-
p.backCompat(
|
|
3376
|
+
p.addGetterSetter(x, "fillRadialGradientEndPointX", 0);
|
|
3377
|
+
p.addGetterSetter(x, "fillRadialGradientEndPointY", 0);
|
|
3378
|
+
p.addGetterSetter(x, "fillPatternRotation", 0);
|
|
3379
|
+
p.addGetterSetter(x, "fillRule", void 0, Pt());
|
|
3380
|
+
p.backCompat(x, {
|
|
3381
3381
|
dashArray: "dash",
|
|
3382
3382
|
getDashArray: "getDash",
|
|
3383
3383
|
setDashArray: "getDash",
|
|
@@ -3395,9 +3395,9 @@ const sn = "beforeDraw", nn = "draw", Bi = [
|
|
|
3395
3395
|
{ x: 1, y: 1 },
|
|
3396
3396
|
{ x: -1, y: 1 }
|
|
3397
3397
|
], rn = Bi.length;
|
|
3398
|
-
class At extends
|
|
3398
|
+
class At extends ht {
|
|
3399
3399
|
constructor(t) {
|
|
3400
|
-
super(t), this.canvas = new
|
|
3400
|
+
super(t), this.canvas = new bt(), this.hitCanvas = new Ne({
|
|
3401
3401
|
pixelRatio: 1
|
|
3402
3402
|
}), this._waitingForDraw = !1, this.on("visibleChange.konva", this._checkVisibility), this._checkVisibility(), this.on("imageSmoothingEnabledChange.konva", this._setSmoothEnabled), this._setSmoothEnabled();
|
|
3403
3403
|
}
|
|
@@ -3526,7 +3526,7 @@ class At extends ot {
|
|
|
3526
3526
|
_getIntersection(t) {
|
|
3527
3527
|
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];
|
|
3528
3528
|
if (s === 255) {
|
|
3529
|
-
const n = m.getHitColorKey(i[0], i[1], i[2]), r =
|
|
3529
|
+
const n = m.getHitColorKey(i[0], i[1], i[2]), r = Kt[n];
|
|
3530
3530
|
return r ? {
|
|
3531
3531
|
shape: r
|
|
3532
3532
|
} : {
|
|
@@ -3542,13 +3542,13 @@ class At extends ot {
|
|
|
3542
3542
|
const s = this.getLayer(), n = t || s && s.getCanvas();
|
|
3543
3543
|
return this._fire(sn, {
|
|
3544
3544
|
node: this
|
|
3545
|
-
}), this.clearBeforeDraw() && n.getContext().clear(),
|
|
3545
|
+
}), this.clearBeforeDraw() && n.getContext().clear(), ht.prototype.drawScene.call(this, n, e, i), this._fire(nn, {
|
|
3546
3546
|
node: this
|
|
3547
3547
|
}), this;
|
|
3548
3548
|
}
|
|
3549
3549
|
drawHit(t, e) {
|
|
3550
3550
|
const i = this.getLayer(), s = t || i && i.hitCanvas;
|
|
3551
|
-
return i && i.clearBeforeDraw() && i.getHitCanvas().getContext().clear(),
|
|
3551
|
+
return i && i.clearBeforeDraw() && i.getHitCanvas().getContext().clear(), ht.prototype.drawHit.call(this, s, e), this;
|
|
3552
3552
|
}
|
|
3553
3553
|
enableHitGraph() {
|
|
3554
3554
|
return this.hitGraphEnabled(!0), this;
|
|
@@ -3576,7 +3576,7 @@ At.prototype.nodeType = "Layer";
|
|
|
3576
3576
|
tt(At);
|
|
3577
3577
|
p.addGetterSetter(At, "imageSmoothingEnabled", !0);
|
|
3578
3578
|
p.addGetterSetter(At, "clearBeforeDraw", !0);
|
|
3579
|
-
p.addGetterSetter(At, "hitGraphEnabled", !0,
|
|
3579
|
+
p.addGetterSetter(At, "hitGraphEnabled", !0, dt());
|
|
3580
3580
|
class We extends At {
|
|
3581
3581
|
constructor(t) {
|
|
3582
3582
|
super(t), this.listening(!1), m.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.');
|
|
@@ -3584,7 +3584,7 @@ class We extends At {
|
|
|
3584
3584
|
}
|
|
3585
3585
|
We.prototype.nodeType = "FastLayer";
|
|
3586
3586
|
tt(We);
|
|
3587
|
-
class Ot extends
|
|
3587
|
+
class Ot extends ht {
|
|
3588
3588
|
_validateAdd(t) {
|
|
3589
3589
|
const e = t.getType();
|
|
3590
3590
|
e !== "Group" && e !== "Shape" && m.throw("You may only add groups and shapes to groups.");
|
|
@@ -3593,15 +3593,15 @@ class Ot extends ot {
|
|
|
3593
3593
|
Ot.prototype.nodeType = "Group";
|
|
3594
3594
|
tt(Ot);
|
|
3595
3595
|
const be = function() {
|
|
3596
|
-
return
|
|
3597
|
-
return
|
|
3596
|
+
return Et.performance && Et.performance.now ? function() {
|
|
3597
|
+
return Et.performance.now();
|
|
3598
3598
|
} : function() {
|
|
3599
3599
|
return (/* @__PURE__ */ new Date()).getTime();
|
|
3600
3600
|
};
|
|
3601
3601
|
}();
|
|
3602
|
-
class
|
|
3602
|
+
class lt {
|
|
3603
3603
|
constructor(t, e) {
|
|
3604
|
-
this.id =
|
|
3604
|
+
this.id = lt.animIdCounter++, this.frame = {
|
|
3605
3605
|
time: 0,
|
|
3606
3606
|
timeDiff: 0,
|
|
3607
3607
|
lastTime: be(),
|
|
@@ -3623,17 +3623,17 @@ class ht {
|
|
|
3623
3623
|
return this.layers.push(t), !0;
|
|
3624
3624
|
}
|
|
3625
3625
|
isRunning() {
|
|
3626
|
-
const e =
|
|
3626
|
+
const e = lt.animations, i = e.length;
|
|
3627
3627
|
for (let s = 0; s < i; s++)
|
|
3628
3628
|
if (e[s].id === this.id)
|
|
3629
3629
|
return !0;
|
|
3630
3630
|
return !1;
|
|
3631
3631
|
}
|
|
3632
3632
|
start() {
|
|
3633
|
-
return this.stop(), this.frame.timeDiff = 0, this.frame.lastTime = be(),
|
|
3633
|
+
return this.stop(), this.frame.timeDiff = 0, this.frame.lastTime = be(), lt._addAnimation(this), this;
|
|
3634
3634
|
}
|
|
3635
3635
|
stop() {
|
|
3636
|
-
return
|
|
3636
|
+
return lt._removeAnimation(this), this;
|
|
3637
3637
|
}
|
|
3638
3638
|
_updateFrameObject(t) {
|
|
3639
3639
|
this.frame.timeDiff = t - this.frame.lastTime, this.frame.lastTime = t, this.frame.time += this.frame.timeDiff, this.frame.frameRate = 1e3 / this.frame.timeDiff;
|
|
@@ -3666,16 +3666,16 @@ class ht {
|
|
|
3666
3666
|
t.hasOwnProperty(i) && t[i].batchDraw();
|
|
3667
3667
|
}
|
|
3668
3668
|
static _animationLoop() {
|
|
3669
|
-
const t =
|
|
3669
|
+
const t = lt;
|
|
3670
3670
|
t.animations.length ? (t._runFrames(), m.requestAnimFrame(t._animationLoop)) : t.animRunning = !1;
|
|
3671
3671
|
}
|
|
3672
3672
|
static _handleAnimation() {
|
|
3673
3673
|
this.animRunning || (this.animRunning = !0, m.requestAnimFrame(this._animationLoop));
|
|
3674
3674
|
}
|
|
3675
3675
|
}
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3676
|
+
lt.animations = [];
|
|
3677
|
+
lt.animIdCounter = 0;
|
|
3678
|
+
lt.animRunning = !1;
|
|
3679
3679
|
const an = {
|
|
3680
3680
|
node: 1,
|
|
3681
3681
|
duration: 1,
|
|
@@ -3738,8 +3738,8 @@ class $ {
|
|
|
3738
3738
|
const e = this, i = t.node, s = i._id, n = t.easing || Jt.Linear, r = !!t.yoyo;
|
|
3739
3739
|
let a, h;
|
|
3740
3740
|
typeof t.duration > "u" ? a = 0.3 : t.duration === 0 ? a = 1e-3 : a = t.duration, this.node = i, this._id = hn++;
|
|
3741
|
-
const l = i.getLayer() || (i instanceof
|
|
3742
|
-
l || m.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."), this.anim = new
|
|
3741
|
+
const l = i.getLayer() || (i instanceof A.Stage ? i.getLayers() : null);
|
|
3742
|
+
l || m.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."), this.anim = new lt(function() {
|
|
3743
3743
|
e.tween.onEnterFrame();
|
|
3744
3744
|
}, l), this.tween = new ln(h, function(c) {
|
|
3745
3745
|
e._tweenFunc(c);
|
|
@@ -3904,28 +3904,28 @@ const Jt = {
|
|
|
3904
3904
|
Linear(o, t, e, i) {
|
|
3905
3905
|
return e * o / i + t;
|
|
3906
3906
|
}
|
|
3907
|
-
}, ri = m._assign(
|
|
3907
|
+
}, ri = m._assign(A, {
|
|
3908
3908
|
Util: m,
|
|
3909
3909
|
Transform: at,
|
|
3910
3910
|
Node: k,
|
|
3911
|
-
Container:
|
|
3911
|
+
Container: ht,
|
|
3912
3912
|
Stage: me,
|
|
3913
|
-
stages:
|
|
3913
|
+
stages: Zt,
|
|
3914
3914
|
Layer: At,
|
|
3915
3915
|
FastLayer: We,
|
|
3916
3916
|
Group: Ot,
|
|
3917
|
-
DD:
|
|
3918
|
-
Shape:
|
|
3919
|
-
shapes:
|
|
3920
|
-
Animation:
|
|
3917
|
+
DD: V,
|
|
3918
|
+
Shape: x,
|
|
3919
|
+
shapes: Kt,
|
|
3920
|
+
Animation: lt,
|
|
3921
3921
|
Tween: $,
|
|
3922
3922
|
Easings: Jt,
|
|
3923
3923
|
Context: ge,
|
|
3924
3924
|
Canvas: Fe
|
|
3925
3925
|
});
|
|
3926
|
-
class pt extends
|
|
3926
|
+
class pt extends x {
|
|
3927
3927
|
_sceneFunc(t) {
|
|
3928
|
-
const e =
|
|
3928
|
+
const e = A.getAngle(this.angle()), i = this.clockwise();
|
|
3929
3929
|
t.beginPath(), t.arc(0, 0, this.outerRadius(), 0, e, i), t.arc(0, 0, this.innerRadius(), e, 0, !i), t.closePath(), t.fillStrokeShape(this);
|
|
3930
3930
|
}
|
|
3931
3931
|
getWidth() {
|
|
@@ -3941,7 +3941,7 @@ class pt extends w {
|
|
|
3941
3941
|
this.outerRadius(t / 2);
|
|
3942
3942
|
}
|
|
3943
3943
|
getSelfRect() {
|
|
3944
|
-
const t = this.innerRadius(), e = this.outerRadius(), i = this.clockwise(), s =
|
|
3944
|
+
const t = this.innerRadius(), e = this.outerRadius(), i = this.clockwise(), s = A.getAngle(i ? 360 - this.angle() : this.angle()), n = Math.cos(Math.min(s, Math.PI)), r = 1, a = Math.sin(Math.min(Math.max(Math.PI, s), 3 * Math.PI / 2)), h = Math.sin(Math.min(s, Math.PI / 2)), l = n * (n > 0 ? t : e), c = r * e, u = a * (a > 0 ? t : e), d = h * (h > 0 ? e : t);
|
|
3945
3945
|
return {
|
|
3946
3946
|
x: l,
|
|
3947
3947
|
y: i ? -1 * d : u,
|
|
@@ -3959,10 +3959,10 @@ pt.prototype._attrsAffectingSize = [
|
|
|
3959
3959
|
"clockwise"
|
|
3960
3960
|
];
|
|
3961
3961
|
tt(pt);
|
|
3962
|
-
p.addGetterSetter(pt, "innerRadius", 0,
|
|
3963
|
-
p.addGetterSetter(pt, "outerRadius", 0,
|
|
3964
|
-
p.addGetterSetter(pt, "angle", 0,
|
|
3965
|
-
p.addGetterSetter(pt, "clockwise", !1,
|
|
3962
|
+
p.addGetterSetter(pt, "innerRadius", 0, P());
|
|
3963
|
+
p.addGetterSetter(pt, "outerRadius", 0, P());
|
|
3964
|
+
p.addGetterSetter(pt, "angle", 0, P());
|
|
3965
|
+
p.addGetterSetter(pt, "clockwise", !1, dt());
|
|
3966
3966
|
function Re(o, t, e, i, s, n, r) {
|
|
3967
3967
|
const a = Math.sqrt(Math.pow(e - o, 2) + Math.pow(i - t, 2)), h = Math.sqrt(Math.pow(s - e, 2) + Math.pow(n - i, 2)), l = r * a / (a + h), c = r * h / (a + h), u = e - l * (s - o), d = i - l * (n - t), g = e + c * (s - o), f = i + c * (n - t);
|
|
3968
3968
|
return [u, d, g, f];
|
|
@@ -3995,7 +3995,7 @@ function cn(o) {
|
|
|
3995
3995
|
return n * n * n * s[0] + 3 * n * n * i * s[1] + 3 * n * i * i * s[2] + i * i * i * s[3];
|
|
3996
3996
|
}));
|
|
3997
3997
|
}
|
|
3998
|
-
class mt extends
|
|
3998
|
+
class mt extends x {
|
|
3999
3999
|
constructor(t) {
|
|
4000
4000
|
super(t), this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva", function() {
|
|
4001
4001
|
this._clearCache("tensionPoints");
|
|
@@ -4084,8 +4084,8 @@ mt.prototype._attrsAffectingSize = ["points", "bezier", "tension"];
|
|
|
4084
4084
|
tt(mt);
|
|
4085
4085
|
p.addGetterSetter(mt, "closed", !1);
|
|
4086
4086
|
p.addGetterSetter(mt, "bezier", !1);
|
|
4087
|
-
p.addGetterSetter(mt, "tension", 0,
|
|
4088
|
-
p.addGetterSetter(mt, "points", [],
|
|
4087
|
+
p.addGetterSetter(mt, "tension", 0, P());
|
|
4088
|
+
p.addGetterSetter(mt, "points", [], xs());
|
|
4089
4089
|
const dn = [
|
|
4090
4090
|
[],
|
|
4091
4091
|
[],
|
|
@@ -4791,8 +4791,8 @@ const dn = [
|
|
|
4791
4791
|
const i = o[0] - 2 * o[1] + o[2], s = t[0] - 2 * t[1] + t[2], n = 2 * o[1] - 2 * o[0], r = 2 * t[1] - 2 * t[0], a = 4 * (i * i + s * s), h = 4 * (i * n + s * r), l = n * n + r * r;
|
|
4792
4792
|
if (a === 0)
|
|
4793
4793
|
return e * Math.sqrt(Math.pow(o[2] - o[0], 2) + Math.pow(t[2] - t[0], 2));
|
|
4794
|
-
const c = h / (2 * a), u = l / a, d = e + c, g = u - c * c, f = d * d + g > 0 ? Math.sqrt(d * d + g) : 0,
|
|
4795
|
-
return Math.sqrt(a) / 2 * (d * f - c *
|
|
4794
|
+
const c = h / (2 * a), u = l / a, d = e + c, g = u - c * c, f = d * d + g > 0 ? Math.sqrt(d * d + g) : 0, S = c * c + g > 0 ? Math.sqrt(c * c + g) : 0, C = c + Math.sqrt(c * c + g) !== 0 ? g * Math.log(Math.abs((d + f) / (c + S))) : 0;
|
|
4795
|
+
return Math.sqrt(a) / 2 * (d * f - c * S + C);
|
|
4796
4796
|
};
|
|
4797
4797
|
function gn(o, t, e) {
|
|
4798
4798
|
const i = Le(1, e, o), s = Le(1, e, t), n = i * i + s * s;
|
|
@@ -4829,14 +4829,14 @@ const Le = (o, t, e) => {
|
|
|
4829
4829
|
}
|
|
4830
4830
|
return s;
|
|
4831
4831
|
};
|
|
4832
|
-
class
|
|
4832
|
+
class Z extends x {
|
|
4833
4833
|
constructor(t) {
|
|
4834
4834
|
super(t), this.dataArray = [], this.pathLength = 0, this._readDataAttribute(), this.on("dataChange.konva", function() {
|
|
4835
4835
|
this._readDataAttribute();
|
|
4836
4836
|
});
|
|
4837
4837
|
}
|
|
4838
4838
|
_readDataAttribute() {
|
|
4839
|
-
this.dataArray =
|
|
4839
|
+
this.dataArray = Z.parsePathData(this.data()), this.pathLength = Z.getPathLength(this.dataArray);
|
|
4840
4840
|
}
|
|
4841
4841
|
_sceneFunc(t) {
|
|
4842
4842
|
const e = this.dataArray;
|
|
@@ -4858,8 +4858,8 @@ class K extends w {
|
|
|
4858
4858
|
t.quadraticCurveTo(r[0], r[1], r[2], r[3]);
|
|
4859
4859
|
break;
|
|
4860
4860
|
case "A":
|
|
4861
|
-
const a = r[0], h = r[1], l = r[2], c = r[3], u = r[4], d = r[5], g = r[6], f = r[7],
|
|
4862
|
-
t.translate(a, h), t.rotate(g), t.scale(
|
|
4861
|
+
const a = r[0], h = r[1], l = r[2], c = r[3], u = r[4], d = r[5], g = r[6], f = r[7], S = l > c ? l : c, C = l > c ? 1 : l / c, y = l > c ? c / l : 1;
|
|
4862
|
+
t.translate(a, h), t.rotate(g), t.scale(C, y), t.arc(0, 0, S, u, u + d, 1 - f), t.scale(1 / C, 1 / y), t.rotate(-g), t.translate(-a, -h);
|
|
4863
4863
|
break;
|
|
4864
4864
|
case "z":
|
|
4865
4865
|
i = !0, t.closePath();
|
|
@@ -4876,17 +4876,17 @@ class K extends w {
|
|
|
4876
4876
|
let d = Math.PI / 180;
|
|
4877
4877
|
if (Math.abs(l - u) < d && (d = Math.abs(l - u)), c < 0)
|
|
4878
4878
|
for (let g = l - d; g > u; g -= d) {
|
|
4879
|
-
const f =
|
|
4879
|
+
const f = Z.getPointOnEllipticalArc(h.points[0], h.points[1], h.points[2], h.points[3], g, 0);
|
|
4880
4880
|
t.push(f.x, f.y);
|
|
4881
4881
|
}
|
|
4882
4882
|
else
|
|
4883
4883
|
for (let g = l + d; g < u; g += d) {
|
|
4884
|
-
const f =
|
|
4884
|
+
const f = Z.getPointOnEllipticalArc(h.points[0], h.points[1], h.points[2], h.points[3], g, 0);
|
|
4885
4885
|
t.push(f.x, f.y);
|
|
4886
4886
|
}
|
|
4887
4887
|
} else if (h.command === "C")
|
|
4888
4888
|
for (let l = 0; l <= 1; l += 0.01) {
|
|
4889
|
-
const c =
|
|
4889
|
+
const c = Z.getPointOnCubicBezier(l, h.start.x, h.start.y, h.points[0], h.points[1], h.points[2], h.points[3], h.points[4], h.points[5]);
|
|
4890
4890
|
t.push(c.x, c.y);
|
|
4891
4891
|
}
|
|
4892
4892
|
else
|
|
@@ -4906,7 +4906,7 @@ class K extends w {
|
|
|
4906
4906
|
return this.pathLength;
|
|
4907
4907
|
}
|
|
4908
4908
|
getPointAtLength(t) {
|
|
4909
|
-
return
|
|
4909
|
+
return Z.getPointAtLengthOfDataArray(t, this.dataArray);
|
|
4910
4910
|
}
|
|
4911
4911
|
static getLineLength(t, e, i, s) {
|
|
4912
4912
|
return Math.sqrt((i - t) * (i - t) + (s - e) * (s - e));
|
|
@@ -4939,15 +4939,15 @@ class K extends w {
|
|
|
4939
4939
|
const r = e[s], a = r.points;
|
|
4940
4940
|
switch (r.command) {
|
|
4941
4941
|
case "L":
|
|
4942
|
-
return
|
|
4942
|
+
return Z.getPointOnLine(t, r.start.x, r.start.y, a[0], a[1]);
|
|
4943
4943
|
case "C":
|
|
4944
|
-
return
|
|
4944
|
+
return Z.getPointOnCubicBezier(li(t, Z.getPathLength(e), (S) => oi([r.start.x, a[0], a[2], a[4]], [r.start.y, a[1], a[3], a[5]], S)), r.start.x, r.start.y, a[0], a[1], a[2], a[3], a[4], a[5]);
|
|
4945
4945
|
case "Q":
|
|
4946
|
-
return
|
|
4946
|
+
return Z.getPointOnQuadraticBezier(li(t, Z.getPathLength(e), (S) => hi([r.start.x, a[0], a[2]], [r.start.y, a[1], a[3]], S)), r.start.x, r.start.y, a[0], a[1], a[2], a[3]);
|
|
4947
4947
|
case "A":
|
|
4948
4948
|
const h = a[0], l = a[1], c = a[2], u = a[3], d = a[5], g = a[6];
|
|
4949
4949
|
let f = a[4];
|
|
4950
|
-
return f += d * t / r.pathLength,
|
|
4950
|
+
return f += d * t / r.pathLength, Z.getPointOnEllipticalArc(h, l, c, u, f, g);
|
|
4951
4951
|
}
|
|
4952
4952
|
return null;
|
|
4953
4953
|
}
|
|
@@ -4961,24 +4961,24 @@ class K extends w {
|
|
|
4961
4961
|
const l = (n - i) / (s - e), c = Math.sqrt(t * t / (1 + l * l)) * (s < e ? -1 : 1), u = l * c;
|
|
4962
4962
|
if (Math.abs(a - i - l * (r - e)) < 1e-10)
|
|
4963
4963
|
return { x: r + c, y: a + u };
|
|
4964
|
-
const d = ((r - e) * (s - e) + (a - i) * (n - i)) / (h * h), g = e + d * (s - e), f = i + d * (n - i),
|
|
4964
|
+
const d = ((r - e) * (s - e) + (a - i) * (n - i)) / (h * h), g = e + d * (s - e), f = i + d * (n - i), S = this.getLineLength(r, a, g, f), C = Math.sqrt(t * t - S * S), y = Math.sqrt(C * C / (1 + l * l)) * (s < e ? -1 : 1), _ = l * y;
|
|
4965
4965
|
return { x: g + y, y: f + _ };
|
|
4966
4966
|
}
|
|
4967
4967
|
static getPointOnCubicBezier(t, e, i, s, n, r, a, h, l) {
|
|
4968
|
-
function c(
|
|
4969
|
-
return
|
|
4968
|
+
function c(C) {
|
|
4969
|
+
return C * C * C;
|
|
4970
4970
|
}
|
|
4971
|
-
function u(
|
|
4972
|
-
return 3 *
|
|
4971
|
+
function u(C) {
|
|
4972
|
+
return 3 * C * C * (1 - C);
|
|
4973
4973
|
}
|
|
4974
|
-
function d(
|
|
4975
|
-
return 3 *
|
|
4974
|
+
function d(C) {
|
|
4975
|
+
return 3 * C * (1 - C) * (1 - C);
|
|
4976
4976
|
}
|
|
4977
|
-
function g(
|
|
4978
|
-
return (1 -
|
|
4977
|
+
function g(C) {
|
|
4978
|
+
return (1 - C) * (1 - C) * (1 - C);
|
|
4979
4979
|
}
|
|
4980
|
-
const f = h * c(t) + r * u(t) + s * d(t) + e * g(t),
|
|
4981
|
-
return { x: f, y:
|
|
4980
|
+
const f = h * c(t) + r * u(t) + s * d(t) + e * g(t), S = l * c(t) + a * u(t) + n * d(t) + i * g(t);
|
|
4981
|
+
return { x: f, y: S };
|
|
4982
4982
|
}
|
|
4983
4983
|
static getPointOnQuadraticBezier(t, e, i, s, n, r, a) {
|
|
4984
4984
|
function h(g) {
|
|
@@ -5040,58 +5040,58 @@ class K extends w {
|
|
|
5040
5040
|
let d = s[u], g = d.charAt(0);
|
|
5041
5041
|
for (d = d.slice(1), r.length = 0; c = l.exec(d); )
|
|
5042
5042
|
r.push(c[0]);
|
|
5043
|
-
let f = [],
|
|
5044
|
-
for (let
|
|
5045
|
-
const _ = r[
|
|
5043
|
+
let f = [], S = g === "A" || g === "a" ? 0 : -1;
|
|
5044
|
+
for (let C = 0, y = r.length; C < y; C++) {
|
|
5045
|
+
const _ = r[C];
|
|
5046
5046
|
if (_ === "00") {
|
|
5047
|
-
f.push(0, 0),
|
|
5047
|
+
f.push(0, 0), S >= 0 && (S += 2, S >= 7 && (S -= 7));
|
|
5048
5048
|
continue;
|
|
5049
5049
|
}
|
|
5050
|
-
if (
|
|
5051
|
-
if (
|
|
5050
|
+
if (S >= 0) {
|
|
5051
|
+
if (S === 3) {
|
|
5052
5052
|
if (/^[01]{2}\d+(?:\.\d+)?$/.test(_)) {
|
|
5053
|
-
f.push(parseInt(_[0], 10)), f.push(parseInt(_[1], 10)), f.push(parseFloat(_.slice(2))),
|
|
5053
|
+
f.push(parseInt(_[0], 10)), f.push(parseInt(_[1], 10)), f.push(parseFloat(_.slice(2))), S += 3, S >= 7 && (S -= 7);
|
|
5054
5054
|
continue;
|
|
5055
5055
|
}
|
|
5056
5056
|
if (_ === "11" || _ === "10" || _ === "01") {
|
|
5057
|
-
f.push(parseInt(_[0], 10)), f.push(parseInt(_[1], 10)),
|
|
5057
|
+
f.push(parseInt(_[0], 10)), f.push(parseInt(_[1], 10)), S += 2, S >= 7 && (S -= 7);
|
|
5058
5058
|
continue;
|
|
5059
5059
|
}
|
|
5060
5060
|
if (_ === "0" || _ === "1") {
|
|
5061
|
-
f.push(parseInt(_, 10)),
|
|
5061
|
+
f.push(parseInt(_, 10)), S += 1, S >= 7 && (S -= 7);
|
|
5062
5062
|
continue;
|
|
5063
5063
|
}
|
|
5064
|
-
} else if (
|
|
5064
|
+
} else if (S === 4) {
|
|
5065
5065
|
if (/^[01]\d+(?:\.\d+)?$/.test(_)) {
|
|
5066
|
-
f.push(parseInt(_[0], 10)), f.push(parseFloat(_.slice(1))),
|
|
5066
|
+
f.push(parseInt(_[0], 10)), f.push(parseFloat(_.slice(1))), S += 2, S >= 7 && (S -= 7);
|
|
5067
5067
|
continue;
|
|
5068
5068
|
}
|
|
5069
5069
|
if (_ === "0" || _ === "1") {
|
|
5070
|
-
f.push(parseInt(_, 10)),
|
|
5070
|
+
f.push(parseInt(_, 10)), S += 1, S >= 7 && (S -= 7);
|
|
5071
5071
|
continue;
|
|
5072
5072
|
}
|
|
5073
5073
|
}
|
|
5074
5074
|
const v = parseFloat(_);
|
|
5075
|
-
isNaN(v) ? f.push(0) : f.push(v),
|
|
5075
|
+
isNaN(v) ? f.push(0) : f.push(v), S += 1, S >= 7 && (S -= 7);
|
|
5076
5076
|
} else {
|
|
5077
5077
|
const v = parseFloat(_);
|
|
5078
5078
|
isNaN(v) ? f.push(0) : f.push(v);
|
|
5079
5079
|
}
|
|
5080
5080
|
}
|
|
5081
5081
|
for (; f.length > 0 && !isNaN(f[0]); ) {
|
|
5082
|
-
let
|
|
5082
|
+
let C = "", y = [];
|
|
5083
5083
|
const _ = a, v = h;
|
|
5084
|
-
let b, E,
|
|
5084
|
+
let b, E, w, L, R, I, G, W, B, X;
|
|
5085
5085
|
switch (g) {
|
|
5086
5086
|
case "l":
|
|
5087
|
-
a += f.shift(), h += f.shift(),
|
|
5087
|
+
a += f.shift(), h += f.shift(), C = "L", y.push(a, h);
|
|
5088
5088
|
break;
|
|
5089
5089
|
case "L":
|
|
5090
5090
|
a = f.shift(), h = f.shift(), y.push(a, h);
|
|
5091
5091
|
break;
|
|
5092
5092
|
case "m":
|
|
5093
5093
|
const z = f.shift(), F = f.shift();
|
|
5094
|
-
if (a += z, h += F,
|
|
5094
|
+
if (a += z, h += F, C = "M", n.length > 2 && n[n.length - 1].command === "z") {
|
|
5095
5095
|
for (let D = n.length - 2; D >= 0; D--)
|
|
5096
5096
|
if (n[D].command === "M") {
|
|
5097
5097
|
a = n[D].points[0] + z, h = n[D].points[1] + F;
|
|
@@ -5101,59 +5101,59 @@ class K extends w {
|
|
|
5101
5101
|
y.push(a, h), g = "l";
|
|
5102
5102
|
break;
|
|
5103
5103
|
case "M":
|
|
5104
|
-
a = f.shift(), h = f.shift(),
|
|
5104
|
+
a = f.shift(), h = f.shift(), C = "M", y.push(a, h), g = "L";
|
|
5105
5105
|
break;
|
|
5106
5106
|
case "h":
|
|
5107
|
-
a += f.shift(),
|
|
5107
|
+
a += f.shift(), C = "L", y.push(a, h);
|
|
5108
5108
|
break;
|
|
5109
5109
|
case "H":
|
|
5110
|
-
a = f.shift(),
|
|
5110
|
+
a = f.shift(), C = "L", y.push(a, h);
|
|
5111
5111
|
break;
|
|
5112
5112
|
case "v":
|
|
5113
|
-
h += f.shift(),
|
|
5113
|
+
h += f.shift(), C = "L", y.push(a, h);
|
|
5114
5114
|
break;
|
|
5115
5115
|
case "V":
|
|
5116
|
-
h = f.shift(),
|
|
5116
|
+
h = f.shift(), C = "L", y.push(a, h);
|
|
5117
5117
|
break;
|
|
5118
5118
|
case "C":
|
|
5119
5119
|
y.push(f.shift(), f.shift(), f.shift(), f.shift()), a = f.shift(), h = f.shift(), y.push(a, h);
|
|
5120
5120
|
break;
|
|
5121
5121
|
case "c":
|
|
5122
|
-
y.push(a + f.shift(), h + f.shift(), a + f.shift(), h + f.shift()), a += f.shift(), h += f.shift(),
|
|
5122
|
+
y.push(a + f.shift(), h + f.shift(), a + f.shift(), h + f.shift()), a += f.shift(), h += f.shift(), C = "C", y.push(a, h);
|
|
5123
5123
|
break;
|
|
5124
5124
|
case "S":
|
|
5125
|
-
E = a,
|
|
5125
|
+
E = a, w = h, b = n[n.length - 1], b.command === "C" && (E = a + (a - b.points[2]), w = h + (h - b.points[3])), y.push(E, w, f.shift(), f.shift()), a = f.shift(), h = f.shift(), C = "C", y.push(a, h);
|
|
5126
5126
|
break;
|
|
5127
5127
|
case "s":
|
|
5128
|
-
E = a,
|
|
5128
|
+
E = a, w = h, b = n[n.length - 1], b.command === "C" && (E = a + (a - b.points[2]), w = h + (h - b.points[3])), y.push(E, w, a + f.shift(), h + f.shift()), a += f.shift(), h += f.shift(), C = "C", y.push(a, h);
|
|
5129
5129
|
break;
|
|
5130
5130
|
case "Q":
|
|
5131
5131
|
y.push(f.shift(), f.shift()), a = f.shift(), h = f.shift(), y.push(a, h);
|
|
5132
5132
|
break;
|
|
5133
5133
|
case "q":
|
|
5134
|
-
y.push(a + f.shift(), h + f.shift()), a += f.shift(), h += f.shift(),
|
|
5134
|
+
y.push(a + f.shift(), h + f.shift()), a += f.shift(), h += f.shift(), C = "Q", y.push(a, h);
|
|
5135
5135
|
break;
|
|
5136
5136
|
case "T":
|
|
5137
|
-
E = a,
|
|
5137
|
+
E = a, w = h, b = n[n.length - 1], b.command === "Q" && (E = a + (a - b.points[0]), w = h + (h - b.points[1])), a = f.shift(), h = f.shift(), C = "Q", y.push(E, w, a, h);
|
|
5138
5138
|
break;
|
|
5139
5139
|
case "t":
|
|
5140
|
-
E = a,
|
|
5140
|
+
E = a, w = h, b = n[n.length - 1], b.command === "Q" && (E = a + (a - b.points[0]), w = h + (h - b.points[1])), a += f.shift(), h += f.shift(), C = "Q", y.push(E, w, a, h);
|
|
5141
5141
|
break;
|
|
5142
5142
|
case "A":
|
|
5143
|
-
L = f.shift(), R = f.shift(), I = f.shift(), G = f.shift(), W = f.shift(), B = a, X = h, a = f.shift(), h = f.shift(),
|
|
5143
|
+
L = f.shift(), R = f.shift(), I = f.shift(), G = f.shift(), W = f.shift(), B = a, X = h, a = f.shift(), h = f.shift(), C = "A", y = this.convertEndpointToCenterParameterization(B, X, a, h, G, W, L, R, I);
|
|
5144
5144
|
break;
|
|
5145
5145
|
case "a":
|
|
5146
|
-
L = f.shift(), R = f.shift(), I = f.shift(), G = f.shift(), W = f.shift(), B = a, X = h, a += f.shift(), h += f.shift(),
|
|
5146
|
+
L = f.shift(), R = f.shift(), I = f.shift(), G = f.shift(), W = f.shift(), B = a, X = h, a += f.shift(), h += f.shift(), C = "A", y = this.convertEndpointToCenterParameterization(B, X, a, h, G, W, L, R, I);
|
|
5147
5147
|
break;
|
|
5148
5148
|
}
|
|
5149
5149
|
n.push({
|
|
5150
|
-
command:
|
|
5150
|
+
command: C || g,
|
|
5151
5151
|
points: y,
|
|
5152
5152
|
start: {
|
|
5153
5153
|
x: _,
|
|
5154
5154
|
y: v
|
|
5155
5155
|
},
|
|
5156
|
-
pathLength: this.calcLength(_, v,
|
|
5156
|
+
pathLength: this.calcLength(_, v, C || g, y)
|
|
5157
5157
|
});
|
|
5158
5158
|
}
|
|
5159
5159
|
(g === "z" || g === "Z") && n.push({
|
|
@@ -5167,7 +5167,7 @@ class K extends w {
|
|
|
5167
5167
|
}
|
|
5168
5168
|
static calcLength(t, e, i, s) {
|
|
5169
5169
|
let n, r, a, h;
|
|
5170
|
-
const l =
|
|
5170
|
+
const l = Z;
|
|
5171
5171
|
switch (i) {
|
|
5172
5172
|
case "L":
|
|
5173
5173
|
return l.getLineLength(t, e, s[0], s[1]);
|
|
@@ -5194,22 +5194,22 @@ class K extends w {
|
|
|
5194
5194
|
g > 1 && (a *= Math.sqrt(g), h *= Math.sqrt(g));
|
|
5195
5195
|
let f = Math.sqrt((a * a * (h * h) - a * a * (d * d) - h * h * (u * u)) / (a * a * (d * d) + h * h * (u * u)));
|
|
5196
5196
|
n === r && (f *= -1), isNaN(f) && (f = 0);
|
|
5197
|
-
const
|
|
5197
|
+
const S = f * a * d / h, C = f * -h * u / a, y = (t + i) / 2 + Math.cos(c) * S - Math.sin(c) * C, _ = (e + s) / 2 + Math.sin(c) * S + Math.cos(c) * C, v = function(G) {
|
|
5198
5198
|
return Math.sqrt(G[0] * G[0] + G[1] * G[1]);
|
|
5199
5199
|
}, b = function(G, W) {
|
|
5200
5200
|
return (G[0] * W[0] + G[1] * W[1]) / (v(G) * v(W));
|
|
5201
5201
|
}, E = function(G, W) {
|
|
5202
5202
|
return (G[0] * W[1] < G[1] * W[0] ? -1 : 1) * Math.acos(b(G, W));
|
|
5203
|
-
},
|
|
5203
|
+
}, w = E([1, 0], [(u - S) / a, (d - C) / h]), L = [(u - S) / a, (d - C) / h], R = [(-1 * u - S) / a, (-1 * d - C) / h];
|
|
5204
5204
|
let I = E(L, R);
|
|
5205
|
-
return b(L, R) <= -1 && (I = Math.PI), b(L, R) >= 1 && (I = 0), r === 0 && I > 0 && (I = I - 2 * Math.PI), r === 1 && I < 0 && (I = I + 2 * Math.PI), [y, _, a, h,
|
|
5205
|
+
return b(L, R) <= -1 && (I = Math.PI), b(L, R) >= 1 && (I = 0), r === 0 && I > 0 && (I = I - 2 * Math.PI), r === 1 && I < 0 && (I = I + 2 * Math.PI), [y, _, a, h, w, I, c, r];
|
|
5206
5206
|
}
|
|
5207
5207
|
}
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
tt(
|
|
5211
|
-
p.addGetterSetter(
|
|
5212
|
-
class
|
|
5208
|
+
Z.prototype.className = "Path";
|
|
5209
|
+
Z.prototype._attrsAffectingSize = ["data"];
|
|
5210
|
+
tt(Z);
|
|
5211
|
+
p.addGetterSetter(Z, "data");
|
|
5212
|
+
class Mt extends mt {
|
|
5213
5213
|
_sceneFunc(t) {
|
|
5214
5214
|
super._sceneFunc(t);
|
|
5215
5215
|
const e = Math.PI * 2, i = this.points();
|
|
@@ -5226,7 +5226,7 @@ class Pt extends mt {
|
|
|
5226
5226
|
s[s.length - 1],
|
|
5227
5227
|
i[a - 2],
|
|
5228
5228
|
i[a - 1]
|
|
5229
|
-
], g =
|
|
5229
|
+
], g = Z.calcLength(s[s.length - 4], s[s.length - 3], "C", d), f = Z.getPointOnQuadraticBezier(Math.min(1, 1 - r / g), d[0], d[1], d[2], d[3], d[4], d[5]);
|
|
5230
5230
|
h = i[a - 2] - f.x, l = i[a - 1] - f.y;
|
|
5231
5231
|
} else
|
|
5232
5232
|
h = i[a - 2] - i[a - 4], l = i[a - 1] - i[a - 3];
|
|
@@ -5247,13 +5247,13 @@ class Pt extends mt {
|
|
|
5247
5247
|
};
|
|
5248
5248
|
}
|
|
5249
5249
|
}
|
|
5250
|
-
|
|
5251
|
-
tt(
|
|
5252
|
-
p.addGetterSetter(
|
|
5253
|
-
p.addGetterSetter(
|
|
5254
|
-
p.addGetterSetter(
|
|
5255
|
-
p.addGetterSetter(
|
|
5256
|
-
class Bt extends
|
|
5250
|
+
Mt.prototype.className = "Arrow";
|
|
5251
|
+
tt(Mt);
|
|
5252
|
+
p.addGetterSetter(Mt, "pointerLength", 10, P());
|
|
5253
|
+
p.addGetterSetter(Mt, "pointerWidth", 10, P());
|
|
5254
|
+
p.addGetterSetter(Mt, "pointerAtBeginning", !1);
|
|
5255
|
+
p.addGetterSetter(Mt, "pointerAtEnding", !0);
|
|
5256
|
+
class Bt extends x {
|
|
5257
5257
|
_sceneFunc(t) {
|
|
5258
5258
|
t.beginPath(), t.arc(0, 0, this.attrs.radius || 0, 0, Math.PI * 2, !1), t.closePath(), t.fillStrokeShape(this);
|
|
5259
5259
|
}
|
|
@@ -5274,8 +5274,8 @@ Bt.prototype._centroid = !0;
|
|
|
5274
5274
|
Bt.prototype.className = "Circle";
|
|
5275
5275
|
Bt.prototype._attrsAffectingSize = ["radius"];
|
|
5276
5276
|
tt(Bt);
|
|
5277
|
-
p.addGetterSetter(Bt, "radius", 0,
|
|
5278
|
-
class
|
|
5277
|
+
p.addGetterSetter(Bt, "radius", 0, P());
|
|
5278
|
+
class Tt extends x {
|
|
5279
5279
|
_sceneFunc(t) {
|
|
5280
5280
|
const e = this.radiusX(), i = this.radiusY();
|
|
5281
5281
|
t.beginPath(), t.save(), e !== i && t.scale(1, i / e), t.arc(0, 0, e, 0, Math.PI * 2, !1), t.restore(), t.closePath(), t.fillStrokeShape(this);
|
|
@@ -5293,14 +5293,14 @@ class vt extends w {
|
|
|
5293
5293
|
this.radiusY(t / 2);
|
|
5294
5294
|
}
|
|
5295
5295
|
}
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
tt(
|
|
5300
|
-
p.addComponentsGetterSetter(
|
|
5301
|
-
p.addGetterSetter(
|
|
5302
|
-
p.addGetterSetter(
|
|
5303
|
-
let
|
|
5296
|
+
Tt.prototype.className = "Ellipse";
|
|
5297
|
+
Tt.prototype._centroid = !0;
|
|
5298
|
+
Tt.prototype._attrsAffectingSize = ["radiusX", "radiusY"];
|
|
5299
|
+
tt(Tt);
|
|
5300
|
+
p.addComponentsGetterSetter(Tt, "radius", ["x", "y"]);
|
|
5301
|
+
p.addGetterSetter(Tt, "radiusX", 0, P());
|
|
5302
|
+
p.addGetterSetter(Tt, "radiusY", 0, P());
|
|
5303
|
+
let ut = class Fi extends x {
|
|
5304
5304
|
constructor(t) {
|
|
5305
5305
|
super(t), this._loadListener = () => {
|
|
5306
5306
|
this._requestDraw();
|
|
@@ -5363,16 +5363,16 @@ let dt = class Fi extends w {
|
|
|
5363
5363
|
}, s.onerror = i, s.crossOrigin = "Anonymous", s.src = t;
|
|
5364
5364
|
}
|
|
5365
5365
|
};
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
tt(
|
|
5369
|
-
p.addGetterSetter(
|
|
5370
|
-
p.addGetterSetter(
|
|
5371
|
-
p.addComponentsGetterSetter(
|
|
5372
|
-
p.addGetterSetter(
|
|
5373
|
-
p.addGetterSetter(
|
|
5374
|
-
p.addGetterSetter(
|
|
5375
|
-
p.addGetterSetter(
|
|
5366
|
+
ut.prototype.className = "Image";
|
|
5367
|
+
ut.prototype._attrsAffectingSize = ["image"];
|
|
5368
|
+
tt(ut);
|
|
5369
|
+
p.addGetterSetter(ut, "cornerRadius", 0, pe(4));
|
|
5370
|
+
p.addGetterSetter(ut, "image");
|
|
5371
|
+
p.addComponentsGetterSetter(ut, "crop", ["x", "y", "width", "height"]);
|
|
5372
|
+
p.addGetterSetter(ut, "cropX", 0, P());
|
|
5373
|
+
p.addGetterSetter(ut, "cropY", 0, P());
|
|
5374
|
+
p.addGetterSetter(ut, "cropWidth", 0, P());
|
|
5375
|
+
p.addGetterSetter(ut, "cropHeight", 0, P());
|
|
5376
5376
|
const Ni = [
|
|
5377
5377
|
"fontFamily",
|
|
5378
5378
|
"fontSize",
|
|
@@ -5443,7 +5443,7 @@ class Xe extends Ot {
|
|
|
5443
5443
|
}
|
|
5444
5444
|
Xe.prototype.className = "Label";
|
|
5445
5445
|
tt(Xe);
|
|
5446
|
-
class
|
|
5446
|
+
class Rt extends x {
|
|
5447
5447
|
_sceneFunc(t) {
|
|
5448
5448
|
const e = this.width(), i = this.height(), s = this.pointerDirection(), n = this.pointerWidth(), r = this.pointerHeight(), a = this.cornerRadius();
|
|
5449
5449
|
let h = 0, l = 0, c = 0, u = 0;
|
|
@@ -5459,13 +5459,13 @@ class Mt extends w {
|
|
|
5459
5459
|
};
|
|
5460
5460
|
}
|
|
5461
5461
|
}
|
|
5462
|
-
|
|
5463
|
-
tt(
|
|
5464
|
-
p.addGetterSetter(
|
|
5465
|
-
p.addGetterSetter(
|
|
5466
|
-
p.addGetterSetter(
|
|
5467
|
-
p.addGetterSetter(
|
|
5468
|
-
class te extends
|
|
5462
|
+
Rt.prototype.className = "Tag";
|
|
5463
|
+
tt(Rt);
|
|
5464
|
+
p.addGetterSetter(Rt, "pointerDirection", mn);
|
|
5465
|
+
p.addGetterSetter(Rt, "pointerWidth", 0, P());
|
|
5466
|
+
p.addGetterSetter(Rt, "pointerHeight", 0, P());
|
|
5467
|
+
p.addGetterSetter(Rt, "cornerRadius", 0, pe(4));
|
|
5468
|
+
class te extends x {
|
|
5469
5469
|
_sceneFunc(t) {
|
|
5470
5470
|
const e = this.cornerRadius(), i = this.width(), s = this.height();
|
|
5471
5471
|
t.beginPath(), e ? m.drawRoundedRectPath(t, i, s, e) : t.rect(0, 0, i, s), t.closePath(), t.fillStrokeShape(this);
|
|
@@ -5474,7 +5474,7 @@ class te extends w {
|
|
|
5474
5474
|
te.prototype.className = "Rect";
|
|
5475
5475
|
tt(te);
|
|
5476
5476
|
p.addGetterSetter(te, "cornerRadius", 0, pe(4));
|
|
5477
|
-
class
|
|
5477
|
+
class wt extends x {
|
|
5478
5478
|
_sceneFunc(t) {
|
|
5479
5479
|
const e = this._getPoints(), i = this.radius(), s = this.sides(), n = this.cornerRadius();
|
|
5480
5480
|
if (t.beginPath(), n)
|
|
@@ -5520,15 +5520,15 @@ class Tt extends w {
|
|
|
5520
5520
|
this.radius(t / 2);
|
|
5521
5521
|
}
|
|
5522
5522
|
}
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
tt(
|
|
5527
|
-
p.addGetterSetter(
|
|
5528
|
-
p.addGetterSetter(
|
|
5529
|
-
p.addGetterSetter(
|
|
5523
|
+
wt.prototype.className = "RegularPolygon";
|
|
5524
|
+
wt.prototype._centroid = !0;
|
|
5525
|
+
wt.prototype._attrsAffectingSize = ["radius"];
|
|
5526
|
+
tt(wt);
|
|
5527
|
+
p.addGetterSetter(wt, "radius", 0, P());
|
|
5528
|
+
p.addGetterSetter(wt, "sides", 0, P());
|
|
5529
|
+
p.addGetterSetter(wt, "cornerRadius", 0, pe(4));
|
|
5530
5530
|
const ci = Math.PI * 2;
|
|
5531
|
-
class
|
|
5531
|
+
class Lt extends x {
|
|
5532
5532
|
_sceneFunc(t) {
|
|
5533
5533
|
t.beginPath(), t.arc(0, 0, this.innerRadius(), 0, ci, !1), t.moveTo(this.outerRadius(), 0), t.arc(0, 0, this.outerRadius(), ci, 0, !0), t.closePath(), t.fillStrokeShape(this);
|
|
5534
5534
|
}
|
|
@@ -5545,15 +5545,15 @@ class Rt extends w {
|
|
|
5545
5545
|
this.outerRadius(t / 2);
|
|
5546
5546
|
}
|
|
5547
5547
|
}
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
tt(
|
|
5552
|
-
p.addGetterSetter(
|
|
5553
|
-
p.addGetterSetter(
|
|
5554
|
-
class
|
|
5548
|
+
Lt.prototype.className = "Ring";
|
|
5549
|
+
Lt.prototype._centroid = !0;
|
|
5550
|
+
Lt.prototype._attrsAffectingSize = ["innerRadius", "outerRadius"];
|
|
5551
|
+
tt(Lt);
|
|
5552
|
+
p.addGetterSetter(Lt, "innerRadius", 0, P());
|
|
5553
|
+
p.addGetterSetter(Lt, "outerRadius", 0, P());
|
|
5554
|
+
class ft extends x {
|
|
5555
5555
|
constructor(t) {
|
|
5556
|
-
super(t), this._updated = !0, this.anim = new
|
|
5556
|
+
super(t), this._updated = !0, this.anim = new lt(() => {
|
|
5557
5557
|
const e = this._updated;
|
|
5558
5558
|
return this._updated = !1, e;
|
|
5559
5559
|
}), this.on("animationChange.konva", function() {
|
|
@@ -5608,20 +5608,20 @@ class ut extends w {
|
|
|
5608
5608
|
t < n - 1 ? this.frameIndex(t + 1) : this.frameIndex(0);
|
|
5609
5609
|
}
|
|
5610
5610
|
}
|
|
5611
|
-
|
|
5612
|
-
tt(
|
|
5613
|
-
p.addGetterSetter(
|
|
5614
|
-
p.addGetterSetter(
|
|
5615
|
-
p.addGetterSetter(
|
|
5616
|
-
p.addGetterSetter(
|
|
5617
|
-
p.addGetterSetter(
|
|
5618
|
-
p.addGetterSetter(
|
|
5619
|
-
p.backCompat(
|
|
5611
|
+
ft.prototype.className = "Sprite";
|
|
5612
|
+
tt(ft);
|
|
5613
|
+
p.addGetterSetter(ft, "animation");
|
|
5614
|
+
p.addGetterSetter(ft, "animations");
|
|
5615
|
+
p.addGetterSetter(ft, "frameOffsets");
|
|
5616
|
+
p.addGetterSetter(ft, "image");
|
|
5617
|
+
p.addGetterSetter(ft, "frameIndex", 0, P());
|
|
5618
|
+
p.addGetterSetter(ft, "frameRate", 17, P());
|
|
5619
|
+
p.backCompat(ft, {
|
|
5620
5620
|
index: "frameIndex",
|
|
5621
5621
|
getIndex: "getFrameIndex",
|
|
5622
5622
|
setIndex: "setFrameIndex"
|
|
5623
5623
|
});
|
|
5624
|
-
class xt extends
|
|
5624
|
+
class xt extends x {
|
|
5625
5625
|
_sceneFunc(t) {
|
|
5626
5626
|
const e = this.innerRadius(), i = this.outerRadius(), s = this.numPoints();
|
|
5627
5627
|
t.beginPath(), t.moveTo(0, 0 - i);
|
|
@@ -5648,10 +5648,10 @@ xt.prototype.className = "Star";
|
|
|
5648
5648
|
xt.prototype._centroid = !0;
|
|
5649
5649
|
xt.prototype._attrsAffectingSize = ["innerRadius", "outerRadius"];
|
|
5650
5650
|
tt(xt);
|
|
5651
|
-
p.addGetterSetter(xt, "numPoints", 5,
|
|
5652
|
-
p.addGetterSetter(xt, "innerRadius", 0,
|
|
5653
|
-
p.addGetterSetter(xt, "outerRadius", 0,
|
|
5654
|
-
function
|
|
5651
|
+
p.addGetterSetter(xt, "numPoints", 5, P());
|
|
5652
|
+
p.addGetterSetter(xt, "innerRadius", 0, P());
|
|
5653
|
+
p.addGetterSetter(xt, "outerRadius", 0, P());
|
|
5654
|
+
function St(o) {
|
|
5655
5655
|
return [...o].reduce((t, e, i, s) => {
|
|
5656
5656
|
if (new RegExp("\\p{Emoji}", "u").test(e)) {
|
|
5657
5657
|
const n = s[i + 1];
|
|
@@ -5660,7 +5660,7 @@ function Ct(o) {
|
|
|
5660
5660
|
return t;
|
|
5661
5661
|
}, []);
|
|
5662
5662
|
}
|
|
5663
|
-
const
|
|
5663
|
+
const It = "auto", _n = "center", zi = "inherit", Wt = "justify", Sn = "Change.konva", Cn = "2d", di = "-", Hi = "left", bn = "text", vn = "Text", Tn = "top", wn = "bottom", ui = "middle", Wi = "normal", xn = "px ", he = " ", kn = "right", fi = "rtl", En = "word", Pn = "char", gi = "none", ve = "…", Xi = [
|
|
5664
5664
|
"direction",
|
|
5665
5665
|
"fontFamily",
|
|
5666
5666
|
"fontSize",
|
|
@@ -5676,7 +5676,7 @@ const Dt = "auto", _n = "center", zi = "inherit", Wt = "justify", Cn = "Change.k
|
|
|
5676
5676
|
"wrap",
|
|
5677
5677
|
"ellipsis",
|
|
5678
5678
|
"letterSpacing"
|
|
5679
|
-
],
|
|
5679
|
+
], An = Xi.length;
|
|
5680
5680
|
function Mn(o) {
|
|
5681
5681
|
return o.split(",").map((t) => {
|
|
5682
5682
|
t = t.trim();
|
|
@@ -5686,7 +5686,7 @@ function Mn(o) {
|
|
|
5686
5686
|
}
|
|
5687
5687
|
let le;
|
|
5688
5688
|
function Te() {
|
|
5689
|
-
return le || (le = m.createCanvasElement().getContext(
|
|
5689
|
+
return le || (le = m.createCanvasElement().getContext(Cn), le);
|
|
5690
5690
|
}
|
|
5691
5691
|
function Rn(o) {
|
|
5692
5692
|
o.fillText(this._partialText, this._partialTextX, this._partialTextY);
|
|
@@ -5697,11 +5697,11 @@ function Ln(o) {
|
|
|
5697
5697
|
function Dn(o) {
|
|
5698
5698
|
return o = o || {}, !o.fillLinearGradientColorStops && !o.fillRadialGradientColorStops && !o.fillPatternImage && (o.fill = o.fill || "black"), o;
|
|
5699
5699
|
}
|
|
5700
|
-
class
|
|
5700
|
+
class K extends x {
|
|
5701
5701
|
constructor(t) {
|
|
5702
5702
|
super(Dn(t)), this._partialTextX = 0, this._partialTextY = 0;
|
|
5703
|
-
for (let e = 0; e <
|
|
5704
|
-
this.on(Xi[e] +
|
|
5703
|
+
for (let e = 0; e < An; e++)
|
|
5704
|
+
this.on(Xi[e] + Sn, this._setTextData);
|
|
5705
5705
|
this._setTextData();
|
|
5706
5706
|
}
|
|
5707
5707
|
_sceneFunc(t) {
|
|
@@ -5709,40 +5709,40 @@ class Z extends w {
|
|
|
5709
5709
|
const s = this.textArr, n = s.length;
|
|
5710
5710
|
if (!this.text())
|
|
5711
5711
|
return;
|
|
5712
|
-
let r = this.padding(), a = this.fontSize(), h = this.lineHeight() * a, l = this.verticalAlign(), c = this.direction(), u = 0, d = this.align(), g = this.getWidth(), f = this.letterSpacing(),
|
|
5712
|
+
let r = this.padding(), a = this.fontSize(), h = this.lineHeight() * a, l = this.verticalAlign(), c = this.direction(), u = 0, d = this.align(), g = this.getWidth(), f = this.letterSpacing(), S = this.charRenderFunc(), C = this.fill(), y = this.textDecoration(), _ = this.underlineOffset(), v = y.indexOf("underline") !== -1, b = y.indexOf("line-through") !== -1, E;
|
|
5713
5713
|
c = c === zi ? t.direction : c;
|
|
5714
|
-
let
|
|
5715
|
-
if (!
|
|
5714
|
+
let w = h / 2, L = ui;
|
|
5715
|
+
if (!A.legacyTextRendering) {
|
|
5716
5716
|
const R = this.measureSize("M");
|
|
5717
5717
|
L = "alphabetic";
|
|
5718
5718
|
const I = (e = R.fontBoundingBoxAscent) !== null && e !== void 0 ? e : R.actualBoundingBoxAscent, G = (i = R.fontBoundingBoxDescent) !== null && i !== void 0 ? i : R.actualBoundingBoxDescent;
|
|
5719
|
-
|
|
5719
|
+
w = (I - G) / 2 + h / 2;
|
|
5720
5720
|
}
|
|
5721
|
-
for (c === fi && t.setAttr("direction", c), t.setAttr("font", this._getContextFont()), t.setAttr("textBaseline", L), t.setAttr("textAlign", Hi), l === ui ? u = (this.getHeight() - n * h - r * 2) / 2 : l ===
|
|
5721
|
+
for (c === fi && t.setAttr("direction", c), t.setAttr("font", this._getContextFont()), t.setAttr("textBaseline", L), t.setAttr("textAlign", Hi), l === ui ? u = (this.getHeight() - n * h - r * 2) / 2 : l === wn && (u = this.getHeight() - n * h - r * 2), t.translate(r, u + r), E = 0; E < n; E++) {
|
|
5722
5722
|
let R = 0, I = 0;
|
|
5723
5723
|
const G = s[E], W = G.text, B = G.width, X = G.lastInParagraph;
|
|
5724
5724
|
if (t.save(), d === kn ? R += g - B - r * 2 : d === _n && (R += (g - B - r * 2) / 2), v) {
|
|
5725
5725
|
t.save(), t.beginPath();
|
|
5726
|
-
const F = _ ?? (
|
|
5726
|
+
const F = _ ?? (A.legacyTextRendering ? Math.round(a / 2) : Math.round(a / 4)), D = R, q = w + I + F;
|
|
5727
5727
|
t.moveTo(D, q);
|
|
5728
5728
|
const O = d === Wt && !X ? g - r * 2 : B;
|
|
5729
5729
|
t.lineTo(D + Math.round(O), q), t.lineWidth = a / 15;
|
|
5730
5730
|
const Y = this._getLinearGradient();
|
|
5731
|
-
t.strokeStyle = Y ||
|
|
5731
|
+
t.strokeStyle = Y || C, t.stroke(), t.restore();
|
|
5732
5732
|
}
|
|
5733
5733
|
const z = R;
|
|
5734
|
-
if (c !== fi && (f !== 0 || d === Wt ||
|
|
5735
|
-
const F = W.split(" ").length - 1, D =
|
|
5734
|
+
if (c !== fi && (f !== 0 || d === Wt || S)) {
|
|
5735
|
+
const F = W.split(" ").length - 1, D = St(W);
|
|
5736
5736
|
for (let q = 0; q < D.length; q++) {
|
|
5737
5737
|
const O = D[q];
|
|
5738
|
-
if (O === " " && !X && d === Wt && (R += (g - r * 2 - B) / F), this._partialTextX = R, this._partialTextY =
|
|
5738
|
+
if (O === " " && !X && d === Wt && (R += (g - r * 2 - B) / F), this._partialTextX = R, this._partialTextY = w + I, this._partialText = O, S) {
|
|
5739
5739
|
t.save();
|
|
5740
|
-
const it = s.slice(0, E).reduce((et, rt) => et +
|
|
5741
|
-
|
|
5740
|
+
const it = s.slice(0, E).reduce((et, rt) => et + St(rt.text).length, 0), U = q + it;
|
|
5741
|
+
S({
|
|
5742
5742
|
char: O,
|
|
5743
|
-
index:
|
|
5743
|
+
index: U,
|
|
5744
5744
|
x: R,
|
|
5745
|
-
y:
|
|
5745
|
+
y: w + I,
|
|
5746
5746
|
lineIndex: E,
|
|
5747
5747
|
column: q,
|
|
5748
5748
|
isLastInLine: X,
|
|
@@ -5750,20 +5750,20 @@ class Z extends w {
|
|
|
5750
5750
|
context: t
|
|
5751
5751
|
});
|
|
5752
5752
|
}
|
|
5753
|
-
t.fillStrokeShape(this),
|
|
5753
|
+
t.fillStrokeShape(this), S && t.restore(), R += this.measureSize(O).width + f;
|
|
5754
5754
|
}
|
|
5755
5755
|
} else
|
|
5756
|
-
f !== 0 && t.setAttr("letterSpacing", `${f}px`), this._partialTextX = R, this._partialTextY =
|
|
5756
|
+
f !== 0 && t.setAttr("letterSpacing", `${f}px`), this._partialTextX = R, this._partialTextY = w + I, this._partialText = W, t.fillStrokeShape(this);
|
|
5757
5757
|
if (b) {
|
|
5758
5758
|
t.save(), t.beginPath();
|
|
5759
|
-
const F =
|
|
5760
|
-
t.moveTo(D,
|
|
5759
|
+
const F = A.legacyTextRendering ? 0 : -Math.round(a / 4), D = z;
|
|
5760
|
+
t.moveTo(D, w + I + F);
|
|
5761
5761
|
const q = d === Wt && !X ? g - r * 2 : B;
|
|
5762
|
-
t.lineTo(D + Math.round(q),
|
|
5762
|
+
t.lineTo(D + Math.round(q), w + I + F), t.lineWidth = a / 15;
|
|
5763
5763
|
const O = this._getLinearGradient();
|
|
5764
|
-
t.strokeStyle = O ||
|
|
5764
|
+
t.strokeStyle = O || C, t.stroke(), t.restore();
|
|
5765
5765
|
}
|
|
5766
|
-
t.restore(), n > 1 && (
|
|
5766
|
+
t.restore(), n > 1 && (w += h);
|
|
5767
5767
|
}
|
|
5768
5768
|
}
|
|
5769
5769
|
_hitFunc(t) {
|
|
@@ -5775,10 +5775,10 @@ class Z extends w {
|
|
|
5775
5775
|
return this._setAttr(bn, e), this;
|
|
5776
5776
|
}
|
|
5777
5777
|
getWidth() {
|
|
5778
|
-
return this.attrs.width ===
|
|
5778
|
+
return this.attrs.width === It || this.attrs.width === void 0 ? this.getTextWidth() + this.padding() * 2 : this.attrs.width;
|
|
5779
5779
|
}
|
|
5780
5780
|
getHeight() {
|
|
5781
|
-
return this.attrs.height ===
|
|
5781
|
+
return this.attrs.height === It || this.attrs.height === void 0 ? this.fontSize() * this.textArr.length * this.lineHeight() + this.padding() * 2 : this.attrs.height;
|
|
5782
5782
|
}
|
|
5783
5783
|
getTextWidth() {
|
|
5784
5784
|
return this.textWidth;
|
|
@@ -5788,27 +5788,27 @@ class Z extends w {
|
|
|
5788
5788
|
}
|
|
5789
5789
|
measureSize(t) {
|
|
5790
5790
|
var e, i, s, n, r, a, h, l, c, u, d;
|
|
5791
|
-
let g = Te(), f = this.fontSize(),
|
|
5792
|
-
g.save(), g.font = this._getContextFont(),
|
|
5793
|
-
const
|
|
5791
|
+
let g = Te(), f = this.fontSize(), S;
|
|
5792
|
+
g.save(), g.font = this._getContextFont(), S = g.measureText(t), g.restore();
|
|
5793
|
+
const C = f / 100;
|
|
5794
5794
|
return {
|
|
5795
|
-
actualBoundingBoxAscent: (e =
|
|
5796
|
-
actualBoundingBoxDescent: (i =
|
|
5797
|
-
actualBoundingBoxLeft: (s =
|
|
5798
|
-
actualBoundingBoxRight: (n =
|
|
5799
|
-
alphabeticBaseline: (r =
|
|
5800
|
-
emHeightAscent: (a =
|
|
5801
|
-
emHeightDescent: (h =
|
|
5802
|
-
fontBoundingBoxAscent: (l =
|
|
5803
|
-
fontBoundingBoxDescent: (c =
|
|
5804
|
-
hangingBaseline: (u =
|
|
5805
|
-
ideographicBaseline: (d =
|
|
5806
|
-
width:
|
|
5795
|
+
actualBoundingBoxAscent: (e = S.actualBoundingBoxAscent) !== null && e !== void 0 ? e : 71.58203125 * C,
|
|
5796
|
+
actualBoundingBoxDescent: (i = S.actualBoundingBoxDescent) !== null && i !== void 0 ? i : 0,
|
|
5797
|
+
actualBoundingBoxLeft: (s = S.actualBoundingBoxLeft) !== null && s !== void 0 ? s : -7.421875 * C,
|
|
5798
|
+
actualBoundingBoxRight: (n = S.actualBoundingBoxRight) !== null && n !== void 0 ? n : 75.732421875 * C,
|
|
5799
|
+
alphabeticBaseline: (r = S.alphabeticBaseline) !== null && r !== void 0 ? r : 0,
|
|
5800
|
+
emHeightAscent: (a = S.emHeightAscent) !== null && a !== void 0 ? a : 100 * C,
|
|
5801
|
+
emHeightDescent: (h = S.emHeightDescent) !== null && h !== void 0 ? h : -20 * C,
|
|
5802
|
+
fontBoundingBoxAscent: (l = S.fontBoundingBoxAscent) !== null && l !== void 0 ? l : 91 * C,
|
|
5803
|
+
fontBoundingBoxDescent: (c = S.fontBoundingBoxDescent) !== null && c !== void 0 ? c : 21 * C,
|
|
5804
|
+
hangingBaseline: (u = S.hangingBaseline) !== null && u !== void 0 ? u : 72.80000305175781 * C,
|
|
5805
|
+
ideographicBaseline: (d = S.ideographicBaseline) !== null && d !== void 0 ? d : -21 * C,
|
|
5806
|
+
width: S.width,
|
|
5807
5807
|
height: f
|
|
5808
5808
|
};
|
|
5809
5809
|
}
|
|
5810
5810
|
_getContextFont() {
|
|
5811
|
-
return this.fontStyle() + he + this.fontVariant() + he + (this.fontSize() +
|
|
5811
|
+
return this.fontStyle() + he + this.fontVariant() + he + (this.fontSize() + xn) + Mn(this.fontFamily());
|
|
5812
5812
|
}
|
|
5813
5813
|
_addTextLine(t) {
|
|
5814
5814
|
this.align() === Wt && (t = t.trim());
|
|
@@ -5825,21 +5825,21 @@ class Z extends w {
|
|
|
5825
5825
|
}
|
|
5826
5826
|
_setTextData() {
|
|
5827
5827
|
let t = this.text().split(`
|
|
5828
|
-
`), e = +this.fontSize(), i = 0, s = this.lineHeight() * e, n = this.attrs.width, r = this.attrs.height, a = n !==
|
|
5828
|
+
`), e = +this.fontSize(), i = 0, s = this.lineHeight() * e, n = this.attrs.width, r = this.attrs.height, a = n !== It && n !== void 0, h = r !== It && r !== void 0, l = this.padding(), c = n - l * 2, u = r - l * 2, d = 0, g = this.wrap(), f = g !== gi, S = g !== Pn && f, C = this.ellipsis();
|
|
5829
5829
|
this.textArr = [], Te().font = this._getContextFont();
|
|
5830
|
-
const y =
|
|
5830
|
+
const y = C ? this._getTextWidth(ve) : 0;
|
|
5831
5831
|
for (let _ = 0, v = t.length; _ < v; ++_) {
|
|
5832
5832
|
let b = t[_], E = this._getTextWidth(b);
|
|
5833
5833
|
if (a && E > c)
|
|
5834
5834
|
for (; b.length > 0; ) {
|
|
5835
|
-
let
|
|
5836
|
-
for (;
|
|
5837
|
-
const G =
|
|
5838
|
-
(
|
|
5835
|
+
let w = 0, L = St(b).length, R = "", I = 0;
|
|
5836
|
+
for (; w < L; ) {
|
|
5837
|
+
const G = w + L >>> 1, W = St(b), B = W.slice(0, G + 1).join(""), X = this._getTextWidth(B);
|
|
5838
|
+
(C && h && d + s > u ? X + y : X) <= c ? (w = G + 1, R = B, I = X) : L = G;
|
|
5839
5839
|
}
|
|
5840
5840
|
if (R) {
|
|
5841
|
-
if (
|
|
5842
|
-
const B =
|
|
5841
|
+
if (S) {
|
|
5842
|
+
const B = St(b), X = St(R), z = B[X.length], F = z === he || z === di;
|
|
5843
5843
|
let D;
|
|
5844
5844
|
if (F && I <= c)
|
|
5845
5845
|
D = X.length;
|
|
@@ -5847,13 +5847,13 @@ class Z extends w {
|
|
|
5847
5847
|
const q = X.lastIndexOf(he), O = X.lastIndexOf(di);
|
|
5848
5848
|
D = Math.max(q, O) + 1;
|
|
5849
5849
|
}
|
|
5850
|
-
D > 0 && (
|
|
5850
|
+
D > 0 && (w = D, R = B.slice(0, w).join(""), I = this._getTextWidth(R));
|
|
5851
5851
|
}
|
|
5852
5852
|
if (R = R.trimRight(), this._addTextLine(R), i = Math.max(i, I), d += s, this._shouldHandleEllipsis(d)) {
|
|
5853
5853
|
this._tryToAddEllipsisToLastLine();
|
|
5854
5854
|
break;
|
|
5855
5855
|
}
|
|
5856
|
-
if (b =
|
|
5856
|
+
if (b = St(b).slice(w).join("").trimLeft(), b.length > 0 && (E = this._getTextWidth(b), E <= c)) {
|
|
5857
5857
|
this._addTextLine(b), d += s, i = Math.max(i, E);
|
|
5858
5858
|
break;
|
|
5859
5859
|
}
|
|
@@ -5868,11 +5868,11 @@ class Z extends w {
|
|
|
5868
5868
|
this.textHeight = e, this.textWidth = i;
|
|
5869
5869
|
}
|
|
5870
5870
|
_shouldHandleEllipsis(t) {
|
|
5871
|
-
const e = +this.fontSize(), i = this.lineHeight() * e, s = this.attrs.height, n = s !==
|
|
5871
|
+
const e = +this.fontSize(), i = this.lineHeight() * e, s = this.attrs.height, n = s !== It && s !== void 0, r = this.padding(), a = s - r * 2;
|
|
5872
5872
|
return !(this.wrap() !== gi) || n && t + i > a;
|
|
5873
5873
|
}
|
|
5874
5874
|
_tryToAddEllipsisToLastLine() {
|
|
5875
|
-
const t = this.attrs.width, e = t !==
|
|
5875
|
+
const t = this.attrs.width, e = t !== It && t !== void 0, i = this.padding(), s = t - i * 2, n = this.ellipsis(), r = this.textArr[this.textArr.length - 1];
|
|
5876
5876
|
!r || !n || (e && (this._getTextWidth(r.text + ve) < s || (r.text = r.text.slice(0, r.text.length - 3))), this.textArr.splice(this.textArr.length - 1, 1), this._addTextLine(r.text + ve));
|
|
5877
5877
|
}
|
|
5878
5878
|
getStrokeScaleEnabled() {
|
|
@@ -5883,10 +5883,10 @@ class Z extends w {
|
|
|
5883
5883
|
return t && e ? !0 : super._useBufferCanvas();
|
|
5884
5884
|
}
|
|
5885
5885
|
}
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5886
|
+
K.prototype._fillFunc = Rn;
|
|
5887
|
+
K.prototype._strokeFunc = Ln;
|
|
5888
|
+
K.prototype.className = vn;
|
|
5889
|
+
K.prototype._attrsAffectingSize = [
|
|
5890
5890
|
"text",
|
|
5891
5891
|
"fontSize",
|
|
5892
5892
|
"padding",
|
|
@@ -5894,49 +5894,49 @@ Z.prototype._attrsAffectingSize = [
|
|
|
5894
5894
|
"lineHeight",
|
|
5895
5895
|
"letterSpacing"
|
|
5896
5896
|
];
|
|
5897
|
-
tt(
|
|
5898
|
-
p.overWriteSetter(
|
|
5899
|
-
p.overWriteSetter(
|
|
5900
|
-
p.addGetterSetter(
|
|
5901
|
-
p.addGetterSetter(
|
|
5902
|
-
p.addGetterSetter(
|
|
5903
|
-
p.addGetterSetter(
|
|
5904
|
-
p.addGetterSetter(
|
|
5905
|
-
p.addGetterSetter(
|
|
5906
|
-
p.addGetterSetter(
|
|
5907
|
-
p.addGetterSetter(
|
|
5908
|
-
p.addGetterSetter(
|
|
5909
|
-
p.addGetterSetter(
|
|
5910
|
-
p.addGetterSetter(
|
|
5911
|
-
p.addGetterSetter(
|
|
5912
|
-
p.addGetterSetter(
|
|
5913
|
-
p.addGetterSetter(
|
|
5914
|
-
p.addGetterSetter(
|
|
5915
|
-
p.addGetterSetter(
|
|
5916
|
-
const In = "",
|
|
5917
|
-
function
|
|
5897
|
+
tt(K);
|
|
5898
|
+
p.overWriteSetter(K, "width", ze());
|
|
5899
|
+
p.overWriteSetter(K, "height", ze());
|
|
5900
|
+
p.addGetterSetter(K, "direction", zi);
|
|
5901
|
+
p.addGetterSetter(K, "fontFamily", "Arial");
|
|
5902
|
+
p.addGetterSetter(K, "fontSize", 12, P());
|
|
5903
|
+
p.addGetterSetter(K, "fontStyle", Wi);
|
|
5904
|
+
p.addGetterSetter(K, "fontVariant", Wi);
|
|
5905
|
+
p.addGetterSetter(K, "padding", 0, P());
|
|
5906
|
+
p.addGetterSetter(K, "align", Hi);
|
|
5907
|
+
p.addGetterSetter(K, "verticalAlign", Tn);
|
|
5908
|
+
p.addGetterSetter(K, "lineHeight", 1, P());
|
|
5909
|
+
p.addGetterSetter(K, "wrap", En);
|
|
5910
|
+
p.addGetterSetter(K, "ellipsis", !1, dt());
|
|
5911
|
+
p.addGetterSetter(K, "letterSpacing", 0, P());
|
|
5912
|
+
p.addGetterSetter(K, "text", "", Pt());
|
|
5913
|
+
p.addGetterSetter(K, "textDecoration", "");
|
|
5914
|
+
p.addGetterSetter(K, "underlineOffset", void 0, P());
|
|
5915
|
+
p.addGetterSetter(K, "charRenderFunc", void 0);
|
|
5916
|
+
const In = "", Vi = "normal";
|
|
5917
|
+
function Ui(o) {
|
|
5918
5918
|
o.fillText(this.partialText, 0, 0);
|
|
5919
5919
|
}
|
|
5920
5920
|
function Yi(o) {
|
|
5921
5921
|
o.strokeText(this.partialText, 0, 0);
|
|
5922
5922
|
}
|
|
5923
|
-
class st extends
|
|
5923
|
+
class st extends x {
|
|
5924
5924
|
constructor(t) {
|
|
5925
5925
|
super(t), this.dummyCanvas = m.createCanvasElement(), this.dataArray = [], this._readDataAttribute(), this.on("dataChange.konva", function() {
|
|
5926
5926
|
this._readDataAttribute(), this._setTextData();
|
|
5927
5927
|
}), this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva", this._setTextData), this._setTextData();
|
|
5928
5928
|
}
|
|
5929
5929
|
_getTextPathLength() {
|
|
5930
|
-
return
|
|
5930
|
+
return Z.getPathLength(this.dataArray);
|
|
5931
5931
|
}
|
|
5932
5932
|
_getPointAtLength(t) {
|
|
5933
5933
|
if (!this.attrs.data)
|
|
5934
5934
|
return null;
|
|
5935
5935
|
const e = this.pathLength;
|
|
5936
|
-
return t > e ? null :
|
|
5936
|
+
return t > e ? null : Z.getPointAtLengthOfDataArray(t, this.dataArray);
|
|
5937
5937
|
}
|
|
5938
5938
|
_readDataAttribute() {
|
|
5939
|
-
this.dataArray =
|
|
5939
|
+
this.dataArray = Z.parsePathData(this.attrs.data), this.pathLength = this._getTextPathLength();
|
|
5940
5940
|
}
|
|
5941
5941
|
_sceneFunc(t) {
|
|
5942
5942
|
t.setAttr("font", this._getContextFont()), t.setAttr("textBaseline", this.textBaseline()), t.setAttr("textAlign", "left"), t.save();
|
|
@@ -5978,10 +5978,10 @@ class st extends w {
|
|
|
5978
5978
|
return m.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."), this.textHeight;
|
|
5979
5979
|
}
|
|
5980
5980
|
setText(t) {
|
|
5981
|
-
return
|
|
5981
|
+
return K.prototype.setText.call(this, t);
|
|
5982
5982
|
}
|
|
5983
5983
|
_getContextFont() {
|
|
5984
|
-
return
|
|
5984
|
+
return K.prototype._getContextFont.call(this);
|
|
5985
5985
|
}
|
|
5986
5986
|
_getTextSize(t) {
|
|
5987
5987
|
const i = this.dummyCanvas.getContext("2d");
|
|
@@ -5993,7 +5993,7 @@ class st extends w {
|
|
|
5993
5993
|
};
|
|
5994
5994
|
}
|
|
5995
5995
|
_setTextData() {
|
|
5996
|
-
const t =
|
|
5996
|
+
const t = St(this.text()), e = [];
|
|
5997
5997
|
let i = 0;
|
|
5998
5998
|
for (let u = 0; u < t.length; u++)
|
|
5999
5999
|
e.push({
|
|
@@ -6017,10 +6017,10 @@ class st extends w {
|
|
|
6017
6017
|
const b = this.text().split(" ").length - 1;
|
|
6018
6018
|
f += (this.pathLength - h) / b;
|
|
6019
6019
|
}
|
|
6020
|
-
const
|
|
6021
|
-
if (!
|
|
6020
|
+
const S = this._getPointAtLength(c + f);
|
|
6021
|
+
if (!S)
|
|
6022
6022
|
return;
|
|
6023
|
-
const
|
|
6023
|
+
const C = Z.getLineLength(d.x, d.y, S.x, S.y);
|
|
6024
6024
|
let y = 0;
|
|
6025
6025
|
if (a)
|
|
6026
6026
|
try {
|
|
@@ -6028,16 +6028,16 @@ class st extends w {
|
|
|
6028
6028
|
} catch {
|
|
6029
6029
|
y = 0;
|
|
6030
6030
|
}
|
|
6031
|
-
d.x += y,
|
|
6032
|
-
const _ =
|
|
6031
|
+
d.x += y, S.x += y, this.textWidth += y;
|
|
6032
|
+
const _ = Z.getPointOnLine(y + C / 2, d.x, d.y, S.x, S.y), v = Math.atan2(S.y - d.y, S.x - d.x);
|
|
6033
6033
|
this.glyphInfo.push({
|
|
6034
6034
|
transposeX: _.x,
|
|
6035
6035
|
transposeY: _.y,
|
|
6036
6036
|
text: t[u],
|
|
6037
6037
|
rotation: v,
|
|
6038
6038
|
p0: d,
|
|
6039
|
-
p1:
|
|
6040
|
-
width:
|
|
6039
|
+
p1: S,
|
|
6040
|
+
width: C
|
|
6041
6041
|
}), c += f;
|
|
6042
6042
|
}
|
|
6043
6043
|
}
|
|
@@ -6068,21 +6068,21 @@ class st extends w {
|
|
|
6068
6068
|
return m.releaseCanvas(this.dummyCanvas), super.destroy();
|
|
6069
6069
|
}
|
|
6070
6070
|
}
|
|
6071
|
-
st.prototype._fillFunc =
|
|
6071
|
+
st.prototype._fillFunc = Ui;
|
|
6072
6072
|
st.prototype._strokeFunc = Yi;
|
|
6073
|
-
st.prototype._fillFuncHit =
|
|
6073
|
+
st.prototype._fillFuncHit = Ui;
|
|
6074
6074
|
st.prototype._strokeFuncHit = Yi;
|
|
6075
6075
|
st.prototype.className = "TextPath";
|
|
6076
6076
|
st.prototype._attrsAffectingSize = ["text", "fontSize", "data"];
|
|
6077
6077
|
tt(st);
|
|
6078
6078
|
p.addGetterSetter(st, "data");
|
|
6079
6079
|
p.addGetterSetter(st, "fontFamily", "Arial");
|
|
6080
|
-
p.addGetterSetter(st, "fontSize", 12,
|
|
6081
|
-
p.addGetterSetter(st, "fontStyle",
|
|
6080
|
+
p.addGetterSetter(st, "fontSize", 12, P());
|
|
6081
|
+
p.addGetterSetter(st, "fontStyle", Vi);
|
|
6082
6082
|
p.addGetterSetter(st, "align", "left");
|
|
6083
|
-
p.addGetterSetter(st, "letterSpacing", 0,
|
|
6083
|
+
p.addGetterSetter(st, "letterSpacing", 0, P());
|
|
6084
6084
|
p.addGetterSetter(st, "textBaseline", "middle");
|
|
6085
|
-
p.addGetterSetter(st, "fontVariant",
|
|
6085
|
+
p.addGetterSetter(st, "fontVariant", Vi);
|
|
6086
6086
|
p.addGetterSetter(st, "text", In);
|
|
6087
6087
|
p.addGetterSetter(st, "textDecoration", "");
|
|
6088
6088
|
p.addGetterSetter(st, "kerningFunc", void 0);
|
|
@@ -6125,7 +6125,7 @@ const ji = "tr-konva", Gn = [
|
|
|
6125
6125
|
"bottom-left": -135,
|
|
6126
6126
|
"bottom-center": 180,
|
|
6127
6127
|
"bottom-right": 135
|
|
6128
|
-
}, Fn = "ontouchstart" in
|
|
6128
|
+
}, Fn = "ontouchstart" in A._global;
|
|
6129
6129
|
function Nn(o, t, e) {
|
|
6130
6130
|
if (o === "rotater")
|
|
6131
6131
|
return e;
|
|
@@ -6165,7 +6165,7 @@ function Hn(o, t) {
|
|
|
6165
6165
|
function Wn(o, t, e) {
|
|
6166
6166
|
let i = t;
|
|
6167
6167
|
for (let s = 0; s < o.length; s++) {
|
|
6168
|
-
const n =
|
|
6168
|
+
const n = A.getAngle(o[s]), r = Math.abs(n - t) % (Math.PI * 2);
|
|
6169
6169
|
Math.min(r, Math.PI * 2 - r) < e && (i = n);
|
|
6170
6170
|
}
|
|
6171
6171
|
return i;
|
|
@@ -6242,14 +6242,14 @@ class H extends Ot {
|
|
|
6242
6242
|
skipTransform: !0,
|
|
6243
6243
|
skipShadow: !0,
|
|
6244
6244
|
skipStroke: this.ignoreStroke()
|
|
6245
|
-
}), n = t.getAbsoluteScale(i), r = t.getAbsolutePosition(i), a = s.x * n.x - t.offsetX() * n.x, h = s.y * n.y - t.offsetY() * n.y, l = (
|
|
6245
|
+
}), n = t.getAbsoluteScale(i), r = t.getAbsolutePosition(i), a = s.x * n.x - t.offsetX() * n.x, h = s.y * n.y - t.offsetY() * n.y, l = (A.getAngle(t.getAbsoluteRotation()) + Math.PI * 2) % (Math.PI * 2), c = {
|
|
6246
6246
|
x: r.x + a * Math.cos(l) + h * Math.sin(-l),
|
|
6247
6247
|
y: r.y + h * Math.cos(l) + a * Math.sin(l),
|
|
6248
6248
|
width: s.width * n.x,
|
|
6249
6249
|
height: s.height * n.y,
|
|
6250
6250
|
rotation: l
|
|
6251
6251
|
};
|
|
6252
|
-
return qi(c, -
|
|
6252
|
+
return qi(c, -A.getAngle(e), {
|
|
6253
6253
|
x: 0,
|
|
6254
6254
|
y: 0
|
|
6255
6255
|
});
|
|
@@ -6281,7 +6281,7 @@ class H extends Ot {
|
|
|
6281
6281
|
});
|
|
6282
6282
|
});
|
|
6283
6283
|
const i = new at();
|
|
6284
|
-
i.rotate(-
|
|
6284
|
+
i.rotate(-A.getAngle(this.rotation()));
|
|
6285
6285
|
let s = 1 / 0, n = 1 / 0, r = -1 / 0, a = -1 / 0;
|
|
6286
6286
|
e.forEach(function(l) {
|
|
6287
6287
|
const c = i.point(l);
|
|
@@ -6293,7 +6293,7 @@ class H extends Ot {
|
|
|
6293
6293
|
y: h.y,
|
|
6294
6294
|
width: r - s,
|
|
6295
6295
|
height: a - n,
|
|
6296
|
-
rotation:
|
|
6296
|
+
rotation: A.getAngle(this.rotation())
|
|
6297
6297
|
};
|
|
6298
6298
|
}
|
|
6299
6299
|
getX() {
|
|
@@ -6330,14 +6330,14 @@ class H extends Ot {
|
|
|
6330
6330
|
}), e.on("dragend", (s) => {
|
|
6331
6331
|
s.cancelBubble = !0;
|
|
6332
6332
|
}), e.on("mouseenter", () => {
|
|
6333
|
-
const s =
|
|
6333
|
+
const s = A.getAngle(this.rotation()), n = this.rotateAnchorCursor(), r = Nn(t, s, n);
|
|
6334
6334
|
e.getStage().content && (e.getStage().content.style.cursor = r), this._cursorChange = !0;
|
|
6335
6335
|
}), e.on("mouseout", () => {
|
|
6336
6336
|
e.getStage().content && (e.getStage().content.style.cursor = ""), this._cursorChange = !1;
|
|
6337
6337
|
}), this.add(e);
|
|
6338
6338
|
}
|
|
6339
6339
|
_createBack() {
|
|
6340
|
-
const t = new
|
|
6340
|
+
const t = new x({
|
|
6341
6341
|
name: "back",
|
|
6342
6342
|
width: 0,
|
|
6343
6343
|
height: 0,
|
|
@@ -6345,10 +6345,10 @@ class H extends Ot {
|
|
|
6345
6345
|
const s = i.getParent(), n = s.padding(), r = i.width(), a = i.height();
|
|
6346
6346
|
if (e.beginPath(), e.rect(-n, -n, r + n * 2, a + n * 2), s.rotateEnabled() && s.rotateLineVisible()) {
|
|
6347
6347
|
const h = s.rotateAnchorAngle(), l = s.rotateAnchorOffset(), c = m.degToRad(h), u = Math.sin(c), d = -Math.cos(c), g = r / 2, f = a / 2;
|
|
6348
|
-
let
|
|
6349
|
-
d < 0 ?
|
|
6350
|
-
const
|
|
6351
|
-
e.moveTo(
|
|
6348
|
+
let S = 1 / 0;
|
|
6349
|
+
d < 0 ? S = Math.min(S, -f / d) : d > 0 && (S = Math.min(S, (a - f) / d)), u < 0 ? S = Math.min(S, -g / u) : u > 0 && (S = Math.min(S, (r - g) / u));
|
|
6350
|
+
const C = g + u * S, y = f + d * S, _ = m._sign(a), v = C + u * l * _, b = y + d * l * _;
|
|
6351
|
+
e.moveTo(C, y), e.lineTo(v, b);
|
|
6352
6352
|
}
|
|
6353
6353
|
e.fillStrokeShape(i);
|
|
6354
6354
|
},
|
|
@@ -6400,10 +6400,10 @@ class H extends Ot {
|
|
|
6400
6400
|
if (this._movingAnchorName === "rotater") {
|
|
6401
6401
|
const _ = this._getNodeRect();
|
|
6402
6402
|
e = n.x() - _.width / 2, i = -n.y() + _.height / 2;
|
|
6403
|
-
const v =
|
|
6403
|
+
const v = A.getAngle(this.rotateAnchorAngle());
|
|
6404
6404
|
let b = Math.atan2(-i, e) + Math.PI / 2 - v;
|
|
6405
6405
|
_.height < 0 && (b -= Math.PI);
|
|
6406
|
-
const
|
|
6406
|
+
const w = A.getAngle(this.rotation()) + b, L = A.getAngle(this.rotationSnapTolerance()), I = Wn(this.rotationSnaps(), w, L) - _.rotation, G = Hn(_, I);
|
|
6407
6407
|
this._fitNodesInto(G, t);
|
|
6408
6408
|
return;
|
|
6409
6409
|
}
|
|
@@ -6477,24 +6477,24 @@ class H extends Ot {
|
|
|
6477
6477
|
} else
|
|
6478
6478
|
console.error(new Error("Wrong position argument of selection resizer: " + this._movingAnchorName));
|
|
6479
6479
|
if (g = this.centeredScaling() || t.altKey, g) {
|
|
6480
|
-
const _ = this.findOne(".top-left"), v = this.findOne(".bottom-right"), b = _.x(), E = _.y(),
|
|
6480
|
+
const _ = this.findOne(".top-left"), v = this.findOne(".bottom-right"), b = _.x(), E = _.y(), w = this.getWidth() - v.x(), L = this.getHeight() - v.y();
|
|
6481
6481
|
v.move({
|
|
6482
6482
|
x: -b,
|
|
6483
6483
|
y: -E
|
|
6484
6484
|
}), _.move({
|
|
6485
|
-
x:
|
|
6485
|
+
x: w,
|
|
6486
6486
|
y: L
|
|
6487
6487
|
});
|
|
6488
6488
|
}
|
|
6489
|
-
const
|
|
6490
|
-
e =
|
|
6491
|
-
const
|
|
6489
|
+
const S = this.findOne(".top-left").getAbsolutePosition();
|
|
6490
|
+
e = S.x, i = S.y;
|
|
6491
|
+
const C = this.findOne(".bottom-right").x() - this.findOne(".top-left").x(), y = this.findOne(".bottom-right").y() - this.findOne(".top-left").y();
|
|
6492
6492
|
this._fitNodesInto({
|
|
6493
6493
|
x: e,
|
|
6494
6494
|
y: i,
|
|
6495
|
-
width:
|
|
6495
|
+
width: C,
|
|
6496
6496
|
height: y,
|
|
6497
|
-
rotation:
|
|
6497
|
+
rotation: A.getAngle(this.rotation())
|
|
6498
6498
|
}, t);
|
|
6499
6499
|
}
|
|
6500
6500
|
_handleMouseUp(t) {
|
|
@@ -6525,7 +6525,7 @@ class H extends Ot {
|
|
|
6525
6525
|
return;
|
|
6526
6526
|
}
|
|
6527
6527
|
const n = new at();
|
|
6528
|
-
if (n.rotate(
|
|
6528
|
+
if (n.rotate(A.getAngle(this.rotation())), this._movingAnchorName && t.width < 0 && this._movingAnchorName.indexOf("left") >= 0) {
|
|
6529
6529
|
const d = n.point({
|
|
6530
6530
|
x: -this.padding() * 2,
|
|
6531
6531
|
y: 0
|
|
@@ -6564,11 +6564,11 @@ class H extends Ot {
|
|
|
6564
6564
|
var g;
|
|
6565
6565
|
if (!d.getStage())
|
|
6566
6566
|
return;
|
|
6567
|
-
const f = d.getParent().getAbsoluteTransform(),
|
|
6568
|
-
|
|
6569
|
-
const
|
|
6570
|
-
|
|
6571
|
-
const y =
|
|
6567
|
+
const f = d.getParent().getAbsoluteTransform(), S = d.getTransform().copy();
|
|
6568
|
+
S.translate(d.offsetX(), d.offsetY());
|
|
6569
|
+
const C = new at();
|
|
6570
|
+
C.multiply(f.copy().invert()).multiply(u).multiply(f).multiply(S);
|
|
6571
|
+
const y = C.decompose();
|
|
6572
6572
|
d.setAttrs(y), (g = d.getLayer()) === null || g === void 0 || g.batchDraw();
|
|
6573
6573
|
}), this.rotation(m._getRotation(t.rotation)), this._nodes.forEach((d) => {
|
|
6574
6574
|
this._fire("transform", { evt: e, target: d }), d._fire("transform", { evt: e, target: d });
|
|
@@ -6585,8 +6585,8 @@ class H extends Ot {
|
|
|
6585
6585
|
const e = this._getNodeRect();
|
|
6586
6586
|
this.rotation(m._getRotation(e.rotation));
|
|
6587
6587
|
const i = e.width, s = e.height, n = this.enabledAnchors(), r = this.resizeEnabled(), a = this.padding(), h = this.anchorSize(), l = this.find("._anchor");
|
|
6588
|
-
l.forEach((
|
|
6589
|
-
|
|
6588
|
+
l.forEach((w) => {
|
|
6589
|
+
w.setAttrs({
|
|
6590
6590
|
width: h,
|
|
6591
6591
|
height: h,
|
|
6592
6592
|
offsetX: h / 2,
|
|
@@ -6641,10 +6641,10 @@ class H extends Ot {
|
|
|
6641
6641
|
offsetY: h / 2 - a,
|
|
6642
6642
|
visible: r && n.indexOf("bottom-right") >= 0
|
|
6643
6643
|
});
|
|
6644
|
-
const c = this.rotateAnchorAngle(), u = this.rotateAnchorOffset(), d = m.degToRad(c), g = Math.sin(d), f = -Math.cos(d),
|
|
6644
|
+
const c = this.rotateAnchorAngle(), u = this.rotateAnchorOffset(), d = m.degToRad(c), g = Math.sin(d), f = -Math.cos(d), S = i / 2, C = s / 2;
|
|
6645
6645
|
let y = 1 / 0;
|
|
6646
|
-
f < 0 ? y = Math.min(y, -
|
|
6647
|
-
const _ =
|
|
6646
|
+
f < 0 ? y = Math.min(y, -C / f) : f > 0 && (y = Math.min(y, (s - C) / f)), g < 0 ? y = Math.min(y, -S / g) : g > 0 && (y = Math.min(y, (i - S) / g));
|
|
6647
|
+
const _ = S + g * y, v = C + f * y, b = m._sign(s);
|
|
6648
6648
|
this._batchChangeChild(".rotater", {
|
|
6649
6649
|
x: _ + g * u * b,
|
|
6650
6650
|
y: v + f * u * b - a * f,
|
|
@@ -6656,13 +6656,13 @@ class H extends Ot {
|
|
|
6656
6656
|
stroke: this.borderStroke(),
|
|
6657
6657
|
strokeWidth: this.borderStrokeWidth(),
|
|
6658
6658
|
dash: this.borderDash(),
|
|
6659
|
-
draggable: this.nodes().some((
|
|
6659
|
+
draggable: this.nodes().some((w) => w.draggable()),
|
|
6660
6660
|
x: 0,
|
|
6661
6661
|
y: 0
|
|
6662
6662
|
});
|
|
6663
6663
|
const E = this.anchorStyleFunc();
|
|
6664
|
-
E && l.forEach((
|
|
6665
|
-
E(
|
|
6664
|
+
E && l.forEach((w) => {
|
|
6665
|
+
E(w);
|
|
6666
6666
|
}), (t = this.getLayer()) === null || t === void 0 || t.batchDraw();
|
|
6667
6667
|
}
|
|
6668
6668
|
isTransforming() {
|
|
@@ -6697,29 +6697,29 @@ function Xn(o) {
|
|
|
6697
6697
|
H.prototype.className = "Transformer";
|
|
6698
6698
|
tt(H);
|
|
6699
6699
|
p.addGetterSetter(H, "enabledAnchors", fe, Xn);
|
|
6700
|
-
p.addGetterSetter(H, "flipEnabled", !0,
|
|
6700
|
+
p.addGetterSetter(H, "flipEnabled", !0, dt());
|
|
6701
6701
|
p.addGetterSetter(H, "resizeEnabled", !0);
|
|
6702
|
-
p.addGetterSetter(H, "anchorSize", 10,
|
|
6702
|
+
p.addGetterSetter(H, "anchorSize", 10, P());
|
|
6703
6703
|
p.addGetterSetter(H, "rotateEnabled", !0);
|
|
6704
6704
|
p.addGetterSetter(H, "rotateLineVisible", !0);
|
|
6705
6705
|
p.addGetterSetter(H, "rotationSnaps", []);
|
|
6706
|
-
p.addGetterSetter(H, "rotateAnchorOffset", 50,
|
|
6707
|
-
p.addGetterSetter(H, "rotateAnchorAngle", 0,
|
|
6706
|
+
p.addGetterSetter(H, "rotateAnchorOffset", 50, P());
|
|
6707
|
+
p.addGetterSetter(H, "rotateAnchorAngle", 0, P());
|
|
6708
6708
|
p.addGetterSetter(H, "rotateAnchorCursor", "crosshair");
|
|
6709
|
-
p.addGetterSetter(H, "rotationSnapTolerance", 5,
|
|
6709
|
+
p.addGetterSetter(H, "rotationSnapTolerance", 5, P());
|
|
6710
6710
|
p.addGetterSetter(H, "borderEnabled", !0);
|
|
6711
6711
|
p.addGetterSetter(H, "anchorStroke", "rgb(0, 161, 255)");
|
|
6712
|
-
p.addGetterSetter(H, "anchorStrokeWidth", 1,
|
|
6712
|
+
p.addGetterSetter(H, "anchorStrokeWidth", 1, P());
|
|
6713
6713
|
p.addGetterSetter(H, "anchorFill", "white");
|
|
6714
|
-
p.addGetterSetter(H, "anchorCornerRadius", 0,
|
|
6714
|
+
p.addGetterSetter(H, "anchorCornerRadius", 0, P());
|
|
6715
6715
|
p.addGetterSetter(H, "borderStroke", "rgb(0, 161, 255)");
|
|
6716
|
-
p.addGetterSetter(H, "borderStrokeWidth", 1,
|
|
6716
|
+
p.addGetterSetter(H, "borderStrokeWidth", 1, P());
|
|
6717
6717
|
p.addGetterSetter(H, "borderDash");
|
|
6718
6718
|
p.addGetterSetter(H, "keepRatio", !0);
|
|
6719
6719
|
p.addGetterSetter(H, "shiftBehavior", "default");
|
|
6720
6720
|
p.addGetterSetter(H, "centeredScaling", !1);
|
|
6721
6721
|
p.addGetterSetter(H, "ignoreStroke", !1);
|
|
6722
|
-
p.addGetterSetter(H, "padding", 0,
|
|
6722
|
+
p.addGetterSetter(H, "padding", 0, P());
|
|
6723
6723
|
p.addGetterSetter(H, "nodes");
|
|
6724
6724
|
p.addGetterSetter(H, "node");
|
|
6725
6725
|
p.addGetterSetter(H, "boundBoxFunc");
|
|
@@ -6732,9 +6732,9 @@ p.backCompat(H, {
|
|
|
6732
6732
|
rotateHandlerOffset: "rotateAnchorOffset",
|
|
6733
6733
|
enabledHandlers: "enabledAnchors"
|
|
6734
6734
|
});
|
|
6735
|
-
class yt extends
|
|
6735
|
+
class yt extends x {
|
|
6736
6736
|
_sceneFunc(t) {
|
|
6737
|
-
t.beginPath(), t.arc(0, 0, this.radius(), 0,
|
|
6737
|
+
t.beginPath(), t.arc(0, 0, this.radius(), 0, A.getAngle(this.angle()), this.clockwise()), t.lineTo(0, 0), t.closePath(), t.fillStrokeShape(this);
|
|
6738
6738
|
}
|
|
6739
6739
|
getWidth() {
|
|
6740
6740
|
return this.radius() * 2;
|
|
@@ -6753,8 +6753,8 @@ yt.prototype.className = "Wedge";
|
|
|
6753
6753
|
yt.prototype._centroid = !0;
|
|
6754
6754
|
yt.prototype._attrsAffectingSize = ["radius"];
|
|
6755
6755
|
tt(yt);
|
|
6756
|
-
p.addGetterSetter(yt, "radius", 0,
|
|
6757
|
-
p.addGetterSetter(yt, "angle", 0,
|
|
6756
|
+
p.addGetterSetter(yt, "radius", 0, P());
|
|
6757
|
+
p.addGetterSetter(yt, "angle", 0, P());
|
|
6758
6758
|
p.addGetterSetter(yt, "clockwise", !1);
|
|
6759
6759
|
p.backCompat(yt, {
|
|
6760
6760
|
angleDeg: "angle",
|
|
@@ -6764,7 +6764,7 @@ p.backCompat(yt, {
|
|
|
6764
6764
|
function mi() {
|
|
6765
6765
|
this.r = 0, this.g = 0, this.b = 0, this.a = 0, this.next = null;
|
|
6766
6766
|
}
|
|
6767
|
-
const
|
|
6767
|
+
const Vn = [
|
|
6768
6768
|
512,
|
|
6769
6769
|
512,
|
|
6770
6770
|
456,
|
|
@@ -7020,7 +7020,7 @@ const Un = [
|
|
|
7020
7020
|
263,
|
|
7021
7021
|
261,
|
|
7022
7022
|
259
|
|
7023
|
-
],
|
|
7023
|
+
], Un = [
|
|
7024
7024
|
9,
|
|
7025
7025
|
11,
|
|
7026
7026
|
12,
|
|
@@ -7279,60 +7279,60 @@ const Un = [
|
|
|
7279
7279
|
];
|
|
7280
7280
|
function Yn(o, t) {
|
|
7281
7281
|
const e = o.data, i = o.width, s = o.height;
|
|
7282
|
-
let n, r, a, h, l, c, u, d, g, f,
|
|
7283
|
-
const I = t + t + 1, G = i - 1, W = s - 1, B = t + 1, X = B * (B + 1) / 2, z = new mi(), F =
|
|
7282
|
+
let n, r, a, h, l, c, u, d, g, f, S, C, y, _, v, b, E, w, L, R;
|
|
7283
|
+
const I = t + t + 1, G = i - 1, W = s - 1, B = t + 1, X = B * (B + 1) / 2, z = new mi(), F = Vn[t], D = Un[t];
|
|
7284
7284
|
let q = null, O = z, Y = null, it = null;
|
|
7285
|
-
for (let
|
|
7286
|
-
O = O.next = new mi(),
|
|
7285
|
+
for (let U = 1; U < I; U++)
|
|
7286
|
+
O = O.next = new mi(), U === B && (q = O);
|
|
7287
7287
|
O.next = z, a = r = 0;
|
|
7288
|
-
for (let
|
|
7289
|
-
|
|
7288
|
+
for (let U = 0; U < s; U++) {
|
|
7289
|
+
C = y = _ = v = h = l = c = u = 0, d = B * (b = e[r]), g = B * (E = e[r + 1]), f = B * (w = e[r + 2]), S = B * (L = e[r + 3]), h += X * b, l += X * E, c += X * w, u += X * L, O = z;
|
|
7290
7290
|
for (let et = 0; et < B; et++)
|
|
7291
|
-
O.r = b, O.g = E, O.b =
|
|
7291
|
+
O.r = b, O.g = E, O.b = w, O.a = L, O = O.next;
|
|
7292
7292
|
for (let et = 1; et < B; et++)
|
|
7293
|
-
n = r + ((G < et ? G : et) << 2), h += (O.r = b = e[n]) * (R = B - et), l += (O.g = E = e[n + 1]) * R, c += (O.b =
|
|
7293
|
+
n = r + ((G < et ? G : et) << 2), h += (O.r = b = e[n]) * (R = B - et), l += (O.g = E = e[n + 1]) * R, c += (O.b = w = e[n + 2]) * R, u += (O.a = L = e[n + 3]) * R, C += b, y += E, _ += w, v += L, O = O.next;
|
|
7294
7294
|
Y = z, it = q;
|
|
7295
7295
|
for (let et = 0; et < i; et++)
|
|
7296
|
-
e[r + 3] = L = u * F >> D, L !== 0 ? (L = 255 / L, e[r] = (h * F >> D) * L, e[r + 1] = (l * F >> D) * L, e[r + 2] = (c * F >> D) * L) : e[r] = e[r + 1] = e[r + 2] = 0, h -= d, l -= g, c -= f, u -=
|
|
7296
|
+
e[r + 3] = L = u * F >> D, L !== 0 ? (L = 255 / L, e[r] = (h * F >> D) * L, e[r + 1] = (l * F >> D) * L, e[r + 2] = (c * F >> D) * L) : e[r] = e[r + 1] = e[r + 2] = 0, h -= d, l -= g, c -= f, u -= S, d -= Y.r, g -= Y.g, f -= Y.b, S -= Y.a, n = a + ((n = et + t + 1) < G ? n : G) << 2, C += Y.r = e[n], y += Y.g = e[n + 1], _ += Y.b = e[n + 2], v += Y.a = e[n + 3], h += C, l += y, c += _, u += v, Y = Y.next, d += b = it.r, g += E = it.g, f += w = it.b, S += L = it.a, C -= b, y -= E, _ -= w, v -= L, it = it.next, r += 4;
|
|
7297
7297
|
a += i;
|
|
7298
7298
|
}
|
|
7299
|
-
for (let
|
|
7300
|
-
y = _ = v =
|
|
7299
|
+
for (let U = 0; U < i; U++) {
|
|
7300
|
+
y = _ = v = C = l = c = u = h = 0, r = U << 2, d = B * (b = e[r]), g = B * (E = e[r + 1]), f = B * (w = e[r + 2]), S = B * (L = e[r + 3]), h += X * b, l += X * E, c += X * w, u += X * L, O = z;
|
|
7301
7301
|
for (let rt = 0; rt < B; rt++)
|
|
7302
|
-
O.r = b, O.g = E, O.b =
|
|
7302
|
+
O.r = b, O.g = E, O.b = w, O.a = L, O = O.next;
|
|
7303
7303
|
let et = i;
|
|
7304
7304
|
for (let rt = 1; rt <= t; rt++)
|
|
7305
|
-
r = et +
|
|
7306
|
-
r =
|
|
7305
|
+
r = et + U << 2, h += (O.r = b = e[r]) * (R = B - rt), l += (O.g = E = e[r + 1]) * R, c += (O.b = w = e[r + 2]) * R, u += (O.a = L = e[r + 3]) * R, C += b, y += E, _ += w, v += L, O = O.next, rt < W && (et += i);
|
|
7306
|
+
r = U, Y = z, it = q;
|
|
7307
7307
|
for (let rt = 0; rt < s; rt++)
|
|
7308
|
-
n = r << 2, e[n + 3] = L = u * F >> D, L > 0 ? (L = 255 / L, e[n] = (h * F >> D) * L, e[n + 1] = (l * F >> D) * L, e[n + 2] = (c * F >> D) * L) : e[n] = e[n + 1] = e[n + 2] = 0, h -= d, l -= g, c -= f, u -=
|
|
7308
|
+
n = r << 2, e[n + 3] = L = u * F >> D, L > 0 ? (L = 255 / L, e[n] = (h * F >> D) * L, e[n + 1] = (l * F >> D) * L, e[n + 2] = (c * F >> D) * L) : e[n] = e[n + 1] = e[n + 2] = 0, h -= d, l -= g, c -= f, u -= S, d -= Y.r, g -= Y.g, f -= Y.b, S -= Y.a, n = U + ((n = rt + B) < W ? n : W) * i << 2, h += C += Y.r = e[n], l += y += Y.g = e[n + 1], c += _ += Y.b = e[n + 2], u += v += Y.a = e[n + 3], Y = Y.next, d += b = it.r, g += E = it.g, f += w = it.b, S += L = it.a, C -= b, y -= E, _ -= w, v -= L, it = it.next, r += i;
|
|
7309
7309
|
}
|
|
7310
7310
|
}
|
|
7311
7311
|
const jn = function(t) {
|
|
7312
7312
|
const e = Math.round(this.blurRadius());
|
|
7313
7313
|
e > 0 && Yn(t, e);
|
|
7314
7314
|
};
|
|
7315
|
-
p.addGetterSetter(k, "blurRadius", 0,
|
|
7315
|
+
p.addGetterSetter(k, "blurRadius", 0, P(), p.afterSetFilter);
|
|
7316
7316
|
const qn = function(o) {
|
|
7317
7317
|
const t = this.brightness() * 255, e = o.data, i = e.length;
|
|
7318
7318
|
for (let s = 0; s < i; s += 4)
|
|
7319
7319
|
e[s] += t, e[s + 1] += t, e[s + 2] += t;
|
|
7320
7320
|
};
|
|
7321
|
-
p.addGetterSetter(k, "brightness", 0,
|
|
7321
|
+
p.addGetterSetter(k, "brightness", 0, P(), p.afterSetFilter);
|
|
7322
7322
|
const $n = function(o) {
|
|
7323
7323
|
const t = this.brightness(), e = o.data, i = e.length;
|
|
7324
7324
|
for (let s = 0; s < i; s += 4)
|
|
7325
7325
|
e[s] = Math.min(255, e[s] * t), e[s + 1] = Math.min(255, e[s + 1] * t), e[s + 2] = Math.min(255, e[s + 2] * t);
|
|
7326
|
-
},
|
|
7326
|
+
}, Zn = function(o) {
|
|
7327
7327
|
const t = Math.pow((this.contrast() + 100) / 100, 2), e = o.data, i = e.length;
|
|
7328
7328
|
let s = 150, n = 150, r = 150;
|
|
7329
7329
|
for (let a = 0; a < i; a += 4)
|
|
7330
7330
|
s = e[a], n = e[a + 1], r = e[a + 2], s /= 255, s -= 0.5, s *= t, s += 0.5, s *= 255, n /= 255, n -= 0.5, n *= t, n += 0.5, n *= 255, r /= 255, r -= 0.5, r *= t, r += 0.5, r *= 255, s = s < 0 ? 0 : s > 255 ? 255 : s, n = n < 0 ? 0 : n > 255 ? 255 : n, r = r < 0 ? 0 : r > 255 ? 255 : r, e[a] = s, e[a + 1] = n, e[a + 2] = r;
|
|
7331
7331
|
};
|
|
7332
|
-
p.addGetterSetter(k, "contrast", 0,
|
|
7333
|
-
const
|
|
7332
|
+
p.addGetterSetter(k, "contrast", 0, P(), p.afterSetFilter);
|
|
7333
|
+
const Kn = function(o) {
|
|
7334
7334
|
var t, e, i, s, n, r, a, h, l;
|
|
7335
|
-
const c = o.data, u = o.width, d = o.height, g = Math.min(1, Math.max(0, (e = (t = this.embossStrength) === null || t === void 0 ? void 0 : t.call(this)) !== null && e !== void 0 ? e : 0.5)), f = Math.min(1, Math.max(0, (s = (i = this.embossWhiteLevel) === null || i === void 0 ? void 0 : i.call(this)) !== null && s !== void 0 ? s : 0.5)),
|
|
7335
|
+
const c = o.data, u = o.width, d = o.height, g = Math.min(1, Math.max(0, (e = (t = this.embossStrength) === null || t === void 0 ? void 0 : t.call(this)) !== null && e !== void 0 ? e : 0.5)), f = Math.min(1, Math.max(0, (s = (i = this.embossWhiteLevel) === null || i === void 0 ? void 0 : i.call(this)) !== null && s !== void 0 ? s : 0.5)), C = (a = {
|
|
7336
7336
|
"top-left": 315,
|
|
7337
7337
|
top: 270,
|
|
7338
7338
|
"top-right": 225,
|
|
@@ -7341,7 +7341,7 @@ const Zn = function(o) {
|
|
|
7341
7341
|
bottom: 90,
|
|
7342
7342
|
"bottom-left": 45,
|
|
7343
7343
|
left: 0
|
|
7344
|
-
}[(r = (n = this.embossDirection) === null || n === void 0 ? void 0 : n.call(this)) !== null && r !== void 0 ? r : "top-left"]) !== null && a !== void 0 ? a : 315, y = !!((l = (h = this.embossBlend) === null || h === void 0 ? void 0 : h.call(this)) !== null && l !== void 0 && l), _ = g * 10, v = f * 255, b =
|
|
7344
|
+
}[(r = (n = this.embossDirection) === null || n === void 0 ? void 0 : n.call(this)) !== null && r !== void 0 ? r : "top-left"]) !== null && a !== void 0 ? a : 315, y = !!((l = (h = this.embossBlend) === null || h === void 0 ? void 0 : h.call(this)) !== null && l !== void 0 && l), _ = g * 10, v = f * 255, b = C * Math.PI / 180, E = Math.cos(b), w = Math.sin(b), L = 128 / 1020 * _, R = new Uint8ClampedArray(c), I = new Float32Array(u * d);
|
|
7345
7345
|
for (let z = 0, F = 0; F < c.length; F += 4, z++)
|
|
7346
7346
|
I[z] = 0.2126 * R[F] + 0.7152 * R[F + 1] + 0.0722 * R[F + 2];
|
|
7347
7347
|
const G = [-1, 0, 1, -2, 0, 2, -1, 0, 1], W = [-1, -2, -1, 0, 0, 0, 1, 2, 1], B = [-u - 1, -u, -u + 1, -1, 0, 1, u - 1, u, u + 1], X = (z) => z < 0 ? 0 : z > 255 ? 255 : z;
|
|
@@ -7350,12 +7350,12 @@ const Zn = function(o) {
|
|
|
7350
7350
|
const D = z * u + F;
|
|
7351
7351
|
let q = 0, O = 0;
|
|
7352
7352
|
q += I[D + B[0]] * G[0], O += I[D + B[0]] * W[0], q += I[D + B[1]] * G[1], O += I[D + B[1]] * W[1], q += I[D + B[2]] * G[2], O += I[D + B[2]] * W[2], q += I[D + B[3]] * G[3], O += I[D + B[3]] * W[3], q += I[D + B[5]] * G[5], O += I[D + B[5]] * W[5], q += I[D + B[6]] * G[6], O += I[D + B[6]] * W[6], q += I[D + B[7]] * G[7], O += I[D + B[7]] * W[7], q += I[D + B[8]] * G[8], O += I[D + B[8]] * W[8];
|
|
7353
|
-
const Y = E * q +
|
|
7353
|
+
const Y = E * q + w * O, it = X(v + Y * L), U = D * 4;
|
|
7354
7354
|
if (y) {
|
|
7355
7355
|
const et = it - v;
|
|
7356
|
-
c[
|
|
7356
|
+
c[U] = X(R[U] + et), c[U + 1] = X(R[U + 1] + et), c[U + 2] = X(R[U + 2] + et), c[U + 3] = R[U + 3];
|
|
7357
7357
|
} else
|
|
7358
|
-
c[
|
|
7358
|
+
c[U] = c[U + 1] = c[U + 2] = it, c[U + 3] = R[U + 3];
|
|
7359
7359
|
}
|
|
7360
7360
|
for (let z = 0; z < u; z++) {
|
|
7361
7361
|
let F = z * 4, D = ((d - 1) * u + z) * 4;
|
|
@@ -7367,11 +7367,11 @@ const Zn = function(o) {
|
|
|
7367
7367
|
}
|
|
7368
7368
|
return o;
|
|
7369
7369
|
};
|
|
7370
|
-
p.addGetterSetter(k, "embossStrength", 0.5,
|
|
7371
|
-
p.addGetterSetter(k, "embossWhiteLevel", 0.5,
|
|
7370
|
+
p.addGetterSetter(k, "embossStrength", 0.5, P(), p.afterSetFilter);
|
|
7371
|
+
p.addGetterSetter(k, "embossWhiteLevel", 0.5, P(), p.afterSetFilter);
|
|
7372
7372
|
p.addGetterSetter(k, "embossDirection", "top-left", void 0, p.afterSetFilter);
|
|
7373
7373
|
p.addGetterSetter(k, "embossBlend", !1, void 0, p.afterSetFilter);
|
|
7374
|
-
function
|
|
7374
|
+
function we(o, t, e, i, s) {
|
|
7375
7375
|
const n = e - t, r = s - i;
|
|
7376
7376
|
if (n === 0)
|
|
7377
7377
|
return i + r / 2;
|
|
@@ -7389,21 +7389,21 @@ const Jn = function(o) {
|
|
|
7389
7389
|
for (let v = 0; v < e; v += 4)
|
|
7390
7390
|
n = t[v + 0], n < i ? i = n : n > s && (s = n), h = t[v + 1], h < r ? r = h : h > a && (a = h), u = t[v + 2], u < l ? l = u : u > c && (c = u);
|
|
7391
7391
|
s === i && (s = 255, i = 0), a === r && (a = 255, r = 0), c === l && (c = 255, l = 0);
|
|
7392
|
-
let g, f,
|
|
7392
|
+
let g, f, S, C, y, _;
|
|
7393
7393
|
if (d > 0)
|
|
7394
|
-
g = s + d * (255 - s), f = i - d * (i - 0),
|
|
7394
|
+
g = s + d * (255 - s), f = i - d * (i - 0), S = a + d * (255 - a), C = r - d * (r - 0), y = c + d * (255 - c), _ = l - d * (l - 0);
|
|
7395
7395
|
else {
|
|
7396
7396
|
const v = (s + i) * 0.5;
|
|
7397
7397
|
g = s + d * (s - v), f = i + d * (i - v);
|
|
7398
7398
|
const b = (a + r) * 0.5;
|
|
7399
|
-
|
|
7399
|
+
S = a + d * (a - b), C = r + d * (r - b);
|
|
7400
7400
|
const E = (c + l) * 0.5;
|
|
7401
7401
|
y = c + d * (c - E), _ = l + d * (l - E);
|
|
7402
7402
|
}
|
|
7403
7403
|
for (let v = 0; v < e; v += 4)
|
|
7404
|
-
t[v + 0] =
|
|
7404
|
+
t[v + 0] = we(t[v + 0], i, s, f, g), t[v + 1] = we(t[v + 1], r, a, C, S), t[v + 2] = we(t[v + 2], l, c, _, y);
|
|
7405
7405
|
};
|
|
7406
|
-
p.addGetterSetter(k, "enhance", 0,
|
|
7406
|
+
p.addGetterSetter(k, "enhance", 0, P(), p.afterSetFilter);
|
|
7407
7407
|
const Qn = function(o) {
|
|
7408
7408
|
const t = o.data, e = t.length;
|
|
7409
7409
|
for (let i = 0; i < e; i += 4) {
|
|
@@ -7411,24 +7411,24 @@ const Qn = function(o) {
|
|
|
7411
7411
|
t[i] = s, t[i + 1] = s, t[i + 2] = s;
|
|
7412
7412
|
}
|
|
7413
7413
|
};
|
|
7414
|
-
p.addGetterSetter(k, "hue", 0,
|
|
7415
|
-
p.addGetterSetter(k, "saturation", 0,
|
|
7416
|
-
p.addGetterSetter(k, "luminance", 0,
|
|
7414
|
+
p.addGetterSetter(k, "hue", 0, P(), p.afterSetFilter);
|
|
7415
|
+
p.addGetterSetter(k, "saturation", 0, P(), p.afterSetFilter);
|
|
7416
|
+
p.addGetterSetter(k, "luminance", 0, P(), p.afterSetFilter);
|
|
7417
7417
|
const tr = function(o) {
|
|
7418
|
-
const t = o.data, e = t.length, i = 1, s = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, r = this.luminance() * 127, a = i * s * Math.cos(n * Math.PI / 180), h = i * s * Math.sin(n * Math.PI / 180), l = 0.299 * i + 0.701 * a + 0.167 * h, c = 0.587 * i - 0.587 * a + 0.33 * h, u = 0.114 * i - 0.114 * a - 0.497 * h, d = 0.299 * i - 0.299 * a - 0.328 * h, g = 0.587 * i + 0.413 * a + 0.035 * h, f = 0.114 * i - 0.114 * a + 0.293 * h,
|
|
7418
|
+
const t = o.data, e = t.length, i = 1, s = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, r = this.luminance() * 127, a = i * s * Math.cos(n * Math.PI / 180), h = i * s * Math.sin(n * Math.PI / 180), l = 0.299 * i + 0.701 * a + 0.167 * h, c = 0.587 * i - 0.587 * a + 0.33 * h, u = 0.114 * i - 0.114 * a - 0.497 * h, d = 0.299 * i - 0.299 * a - 0.328 * h, g = 0.587 * i + 0.413 * a + 0.035 * h, f = 0.114 * i - 0.114 * a + 0.293 * h, S = 0.299 * i - 0.3 * a + 1.25 * h, C = 0.587 * i - 0.586 * a - 1.05 * h, y = 0.114 * i + 0.886 * a - 0.2 * h;
|
|
7419
7419
|
let _, v, b, E;
|
|
7420
|
-
for (let
|
|
7421
|
-
_ = t[
|
|
7420
|
+
for (let w = 0; w < e; w += 4)
|
|
7421
|
+
_ = t[w + 0], v = t[w + 1], b = t[w + 2], E = t[w + 3], t[w + 0] = l * _ + c * v + u * b + r, t[w + 1] = d * _ + g * v + f * b + r, t[w + 2] = S * _ + C * v + y * b + r, t[w + 3] = E;
|
|
7422
7422
|
}, er = function(o) {
|
|
7423
|
-
const t = o.data, e = t.length, i = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, r = i * s * Math.cos(n * Math.PI / 180), a = i * s * Math.sin(n * Math.PI / 180), h = 0.299 * i + 0.701 * r + 0.167 * a, l = 0.587 * i - 0.587 * r + 0.33 * a, c = 0.114 * i - 0.114 * r - 0.497 * a, u = 0.299 * i - 0.299 * r - 0.328 * a, d = 0.587 * i + 0.413 * r + 0.035 * a, g = 0.114 * i - 0.114 * r + 0.293 * a, f = 0.299 * i - 0.3 * r + 1.25 * a,
|
|
7423
|
+
const t = o.data, e = t.length, i = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, r = i * s * Math.cos(n * Math.PI / 180), a = i * s * Math.sin(n * Math.PI / 180), h = 0.299 * i + 0.701 * r + 0.167 * a, l = 0.587 * i - 0.587 * r + 0.33 * a, c = 0.114 * i - 0.114 * r - 0.497 * a, u = 0.299 * i - 0.299 * r - 0.328 * a, d = 0.587 * i + 0.413 * r + 0.035 * a, g = 0.114 * i - 0.114 * r + 0.293 * a, f = 0.299 * i - 0.3 * r + 1.25 * a, S = 0.587 * i - 0.586 * r - 1.05 * a, C = 0.114 * i + 0.886 * r - 0.2 * a;
|
|
7424
7424
|
for (let y = 0; y < e; y += 4) {
|
|
7425
7425
|
const _ = t[y + 0], v = t[y + 1], b = t[y + 2], E = t[y + 3];
|
|
7426
|
-
t[y + 0] = h * _ + l * v + c * b, t[y + 1] = u * _ + d * v + g * b, t[y + 2] = f * _ +
|
|
7426
|
+
t[y + 0] = h * _ + l * v + c * b, t[y + 1] = u * _ + d * v + g * b, t[y + 2] = f * _ + S * v + C * b, t[y + 3] = E;
|
|
7427
7427
|
}
|
|
7428
7428
|
};
|
|
7429
|
-
p.addGetterSetter(k, "hue", 0,
|
|
7430
|
-
p.addGetterSetter(k, "saturation", 0,
|
|
7431
|
-
p.addGetterSetter(k, "value", 0,
|
|
7429
|
+
p.addGetterSetter(k, "hue", 0, P(), p.afterSetFilter);
|
|
7430
|
+
p.addGetterSetter(k, "saturation", 0, P(), p.afterSetFilter);
|
|
7431
|
+
p.addGetterSetter(k, "value", 0, P(), p.afterSetFilter);
|
|
7432
7432
|
const ir = function(o) {
|
|
7433
7433
|
const t = o.data, e = t.length;
|
|
7434
7434
|
for (let i = 0; i < e; i += 4)
|
|
@@ -7438,14 +7438,14 @@ const ir = function(o) {
|
|
|
7438
7438
|
let l = Math.sqrt(a * a + h * h), c = n - a, u = r - h;
|
|
7439
7439
|
const d = Math.sqrt(c * c + u * u);
|
|
7440
7440
|
l = d > l ? d : l;
|
|
7441
|
-
const g = r, f = n,
|
|
7442
|
-
for (let
|
|
7443
|
-
const y = Math.sin(
|
|
7441
|
+
const g = r, f = n, S = 360 / f * Math.PI / 180;
|
|
7442
|
+
for (let C = 0; C < f; C += 1) {
|
|
7443
|
+
const y = Math.sin(C * S), _ = Math.cos(C * S);
|
|
7444
7444
|
for (let v = 0; v < g; v += 1) {
|
|
7445
7445
|
c = Math.floor(a + l * v / g * _), u = Math.floor(h + l * v / g * y);
|
|
7446
7446
|
let b = (u * n + c) * 4;
|
|
7447
|
-
const E = i[b + 0],
|
|
7448
|
-
b = (
|
|
7447
|
+
const E = i[b + 0], w = i[b + 1], L = i[b + 2], R = i[b + 3];
|
|
7448
|
+
b = (C + v * n) * 4, s[b + 0] = E, s[b + 1] = w, s[b + 2] = L, s[b + 3] = R;
|
|
7449
7449
|
}
|
|
7450
7450
|
}
|
|
7451
7451
|
}, nr = function(o, t, e) {
|
|
@@ -7453,27 +7453,27 @@ const ir = function(o) {
|
|
|
7453
7453
|
let l = Math.sqrt(a * a + h * h), c = n - a, u = r - h;
|
|
7454
7454
|
const d = Math.sqrt(c * c + u * u);
|
|
7455
7455
|
l = d > l ? d : l;
|
|
7456
|
-
const g = r, f = n,
|
|
7457
|
-
let
|
|
7456
|
+
const g = r, f = n, S = 0;
|
|
7457
|
+
let C, y;
|
|
7458
7458
|
for (c = 0; c < n; c += 1)
|
|
7459
7459
|
for (u = 0; u < r; u += 1) {
|
|
7460
7460
|
const _ = c - a, v = u - h, b = Math.sqrt(_ * _ + v * v) * g / l;
|
|
7461
|
-
let E = (Math.atan2(v, _) * 180 / Math.PI + 360 +
|
|
7462
|
-
E = E * f / 360,
|
|
7463
|
-
let
|
|
7464
|
-
const L = i[
|
|
7465
|
-
|
|
7461
|
+
let E = (Math.atan2(v, _) * 180 / Math.PI + 360 + S) % 360;
|
|
7462
|
+
E = E * f / 360, C = Math.floor(E), y = Math.floor(b);
|
|
7463
|
+
let w = (y * n + C) * 4;
|
|
7464
|
+
const L = i[w + 0], R = i[w + 1], I = i[w + 2], G = i[w + 3];
|
|
7465
|
+
w = (u * n + c) * 4, s[w + 0] = L, s[w + 1] = R, s[w + 2] = I, s[w + 3] = G;
|
|
7466
7466
|
}
|
|
7467
7467
|
}, rr = function(o) {
|
|
7468
7468
|
const t = o.width, e = o.height;
|
|
7469
7469
|
let i, s, n, r, a, h, l, c, u, d, g = Math.round(this.kaleidoscopePower());
|
|
7470
|
-
const f = Math.round(this.kaleidoscopeAngle()),
|
|
7470
|
+
const f = Math.round(this.kaleidoscopeAngle()), S = Math.floor(t * (f % 360) / 360);
|
|
7471
7471
|
if (g < 1)
|
|
7472
7472
|
return;
|
|
7473
|
-
const
|
|
7474
|
-
|
|
7475
|
-
const y =
|
|
7476
|
-
m.releaseCanvas(
|
|
7473
|
+
const C = m.createCanvasElement();
|
|
7474
|
+
C.width = t, C.height = e;
|
|
7475
|
+
const y = C.getContext("2d").getImageData(0, 0, t, e);
|
|
7476
|
+
m.releaseCanvas(C), sr(o, y, {
|
|
7477
7477
|
polarCenterX: t / 2,
|
|
7478
7478
|
polarCenterY: e / 2
|
|
7479
7479
|
});
|
|
@@ -7481,10 +7481,10 @@ const ir = function(o) {
|
|
|
7481
7481
|
for (; _ <= 8; )
|
|
7482
7482
|
_ = _ * 2, g -= 1;
|
|
7483
7483
|
_ = Math.ceil(_);
|
|
7484
|
-
let v = _, b = 0, E = v,
|
|
7485
|
-
for (
|
|
7486
|
-
for (i = b; i !== E; i +=
|
|
7487
|
-
n = Math.round(i +
|
|
7484
|
+
let v = _, b = 0, E = v, w = 1;
|
|
7485
|
+
for (S + _ > t && (b = v, E = 0, w = -1), s = 0; s < e; s += 1)
|
|
7486
|
+
for (i = b; i !== E; i += w)
|
|
7487
|
+
n = Math.round(i + S) % t, u = (t * s + n) * 4, a = y.data[u + 0], h = y.data[u + 1], l = y.data[u + 2], c = y.data[u + 3], d = (t * s + i) * 4, y.data[d + 0] = a, y.data[d + 1] = h, y.data[d + 2] = l, y.data[d + 3] = c;
|
|
7488
7488
|
for (s = 0; s < e; s += 1)
|
|
7489
7489
|
for (v = Math.floor(_), r = 0; r < g; r += 1) {
|
|
7490
7490
|
for (i = 0; i < v + 1; i += 1)
|
|
@@ -7493,8 +7493,8 @@ const ir = function(o) {
|
|
|
7493
7493
|
}
|
|
7494
7494
|
nr(y, o, {});
|
|
7495
7495
|
};
|
|
7496
|
-
p.addGetterSetter(k, "kaleidoscopePower", 2,
|
|
7497
|
-
p.addGetterSetter(k, "kaleidoscopeAngle", 0,
|
|
7496
|
+
p.addGetterSetter(k, "kaleidoscopePower", 2, P(), p.afterSetFilter);
|
|
7497
|
+
p.addGetterSetter(k, "kaleidoscopeAngle", 0, P(), p.afterSetFilter);
|
|
7498
7498
|
function ce(o, t, e) {
|
|
7499
7499
|
let i = (e * o.width + t) * 4;
|
|
7500
7500
|
const s = [];
|
|
@@ -7538,8 +7538,8 @@ function lr(o, t, e) {
|
|
|
7538
7538
|
for (let d = 0; d < s; d++) {
|
|
7539
7539
|
const g = a + u - n, f = h + d - n;
|
|
7540
7540
|
if (g >= 0 && g < e && f >= 0 && f < t) {
|
|
7541
|
-
const
|
|
7542
|
-
c += o[
|
|
7541
|
+
const S = g * t + f, C = i[u * s + d];
|
|
7542
|
+
c += o[S] * C;
|
|
7543
7543
|
}
|
|
7544
7544
|
}
|
|
7545
7545
|
r[l] = c === 255 * 8 ? 255 : 0;
|
|
@@ -7556,8 +7556,8 @@ function cr(o, t, e) {
|
|
|
7556
7556
|
for (let d = 0; d < s; d++) {
|
|
7557
7557
|
const g = a + u - n, f = h + d - n;
|
|
7558
7558
|
if (g >= 0 && g < e && f >= 0 && f < t) {
|
|
7559
|
-
const
|
|
7560
|
-
c += o[
|
|
7559
|
+
const S = g * t + f, C = i[u * s + d];
|
|
7560
|
+
c += o[S] * C;
|
|
7561
7561
|
}
|
|
7562
7562
|
}
|
|
7563
7563
|
r[l] = c >= 255 * 4 ? 255 : 0;
|
|
@@ -7584,8 +7584,8 @@ function dr(o, t, e) {
|
|
|
7584
7584
|
for (let d = 0; d < s; d++) {
|
|
7585
7585
|
const g = a + u - n, f = h + d - n;
|
|
7586
7586
|
if (g >= 0 && g < e && f >= 0 && f < t) {
|
|
7587
|
-
const
|
|
7588
|
-
c += o[
|
|
7587
|
+
const S = g * t + f, C = i[u * s + d];
|
|
7588
|
+
c += o[S] * C;
|
|
7589
7589
|
}
|
|
7590
7590
|
}
|
|
7591
7591
|
r[l] = c;
|
|
@@ -7597,13 +7597,13 @@ const ur = function(o) {
|
|
|
7597
7597
|
let e = or(o, t);
|
|
7598
7598
|
return e && (e = lr(e, o.width, o.height), e = cr(e, o.width, o.height), e = dr(e, o.width, o.height), hr(o, e)), o;
|
|
7599
7599
|
};
|
|
7600
|
-
p.addGetterSetter(k, "threshold", 0,
|
|
7600
|
+
p.addGetterSetter(k, "threshold", 0, P(), p.afterSetFilter);
|
|
7601
7601
|
const fr = function(o) {
|
|
7602
7602
|
const t = this.noise() * 255, e = o.data, i = e.length, s = t / 2;
|
|
7603
7603
|
for (let n = 0; n < i; n += 4)
|
|
7604
7604
|
e[n + 0] += s - 2 * s * Math.random(), e[n + 1] += s - 2 * s * Math.random(), e[n + 2] += s - 2 * s * Math.random();
|
|
7605
7605
|
};
|
|
7606
|
-
p.addGetterSetter(k, "noise", 0.2,
|
|
7606
|
+
p.addGetterSetter(k, "noise", 0.2, P(), p.afterSetFilter);
|
|
7607
7607
|
const gr = function(o) {
|
|
7608
7608
|
let t = Math.ceil(this.pixelSize()), e = o.width, i = o.height, s = Math.ceil(e / t), n = Math.ceil(i / t), r = o.data;
|
|
7609
7609
|
if (t <= 0) {
|
|
@@ -7613,11 +7613,11 @@ const gr = function(o) {
|
|
|
7613
7613
|
for (let a = 0; a < s; a += 1)
|
|
7614
7614
|
for (let h = 0; h < n; h += 1) {
|
|
7615
7615
|
let l = 0, c = 0, u = 0, d = 0;
|
|
7616
|
-
const g = a * t, f = g + t,
|
|
7616
|
+
const g = a * t, f = g + t, S = h * t, C = S + t;
|
|
7617
7617
|
let y = 0;
|
|
7618
7618
|
for (let _ = g; _ < f; _ += 1)
|
|
7619
7619
|
if (!(_ >= e))
|
|
7620
|
-
for (let v =
|
|
7620
|
+
for (let v = S; v < C; v += 1) {
|
|
7621
7621
|
if (v >= i)
|
|
7622
7622
|
continue;
|
|
7623
7623
|
const b = (e * v + _) * 4;
|
|
@@ -7626,7 +7626,7 @@ const gr = function(o) {
|
|
|
7626
7626
|
l = l / y, c = c / y, u = u / y, d = d / y;
|
|
7627
7627
|
for (let _ = g; _ < f; _ += 1)
|
|
7628
7628
|
if (!(_ >= e))
|
|
7629
|
-
for (let v =
|
|
7629
|
+
for (let v = S; v < C; v += 1) {
|
|
7630
7630
|
if (v >= i)
|
|
7631
7631
|
continue;
|
|
7632
7632
|
const b = (e * v + _) * 4;
|
|
@@ -7634,13 +7634,13 @@ const gr = function(o) {
|
|
|
7634
7634
|
}
|
|
7635
7635
|
}
|
|
7636
7636
|
};
|
|
7637
|
-
p.addGetterSetter(k, "pixelSize", 8,
|
|
7637
|
+
p.addGetterSetter(k, "pixelSize", 8, P(), p.afterSetFilter);
|
|
7638
7638
|
const pr = function(o) {
|
|
7639
7639
|
const t = Math.round(this.levels() * 254) + 1, e = o.data, i = e.length, s = 255 / t;
|
|
7640
7640
|
for (let n = 0; n < i; n += 1)
|
|
7641
7641
|
e[n] = Math.floor(e[n] / s) * s;
|
|
7642
7642
|
};
|
|
7643
|
-
p.addGetterSetter(k, "levels", 0.5,
|
|
7643
|
+
p.addGetterSetter(k, "levels", 0.5, P(), p.afterSetFilter);
|
|
7644
7644
|
const mr = function(o) {
|
|
7645
7645
|
const t = o.data, e = t.length, i = this.red(), s = this.green(), n = this.blue();
|
|
7646
7646
|
for (let r = 0; r < e; r += 4) {
|
|
@@ -7678,35 +7678,35 @@ const _r = function(o) {
|
|
|
7678
7678
|
const s = t[i + 0], n = t[i + 1], r = t[i + 2];
|
|
7679
7679
|
t[i + 0] = Math.min(255, s * 0.393 + n * 0.769 + r * 0.189), t[i + 1] = Math.min(255, s * 0.349 + n * 0.686 + r * 0.168), t[i + 2] = Math.min(255, s * 0.272 + n * 0.534 + r * 0.131);
|
|
7680
7680
|
}
|
|
7681
|
-
},
|
|
7681
|
+
}, Sr = function(o) {
|
|
7682
7682
|
const e = o.data;
|
|
7683
7683
|
for (let i = 0; i < e.length; i += 4) {
|
|
7684
7684
|
const s = e[i], n = e[i + 1], r = e[i + 2];
|
|
7685
7685
|
0.2126 * s + 0.7152 * n + 0.0722 * r >= 128 && (e[i] = 255 - s, e[i + 1] = 255 - n, e[i + 2] = 255 - r);
|
|
7686
7686
|
}
|
|
7687
7687
|
return o;
|
|
7688
|
-
},
|
|
7688
|
+
}, Cr = function(o) {
|
|
7689
7689
|
const t = this.threshold() * 255, e = o.data, i = e.length;
|
|
7690
7690
|
for (let s = 0; s < i; s += 1)
|
|
7691
7691
|
e[s] = e[s] < t ? 0 : 255;
|
|
7692
7692
|
};
|
|
7693
|
-
p.addGetterSetter(k, "threshold", 0.5,
|
|
7693
|
+
p.addGetterSetter(k, "threshold", 0.5, P(), p.afterSetFilter);
|
|
7694
7694
|
const J = ri.Util._assign(ri, {
|
|
7695
7695
|
Arc: pt,
|
|
7696
|
-
Arrow:
|
|
7696
|
+
Arrow: Mt,
|
|
7697
7697
|
Circle: Bt,
|
|
7698
|
-
Ellipse:
|
|
7699
|
-
Image:
|
|
7698
|
+
Ellipse: Tt,
|
|
7699
|
+
Image: ut,
|
|
7700
7700
|
Label: Xe,
|
|
7701
|
-
Tag:
|
|
7701
|
+
Tag: Rt,
|
|
7702
7702
|
Line: mt,
|
|
7703
|
-
Path:
|
|
7703
|
+
Path: Z,
|
|
7704
7704
|
Rect: te,
|
|
7705
|
-
RegularPolygon:
|
|
7706
|
-
Ring:
|
|
7707
|
-
Sprite:
|
|
7705
|
+
RegularPolygon: wt,
|
|
7706
|
+
Ring: Lt,
|
|
7707
|
+
Sprite: ft,
|
|
7708
7708
|
Star: xt,
|
|
7709
|
-
Text:
|
|
7709
|
+
Text: K,
|
|
7710
7710
|
TextPath: st,
|
|
7711
7711
|
Transformer: H,
|
|
7712
7712
|
Wedge: yt,
|
|
@@ -7714,8 +7714,8 @@ const J = ri.Util._assign(ri, {
|
|
|
7714
7714
|
Blur: jn,
|
|
7715
7715
|
Brightness: $n,
|
|
7716
7716
|
Brighten: qn,
|
|
7717
|
-
Contrast:
|
|
7718
|
-
Emboss:
|
|
7717
|
+
Contrast: Zn,
|
|
7718
|
+
Emboss: Kn,
|
|
7719
7719
|
Enhance: Jn,
|
|
7720
7720
|
Grayscale: Qn,
|
|
7721
7721
|
HSL: tr,
|
|
@@ -7729,8 +7729,8 @@ const J = ri.Util._assign(ri, {
|
|
|
7729
7729
|
RGB: mr,
|
|
7730
7730
|
RGBA: yr,
|
|
7731
7731
|
Sepia: _r,
|
|
7732
|
-
Solarize:
|
|
7733
|
-
Threshold:
|
|
7732
|
+
Solarize: Sr,
|
|
7733
|
+
Threshold: Cr
|
|
7734
7734
|
}
|
|
7735
7735
|
});
|
|
7736
7736
|
class M {
|
|
@@ -7794,14 +7794,14 @@ class M {
|
|
|
7794
7794
|
console.error(`[ERROR] [${t}] ${e}`, i);
|
|
7795
7795
|
}
|
|
7796
7796
|
}
|
|
7797
|
-
|
|
7798
|
-
const
|
|
7797
|
+
T(M, "debugEnabled", !1), T(M, "moduleDebugEnabled", /* @__PURE__ */ new Map());
|
|
7798
|
+
const ct = {
|
|
7799
7799
|
MIN: 2,
|
|
7800
7800
|
MEDIUM: 30,
|
|
7801
7801
|
MAX: 100
|
|
7802
7802
|
}, br = {
|
|
7803
7803
|
DURATION: 300
|
|
7804
|
-
},
|
|
7804
|
+
}, ot = 15, Ct = 6, nt = class nt {
|
|
7805
7805
|
/**
|
|
7806
7806
|
* 创建舞台
|
|
7807
7807
|
*/
|
|
@@ -8014,7 +8014,7 @@ const gt = {
|
|
|
8014
8014
|
* 创建片段组
|
|
8015
8015
|
*/
|
|
8016
8016
|
static createClipGroup(t, e, i, s, n, r, a, h = !1, l, c) {
|
|
8017
|
-
const u = this.createGroup(t, e), d = i <=
|
|
8017
|
+
const u = this.createGroup(t, e), d = i <= Ct, g = {
|
|
8018
8018
|
...a,
|
|
8019
8019
|
background: h && a.clipSelectedBackground || a.clipBackground,
|
|
8020
8020
|
name: h && a.clipSelectedName || a.clipName,
|
|
@@ -8031,12 +8031,12 @@ const gt = {
|
|
|
8031
8031
|
0
|
|
8032
8032
|
);
|
|
8033
8033
|
if (f.cornerRadius(d ? Math.min(4, Math.floor(i / 2)) : 4), f.name("clip-background"), u.add(f), d) {
|
|
8034
|
-
const
|
|
8035
|
-
u.add(C);
|
|
8036
|
-
const S = new J.Rect({ x: 0, y: 0, width: i, height: s, name: "clip-resize-right", listening: !0 });
|
|
8034
|
+
const S = new J.Rect({ x: 0, y: 0, width: i, height: s, name: "clip-resize-left", listening: !0 });
|
|
8037
8035
|
u.add(S);
|
|
8036
|
+
const C = new J.Rect({ x: 0, y: 0, width: i, height: s, name: "clip-resize-right", listening: !0 });
|
|
8037
|
+
u.add(C);
|
|
8038
8038
|
} else {
|
|
8039
|
-
const
|
|
8039
|
+
const C = s - 15 - 4, y = i - this.RESIZE_AREA_WIDTH * 2, _ = new J.Rect({
|
|
8040
8040
|
x: 0,
|
|
8041
8041
|
y: 0,
|
|
8042
8042
|
width: this.RESIZE_AREA_WIDTH,
|
|
@@ -8053,19 +8053,19 @@ const gt = {
|
|
|
8053
8053
|
});
|
|
8054
8054
|
u.add(v);
|
|
8055
8055
|
const b = this.createGroup(this.RESIZE_AREA_WIDTH, 2);
|
|
8056
|
-
b.name("clip-cover-container"), b.clip({ x: 0, y: 0, width: y, height:
|
|
8056
|
+
b.name("clip-cover-container"), b.clip({ x: 0, y: 0, width: y, height: C }), u.add(b);
|
|
8057
8057
|
const E = this.createRect(
|
|
8058
8058
|
0,
|
|
8059
8059
|
0,
|
|
8060
8060
|
y,
|
|
8061
|
-
|
|
8061
|
+
C,
|
|
8062
8062
|
g.coverBackground,
|
|
8063
8063
|
"transparent",
|
|
8064
8064
|
0
|
|
8065
8065
|
);
|
|
8066
8066
|
E.cornerRadius(2), E.name("clip-cover-background"), b.add(E);
|
|
8067
|
-
const
|
|
8068
|
-
L.name("clip-covers-group"), b.add(L), this.renderClipCovers(L,
|
|
8067
|
+
const w = l ?? [], L = this.createGroup(0, 0);
|
|
8068
|
+
L.name("clip-covers-group"), b.add(L), this.renderClipCovers(L, w, y, C, c);
|
|
8069
8069
|
const R = this.formatDuration(r), I = `${n} ${R}`, G = this.createText(
|
|
8070
8070
|
I,
|
|
8071
8071
|
this.RESIZE_AREA_WIDTH,
|
|
@@ -8084,13 +8084,13 @@ const gt = {
|
|
|
8084
8084
|
* 更新片段组
|
|
8085
8085
|
*/
|
|
8086
8086
|
static updateClipGroup(t, e, i, s, n, r, a = !1, h, l) {
|
|
8087
|
-
const c = e <=
|
|
8087
|
+
const c = e <= Ct, u = t.findOne(".clip-background");
|
|
8088
8088
|
if (u && (u.width(e), u.height(i), u.cornerRadius(c ? Math.min(4, Math.floor(e / 2)) : 4), r)) {
|
|
8089
|
-
const
|
|
8089
|
+
const w = a && r.clipSelectedBackground || r.clipBackground;
|
|
8090
8090
|
new J.Tween({
|
|
8091
8091
|
node: u,
|
|
8092
8092
|
duration: 0.2,
|
|
8093
|
-
fill:
|
|
8093
|
+
fill: w,
|
|
8094
8094
|
easing: J.Easings.EaseInOut
|
|
8095
8095
|
}).play();
|
|
8096
8096
|
}
|
|
@@ -8098,24 +8098,24 @@ const gt = {
|
|
|
8098
8098
|
const g = t.findOne(".clip-label");
|
|
8099
8099
|
if (c) {
|
|
8100
8100
|
d == null || d.visible(!1), g == null || g.visible(!1);
|
|
8101
|
-
const
|
|
8102
|
-
|
|
8101
|
+
const w = t.findOne(".clip-resize-left"), L = t.findOne(".clip-resize-right");
|
|
8102
|
+
w && L && w.getClassName() === "Rect" && L.getClassName() === "Rect" && (w.width(e), L.x(0), L.width(e));
|
|
8103
8103
|
return;
|
|
8104
8104
|
}
|
|
8105
8105
|
d == null || d.visible(!0), g == null || g.visible(!0);
|
|
8106
|
-
const f = 15,
|
|
8106
|
+
const f = 15, S = i - f - 4, C = e - this.RESIZE_AREA_WIDTH * 2, y = t.findOne(".clip-resize-left"), _ = t.findOne(".clip-resize-right");
|
|
8107
8107
|
if (y && (y.x(0), y.width(this.RESIZE_AREA_WIDTH), y.height(i)), _ && (_.x(e - this.RESIZE_AREA_WIDTH), _.width(this.RESIZE_AREA_WIDTH), _.height(i)), d) {
|
|
8108
8108
|
d.x(this.RESIZE_AREA_WIDTH), d.y(2), d.clip({
|
|
8109
8109
|
x: 0,
|
|
8110
8110
|
y: 0,
|
|
8111
|
-
width:
|
|
8112
|
-
height:
|
|
8111
|
+
width: C,
|
|
8112
|
+
height: S
|
|
8113
8113
|
});
|
|
8114
|
-
const
|
|
8115
|
-
if (
|
|
8114
|
+
const w = d.findOne(".clip-cover-background");
|
|
8115
|
+
if (w && (w.width(C), w.height(S), r)) {
|
|
8116
8116
|
const L = a ? r.clipSelectedCoverBackground || r.clipCoverBackground || "#FFF2A0" : r.clipCoverBackground || "#FFF2A0";
|
|
8117
8117
|
new J.Tween({
|
|
8118
|
-
node:
|
|
8118
|
+
node: w,
|
|
8119
8119
|
duration: 0.2,
|
|
8120
8120
|
fill: L,
|
|
8121
8121
|
easing: J.Easings.EaseInOut
|
|
@@ -8125,15 +8125,15 @@ const gt = {
|
|
|
8125
8125
|
d = this.createGroup(this.RESIZE_AREA_WIDTH, 2), d.name("clip-cover-container"), d.clip({
|
|
8126
8126
|
x: 0,
|
|
8127
8127
|
y: 0,
|
|
8128
|
-
width:
|
|
8129
|
-
height:
|
|
8128
|
+
width: C,
|
|
8129
|
+
height: S
|
|
8130
8130
|
}), t.add(d);
|
|
8131
|
-
const
|
|
8131
|
+
const w = a ? (r == null ? void 0 : r.clipSelectedCoverBackground) || (r == null ? void 0 : r.clipCoverBackground) || "#FFF2A0" : (r == null ? void 0 : r.clipCoverBackground) || "#FFF2A0", L = this.createRect(
|
|
8132
8132
|
0,
|
|
8133
8133
|
0,
|
|
8134
|
-
S,
|
|
8135
8134
|
C,
|
|
8136
|
-
|
|
8135
|
+
S,
|
|
8136
|
+
w,
|
|
8137
8137
|
"transparent",
|
|
8138
8138
|
0
|
|
8139
8139
|
);
|
|
@@ -8141,24 +8141,24 @@ const gt = {
|
|
|
8141
8141
|
}
|
|
8142
8142
|
const v = h && h.length > 0 ? h : void 0;
|
|
8143
8143
|
let b = d.findOne(".clip-covers-group");
|
|
8144
|
-
b || (b = this.createGroup(0, 0), b.name("clip-covers-group"), d.add(b)), v && this.renderClipCovers(b, v,
|
|
8144
|
+
b || (b = this.createGroup(0, 0), b.name("clip-covers-group"), d.add(b)), v && this.renderClipCovers(b, v, C, S, l);
|
|
8145
8145
|
let E = t.findOne(".clip-label");
|
|
8146
8146
|
if (!E && r) {
|
|
8147
|
-
const
|
|
8147
|
+
const w = a && r.clipSelectedName || r.clipName;
|
|
8148
8148
|
E = this.createText(
|
|
8149
8149
|
"",
|
|
8150
8150
|
this.RESIZE_AREA_WIDTH,
|
|
8151
8151
|
i - f,
|
|
8152
8152
|
10,
|
|
8153
8153
|
"Arial",
|
|
8154
|
-
|
|
8154
|
+
w,
|
|
8155
8155
|
"left",
|
|
8156
8156
|
"middle"
|
|
8157
8157
|
), E.ellipsis(!0), E.name("clip-label"), t.add(E);
|
|
8158
8158
|
}
|
|
8159
8159
|
if (E) {
|
|
8160
|
-
const
|
|
8161
|
-
if (E.text(`${s} ${
|
|
8160
|
+
const w = this.formatDuration(n);
|
|
8161
|
+
if (E.text(`${s} ${w}`), E.y(i - f), E.width(C), r) {
|
|
8162
8162
|
const L = a && r.clipSelectedName || r.clipName;
|
|
8163
8163
|
E.fill(L);
|
|
8164
8164
|
}
|
|
@@ -8207,15 +8207,15 @@ const gt = {
|
|
|
8207
8207
|
const u = c.width / c.height, d = s * u, g = u >= 1;
|
|
8208
8208
|
let f;
|
|
8209
8209
|
g ? f = Math.min(a, Math.max(1, Math.floor(i / d))) : f = Math.min(a, Math.max(1, Math.floor(i / nt.MIN_IMAGE_DISPLAY_WIDTH)));
|
|
8210
|
-
const
|
|
8210
|
+
const S = i / f, C = [];
|
|
8211
8211
|
if (f === 1)
|
|
8212
|
-
|
|
8212
|
+
C.push(0);
|
|
8213
8213
|
else
|
|
8214
8214
|
for (let _ = 0; _ < f; _++)
|
|
8215
|
-
|
|
8215
|
+
C.push(Math.round(_ * (a - 1) / (f - 1)));
|
|
8216
8216
|
const y = [];
|
|
8217
8217
|
for (let _ = 0; _ < f; _++) {
|
|
8218
|
-
const v = e[
|
|
8218
|
+
const v = e[C[_]];
|
|
8219
8219
|
let b;
|
|
8220
8220
|
try {
|
|
8221
8221
|
b = await nt.getKeyframeDimensions(h, v), (!(b != null && b.width) || !(b != null && b.height)) && (b = l);
|
|
@@ -8227,13 +8227,13 @@ const gt = {
|
|
|
8227
8227
|
coverUrl: v,
|
|
8228
8228
|
imgRatio: E,
|
|
8229
8229
|
singleImageWidth: s * E,
|
|
8230
|
-
segmentStartX: _ *
|
|
8230
|
+
segmentStartX: _ * S
|
|
8231
8231
|
});
|
|
8232
8232
|
}
|
|
8233
8233
|
if (t.getAttr(nt.COVER_RENDER_VERSION_KEY) === r)
|
|
8234
8234
|
for (const { coverUrl: _, singleImageWidth: v, segmentStartX: b } of y) {
|
|
8235
|
-
const E = Math.max(v, 0.01),
|
|
8236
|
-
for (let R = 0; R <
|
|
8235
|
+
const E = Math.max(v, 0.01), w = Math.max(1, Math.ceil(S / E)), L = Math.max(v, 0.01);
|
|
8236
|
+
for (let R = 0; R < w; R++) {
|
|
8237
8237
|
const I = nt.getCachedImage(_);
|
|
8238
8238
|
I.src || (I.src = _);
|
|
8239
8239
|
const G = new J.Image({
|
|
@@ -8253,39 +8253,51 @@ const gt = {
|
|
|
8253
8253
|
}
|
|
8254
8254
|
};
|
|
8255
8255
|
// 定义拉伸交互区域宽度常量
|
|
8256
|
-
|
|
8257
|
-
|
|
8256
|
+
T(nt, "RESIZE_AREA_WIDTH", 3), /** 单张封面图的最小展示宽度(px),zoom 过小时通过减少显示段数保证每段不低于此宽度,且仍填满整条 */
|
|
8257
|
+
T(nt, "MIN_IMAGE_DISPLAY_WIDTH", 24), // 关键帧尺寸缓存,用于存储每个视频源的宽度和高度信息
|
|
8258
8258
|
// 格式: { [videoSrc]: { width: number; height: number } }
|
|
8259
|
-
|
|
8259
|
+
T(nt, "keyframeDimensionsCache", {}), // 图片对象缓存,用于存储已加载的 Image 对象
|
|
8260
8260
|
// 格式: { [imageUrl]: HTMLImageElement }
|
|
8261
|
-
|
|
8262
|
-
|
|
8261
|
+
T(nt, "imageCache", {}), // 图片缓存配置(长视频缩略图多,增大缓存避免滚动时重复请求)
|
|
8262
|
+
T(nt, "MAX_CACHE_SIZE", 1e3), T(nt, "COVER_RENDER_VERSION_KEY", "_coverRenderVersion");
|
|
8263
8263
|
let Q = nt;
|
|
8264
8264
|
class vr {
|
|
8265
8265
|
constructor(t, e, i, s, n, r) {
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8266
|
+
T(this, "stage");
|
|
8267
|
+
T(this, "gridLayer");
|
|
8268
|
+
T(this, "config");
|
|
8269
|
+
T(this, "theme");
|
|
8270
|
+
T(this, "isDragging", !1);
|
|
8271
|
+
T(this, "startDragX", 0);
|
|
8272
|
+
T(this, "scrollLeft", 0);
|
|
8273
|
+
T(this, "timeScaleHeight", 40);
|
|
8274
|
+
T(this, "onTimeChange");
|
|
8275
|
+
T(this, "onZoomChange");
|
|
8276
|
+
T(this, "onScrollChange");
|
|
8277
|
+
T(this, "animationFrameId", null);
|
|
8278
8278
|
// 滚动条相关属性
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8279
|
+
T(this, "scrollbarHeight", 8);
|
|
8280
|
+
T(this, "scrollbarY", 0);
|
|
8281
|
+
T(this, "isScrollbarDragging", !1);
|
|
8282
|
+
T(this, "scrollbarDragStartX", 0);
|
|
8283
|
+
T(this, "scrollbarDragStartScrollLeft", 0);
|
|
8284
|
+
T(this, "hasBoundGlobalPointerListenersForDrag", !1);
|
|
8285
|
+
T(this, "isPointerInsideTimeline", !1);
|
|
8286
|
+
T(this, "lastPointerXInTimeline", null);
|
|
8287
|
+
T(this, "handleGlobalPointerMove", (t) => {
|
|
8288
|
+
this.isPointerSessionActive() && this.handlePointerMove(t);
|
|
8289
|
+
});
|
|
8290
|
+
T(this, "handleGlobalPointerEnd", () => {
|
|
8291
|
+
this.finalizePointerInteraction();
|
|
8292
|
+
});
|
|
8293
|
+
T(this, "handleVisibilityChange", () => {
|
|
8294
|
+
typeof document < "u" && document.hidden && this.finalizePointerInteraction();
|
|
8295
|
+
});
|
|
8284
8296
|
// 左侧间距,确保时间为0时playhead可以完整显示
|
|
8285
|
-
|
|
8297
|
+
T(this, "leftPadding", ot);
|
|
8286
8298
|
this.stage = t, this.gridLayer = e, this.onTimeChange = s, this.onZoomChange = n, this.onScrollChange = r, this.config = {
|
|
8287
8299
|
duration: i.duration || 36e5,
|
|
8288
|
-
zoom: i.zoom ||
|
|
8300
|
+
zoom: i.zoom || ct.MEDIUM,
|
|
8289
8301
|
currentTime: i.currentTime || 0,
|
|
8290
8302
|
playState: i.playState || "paused",
|
|
8291
8303
|
container: i.container,
|
|
@@ -8295,7 +8307,7 @@ class vr {
|
|
|
8295
8307
|
}
|
|
8296
8308
|
initEventListeners() {
|
|
8297
8309
|
this.stage.on("wheel", (t) => {
|
|
8298
|
-
t.evt.preventDefault();
|
|
8310
|
+
t.evt.preventDefault(), this.updatePointerPosition(t.evt.offsetX), this.isPointerInsideTimeline = !0;
|
|
8299
8311
|
const { deltaX: e, deltaY: i, shiftKey: s } = t.evt;
|
|
8300
8312
|
if (s || Math.abs(e) > Math.abs(i)) {
|
|
8301
8313
|
const a = (e || i) * 1.5, h = this.stage.width(), l = N.timeToPixels(this.config.duration, this.config.zoom), c = Math.max(0, l - h), u = Math.max(0, Math.min(c, this.scrollLeft + a));
|
|
@@ -8305,28 +8317,51 @@ class vr {
|
|
|
8305
8317
|
}), this.stage.on("click", (t) => {
|
|
8306
8318
|
t.target.getLayer() === this.gridLayer && this.handleClick(t.evt.offsetX);
|
|
8307
8319
|
}), this.stage.on("mousedown", (t) => {
|
|
8320
|
+
this.updatePointerPosition(t.evt.offsetX), this.isPointerInsideTimeline = !0;
|
|
8308
8321
|
let e = t.target.getLayer(), i = t.target.name() === "scrollbar-background" || t.target.name() === "scrollbar-thumb";
|
|
8309
|
-
e === this.gridLayer && !i && (this.isDragging = !0, this.startDragX = t.evt.clientX);
|
|
8322
|
+
e === this.gridLayer && !i && (this.isDragging = !0, this.startDragX = t.evt.clientX, this.bindGlobalPointerListenersForDrag());
|
|
8310
8323
|
}), this.stage.on("mousemove", (t) => {
|
|
8311
|
-
|
|
8312
|
-
const e = t.evt.clientX - this.startDragX, i = this.scrollLeft;
|
|
8313
|
-
this.scrollLeft -= e;
|
|
8314
|
-
const s = this.stage.width(), n = N.timeToPixels(this.config.duration, this.config.zoom);
|
|
8315
|
-
this.scrollLeft = Math.max(0, Math.min(n - s, this.scrollLeft)), this.startDragX = t.evt.clientX, this.render(), this.scrollLeft !== i && this.onScrollChange(this.scrollLeft);
|
|
8316
|
-
} else if (this.isScrollbarDragging) {
|
|
8317
|
-
const e = t.evt.clientX - this.scrollbarDragStartX, i = this.stage.width(), s = N.timeToPixels(this.config.duration, this.config.zoom), n = Math.max(0, s - i), r = Math.max(20, Math.min(i, i / s * i)), h = e / (i - r) * n, l = this.scrollLeft;
|
|
8318
|
-
this.scrollLeft = Math.max(0, Math.min(n, this.scrollbarDragStartScrollLeft + h)), this.render(), this.scrollLeft !== l && this.onScrollChange(this.scrollLeft);
|
|
8319
|
-
}
|
|
8324
|
+
this.updatePointerPosition(t.evt.offsetX), this.isPointerInsideTimeline = !0, this.isPointerSessionActive() && !this.hasBoundGlobalPointerListenersForDrag && this.handlePointerMove(t.evt);
|
|
8320
8325
|
}), this.stage.on("mouseup", () => {
|
|
8321
|
-
this.
|
|
8326
|
+
this.finalizePointerInteraction();
|
|
8322
8327
|
}), this.stage.on("mouseleave", () => {
|
|
8323
|
-
this.
|
|
8328
|
+
this.isPointerInsideTimeline = !1;
|
|
8324
8329
|
});
|
|
8325
8330
|
}
|
|
8331
|
+
updatePointerPosition(t) {
|
|
8332
|
+
if (!Number.isFinite(t)) return;
|
|
8333
|
+
const e = this.stage.width();
|
|
8334
|
+
this.lastPointerXInTimeline = Math.max(0, Math.min(e, t));
|
|
8335
|
+
}
|
|
8336
|
+
bindGlobalPointerListenersForDrag() {
|
|
8337
|
+
if (this.hasBoundGlobalPointerListenersForDrag) return;
|
|
8338
|
+
let t = !1;
|
|
8339
|
+
typeof window < "u" && (window.addEventListener("mousemove", this.handleGlobalPointerMove), window.addEventListener("mouseup", this.handleGlobalPointerEnd), window.addEventListener("blur", this.handleGlobalPointerEnd), t = !0), typeof document < "u" && (document.addEventListener("visibilitychange", this.handleVisibilityChange), t = !0), this.hasBoundGlobalPointerListenersForDrag = t;
|
|
8340
|
+
}
|
|
8341
|
+
unbindGlobalPointerListenersForDrag() {
|
|
8342
|
+
this.hasBoundGlobalPointerListenersForDrag && (typeof window < "u" && (window.removeEventListener("mousemove", this.handleGlobalPointerMove), window.removeEventListener("mouseup", this.handleGlobalPointerEnd), window.removeEventListener("blur", this.handleGlobalPointerEnd)), typeof document < "u" && document.removeEventListener("visibilitychange", this.handleVisibilityChange), this.hasBoundGlobalPointerListenersForDrag = !1);
|
|
8343
|
+
}
|
|
8344
|
+
isPointerSessionActive() {
|
|
8345
|
+
return this.isDragging || this.isScrollbarDragging;
|
|
8346
|
+
}
|
|
8347
|
+
finalizePointerInteraction() {
|
|
8348
|
+
this.isDragging = !1, this.isScrollbarDragging = !1, this.unbindGlobalPointerListenersForDrag();
|
|
8349
|
+
}
|
|
8350
|
+
handlePointerMove(t) {
|
|
8351
|
+
if (this.isDragging) {
|
|
8352
|
+
const e = t.clientX - this.startDragX, i = this.scrollLeft;
|
|
8353
|
+
this.scrollLeft -= e;
|
|
8354
|
+
const s = this.stage.width(), n = N.timeToPixels(this.config.duration, this.config.zoom);
|
|
8355
|
+
this.scrollLeft = Math.max(0, Math.min(n - s, this.scrollLeft)), this.startDragX = t.clientX, this.render(), this.scrollLeft !== i && this.onScrollChange(this.scrollLeft);
|
|
8356
|
+
} else if (this.isScrollbarDragging) {
|
|
8357
|
+
const e = t.clientX - this.scrollbarDragStartX, i = this.stage.width(), s = N.timeToPixels(this.config.duration, this.config.zoom), n = Math.max(0, s - i), r = Math.max(20, Math.min(i, i / s * i)), h = e / (i - r) * n, l = this.scrollLeft;
|
|
8358
|
+
this.scrollLeft = Math.max(0, Math.min(n, this.scrollbarDragStartScrollLeft + h)), this.render(), this.scrollLeft !== l && this.onScrollChange(this.scrollLeft);
|
|
8359
|
+
}
|
|
8360
|
+
}
|
|
8326
8361
|
handleZoom(t) {
|
|
8327
8362
|
const e = t.evt.deltaY;
|
|
8328
8363
|
if (e === 0) return;
|
|
8329
|
-
const i = e > 0 ? 0.5 : 1.5, s = Math.max(
|
|
8364
|
+
const i = e > 0 ? 0.5 : 1.5, s = Math.max(ct.MIN, Math.min(ct.MAX, this.config.zoom * i));
|
|
8330
8365
|
if (s !== this.config.zoom) {
|
|
8331
8366
|
this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null);
|
|
8332
8367
|
const n = t.evt.offsetX;
|
|
@@ -8339,8 +8374,8 @@ class vr {
|
|
|
8339
8374
|
if (this.scrollLeft = g, this.config.zoom = u, this.onZoomChange(u), this.onScrollChange(g), this.render(), l < 1)
|
|
8340
8375
|
this.animationFrameId = requestAnimationFrame(a);
|
|
8341
8376
|
else {
|
|
8342
|
-
const f = N.timeToPixels(r, t),
|
|
8343
|
-
this.config.zoom = t, this.scrollLeft =
|
|
8377
|
+
const f = N.timeToPixels(r, t), S = Math.max(0, f - (e - this.leftPadding));
|
|
8378
|
+
this.config.zoom = t, this.scrollLeft = S, this.onZoomChange(t), this.onScrollChange(S), this.render();
|
|
8344
8379
|
}
|
|
8345
8380
|
};
|
|
8346
8381
|
this.animationFrameId && cancelAnimationFrame(this.animationFrameId), a();
|
|
@@ -8407,7 +8442,7 @@ class vr {
|
|
|
8407
8442
|
this.theme.scrollbarThumb || "#444"
|
|
8408
8443
|
);
|
|
8409
8444
|
r.name("scrollbar-thumb"), r.cornerRadius(4), r.on("mousedown", (a) => {
|
|
8410
|
-
this.isScrollbarDragging = !0, this.scrollbarDragStartX = a.evt.clientX, this.scrollbarDragStartScrollLeft = this.scrollLeft;
|
|
8445
|
+
this.isScrollbarDragging = !0, this.scrollbarDragStartX = a.evt.clientX, this.scrollbarDragStartScrollLeft = this.scrollLeft, this.bindGlobalPointerListenersForDrag();
|
|
8411
8446
|
}), r.on("mouseover", () => {
|
|
8412
8447
|
r.fill("#999"), this.gridLayer.batchDraw();
|
|
8413
8448
|
}), r.on("mouseout", () => {
|
|
@@ -8417,20 +8452,20 @@ class vr {
|
|
|
8417
8452
|
renderTimeTicks() {
|
|
8418
8453
|
const t = this.stage.width(), e = this.scrollLeft, i = this.scrollLeft + t, s = N.pixelsToTime(e, this.config.zoom), n = N.pixelsToTime(i, this.config.zoom), r = N.msToSeconds(s), a = N.msToSeconds(n), h = 10, l = r - h, c = a + h, { majorStep: u, minorStep: d } = N.getTickConfig(this.config.zoom), g = N.generateVisibleTicks(l, c, u, d);
|
|
8419
8454
|
let f = 0;
|
|
8420
|
-
const
|
|
8421
|
-
for (const
|
|
8422
|
-
const y = this.timeToPixel(
|
|
8423
|
-
y >= -
|
|
8455
|
+
const S = 20;
|
|
8456
|
+
for (const C of g) {
|
|
8457
|
+
const y = this.timeToPixel(C.time);
|
|
8458
|
+
y >= -S && y <= t + S && (Q.drawTimeTick(
|
|
8424
8459
|
this.gridLayer,
|
|
8425
8460
|
y,
|
|
8426
8461
|
0,
|
|
8427
8462
|
this.timeScaleHeight,
|
|
8428
|
-
|
|
8463
|
+
C.time,
|
|
8429
8464
|
{
|
|
8430
8465
|
timeTick: this.theme.timeTick,
|
|
8431
8466
|
timeText: this.theme.timeText
|
|
8432
8467
|
},
|
|
8433
|
-
|
|
8468
|
+
C.type,
|
|
8434
8469
|
this.timeScaleHeight
|
|
8435
8470
|
), f++);
|
|
8436
8471
|
}
|
|
@@ -8475,6 +8510,18 @@ class vr {
|
|
|
8475
8510
|
getGridLayer() {
|
|
8476
8511
|
return this.gridLayer;
|
|
8477
8512
|
}
|
|
8513
|
+
/**
|
|
8514
|
+
* 鼠标当前是否位于时间轴区域内
|
|
8515
|
+
*/
|
|
8516
|
+
hasPointerInTimeline() {
|
|
8517
|
+
return this.isPointerInsideTimeline;
|
|
8518
|
+
}
|
|
8519
|
+
/**
|
|
8520
|
+
* 获取时间轴内最近一次鼠标 X 坐标(相对 stage)
|
|
8521
|
+
*/
|
|
8522
|
+
getPointerXInTimeline() {
|
|
8523
|
+
return this.lastPointerXInTimeline;
|
|
8524
|
+
}
|
|
8478
8525
|
/**
|
|
8479
8526
|
* 调整大小
|
|
8480
8527
|
*/
|
|
@@ -8482,20 +8529,20 @@ class vr {
|
|
|
8482
8529
|
this.render();
|
|
8483
8530
|
}
|
|
8484
8531
|
}
|
|
8485
|
-
class
|
|
8532
|
+
class xe {
|
|
8486
8533
|
constructor(t, e, i) {
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8534
|
+
T(this, "clip");
|
|
8535
|
+
T(this, "onUpdate");
|
|
8536
|
+
T(this, "onSplit");
|
|
8490
8537
|
// 临时状态 - 仅在操作过程中使用
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8538
|
+
T(this, "isMoving", !1);
|
|
8539
|
+
T(this, "isMovingVisualApplied", !1);
|
|
8540
|
+
T(this, "dragStartPos", { x: 0, y: 0 });
|
|
8541
|
+
T(this, "originalStart", 0);
|
|
8542
|
+
T(this, "originalDuration", 0);
|
|
8543
|
+
T(this, "originalStartTimeAtSource", 0);
|
|
8544
|
+
T(this, "originalEndTimeAtSource", 0);
|
|
8545
|
+
T(this, "originalOpacity", 1);
|
|
8499
8546
|
this.clip = {
|
|
8500
8547
|
...t,
|
|
8501
8548
|
endTime: N.calculateEndTime(t.startTime, t.duration),
|
|
@@ -8542,11 +8589,11 @@ class we {
|
|
|
8542
8589
|
}, this.onUpdate(this.clip);
|
|
8543
8590
|
}
|
|
8544
8591
|
isPointInClip(t, e, i, s, n, r) {
|
|
8545
|
-
const a = N.timeToPixels(this.clip.startTime, i) - r +
|
|
8592
|
+
const a = N.timeToPixels(this.clip.startTime, i) - r + ot, h = N.timeToPixels(this.clip.duration, i);
|
|
8546
8593
|
return t >= a && t <= a + h && e >= s && e <= s + n;
|
|
8547
8594
|
}
|
|
8548
8595
|
isPointInResizeHandle(t, e, i, s, n, r) {
|
|
8549
|
-
const a = N.timeToPixels(this.clip.startTime, i) - r +
|
|
8596
|
+
const a = N.timeToPixels(this.clip.startTime, i) - r + ot, h = N.timeToPixels(this.clip.duration, i), l = 8;
|
|
8550
8597
|
return e < s || e > s + n ? (this.clip = {
|
|
8551
8598
|
...this.clip,
|
|
8552
8599
|
isResizingLeft: !1,
|
|
@@ -8594,10 +8641,10 @@ class we {
|
|
|
8594
8641
|
M.debug("Clip", "drag", { pos: t, clip: this.clip, deltaX: n, deltaTime: r });
|
|
8595
8642
|
let a = this.originalStart, h = this.originalDuration, l = this.originalStartTimeAtSource, c = this.originalEndTimeAtSource, u = "move";
|
|
8596
8643
|
if (this.clip.isResizingLeft) {
|
|
8597
|
-
const y = Math.max(0, this.originalStart + r) - this.originalStart, v = Math.max(0, this.originalStartTimeAtSource + r) - this.originalStartTimeAtSource, b = Math.abs(y), E = Math.abs(v),
|
|
8598
|
-
a = this.originalStart +
|
|
8644
|
+
const y = Math.max(0, this.originalStart + r) - this.originalStart, v = Math.max(0, this.originalStartTimeAtSource + r) - this.originalStartTimeAtSource, b = Math.abs(y), E = Math.abs(v), w = b < E ? y : v;
|
|
8645
|
+
a = this.originalStart + w, h = this.originalDuration - w;
|
|
8599
8646
|
const L = N.calculateEndTime(this.originalStart, this.originalDuration);
|
|
8600
|
-
h < 1e3 ? (h = 1e3, a = L - h, l = this.originalEndTimeAtSource - h) : l = this.originalStartTimeAtSource +
|
|
8647
|
+
h < 1e3 ? (h = 1e3, a = L - h, l = this.originalEndTimeAtSource - h) : l = this.originalStartTimeAtSource + w, c = this.originalEndTimeAtSource, u = "resize-left", M.debug("Clip", "Resize left", { operation: u, clipId: this.clip.id, originalStartTimeAtSource: this.originalStartTimeAtSource, newStartTimeAtSource: l, deltaTime: r, actualDeltaTime: w, timelineDeltaTime: y, sourceDeltaTime: v, newDuration: h, newEndTimeAtSource: c });
|
|
8601
8648
|
} else this.clip.isResizingRight ? (h = Math.max(1e3, this.originalDuration + r), l = this.originalStartTimeAtSource, c = Math.min(
|
|
8602
8649
|
this.clip.sourceDuration,
|
|
8603
8650
|
l + h
|
|
@@ -8612,12 +8659,12 @@ class we {
|
|
|
8612
8659
|
if (g = this.checkBoundary(l, c, h, a), !g)
|
|
8613
8660
|
return M.debug("Clip", `Boundary check failed - ${u}`, { clipId: this.clip.id, operation: u, newStart: a, newDuration: h, newStartTimeAtSource: l, newEndTimeAtSource: c, deltaX: n, deltaTime: r }), !1;
|
|
8614
8661
|
if (f = this.checkCollision(a, h, i), f) {
|
|
8615
|
-
const
|
|
8662
|
+
const C = f.startTime + f.duration;
|
|
8616
8663
|
let y = !1;
|
|
8617
8664
|
if (this.clip.isResizingLeft || this.clip.isResizingRight) {
|
|
8618
8665
|
if (this.clip.isResizingLeft) {
|
|
8619
|
-
if (M.debug("Clip", "Resizing left with collision", { clipId: this.clip.id, collisionClip: f, newStart: a, collisionEndTime:
|
|
8620
|
-
const _ =
|
|
8666
|
+
if (M.debug("Clip", "Resizing left with collision", { clipId: this.clip.id, collisionClip: f, newStart: a, collisionEndTime: C }), a <= C) {
|
|
8667
|
+
const _ = C, v = d - _;
|
|
8621
8668
|
if (v >= 1e3) {
|
|
8622
8669
|
const b = _ - a;
|
|
8623
8670
|
a = _, h = v, l += b, d = N.calculateEndTime(a, h), y = !0, M.debug("Clip", "Resizing left adjusted to avoid collision", { clipId: this.clip.id, newStart: a, newDuration: h, newStartTimeAtSource: l });
|
|
@@ -8657,32 +8704,44 @@ class we {
|
|
|
8657
8704
|
}
|
|
8658
8705
|
}
|
|
8659
8706
|
class Tr {
|
|
8660
|
-
constructor(t, e, i, s, n, r, a, h, l, c, u, d) {
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8707
|
+
constructor(t, e, i, s, n, r, a, h, l, c, u, d, g) {
|
|
8708
|
+
T(this, "layer");
|
|
8709
|
+
T(this, "trackGroup");
|
|
8710
|
+
T(this, "config");
|
|
8711
|
+
T(this, "theme");
|
|
8712
|
+
T(this, "clips", []);
|
|
8713
|
+
T(this, "clipGroups", /* @__PURE__ */ new Map());
|
|
8714
|
+
T(this, "zoom", 100);
|
|
8715
|
+
T(this, "scrollLeft", 0);
|
|
8716
|
+
T(this, "trackY", 0);
|
|
8717
|
+
T(this, "trackHeight", 64);
|
|
8718
|
+
T(this, "selectedClip", null);
|
|
8719
|
+
T(this, "originalClipsState", []);
|
|
8720
|
+
T(this, "nonDraggedClips", []);
|
|
8721
|
+
T(this, "isVisualUpdate", !1);
|
|
8722
|
+
T(this, "onClipUpdate");
|
|
8723
|
+
T(this, "onClipAdd");
|
|
8724
|
+
T(this, "onClipRemove");
|
|
8725
|
+
T(this, "onClipSplit");
|
|
8726
|
+
T(this, "onClipSelect");
|
|
8727
|
+
T(this, "onTimeJump");
|
|
8728
|
+
T(this, "onAutoScrollDuringDrag");
|
|
8729
|
+
T(this, "dragAutoScrollOffsetPx", 0);
|
|
8730
|
+
T(this, "hasBoundGlobalPointerListenersForDrag", !1);
|
|
8731
|
+
T(this, "handleGlobalPointerMove", (t) => {
|
|
8732
|
+
this.isDragSessionActive() && this.handleDragMove(t);
|
|
8733
|
+
});
|
|
8734
|
+
T(this, "handleGlobalPointerEnd", () => {
|
|
8735
|
+
this.handleClipMouseUp();
|
|
8736
|
+
});
|
|
8737
|
+
T(this, "handleVisibilityChange", () => {
|
|
8738
|
+
typeof document < "u" && document.hidden && this.handleClipMouseUp();
|
|
8739
|
+
});
|
|
8740
|
+
this.layer = t, this.config = e, this.theme = r, this.zoom = i, this.trackY = s, this.trackHeight = n, this.onClipUpdate = a, this.onClipAdd = h, this.onClipRemove = l, this.onClipSplit = c, this.onClipSelect = u, this.onTimeJump = d, this.onAutoScrollDuringDrag = g, this.trackGroup = Q.createGroup(0, s), this.layer.add(this.trackGroup), this.initClips(), this.initEventListeners(), this.render();
|
|
8682
8741
|
}
|
|
8683
8742
|
initClips() {
|
|
8684
8743
|
this.clips = this.config.clips.map((t) => {
|
|
8685
|
-
const e = new
|
|
8744
|
+
const e = new xe(
|
|
8686
8745
|
t,
|
|
8687
8746
|
this.handleClipUpdate.bind(this),
|
|
8688
8747
|
this.handleClipSplit.bind(this)
|
|
@@ -8696,10 +8755,14 @@ class Tr {
|
|
|
8696
8755
|
this.handleStageMouseMove(e.evt);
|
|
8697
8756
|
}), t.on("mouseup", () => {
|
|
8698
8757
|
this.handleClipMouseUp();
|
|
8699
|
-
}), t.on("mouseleave", () => {
|
|
8700
|
-
this.handleClipMouseUp();
|
|
8701
8758
|
}));
|
|
8702
8759
|
}
|
|
8760
|
+
bindGlobalPointerListenersForDrag() {
|
|
8761
|
+
this.hasBoundGlobalPointerListenersForDrag || (typeof window < "u" && (window.addEventListener("mousemove", this.handleGlobalPointerMove), window.addEventListener("mouseup", this.handleGlobalPointerEnd), window.addEventListener("blur", this.handleGlobalPointerEnd)), typeof document < "u" && document.addEventListener("visibilitychange", this.handleVisibilityChange), this.hasBoundGlobalPointerListenersForDrag = !0);
|
|
8762
|
+
}
|
|
8763
|
+
unbindGlobalPointerListenersForDrag() {
|
|
8764
|
+
this.hasBoundGlobalPointerListenersForDrag && (typeof window < "u" && (window.removeEventListener("mousemove", this.handleGlobalPointerMove), window.removeEventListener("mouseup", this.handleGlobalPointerEnd), window.removeEventListener("blur", this.handleGlobalPointerEnd)), typeof document < "u" && document.removeEventListener("visibilitychange", this.handleVisibilityChange), this.hasBoundGlobalPointerListenersForDrag = !1);
|
|
8765
|
+
}
|
|
8703
8766
|
/**
|
|
8704
8767
|
* 处理轨道背景点击事件
|
|
8705
8768
|
*/
|
|
@@ -8708,14 +8771,14 @@ class Tr {
|
|
|
8708
8771
|
if (!e) return;
|
|
8709
8772
|
const i = e.container();
|
|
8710
8773
|
if (!i) return;
|
|
8711
|
-
const s = i.getBoundingClientRect(), n = t.clientX - s.left, r = Math.max(0, N.pixelsToTime(n -
|
|
8774
|
+
const s = i.getBoundingClientRect(), n = t.clientX - s.left, r = Math.max(0, N.pixelsToTime(n - ot + this.scrollLeft, this.zoom));
|
|
8712
8775
|
this.onTimeJump(r);
|
|
8713
8776
|
}
|
|
8714
8777
|
/**
|
|
8715
8778
|
* 创建片段组
|
|
8716
8779
|
*/
|
|
8717
8780
|
createClipGroup(t) {
|
|
8718
|
-
const e = Q.timeToPixels(t.startTime, this.zoom) - this.scrollLeft +
|
|
8781
|
+
const e = Q.timeToPixels(t.startTime, this.zoom) - this.scrollLeft + ot, i = Q.timeToPixels(t.duration, this.zoom), s = t.duration <= 1e3 || i <= Ct ? Ct : i, n = 2, r = this.trackHeight - 4, a = Q.createClipGroup(
|
|
8719
8782
|
e,
|
|
8720
8783
|
n,
|
|
8721
8784
|
s,
|
|
@@ -8766,7 +8829,7 @@ class Tr {
|
|
|
8766
8829
|
return;
|
|
8767
8830
|
}
|
|
8768
8831
|
const a = r.getBoundingClientRect(), h = e.clientX - a.left, l = e.clientY - a.top;
|
|
8769
|
-
M.debug("VideoTrack", "Calculated mouse position", { clipId: t, x: h, y: l, clientX: e.clientX, clientY: e.clientY, rect: a }), i.isPointInResizeHandle(h, l, this.zoom, this.trackY, this.trackHeight, this.scrollLeft) ? (i.startResize({ x: h, y: l }), M.debug("VideoTrack", "Started resize operation", { clipId: t, x: h, y: l })) : (i.startDrag({ x: h, y: l }), M.debug("VideoTrack", "Started drag operation", { clipId: t, x: h, y: l })), this.render();
|
|
8832
|
+
M.debug("VideoTrack", "Calculated mouse position", { clipId: t, x: h, y: l, clientX: e.clientX, clientY: e.clientY, rect: a }), i.isPointInResizeHandle(h, l, this.zoom, this.trackY, this.trackHeight, this.scrollLeft) ? (i.startResize({ x: h, y: l }), M.debug("VideoTrack", "Started resize operation", { clipId: t, x: h, y: l })) : (i.startDrag({ x: h, y: l }), M.debug("VideoTrack", "Started drag operation", { clipId: t, x: h, y: l })), this.dragAutoScrollOffsetPx = 0, this.bindGlobalPointerListenersForDrag(), this.render();
|
|
8770
8833
|
} else
|
|
8771
8834
|
M.debug("VideoTrack", "Clip not found", { clipId: t });
|
|
8772
8835
|
}
|
|
@@ -8779,11 +8842,21 @@ class Tr {
|
|
|
8779
8842
|
* 处理片段鼠标释放事件
|
|
8780
8843
|
*/
|
|
8781
8844
|
handleClipMouseUp() {
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8845
|
+
M.debug("VideoTrack", "Mouse up detected", { selectedClip: this.selectedClip });
|
|
8846
|
+
try {
|
|
8847
|
+
if (this.selectedClip) {
|
|
8848
|
+
const t = this.selectedClip.getClip();
|
|
8849
|
+
if (!t.isDragging) {
|
|
8850
|
+
M.debug("VideoTrack", "Mouse up ignored: selected clip is not dragging", { clipId: t.id });
|
|
8851
|
+
return;
|
|
8852
|
+
}
|
|
8853
|
+
const e = this.selectedClip.getClip();
|
|
8854
|
+
M.debug("VideoTrack", "Processing release for clip", { clipId: e.id }), this.selectedClip.endDrag(), this.handleClipMoveEnd(e), M.debug("VideoTrack", "Clip drag ended successfully"), this.layer.batchDraw();
|
|
8855
|
+
} else
|
|
8856
|
+
M.debug("VideoTrack", "No selected clip to process");
|
|
8857
|
+
} finally {
|
|
8858
|
+
this.dragAutoScrollOffsetPx = 0, this.unbindGlobalPointerListenersForDrag();
|
|
8859
|
+
}
|
|
8787
8860
|
}
|
|
8788
8861
|
/**
|
|
8789
8862
|
* 处理片段移动结束后的重叠检测和重新排序
|
|
@@ -8797,6 +8870,11 @@ class Tr {
|
|
|
8797
8870
|
s.isSelected = !1;
|
|
8798
8871
|
}), e.splice(i, 0, {
|
|
8799
8872
|
...t,
|
|
8873
|
+
isDragging: !1,
|
|
8874
|
+
isResizing: !1,
|
|
8875
|
+
isResizingLeft: !1,
|
|
8876
|
+
isResizingRight: !1,
|
|
8877
|
+
zIndex: 1,
|
|
8800
8878
|
opacity: 1,
|
|
8801
8879
|
isSelected: !0
|
|
8802
8880
|
// 确保保留选中状态
|
|
@@ -8862,22 +8940,13 @@ class Tr {
|
|
|
8862
8940
|
if (!e)
|
|
8863
8941
|
return;
|
|
8864
8942
|
const i = e.container();
|
|
8865
|
-
if (!i)
|
|
8943
|
+
if (!i || this.isDragSessionActive())
|
|
8866
8944
|
return;
|
|
8867
8945
|
const s = i.getBoundingClientRect(), n = t.clientX - s.left, r = t.clientY - s.top;
|
|
8868
|
-
|
|
8869
|
-
const a = this.clips.map((l) => l.getClip()).filter((l) => {
|
|
8870
|
-
var c;
|
|
8871
|
-
return l.id !== ((c = this.selectedClip) == null ? void 0 : c.getClip().id);
|
|
8872
|
-
});
|
|
8873
|
-
if (this.selectedClip.drag({ x: n, y: r }, this.zoom, a, !0)) {
|
|
8874
|
-
const l = this.selectedClip.getClip();
|
|
8875
|
-
this.updateClipGroup(l), this.layer.batchDraw();
|
|
8876
|
-
}
|
|
8877
|
-
} else {
|
|
8946
|
+
{
|
|
8878
8947
|
let a = !1;
|
|
8879
8948
|
for (const h of this.clips) {
|
|
8880
|
-
const l = h.getClip(), c = Q.timeToPixels(l.startTime, this.zoom) - this.scrollLeft +
|
|
8949
|
+
const l = h.getClip(), c = Q.timeToPixels(l.startTime, this.zoom) - this.scrollLeft + ot, u = Q.timeToPixels(l.duration, this.zoom);
|
|
8881
8950
|
if (n >= c && n <= c + Q.RESIZE_AREA_WIDTH && r >= this.trackY && r <= this.trackY + this.trackHeight) {
|
|
8882
8951
|
i.style.cursor = "ew-resize", a = !0;
|
|
8883
8952
|
break;
|
|
@@ -8894,6 +8963,49 @@ class Tr {
|
|
|
8894
8963
|
a || (i.style.cursor = "default");
|
|
8895
8964
|
}
|
|
8896
8965
|
}
|
|
8966
|
+
isDragSessionActive() {
|
|
8967
|
+
var t;
|
|
8968
|
+
return !!((t = this.selectedClip) != null && t.getClip().isDragging);
|
|
8969
|
+
}
|
|
8970
|
+
handleDragMove(t) {
|
|
8971
|
+
const e = this.layer.getStage();
|
|
8972
|
+
if (!e || !this.selectedClip) return;
|
|
8973
|
+
const i = e.container();
|
|
8974
|
+
if (!i) return;
|
|
8975
|
+
const s = i.getBoundingClientRect(), n = t.clientX - s.left, r = t.clientY - s.top, a = this.clips.map((u) => u.getClip()).filter((u) => {
|
|
8976
|
+
var d;
|
|
8977
|
+
return u.id !== ((d = this.selectedClip) == null ? void 0 : d.getClip().id);
|
|
8978
|
+
});
|
|
8979
|
+
this.maybeAutoScrollDuringDrag(t.clientX);
|
|
8980
|
+
const h = n + this.dragAutoScrollOffsetPx;
|
|
8981
|
+
if (!this.selectedClip.drag({ x: h, y: r }, this.zoom, a, !0)) return;
|
|
8982
|
+
const c = this.selectedClip.getClip();
|
|
8983
|
+
this.updateClipGroup(c), this.layer.batchDraw();
|
|
8984
|
+
}
|
|
8985
|
+
maybeAutoScrollDuringDrag(t) {
|
|
8986
|
+
if (!this.onAutoScrollDuringDrag) return;
|
|
8987
|
+
const e = this.layer.getStage();
|
|
8988
|
+
if (!e) return;
|
|
8989
|
+
const i = e.container();
|
|
8990
|
+
if (!i) return;
|
|
8991
|
+
const s = i.getBoundingClientRect(), n = 80, r = 24;
|
|
8992
|
+
let a = 0;
|
|
8993
|
+
const h = s.right - n;
|
|
8994
|
+
if (t > h) {
|
|
8995
|
+
const d = Math.min(2, (t - h) / n);
|
|
8996
|
+
a = r * d;
|
|
8997
|
+
}
|
|
8998
|
+
const l = s.left + n;
|
|
8999
|
+
if (t < l) {
|
|
9000
|
+
const d = Math.min(2, (l - t) / n);
|
|
9001
|
+
a = -r * d;
|
|
9002
|
+
}
|
|
9003
|
+
if (a === 0) return;
|
|
9004
|
+
const c = this.scrollLeft;
|
|
9005
|
+
this.onAutoScrollDuringDrag(this.scrollLeft + a);
|
|
9006
|
+
const u = this.scrollLeft - c;
|
|
9007
|
+
u !== 0 && (this.dragAutoScrollOffsetPx += u);
|
|
9008
|
+
}
|
|
8897
9009
|
/**
|
|
8898
9010
|
* 处理片段鼠标离开事件
|
|
8899
9011
|
*/
|
|
@@ -8926,8 +9038,8 @@ class Tr {
|
|
|
8926
9038
|
var i;
|
|
8927
9039
|
const e = this.clipGroups.get(t.id);
|
|
8928
9040
|
if (e) {
|
|
8929
|
-
const s = Q.timeToPixels(t.startTime, this.zoom) - this.scrollLeft +
|
|
8930
|
-
e.x(s);
|
|
9041
|
+
const s = Q.timeToPixels(t.startTime, this.zoom) - this.scrollLeft + ot, n = Q.timeToPixels(t.duration, this.zoom), r = t.duration <= 1e3 || n <= Ct ? Ct : n;
|
|
9042
|
+
e.x(s), e.visible(s + r > 0 && s < this.layer.width());
|
|
8931
9043
|
const a = t.isSelected || ((i = this.selectedClip) == null ? void 0 : i.getClip().id) === t.id, h = t.isDragging || a;
|
|
8932
9044
|
M.debug("VideoTrack", "updateClipGroup-更新片段组状态", { clipId: t.id, isSelected: a, isDragging: t.isDragging, isActive: h }), h && e.moveToTop(), e.opacity(t.opacity), Q.updateClipGroup(
|
|
8933
9045
|
e,
|
|
@@ -8943,16 +9055,17 @@ class Tr {
|
|
|
8943
9055
|
}
|
|
8944
9056
|
}
|
|
8945
9057
|
handleClipUpdate(t) {
|
|
8946
|
-
|
|
9058
|
+
var i;
|
|
9059
|
+
const e = this.clips.findIndex((s) => s.getClip().id === t.id);
|
|
8947
9060
|
if (M.debug("VideoTrack", "更新片段", { clipId: t.id, isDragging: t.isDragging, zIndex: t.zIndex }), e !== -1) {
|
|
8948
|
-
const
|
|
8949
|
-
this.clips[e] = new
|
|
9061
|
+
const s = this.clips[e].getClip();
|
|
9062
|
+
this.clips[e] = new xe(
|
|
8950
9063
|
t,
|
|
8951
9064
|
this.handleClipUpdate.bind(this),
|
|
8952
9065
|
this.handleClipSplit.bind(this)
|
|
8953
|
-
), this.updateClipGroup(t);
|
|
8954
|
-
const
|
|
8955
|
-
|
|
9066
|
+
), ((i = this.selectedClip) == null ? void 0 : i.getClip().id) === t.id && !t.isDragging && (this.selectedClip = this.clips[e]), this.updateClipGroup(t);
|
|
9067
|
+
const n = this.clipGroups.get(t.id);
|
|
9068
|
+
n && n.opacity(t.opacity), this.isVisualUpdate || this.onClipUpdate(t, s), this.layer.batchDraw();
|
|
8956
9069
|
}
|
|
8957
9070
|
}
|
|
8958
9071
|
handleClipSplit(t, e) {
|
|
@@ -8973,7 +9086,7 @@ class Tr {
|
|
|
8973
9086
|
this.removeClip(t.id), this.addClip(r), this.addClip(a), this.onClipSplit(r, a), this.layer.batchDraw();
|
|
8974
9087
|
}
|
|
8975
9088
|
addClip(t) {
|
|
8976
|
-
const e = new
|
|
9089
|
+
const e = new xe(
|
|
8977
9090
|
t,
|
|
8978
9091
|
this.handleClipUpdate.bind(this),
|
|
8979
9092
|
this.handleClipSplit.bind(this)
|
|
@@ -9016,8 +9129,8 @@ class Tr {
|
|
|
9016
9129
|
updateClipVisibility(t) {
|
|
9017
9130
|
const e = this.clipGroups.get(t.id);
|
|
9018
9131
|
if (e) {
|
|
9019
|
-
const i = Q.timeToPixels(t.startTime, this.zoom) - this.scrollLeft +
|
|
9020
|
-
e.visible(
|
|
9132
|
+
const i = Q.timeToPixels(t.startTime, this.zoom) - this.scrollLeft + ot, s = Q.timeToPixels(t.duration, this.zoom), n = t.duration <= 1e3 || s <= Ct ? Ct : s, r = i + n > 0 && i < this.layer.width();
|
|
9133
|
+
e.visible(r);
|
|
9021
9134
|
}
|
|
9022
9135
|
}
|
|
9023
9136
|
setTrackY(t) {
|
|
@@ -9095,18 +9208,18 @@ class Tr {
|
|
|
9095
9208
|
return this.config.id || "default";
|
|
9096
9209
|
}
|
|
9097
9210
|
}
|
|
9098
|
-
class
|
|
9211
|
+
class wr {
|
|
9099
9212
|
constructor(t, e, i, s, n, r) {
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9213
|
+
T(this, "layer");
|
|
9214
|
+
T(this, "playheadGroup");
|
|
9215
|
+
T(this, "playheadLine");
|
|
9216
|
+
T(this, "playheadTriangle");
|
|
9217
|
+
T(this, "theme");
|
|
9218
|
+
T(this, "currentTime", 0);
|
|
9219
|
+
T(this, "zoom", 100);
|
|
9220
|
+
T(this, "scrollLeft", 0);
|
|
9221
|
+
T(this, "onTimeChange");
|
|
9222
|
+
T(this, "isDragging", !1);
|
|
9110
9223
|
this.layer = t, this.currentTime = e, this.zoom = i, this.theme = n, this.onTimeChange = r, this.playheadGroup = Q.createGroup(), this.layer.add(this.playheadGroup), this.playheadLine = Q.createLine(
|
|
9111
9224
|
[0, 0, 0, s],
|
|
9112
9225
|
this.theme.playhead,
|
|
@@ -9138,7 +9251,7 @@ class xr {
|
|
|
9138
9251
|
if (!e) return;
|
|
9139
9252
|
const i = e.container();
|
|
9140
9253
|
if (!i) return;
|
|
9141
|
-
const s = i.getBoundingClientRect(), n = t.clientX - s.left, r = N.pixelsToTime(n -
|
|
9254
|
+
const s = i.getBoundingClientRect(), n = t.clientX - s.left, r = N.pixelsToTime(n - ot + this.scrollLeft, this.zoom);
|
|
9142
9255
|
this.setTime(r);
|
|
9143
9256
|
}
|
|
9144
9257
|
setTime(t) {
|
|
@@ -9154,7 +9267,7 @@ class xr {
|
|
|
9154
9267
|
this.playheadLine.points([0, 0, 0, t]), this.render();
|
|
9155
9268
|
}
|
|
9156
9269
|
render() {
|
|
9157
|
-
const t = N.timeToPixels(this.currentTime, this.zoom) - this.scrollLeft +
|
|
9270
|
+
const t = N.timeToPixels(this.currentTime, this.zoom) - this.scrollLeft + ot;
|
|
9158
9271
|
this.playheadGroup.x(t), this.playheadGroup.visible(t >= 0 && t <= this.layer.width()), this.layer.batchDraw();
|
|
9159
9272
|
}
|
|
9160
9273
|
getTime() {
|
|
@@ -9167,13 +9280,13 @@ class xr {
|
|
|
9167
9280
|
return this.playheadGroup;
|
|
9168
9281
|
}
|
|
9169
9282
|
}
|
|
9170
|
-
class
|
|
9283
|
+
class xr {
|
|
9171
9284
|
constructor(t, e, i, s = 100) {
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9285
|
+
T(this, "state");
|
|
9286
|
+
T(this, "maxHistorySize", 100);
|
|
9287
|
+
T(this, "onActionUndo");
|
|
9288
|
+
T(this, "onActionRedo");
|
|
9289
|
+
T(this, "onHistoryChange");
|
|
9177
9290
|
this.state = {
|
|
9178
9291
|
past: [],
|
|
9179
9292
|
future: []
|
|
@@ -9321,39 +9434,40 @@ class wr {
|
|
|
9321
9434
|
};
|
|
9322
9435
|
}
|
|
9323
9436
|
}
|
|
9324
|
-
const kr = "1.0.
|
|
9437
|
+
const kr = "1.0.10", Er = {
|
|
9325
9438
|
version: kr
|
|
9326
9439
|
};
|
|
9327
|
-
class
|
|
9440
|
+
class Ar {
|
|
9328
9441
|
constructor(t = {}) {
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9442
|
+
T(this, "timeline", null);
|
|
9443
|
+
T(this, "tracks", []);
|
|
9444
|
+
T(this, "playhead", null);
|
|
9445
|
+
T(this, "history");
|
|
9446
|
+
T(this, "config");
|
|
9447
|
+
T(this, "eventListeners", /* @__PURE__ */ new Map());
|
|
9448
|
+
T(this, "animationFrameId", null);
|
|
9449
|
+
T(this, "lastUpdateTime", 0);
|
|
9450
|
+
T(this, "isInitialized", !1);
|
|
9451
|
+
T(this, "stage", null);
|
|
9452
|
+
T(this, "gridLayer", null);
|
|
9453
|
+
T(this, "trackLayer", null);
|
|
9454
|
+
T(this, "playheadLayer", null);
|
|
9455
|
+
T(this, "selectionLayer", null);
|
|
9456
|
+
T(this, "resizeObserver", null);
|
|
9457
|
+
T(this, "videoPreview", null);
|
|
9458
|
+
T(this, "isExecutingHistoryAction", !1);
|
|
9459
|
+
T(this, "lastTrackDuration", 0);
|
|
9460
|
+
T(this, "thumbnailProvider", null);
|
|
9461
|
+
T(this, "canPlay", !1);
|
|
9462
|
+
T(this, "isBuffering", !1);
|
|
9463
|
+
T(this, "sourceLoadingCount", 0);
|
|
9464
|
+
T(this, "lastSelectedClipId", null);
|
|
9465
|
+
T(this, "playStateBeforeBuffering", null);
|
|
9466
|
+
T(this, "isPausingForBuffering", !1);
|
|
9467
|
+
T(this, "videoBufferingListeners", null);
|
|
9354
9468
|
this.config = {
|
|
9355
9469
|
duration: t.duration || 36e5,
|
|
9356
|
-
zoom: t.zoom ||
|
|
9470
|
+
zoom: t.zoom || ct.MEDIUM,
|
|
9357
9471
|
currentTime: t.currentTime || 0,
|
|
9358
9472
|
playState: t.playState || "paused",
|
|
9359
9473
|
container: t.container,
|
|
@@ -9362,7 +9476,7 @@ class Pr {
|
|
|
9362
9476
|
debug: t.debug,
|
|
9363
9477
|
speed: t.speed || 1,
|
|
9364
9478
|
thumbnailProvider: t.thumbnailProvider
|
|
9365
|
-
}, M.setDebugEnabled(!!this.config.debug), this.thumbnailProvider = t.thumbnailProvider || null, this.history = new
|
|
9479
|
+
}, M.setDebugEnabled(!!this.config.debug), this.thumbnailProvider = t.thumbnailProvider || null, this.history = new xr(
|
|
9366
9480
|
this.handleActionUndo.bind(this),
|
|
9367
9481
|
this.handleActionRedo.bind(this),
|
|
9368
9482
|
() => {
|
|
@@ -9394,7 +9508,7 @@ class Pr {
|
|
|
9394
9508
|
this.handleTimeChange.bind(this),
|
|
9395
9509
|
this.handleZoomChange.bind(this),
|
|
9396
9510
|
this.handleScrollChange.bind(this)
|
|
9397
|
-
), this.playhead = new
|
|
9511
|
+
), this.playhead = new wr(
|
|
9398
9512
|
this.playheadLayer,
|
|
9399
9513
|
this.config.currentTime,
|
|
9400
9514
|
this.config.zoom,
|
|
@@ -9414,7 +9528,8 @@ class Pr {
|
|
|
9414
9528
|
this.handleClipRemove.bind(this),
|
|
9415
9529
|
this.handleClipSplit.bind(this),
|
|
9416
9530
|
this.handleClipSelect.bind(this),
|
|
9417
|
-
this.setCurrentTime.bind(this)
|
|
9531
|
+
this.setCurrentTime.bind(this),
|
|
9532
|
+
this.handleTrackAutoScrollRequest.bind(this)
|
|
9418
9533
|
);
|
|
9419
9534
|
this.tracks.push(i), this.isInitialized = !0, this.stage && this.stage.batchDraw();
|
|
9420
9535
|
}
|
|
@@ -9452,7 +9567,7 @@ class Pr {
|
|
|
9452
9567
|
return this.config.currentTime;
|
|
9453
9568
|
}
|
|
9454
9569
|
setZoom(t) {
|
|
9455
|
-
const e = Math.max(
|
|
9570
|
+
const e = Math.max(ct.MIN, Math.min(ct.MAX, t));
|
|
9456
9571
|
e !== this.config.zoom && (this.config.zoom = e, this.timeline && this.timeline.setZoom(e), this.playhead && this.playhead.setZoom(e), this.tracks.forEach((i) => i.setZoom(e)), this.emitEvent("zoom_change", { zoom: e }));
|
|
9457
9572
|
}
|
|
9458
9573
|
/**
|
|
@@ -9460,7 +9575,7 @@ class Pr {
|
|
|
9460
9575
|
* 调整 scrollLeft 使游标在屏幕上的位置保持不变
|
|
9461
9576
|
*/
|
|
9462
9577
|
setZoomCenteredOnPlayhead(t) {
|
|
9463
|
-
const e = Math.max(
|
|
9578
|
+
const e = Math.max(ct.MIN, Math.min(ct.MAX, t));
|
|
9464
9579
|
if (e === this.config.zoom) return;
|
|
9465
9580
|
const i = this.config.zoom, s = this.config.currentTime;
|
|
9466
9581
|
if (this.config.zoom = e, this.timeline && this.timeline.setZoom(e), this.playhead && this.playhead.setZoom(e), this.tracks.forEach((n) => n.setZoom(e)), this.timeline) {
|
|
@@ -9469,6 +9584,39 @@ class Pr {
|
|
|
9469
9584
|
}
|
|
9470
9585
|
this.emitEvent("zoom_change", { zoom: e });
|
|
9471
9586
|
}
|
|
9587
|
+
/**
|
|
9588
|
+
* 外部缩放入口:
|
|
9589
|
+
* - 鼠标在时间轴内:以鼠标位置为中心缩放
|
|
9590
|
+
* - 鼠标不在时间轴内:回退为以游标(playhead)为中心缩放
|
|
9591
|
+
*/
|
|
9592
|
+
setZoomByInteraction(t) {
|
|
9593
|
+
const e = this.timeline;
|
|
9594
|
+
if (!e) {
|
|
9595
|
+
this.setZoomCenteredOnPlayhead(t);
|
|
9596
|
+
return;
|
|
9597
|
+
}
|
|
9598
|
+
const i = e.getPointerXInTimeline();
|
|
9599
|
+
if (e.hasPointerInTimeline() && i !== null) {
|
|
9600
|
+
this.setZoomCenteredOnTimelinePointer(t, i);
|
|
9601
|
+
return;
|
|
9602
|
+
}
|
|
9603
|
+
this.setZoomCenteredOnPlayhead(t);
|
|
9604
|
+
}
|
|
9605
|
+
/**
|
|
9606
|
+
* 以时间轴上的指定像素点为中心缩放,保持该像素对应时间不变
|
|
9607
|
+
*/
|
|
9608
|
+
setZoomCenteredOnTimelinePointer(t, e) {
|
|
9609
|
+
const i = Math.max(ct.MIN, Math.min(ct.MAX, t));
|
|
9610
|
+
if (i === this.config.zoom) return;
|
|
9611
|
+
if (!this.timeline) {
|
|
9612
|
+
this.setZoom(i);
|
|
9613
|
+
return;
|
|
9614
|
+
}
|
|
9615
|
+
const s = this.config.zoom, n = this.timeline.getScrollLeft(), r = N.pixelsToTime(e - ot + n, s);
|
|
9616
|
+
this.config.zoom = i, this.timeline.setZoom(i), this.playhead && this.playhead.setZoom(i), this.tracks.forEach((l) => l.setZoom(i));
|
|
9617
|
+
const h = N.timeToPixels(r, i) - (e - ot);
|
|
9618
|
+
this.timeline.setScrollLeft(h), this.handleScrollChange(this.timeline.getScrollLeft()), this.emitEvent("zoom_change", { zoom: i });
|
|
9619
|
+
}
|
|
9472
9620
|
getZoom() {
|
|
9473
9621
|
return this.config.zoom;
|
|
9474
9622
|
}
|
|
@@ -9716,12 +9864,12 @@ class Pr {
|
|
|
9716
9864
|
var h;
|
|
9717
9865
|
const t = this.getClips();
|
|
9718
9866
|
if (t.length === 0) return;
|
|
9719
|
-
const e = Math.min(...t.map((l) => l.startTime)), s = (Math.max(...t.map((l) => l.endTime)) - e) / 1e3, n = ((h = this.stage) == null ? void 0 : h.width()) || 0, r = n -
|
|
9867
|
+
const e = Math.min(...t.map((l) => l.startTime)), s = (Math.max(...t.map((l) => l.endTime)) - e) / 1e3, n = ((h = this.stage) == null ? void 0 : h.width()) || 0, r = n - ot * 2;
|
|
9720
9868
|
M.debug("TimelineManager", "适合缩放:", { duration: s, containerWidth: n, availableWidth: r });
|
|
9721
|
-
const a = Math.min(r / s,
|
|
9869
|
+
const a = Math.min(r / s, ct.MAX);
|
|
9722
9870
|
if (this.setZoom(a), this.timeline) {
|
|
9723
9871
|
const l = t.reduce((c, u) => u.startTime < c.startTime ? u : c);
|
|
9724
|
-
this.scrollToClip(l.id
|
|
9872
|
+
this.scrollToClip(l.id);
|
|
9725
9873
|
}
|
|
9726
9874
|
}
|
|
9727
9875
|
/** 删除轨道内clip 间的空隙 */
|
|
@@ -9742,6 +9890,9 @@ class Pr {
|
|
|
9742
9890
|
handleScrollChange(t) {
|
|
9743
9891
|
this.playhead && this.playhead.setScrollLeft(t), this.tracks.forEach((e) => e.setScrollLeft(t));
|
|
9744
9892
|
}
|
|
9893
|
+
handleTrackAutoScrollRequest(t) {
|
|
9894
|
+
this.timeline && (this.timeline.setScrollLeft(t), this.handleScrollChange(this.timeline.getScrollLeft()));
|
|
9895
|
+
}
|
|
9745
9896
|
handleClipUpdate(t, e, i) {
|
|
9746
9897
|
if (!this.isExecutingHistoryAction) {
|
|
9747
9898
|
if (i && i.length > 0) {
|
|
@@ -9764,13 +9915,13 @@ class Pr {
|
|
|
9764
9915
|
}
|
|
9765
9916
|
}
|
|
9766
9917
|
}
|
|
9767
|
-
this.emitEvent("clip_updated", { clip: t }), this.reloadClipThumbnailsIfNeeded(t, e), this.checkTrackDurationChange();
|
|
9918
|
+
this.emitEvent("clip_updated", { clip: t }), this.reloadClipThumbnailsIfNeeded(t, e), this.checkTrackDurationChange(), this.emitSelectedClipChangeIfNeeded();
|
|
9768
9919
|
}
|
|
9769
9920
|
handleClipAdd(t) {
|
|
9770
|
-
this.emitEvent("clip_added", { clip: t });
|
|
9921
|
+
this.emitEvent("clip_added", { clip: t }), this.emitSelectedClipChangeIfNeeded();
|
|
9771
9922
|
}
|
|
9772
9923
|
handleClipRemove(t) {
|
|
9773
|
-
this.emitEvent("clip_removed", { clipId: t });
|
|
9924
|
+
this.emitEvent("clip_removed", { clipId: t }), this.emitSelectedClipChangeIfNeeded();
|
|
9774
9925
|
}
|
|
9775
9926
|
/**
|
|
9776
9927
|
* 检查并重新加载关键帧(如果需要)
|
|
@@ -9818,7 +9969,7 @@ class Pr {
|
|
|
9818
9969
|
this.history.addAction(s), this.emitEvent("clip_updated", { clip: t }), this.emitEvent("clip_added", { clip: e });
|
|
9819
9970
|
}
|
|
9820
9971
|
handleClipSelect(t) {
|
|
9821
|
-
!t.id && t.startTime > 0
|
|
9972
|
+
!t.id && t.startTime > 0 && (this.setCurrentTime(t.startTime), M.debug("TimelineManager", "Empty track clicked, jumping to time:", { time: t.startTime })), this.emitEvent("clip_selected", { clip: t }), this.emitSelectedClipChangeIfNeeded();
|
|
9822
9973
|
}
|
|
9823
9974
|
handleActionUndo(t) {
|
|
9824
9975
|
switch (M.debug("TimelineManager", "Undo action:", { action: t }), this.isExecutingHistoryAction = !0, t.type) {
|
|
@@ -9901,7 +10052,11 @@ class Pr {
|
|
|
9901
10052
|
this.isExecutingHistoryAction = !1, this.checkTrackDurationChange();
|
|
9902
10053
|
}
|
|
9903
10054
|
on(t, e) {
|
|
9904
|
-
this.eventListeners.has(t) || this.eventListeners.set(t, []), this.eventListeners.get(t).push(e), t === "can_play_change" && e(t, { canPlay: this.canPlay }), t === "
|
|
10055
|
+
if (this.eventListeners.has(t) || this.eventListeners.set(t, []), this.eventListeners.get(t).push(e), t === "can_play_change" && e(t, { canPlay: this.canPlay }), t === "selected_clip_change") {
|
|
10056
|
+
const i = this.getSelectedClip();
|
|
10057
|
+
e(t, { clip: i, hasSelectedClip: !!i });
|
|
10058
|
+
}
|
|
10059
|
+
t === "source_loading_change" && e(t, this.getSourceLoadingState());
|
|
9905
10060
|
}
|
|
9906
10061
|
off(t, e) {
|
|
9907
10062
|
if (this.eventListeners.has(t)) {
|
|
@@ -9918,6 +10073,13 @@ class Pr {
|
|
|
9918
10073
|
}
|
|
9919
10074
|
});
|
|
9920
10075
|
}
|
|
10076
|
+
emitSelectedClipChangeIfNeeded() {
|
|
10077
|
+
const t = this.getSelectedClip(), e = (t == null ? void 0 : t.id) || null;
|
|
10078
|
+
e !== this.lastSelectedClipId && (this.lastSelectedClipId = e, this.emitEvent("selected_clip_change", {
|
|
10079
|
+
clip: t,
|
|
10080
|
+
hasSelectedClip: !!t
|
|
10081
|
+
}));
|
|
10082
|
+
}
|
|
9921
10083
|
beginSourceLoading() {
|
|
9922
10084
|
this.sourceLoadingCount += 1, this.emitEvent("source_loading_change", {
|
|
9923
10085
|
isLoading: this.sourceLoadingCount > 0,
|
|
@@ -10030,10 +10192,10 @@ class Pr {
|
|
|
10030
10192
|
lastUpdateTime: Date.now()
|
|
10031
10193
|
}, this.attachVideoBufferingListeners(this.videoPreview.videoElement), e.volume !== void 0 && (this.videoPreview.videoElement.volume = Math.max(0, Math.min(1, e.volume))), e.autoPlay && this.videoPreview.videoElement.play().catch((i) => {
|
|
10032
10194
|
M.warn("TimelineManager", "Auto-play was prevented:", { err: i });
|
|
10033
|
-
}), this.on("time_change", this.handleVideoTimeUpdate.bind(this)), this.on("play_state_change", this.handlePlayStateChange.bind(this)), this.on("clip_added", this.handleClipChange.bind(this)), this.on("clip_removed", this.handleClipChange.bind(this)), M.debug("TimelineManager", "TimelineManager connected to video element");
|
|
10195
|
+
}), this.on("time_change", this.handleVideoTimeUpdate.bind(this)), this.on("play_state_change", this.handlePlayStateChange.bind(this)), this.on("clip_added", this.handleClipChange.bind(this)), this.on("clip_removed", this.handleClipChange.bind(this)), this.on("clip_updated", this.handleClipChange.bind(this)), M.debug("TimelineManager", "TimelineManager connected to video element");
|
|
10034
10196
|
}
|
|
10035
10197
|
disconnectVideo() {
|
|
10036
|
-
this.videoPreview && (this.detachVideoBufferingListeners(this.videoPreview.videoElement), this.off("time_change", this.handleVideoTimeUpdate.bind(this)), this.off("play_state_change", this.handlePlayStateChange.bind(this)), this.off("clip_added", this.handleClipChange.bind(this)), this.off("clip_removed", this.handleClipChange.bind(this)), this.isBuffering = !1, this.playStateBeforeBuffering = null, this.isPausingForBuffering = !1, this.videoPreview = null, M.debug("TimelineManager", "TimelineManager disconnected from video element"));
|
|
10198
|
+
this.videoPreview && (this.detachVideoBufferingListeners(this.videoPreview.videoElement), this.off("time_change", this.handleVideoTimeUpdate.bind(this)), this.off("play_state_change", this.handlePlayStateChange.bind(this)), this.off("clip_added", this.handleClipChange.bind(this)), this.off("clip_removed", this.handleClipChange.bind(this)), this.off("clip_updated", this.handleClipChange.bind(this)), this.isBuffering = !1, this.playStateBeforeBuffering = null, this.isPausingForBuffering = !1, this.videoPreview = null, M.debug("TimelineManager", "TimelineManager disconnected from video element"));
|
|
10037
10199
|
}
|
|
10038
10200
|
/** 清除历史堆栈 */
|
|
10039
10201
|
clearHistory() {
|
|
@@ -10048,14 +10210,18 @@ class Pr {
|
|
|
10048
10210
|
if (n)
|
|
10049
10211
|
this.loadClipToVideo(n);
|
|
10050
10212
|
else {
|
|
10051
|
-
const r = this.getLastClipByEndTime(), a = !!r && s >= r.endTime;
|
|
10052
|
-
if (
|
|
10213
|
+
const r = this.getLastClipByEndTime(), a = !!r && s < r.endTime && this.config.playState === "playing", h = !!r && s >= r.endTime;
|
|
10214
|
+
if (a) {
|
|
10215
|
+
i.paused || i.pause(), i.src && (i.src = ""), this.clearBufferingStateForNoSource(), this.videoPreview.currentClip = null;
|
|
10216
|
+
return;
|
|
10217
|
+
}
|
|
10218
|
+
if (r && h) {
|
|
10053
10219
|
(!this.videoPreview.currentClip || this.videoPreview.currentClip.id !== r.id) && this.loadClipToVideo(r), i.paused || i.pause();
|
|
10054
|
-
const
|
|
10055
|
-
Math.abs(i.currentTime * 1e3 -
|
|
10220
|
+
const l = Math.max(r.startTimeAtSource, r.endTimeAtSource - 1);
|
|
10221
|
+
Math.abs(i.currentTime * 1e3 - l) > 1 && (i.currentTime = l / 1e3);
|
|
10056
10222
|
return;
|
|
10057
10223
|
}
|
|
10058
|
-
i.paused || i.pause(), i.src && (i.src = ""), this.videoPreview.currentClip = null;
|
|
10224
|
+
i.paused || i.pause(), i.src && (i.src = ""), this.clearBufferingStateForNoSource(), this.videoPreview.currentClip = null;
|
|
10059
10225
|
}
|
|
10060
10226
|
else n && this.config.playState === "playing" && i.paused && i.play().catch((r) => {
|
|
10061
10227
|
M.warn("TimelineManager", "Video play was prevented:", { err: r });
|
|
@@ -10081,13 +10247,7 @@ class Pr {
|
|
|
10081
10247
|
}) : i.paused || i.pause();
|
|
10082
10248
|
}
|
|
10083
10249
|
handleClipChange() {
|
|
10084
|
-
|
|
10085
|
-
const t = this.findClipAtTime(this.config.currentTime);
|
|
10086
|
-
if (!t || this.videoPreview.currentClip && t.id !== this.videoPreview.currentClip.id) {
|
|
10087
|
-
const e = this.videoPreview.videoElement;
|
|
10088
|
-
e.paused || e.pause(), e.src && (e.src = ""), this.videoPreview.currentClip = null;
|
|
10089
|
-
}
|
|
10090
|
-
}
|
|
10250
|
+
this.videoPreview && this.handleVideoTimeUpdate("time_change", { time: this.config.currentTime });
|
|
10091
10251
|
}
|
|
10092
10252
|
findClipAtTime(t) {
|
|
10093
10253
|
return this.getClips().find(
|
|
@@ -10123,11 +10283,16 @@ class Pr {
|
|
|
10123
10283
|
this.videoBufferingListeners && (t.removeEventListener("loadstart", this.videoBufferingListeners.loadstart), t.removeEventListener("waiting", this.videoBufferingListeners.waiting), t.removeEventListener("stalled", this.videoBufferingListeners.stalled), t.removeEventListener("canplay", this.videoBufferingListeners.canplay), t.removeEventListener("playing", this.videoBufferingListeners.playing), this.videoBufferingListeners = null);
|
|
10124
10284
|
}
|
|
10125
10285
|
enterBuffering() {
|
|
10126
|
-
|
|
10286
|
+
if (!this.videoPreview || !this.videoPreview.currentClip) return;
|
|
10287
|
+
const t = this.videoPreview.videoElement, e = typeof t.getAttribute == "function" ? t.getAttribute("src") : t.src;
|
|
10288
|
+
(e && e.trim() || t.currentSrc) && (this.isBuffering || (this.isBuffering = !0, this.playStateBeforeBuffering = this.config.playState, this.config.playState === "playing" && (this.isPausingForBuffering = !0, this.pause(), this.isPausingForBuffering = !1), this.emitEvent("buffering_state_change", { isBuffering: !0 })));
|
|
10127
10289
|
}
|
|
10128
10290
|
exitBuffering() {
|
|
10129
10291
|
this.isBuffering && (this.isBuffering = !1, this.emitEvent("buffering_state_change", { isBuffering: !1 }), this.playStateBeforeBuffering === "playing" && this.canPlay && this.play(), this.playStateBeforeBuffering = null);
|
|
10130
10292
|
}
|
|
10293
|
+
clearBufferingStateForNoSource() {
|
|
10294
|
+
this.isBuffering && (this.isBuffering = !1, this.playStateBeforeBuffering = null, this.isPausingForBuffering = !1, this.emitEvent("buffering_state_change", { isBuffering: !1 }));
|
|
10295
|
+
}
|
|
10131
10296
|
/**
|
|
10132
10297
|
* 检查轨道总时长是否变化,如果变化则触发事件并更新时间轴时长
|
|
10133
10298
|
*/
|
|
@@ -10141,12 +10306,12 @@ class Pr {
|
|
|
10141
10306
|
}
|
|
10142
10307
|
}
|
|
10143
10308
|
export {
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10309
|
+
xe as Clip,
|
|
10310
|
+
xr as HistoryManager,
|
|
10311
|
+
wr as Playhead,
|
|
10147
10312
|
N as TimeUtils,
|
|
10148
10313
|
vr as Timeline,
|
|
10149
|
-
|
|
10314
|
+
Ar as TimelineManager,
|
|
10150
10315
|
Tr as VideoTrack,
|
|
10151
10316
|
ke as defaultDarkTheme
|
|
10152
10317
|
};
|