@leafer/core 1.3.3 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core.cjs +181 -138
- package/lib/core.cjs.map +1 -0
- package/lib/core.esm.js +181 -139
- package/lib/core.esm.js.map +1 -0
- package/lib/core.esm.min.js +2 -1
- package/lib/core.esm.min.js.map +1 -0
- package/lib/core.min.cjs +2 -1
- package/lib/core.min.cjs.map +1 -0
- package/package.json +20 -20
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.esm.js
CHANGED
|
@@ -1374,7 +1374,7 @@ function getNameList(name) {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
const D$4 = Debug;
|
|
1376
1376
|
|
|
1377
|
-
const debug$
|
|
1377
|
+
const debug$a = Debug.get('RunTime');
|
|
1378
1378
|
const Run = {
|
|
1379
1379
|
currentId: 0,
|
|
1380
1380
|
currentName: '',
|
|
@@ -1383,24 +1383,24 @@ const Run = {
|
|
|
1383
1383
|
nameToIdMap: {},
|
|
1384
1384
|
start(name, microsecond) {
|
|
1385
1385
|
const id = IncrementId.create(IncrementId.RUNTIME);
|
|
1386
|
-
R.currentId = R.idMap[id] = microsecond ? performance.now() : Date.now();
|
|
1387
|
-
R.currentName = R.nameMap[id] = name;
|
|
1388
|
-
R.nameToIdMap[name] = id;
|
|
1386
|
+
R$1.currentId = R$1.idMap[id] = microsecond ? performance.now() : Date.now();
|
|
1387
|
+
R$1.currentName = R$1.nameMap[id] = name;
|
|
1388
|
+
R$1.nameToIdMap[name] = id;
|
|
1389
1389
|
return id;
|
|
1390
1390
|
},
|
|
1391
1391
|
end(id, microsecond) {
|
|
1392
|
-
const time = R.idMap[id], name = R.nameMap[id];
|
|
1392
|
+
const time = R$1.idMap[id], name = R$1.nameMap[id];
|
|
1393
1393
|
const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
|
|
1394
|
-
R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
|
|
1395
|
-
debug$
|
|
1394
|
+
R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
|
|
1395
|
+
debug$a.log(name, duration, 'ms');
|
|
1396
1396
|
},
|
|
1397
1397
|
endOfName(name, microsecond) {
|
|
1398
|
-
const id = R.nameToIdMap[name];
|
|
1398
|
+
const id = R$1.nameToIdMap[name];
|
|
1399
1399
|
if (id !== undefined)
|
|
1400
|
-
R.end(id, microsecond);
|
|
1400
|
+
R$1.end(id, microsecond);
|
|
1401
1401
|
}
|
|
1402
1402
|
};
|
|
1403
|
-
const R = Run;
|
|
1403
|
+
const R$1 = Run;
|
|
1404
1404
|
|
|
1405
1405
|
const check = [];
|
|
1406
1406
|
const Plugin = {
|
|
@@ -1421,18 +1421,18 @@ const Plugin = {
|
|
|
1421
1421
|
};
|
|
1422
1422
|
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
1423
1423
|
|
|
1424
|
-
const debug$
|
|
1424
|
+
const debug$9 = Debug.get('UICreator');
|
|
1425
1425
|
const UICreator = {
|
|
1426
1426
|
list: {},
|
|
1427
1427
|
register(UI) {
|
|
1428
1428
|
const { __tag: tag } = UI.prototype;
|
|
1429
1429
|
if (list$1[tag])
|
|
1430
|
-
debug$
|
|
1430
|
+
debug$9.repeat(tag);
|
|
1431
1431
|
list$1[tag] = UI;
|
|
1432
1432
|
},
|
|
1433
1433
|
get(tag, data, x, y, width, height) {
|
|
1434
1434
|
if (!list$1[tag])
|
|
1435
|
-
debug$
|
|
1435
|
+
debug$9.error('not register ' + tag);
|
|
1436
1436
|
const ui = new list$1[tag](data);
|
|
1437
1437
|
if (x !== undefined) {
|
|
1438
1438
|
ui.x = x;
|
|
@@ -1448,7 +1448,7 @@ const UICreator = {
|
|
|
1448
1448
|
};
|
|
1449
1449
|
const { list: list$1 } = UICreator;
|
|
1450
1450
|
|
|
1451
|
-
const debug$
|
|
1451
|
+
const debug$8 = Debug.get('EventCreator');
|
|
1452
1452
|
const EventCreator = {
|
|
1453
1453
|
nameList: {},
|
|
1454
1454
|
register(Event) {
|
|
@@ -1456,7 +1456,7 @@ const EventCreator = {
|
|
|
1456
1456
|
Object.keys(Event).forEach(key => {
|
|
1457
1457
|
name = Event[key];
|
|
1458
1458
|
if (typeof name === 'string')
|
|
1459
|
-
nameList[name] && debug$
|
|
1459
|
+
nameList[name] && debug$8.repeat(name), nameList[name] = Event;
|
|
1460
1460
|
});
|
|
1461
1461
|
},
|
|
1462
1462
|
changeName(oldName, newName) {
|
|
@@ -1533,10 +1533,10 @@ const DataHelper = {
|
|
|
1533
1533
|
Object.keys(merge).forEach(key => {
|
|
1534
1534
|
var _a, _b;
|
|
1535
1535
|
value = merge[key];
|
|
1536
|
-
if ((value === null || value ===
|
|
1536
|
+
if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
|
|
1537
1537
|
return assign(t[key], merge[key], exclude && exclude[key]);
|
|
1538
1538
|
if (exclude && (key in exclude)) {
|
|
1539
|
-
if (((_b = exclude[key]) === null || _b ===
|
|
1539
|
+
if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
|
|
1540
1540
|
assign(t[key] = {}, merge[key], exclude[key]);
|
|
1541
1541
|
return;
|
|
1542
1542
|
}
|
|
@@ -1660,7 +1660,7 @@ class LeafData {
|
|
|
1660
1660
|
const t = this;
|
|
1661
1661
|
if (t.blendMode === 'pass-through') {
|
|
1662
1662
|
const leaf = this.__leaf;
|
|
1663
|
-
if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser) {
|
|
1663
|
+
if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser || t.filter) {
|
|
1664
1664
|
t.__single = true;
|
|
1665
1665
|
}
|
|
1666
1666
|
else if (t.__single) {
|
|
@@ -1773,7 +1773,7 @@ class Canvas {
|
|
|
1773
1773
|
}
|
|
1774
1774
|
setTransform(_a, _b, _c, _d, _e, _f) { }
|
|
1775
1775
|
resetTransform() { }
|
|
1776
|
-
getTransform() { return
|
|
1776
|
+
getTransform() { return void 0; }
|
|
1777
1777
|
save() { }
|
|
1778
1778
|
restore() { }
|
|
1779
1779
|
transform(a, b, c, d, e, f) {
|
|
@@ -1830,12 +1830,12 @@ class Canvas {
|
|
|
1830
1830
|
ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { }
|
|
1831
1831
|
rect(_x, _y, _width, _height) { }
|
|
1832
1832
|
roundRect(_x, _y, _width, _height, _radius) { }
|
|
1833
|
-
createConicGradient(_startAngle, _x, _y) { return
|
|
1834
|
-
createLinearGradient(_x0, _y0, _x1, _y1) { return
|
|
1835
|
-
createPattern(_image, _repetition) { return
|
|
1836
|
-
createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return
|
|
1833
|
+
createConicGradient(_startAngle, _x, _y) { return void 0; }
|
|
1834
|
+
createLinearGradient(_x0, _y0, _x1, _y1) { return void 0; }
|
|
1835
|
+
createPattern(_image, _repetition) { return void 0; }
|
|
1836
|
+
createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return void 0; }
|
|
1837
1837
|
fillText(_text, _x, _y, _maxWidth) { }
|
|
1838
|
-
measureText(_text) { return
|
|
1838
|
+
measureText(_text) { return void 0; }
|
|
1839
1839
|
strokeText(_text, _x, _y, _maxWidth) { }
|
|
1840
1840
|
destroy() {
|
|
1841
1841
|
this.context = null;
|
|
@@ -1843,79 +1843,79 @@ class Canvas {
|
|
|
1843
1843
|
}
|
|
1844
1844
|
__decorate([
|
|
1845
1845
|
contextAttr('imageSmoothingEnabled')
|
|
1846
|
-
], Canvas.prototype, "smooth",
|
|
1846
|
+
], Canvas.prototype, "smooth", void 0);
|
|
1847
1847
|
__decorate([
|
|
1848
1848
|
contextAttr('imageSmoothingQuality')
|
|
1849
|
-
], Canvas.prototype, "smoothLevel",
|
|
1849
|
+
], Canvas.prototype, "smoothLevel", void 0);
|
|
1850
1850
|
__decorate([
|
|
1851
1851
|
contextAttr('globalAlpha')
|
|
1852
|
-
], Canvas.prototype, "opacity",
|
|
1852
|
+
], Canvas.prototype, "opacity", void 0);
|
|
1853
1853
|
__decorate([
|
|
1854
1854
|
contextAttr()
|
|
1855
|
-
], Canvas.prototype, "fillStyle",
|
|
1855
|
+
], Canvas.prototype, "fillStyle", void 0);
|
|
1856
1856
|
__decorate([
|
|
1857
1857
|
contextAttr()
|
|
1858
|
-
], Canvas.prototype, "strokeStyle",
|
|
1858
|
+
], Canvas.prototype, "strokeStyle", void 0);
|
|
1859
1859
|
__decorate([
|
|
1860
1860
|
contextAttr('lineWidth')
|
|
1861
|
-
], Canvas.prototype, "strokeWidth",
|
|
1861
|
+
], Canvas.prototype, "strokeWidth", void 0);
|
|
1862
1862
|
__decorate([
|
|
1863
1863
|
contextAttr('lineCap')
|
|
1864
|
-
], Canvas.prototype, "strokeCap",
|
|
1864
|
+
], Canvas.prototype, "strokeCap", void 0);
|
|
1865
1865
|
__decorate([
|
|
1866
1866
|
contextAttr('lineJoin')
|
|
1867
|
-
], Canvas.prototype, "strokeJoin",
|
|
1867
|
+
], Canvas.prototype, "strokeJoin", void 0);
|
|
1868
1868
|
__decorate([
|
|
1869
1869
|
contextAttr('lineDashOffset')
|
|
1870
|
-
], Canvas.prototype, "dashOffset",
|
|
1870
|
+
], Canvas.prototype, "dashOffset", void 0);
|
|
1871
1871
|
__decorate([
|
|
1872
1872
|
contextAttr()
|
|
1873
|
-
], Canvas.prototype, "miterLimit",
|
|
1873
|
+
], Canvas.prototype, "miterLimit", void 0);
|
|
1874
1874
|
__decorate([
|
|
1875
1875
|
contextAttr()
|
|
1876
|
-
], Canvas.prototype, "shadowBlur",
|
|
1876
|
+
], Canvas.prototype, "shadowBlur", void 0);
|
|
1877
1877
|
__decorate([
|
|
1878
1878
|
contextAttr()
|
|
1879
|
-
], Canvas.prototype, "shadowColor",
|
|
1879
|
+
], Canvas.prototype, "shadowColor", void 0);
|
|
1880
1880
|
__decorate([
|
|
1881
1881
|
contextAttr()
|
|
1882
|
-
], Canvas.prototype, "shadowOffsetX",
|
|
1882
|
+
], Canvas.prototype, "shadowOffsetX", void 0);
|
|
1883
1883
|
__decorate([
|
|
1884
1884
|
contextAttr()
|
|
1885
|
-
], Canvas.prototype, "shadowOffsetY",
|
|
1885
|
+
], Canvas.prototype, "shadowOffsetY", void 0);
|
|
1886
1886
|
__decorate([
|
|
1887
1887
|
contextAttr()
|
|
1888
|
-
], Canvas.prototype, "filter",
|
|
1888
|
+
], Canvas.prototype, "filter", void 0);
|
|
1889
1889
|
__decorate([
|
|
1890
1890
|
contextAttr()
|
|
1891
|
-
], Canvas.prototype, "font",
|
|
1891
|
+
], Canvas.prototype, "font", void 0);
|
|
1892
1892
|
__decorate([
|
|
1893
1893
|
contextAttr()
|
|
1894
|
-
], Canvas.prototype, "fontKerning",
|
|
1894
|
+
], Canvas.prototype, "fontKerning", void 0);
|
|
1895
1895
|
__decorate([
|
|
1896
1896
|
contextAttr()
|
|
1897
|
-
], Canvas.prototype, "fontStretch",
|
|
1897
|
+
], Canvas.prototype, "fontStretch", void 0);
|
|
1898
1898
|
__decorate([
|
|
1899
1899
|
contextAttr()
|
|
1900
|
-
], Canvas.prototype, "fontVariantCaps",
|
|
1900
|
+
], Canvas.prototype, "fontVariantCaps", void 0);
|
|
1901
1901
|
__decorate([
|
|
1902
1902
|
contextAttr()
|
|
1903
|
-
], Canvas.prototype, "textAlign",
|
|
1903
|
+
], Canvas.prototype, "textAlign", void 0);
|
|
1904
1904
|
__decorate([
|
|
1905
1905
|
contextAttr()
|
|
1906
|
-
], Canvas.prototype, "textBaseline",
|
|
1906
|
+
], Canvas.prototype, "textBaseline", void 0);
|
|
1907
1907
|
__decorate([
|
|
1908
1908
|
contextAttr()
|
|
1909
|
-
], Canvas.prototype, "textRendering",
|
|
1909
|
+
], Canvas.prototype, "textRendering", void 0);
|
|
1910
1910
|
__decorate([
|
|
1911
1911
|
contextAttr()
|
|
1912
|
-
], Canvas.prototype, "wordSpacing",
|
|
1912
|
+
], Canvas.prototype, "wordSpacing", void 0);
|
|
1913
1913
|
__decorate([
|
|
1914
1914
|
contextAttr()
|
|
1915
|
-
], Canvas.prototype, "letterSpacing",
|
|
1915
|
+
], Canvas.prototype, "letterSpacing", void 0);
|
|
1916
1916
|
__decorate([
|
|
1917
1917
|
contextAttr()
|
|
1918
|
-
], Canvas.prototype, "direction",
|
|
1918
|
+
], Canvas.prototype, "direction", void 0);
|
|
1919
1919
|
__decorate([
|
|
1920
1920
|
contextMethod()
|
|
1921
1921
|
], Canvas.prototype, "setTransform", null);
|
|
@@ -2612,7 +2612,7 @@ const EllipseHelper = {
|
|
|
2612
2612
|
const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$4, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
|
|
2613
2613
|
const { rect: rect$1, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$3, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
|
|
2614
2614
|
const { ellipticalArc } = EllipseHelper;
|
|
2615
|
-
const debug$
|
|
2615
|
+
const debug$7 = Debug.get('PathConvert');
|
|
2616
2616
|
const setEndPoint$1 = {};
|
|
2617
2617
|
const PathConvert = {
|
|
2618
2618
|
current: { dot: 0 },
|
|
@@ -2853,7 +2853,7 @@ const PathConvert = {
|
|
|
2853
2853
|
i += 6;
|
|
2854
2854
|
break;
|
|
2855
2855
|
default:
|
|
2856
|
-
debug$
|
|
2856
|
+
debug$7.error(`command: ${command} [index:${i}]`, old);
|
|
2857
2857
|
return data;
|
|
2858
2858
|
}
|
|
2859
2859
|
lastCommand = command;
|
|
@@ -2962,12 +2962,10 @@ const PathCommandDataHelper = {
|
|
|
2962
2962
|
},
|
|
2963
2963
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
2964
2964
|
if (lastX !== undefined) {
|
|
2965
|
-
const
|
|
2966
|
-
|
|
2967
|
-
}
|
|
2968
|
-
else {
|
|
2969
|
-
data.push(U$2, x1, y1, x2, y2, radius);
|
|
2965
|
+
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
2966
|
+
radius = min(radius, min(d / 2, d / 2 * abs(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
2970
2967
|
}
|
|
2968
|
+
data.push(U$2, x1, y1, x2, y2, radius);
|
|
2971
2969
|
},
|
|
2972
2970
|
drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2973
2971
|
BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation === undefined ? 0 : rotation, startAngle === undefined ? 0 : startAngle, endAngle === undefined ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
@@ -3078,7 +3076,7 @@ class PathCreator {
|
|
|
3078
3076
|
}
|
|
3079
3077
|
|
|
3080
3078
|
const { M: M$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
|
|
3081
|
-
const debug$
|
|
3079
|
+
const debug$6 = Debug.get('PathDrawer');
|
|
3082
3080
|
const PathDrawer = {
|
|
3083
3081
|
drawPathByData(drawer, data) {
|
|
3084
3082
|
if (!data)
|
|
@@ -3141,7 +3139,7 @@ const PathDrawer = {
|
|
|
3141
3139
|
i += 6;
|
|
3142
3140
|
break;
|
|
3143
3141
|
default:
|
|
3144
|
-
debug$
|
|
3142
|
+
debug$6.error(`command: ${command} [index:${i}]`, data);
|
|
3145
3143
|
return;
|
|
3146
3144
|
}
|
|
3147
3145
|
}
|
|
@@ -3151,7 +3149,7 @@ const PathDrawer = {
|
|
|
3151
3149
|
const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
|
|
3152
3150
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse } = BezierHelper;
|
|
3153
3151
|
const { addPointBounds, copy: copy$4, addPoint, setPoint, addBounds, toBounds: toBounds$1 } = TwoPointBoundsHelper;
|
|
3154
|
-
const debug$
|
|
3152
|
+
const debug$5 = Debug.get('PathBounds');
|
|
3155
3153
|
let radius, radiusX, radiusY;
|
|
3156
3154
|
const tempPointBounds = {};
|
|
3157
3155
|
const setPointBounds = {};
|
|
@@ -3259,7 +3257,7 @@ const PathBounds = {
|
|
|
3259
3257
|
i += 6;
|
|
3260
3258
|
break;
|
|
3261
3259
|
default:
|
|
3262
|
-
debug$
|
|
3260
|
+
debug$5.error(`command: ${command} [index:${i}]`, data);
|
|
3263
3261
|
return;
|
|
3264
3262
|
}
|
|
3265
3263
|
}
|
|
@@ -3375,7 +3373,7 @@ const FileHelper = {
|
|
|
3375
3373
|
const F = FileHelper;
|
|
3376
3374
|
F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3377
3375
|
|
|
3378
|
-
const debug$
|
|
3376
|
+
const debug$4 = Debug.get('TaskProcessor');
|
|
3379
3377
|
class TaskItem {
|
|
3380
3378
|
constructor(task) {
|
|
3381
3379
|
this.parallel = true;
|
|
@@ -3384,13 +3382,13 @@ class TaskItem {
|
|
|
3384
3382
|
this.task = task;
|
|
3385
3383
|
}
|
|
3386
3384
|
run() {
|
|
3387
|
-
return __awaiter(this,
|
|
3385
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3388
3386
|
try {
|
|
3389
3387
|
if (this.task && !this.isComplete && this.parent.running)
|
|
3390
3388
|
yield this.task();
|
|
3391
3389
|
}
|
|
3392
3390
|
catch (error) {
|
|
3393
|
-
debug$
|
|
3391
|
+
debug$4.error(error);
|
|
3394
3392
|
}
|
|
3395
3393
|
});
|
|
3396
3394
|
}
|
|
@@ -3623,18 +3621,52 @@ class TaskProcessor {
|
|
|
3623
3621
|
}
|
|
3624
3622
|
}
|
|
3625
3623
|
|
|
3626
|
-
const
|
|
3624
|
+
const debug$3 = Debug.get('Resource');
|
|
3625
|
+
const Resource = {
|
|
3626
|
+
tasker: new TaskProcessor(),
|
|
3627
3627
|
map: {},
|
|
3628
|
+
get isComplete() { return R.tasker.isComplete; },
|
|
3629
|
+
set(key, value) {
|
|
3630
|
+
if (R.map[key])
|
|
3631
|
+
debug$3.repeat(key);
|
|
3632
|
+
R.map[key] = value;
|
|
3633
|
+
},
|
|
3634
|
+
get(key) {
|
|
3635
|
+
return R.map[key];
|
|
3636
|
+
},
|
|
3637
|
+
remove(key) {
|
|
3638
|
+
delete R.map[key];
|
|
3639
|
+
},
|
|
3640
|
+
loadImage(key, format) {
|
|
3641
|
+
return new Promise((resolve, reject) => {
|
|
3642
|
+
const image = this.setImage(key, key, format);
|
|
3643
|
+
image.load(() => resolve(image), (e) => reject(e));
|
|
3644
|
+
});
|
|
3645
|
+
},
|
|
3646
|
+
setImage(key, value, format) {
|
|
3647
|
+
let config;
|
|
3648
|
+
if (typeof value === 'string')
|
|
3649
|
+
config = { url: value };
|
|
3650
|
+
else if (!value.url)
|
|
3651
|
+
config = { url: key, view: value };
|
|
3652
|
+
if (config)
|
|
3653
|
+
format && (config.format = format), value = Creator.image(config);
|
|
3654
|
+
R.set(key, value);
|
|
3655
|
+
return value;
|
|
3656
|
+
},
|
|
3657
|
+
destroy() {
|
|
3658
|
+
R.map = {};
|
|
3659
|
+
}
|
|
3660
|
+
};
|
|
3661
|
+
const R = Resource;
|
|
3662
|
+
|
|
3663
|
+
const ImageManager = {
|
|
3628
3664
|
recycledList: [],
|
|
3629
|
-
tasker: new TaskProcessor(),
|
|
3630
3665
|
patternTasker: new TaskProcessor(),
|
|
3631
|
-
get isComplete() { return I.tasker.isComplete; },
|
|
3632
3666
|
get(config) {
|
|
3633
|
-
let image =
|
|
3634
|
-
if (!image)
|
|
3635
|
-
image = Creator.image(config);
|
|
3636
|
-
I.map[config.url] = image;
|
|
3637
|
-
}
|
|
3667
|
+
let image = Resource.get(config.url);
|
|
3668
|
+
if (!image)
|
|
3669
|
+
Resource.set(config.url, image = Creator.image(config));
|
|
3638
3670
|
image.use++;
|
|
3639
3671
|
return image;
|
|
3640
3672
|
},
|
|
@@ -3648,7 +3680,7 @@ const ImageManager = {
|
|
|
3648
3680
|
if (list.length > 100) {
|
|
3649
3681
|
list.forEach(image => {
|
|
3650
3682
|
if (!image.use && image.url) {
|
|
3651
|
-
|
|
3683
|
+
Resource.remove(image.url);
|
|
3652
3684
|
image.destroy();
|
|
3653
3685
|
}
|
|
3654
3686
|
});
|
|
@@ -3675,7 +3707,6 @@ const ImageManager = {
|
|
|
3675
3707
|
return false;
|
|
3676
3708
|
},
|
|
3677
3709
|
destroy() {
|
|
3678
|
-
I.map = {};
|
|
3679
3710
|
I.recycledList = [];
|
|
3680
3711
|
}
|
|
3681
3712
|
};
|
|
@@ -3689,21 +3720,19 @@ class LeaferImage {
|
|
|
3689
3720
|
this.use = 0;
|
|
3690
3721
|
this.waitComplete = [];
|
|
3691
3722
|
this.innerId = create$1(IMAGE);
|
|
3692
|
-
this.config = config || { url: '' };
|
|
3693
|
-
|
|
3694
|
-
|
|
3723
|
+
this.config = config || (config = { url: '' });
|
|
3724
|
+
if (config.view) {
|
|
3725
|
+
const { view } = config;
|
|
3726
|
+
this.setView(view.config ? view.view : view);
|
|
3727
|
+
}
|
|
3728
|
+
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3729
|
+
ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
|
|
3695
3730
|
}
|
|
3696
3731
|
load(onSuccess, onError) {
|
|
3697
3732
|
if (!this.loading) {
|
|
3698
3733
|
this.loading = true;
|
|
3699
|
-
|
|
3700
|
-
return yield Platform.origin.loadImage(this.url).then((img) => {
|
|
3701
|
-
this.ready = true;
|
|
3702
|
-
this.width = img.naturalWidth || img.width;
|
|
3703
|
-
this.height = img.naturalHeight || img.height;
|
|
3704
|
-
this.view = img;
|
|
3705
|
-
this.onComplete(true);
|
|
3706
|
-
}).catch((e) => {
|
|
3734
|
+
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3735
|
+
return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
|
|
3707
3736
|
this.error = e;
|
|
3708
3737
|
this.onComplete(false);
|
|
3709
3738
|
});
|
|
@@ -3721,6 +3750,13 @@ class LeaferImage {
|
|
|
3721
3750
|
}
|
|
3722
3751
|
l[index] = l[index + 1] = undefined;
|
|
3723
3752
|
}
|
|
3753
|
+
setView(img) {
|
|
3754
|
+
this.ready = true;
|
|
3755
|
+
this.width = img.naturalWidth || img.width;
|
|
3756
|
+
this.height = img.naturalHeight || img.height;
|
|
3757
|
+
this.view = img;
|
|
3758
|
+
this.onComplete(true);
|
|
3759
|
+
}
|
|
3724
3760
|
onComplete(isSuccess) {
|
|
3725
3761
|
let odd;
|
|
3726
3762
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -3739,6 +3775,9 @@ class LeaferImage {
|
|
|
3739
3775
|
this.waitComplete.length = 0;
|
|
3740
3776
|
this.loading = false;
|
|
3741
3777
|
}
|
|
3778
|
+
getFull(_filters) {
|
|
3779
|
+
return this.view;
|
|
3780
|
+
}
|
|
3742
3781
|
getCanvas(width, height, opacity, _filters) {
|
|
3743
3782
|
width || (width = this.width);
|
|
3744
3783
|
height || (height = this.height);
|
|
@@ -3821,10 +3860,10 @@ function autoLayoutType(defaultValue) {
|
|
|
3821
3860
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3822
3861
|
set(value) {
|
|
3823
3862
|
if (this.__setAttr(key, value)) {
|
|
3824
|
-
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3825
3863
|
this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
|
|
3826
3864
|
if (!this.__local)
|
|
3827
3865
|
this.__layout.createLocal();
|
|
3866
|
+
doBoundsType(this);
|
|
3828
3867
|
}
|
|
3829
3868
|
}
|
|
3830
3869
|
}));
|
|
@@ -4207,55 +4246,62 @@ const LeafHelper = {
|
|
|
4207
4246
|
y += t.y;
|
|
4208
4247
|
transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
|
|
4209
4248
|
},
|
|
4210
|
-
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
4211
|
-
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
4249
|
+
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
4250
|
+
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
|
|
4212
4251
|
},
|
|
4213
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4214
|
-
|
|
4252
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
|
|
4253
|
+
const o = t.__localMatrix;
|
|
4254
|
+
if (typeof scaleY !== 'number') {
|
|
4255
|
+
if (scaleY)
|
|
4256
|
+
transition = scaleY;
|
|
4257
|
+
scaleY = scaleX;
|
|
4258
|
+
}
|
|
4259
|
+
copy$3(matrix, o);
|
|
4215
4260
|
scaleOfOuter(matrix, origin, scaleX, scaleY);
|
|
4216
4261
|
if (t.origin || t.around) {
|
|
4217
|
-
L.setTransform(t, matrix, resize);
|
|
4262
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4218
4263
|
}
|
|
4219
4264
|
else {
|
|
4220
|
-
|
|
4221
|
-
|
|
4265
|
+
const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
|
|
4266
|
+
if (transition && !resize)
|
|
4267
|
+
t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
|
|
4268
|
+
else
|
|
4269
|
+
t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4222
4270
|
}
|
|
4223
4271
|
},
|
|
4224
|
-
rotateOfWorld(t, origin, angle) {
|
|
4225
|
-
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4272
|
+
rotateOfWorld(t, origin, angle, transition) {
|
|
4273
|
+
L.rotateOfLocal(t, getTempLocal(t, origin), angle, transition);
|
|
4226
4274
|
},
|
|
4227
|
-
rotateOfLocal(t, origin, angle) {
|
|
4228
|
-
|
|
4275
|
+
rotateOfLocal(t, origin, angle, transition) {
|
|
4276
|
+
const o = t.__localMatrix;
|
|
4277
|
+
copy$3(matrix, o);
|
|
4229
4278
|
rotateOfOuter(matrix, origin, angle);
|
|
4230
|
-
if (t.origin || t.around)
|
|
4231
|
-
L.setTransform(t, matrix);
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
moveByMatrix(t, matrix);
|
|
4235
|
-
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4236
|
-
}
|
|
4279
|
+
if (t.origin || t.around)
|
|
4280
|
+
L.setTransform(t, matrix, false, transition);
|
|
4281
|
+
else
|
|
4282
|
+
t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
|
|
4237
4283
|
},
|
|
4238
|
-
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4239
|
-
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
4284
|
+
skewOfWorld(t, origin, skewX, skewY, resize, transition) {
|
|
4285
|
+
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4240
4286
|
},
|
|
4241
|
-
skewOfLocal(t, origin, skewX, skewY = 0, resize) {
|
|
4287
|
+
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4242
4288
|
copy$3(matrix, t.__localMatrix);
|
|
4243
4289
|
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4244
|
-
L.setTransform(t, matrix, resize);
|
|
4290
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4245
4291
|
},
|
|
4246
|
-
transformWorld(t, transform, resize) {
|
|
4292
|
+
transformWorld(t, transform, resize, transition) {
|
|
4247
4293
|
copy$3(matrix, t.worldTransform);
|
|
4248
4294
|
multiplyParent$2(matrix, transform);
|
|
4249
4295
|
if (t.parent)
|
|
4250
4296
|
divideParent(matrix, t.parent.worldTransform);
|
|
4251
|
-
L.setTransform(t, matrix, resize);
|
|
4297
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4252
4298
|
},
|
|
4253
|
-
transform(t, transform, resize) {
|
|
4299
|
+
transform(t, transform, resize, transition) {
|
|
4254
4300
|
copy$3(matrix, t.localTransform);
|
|
4255
4301
|
multiplyParent$2(matrix, transform);
|
|
4256
|
-
L.setTransform(t, matrix, resize);
|
|
4302
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4257
4303
|
},
|
|
4258
|
-
setTransform(t, transform, resize) {
|
|
4304
|
+
setTransform(t, transform, resize, transition) {
|
|
4259
4305
|
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
4260
4306
|
const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
|
|
4261
4307
|
if (resize) {
|
|
@@ -4270,7 +4316,7 @@ const LeafHelper = {
|
|
|
4270
4316
|
t.scaleResize(scaleX, scaleY, false);
|
|
4271
4317
|
}
|
|
4272
4318
|
else
|
|
4273
|
-
t.set(layout);
|
|
4319
|
+
t.set(layout, transition);
|
|
4274
4320
|
},
|
|
4275
4321
|
getFlipTransform(t, axis) {
|
|
4276
4322
|
const m = getMatrixData();
|
|
@@ -4307,11 +4353,6 @@ const LeafHelper = {
|
|
|
4307
4353
|
};
|
|
4308
4354
|
const L = LeafHelper;
|
|
4309
4355
|
const { updateAllMatrix: updateAllMatrix$1, updateMatrix: updateMatrix$1, updateAllWorldOpacity, updateAllChange } = L;
|
|
4310
|
-
function moveByMatrix(t, matrix) {
|
|
4311
|
-
const { e, f } = t.__localMatrix;
|
|
4312
|
-
t.x += matrix.e - e;
|
|
4313
|
-
t.y += matrix.f - f;
|
|
4314
|
-
}
|
|
4315
4356
|
function getTempLocal(t, world) {
|
|
4316
4357
|
t.__layout.update();
|
|
4317
4358
|
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
@@ -5217,7 +5258,7 @@ const LeafRender = {
|
|
|
5217
5258
|
if (this.__.eraser === 'path')
|
|
5218
5259
|
return this.__renderEraser(canvas, options);
|
|
5219
5260
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5220
|
-
this.__draw(tempCanvas, options);
|
|
5261
|
+
this.__draw(tempCanvas, options, canvas);
|
|
5221
5262
|
if (this.__worldFlipped) {
|
|
5222
5263
|
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, this.__.__blendMode, true);
|
|
5223
5264
|
}
|
|
@@ -5585,11 +5626,11 @@ let Leaf = class Leaf {
|
|
|
5585
5626
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5586
5627
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
5587
5628
|
}
|
|
5588
|
-
setTransform(matrix, resize) {
|
|
5589
|
-
setTransform(this, matrix, resize);
|
|
5629
|
+
setTransform(matrix, resize, transition) {
|
|
5630
|
+
setTransform(this, matrix, resize, transition);
|
|
5590
5631
|
}
|
|
5591
|
-
transform(matrix, resize) {
|
|
5592
|
-
transform(this, matrix, resize);
|
|
5632
|
+
transform(matrix, resize, transition) {
|
|
5633
|
+
transform(this, matrix, resize, transition);
|
|
5593
5634
|
}
|
|
5594
5635
|
move(x, y, transition) {
|
|
5595
5636
|
moveLocal(this, x, y, transition);
|
|
@@ -5597,32 +5638,32 @@ let Leaf = class Leaf {
|
|
|
5597
5638
|
moveInner(x, y, transition) {
|
|
5598
5639
|
moveWorld(this, x, y, true, transition);
|
|
5599
5640
|
}
|
|
5600
|
-
scaleOf(origin, scaleX, scaleY, resize) {
|
|
5601
|
-
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
|
|
5641
|
+
scaleOf(origin, scaleX, scaleY, resize, transition) {
|
|
5642
|
+
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
|
|
5602
5643
|
}
|
|
5603
|
-
rotateOf(origin, rotation) {
|
|
5604
|
-
rotateOfLocal(this, getLocalOrigin(this, origin), rotation);
|
|
5644
|
+
rotateOf(origin, rotation, transition) {
|
|
5645
|
+
rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
|
|
5605
5646
|
}
|
|
5606
|
-
skewOf(origin, skewX, skewY, resize) {
|
|
5607
|
-
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize);
|
|
5647
|
+
skewOf(origin, skewX, skewY, resize, transition) {
|
|
5648
|
+
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
|
|
5608
5649
|
}
|
|
5609
|
-
transformWorld(worldTransform, resize) {
|
|
5610
|
-
transformWorld(this, worldTransform, resize);
|
|
5650
|
+
transformWorld(worldTransform, resize, transition) {
|
|
5651
|
+
transformWorld(this, worldTransform, resize, transition);
|
|
5611
5652
|
}
|
|
5612
5653
|
moveWorld(x, y, transition) {
|
|
5613
5654
|
moveWorld(this, x, y, false, transition);
|
|
5614
5655
|
}
|
|
5615
|
-
scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
|
|
5616
|
-
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
|
|
5656
|
+
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
|
|
5657
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
|
|
5617
5658
|
}
|
|
5618
5659
|
rotateOfWorld(worldOrigin, rotation) {
|
|
5619
5660
|
rotateOfWorld(this, worldOrigin, rotation);
|
|
5620
5661
|
}
|
|
5621
|
-
skewOfWorld(worldOrigin, skewX, skewY, resize) {
|
|
5622
|
-
skewOfWorld(this, worldOrigin, skewX, skewY, resize);
|
|
5662
|
+
skewOfWorld(worldOrigin, skewX, skewY, resize, transition) {
|
|
5663
|
+
skewOfWorld(this, worldOrigin, skewX, skewY, resize, transition);
|
|
5623
5664
|
}
|
|
5624
|
-
flip(axis) {
|
|
5625
|
-
transform(this, getFlipTransform(this, axis));
|
|
5665
|
+
flip(axis, transition) {
|
|
5666
|
+
transform(this, getFlipTransform(this, axis), false, transition);
|
|
5626
5667
|
}
|
|
5627
5668
|
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
5628
5669
|
this.scaleX *= scaleX;
|
|
@@ -6010,6 +6051,7 @@ class LeafLevelList {
|
|
|
6010
6051
|
}
|
|
6011
6052
|
}
|
|
6012
6053
|
|
|
6013
|
-
const version = "1.
|
|
6054
|
+
const version = "1.4.1";
|
|
6014
6055
|
|
|
6015
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, useModule, version, visibleType };
|
|
6056
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, useModule, version, visibleType };
|
|
6057
|
+
//# sourceMappingURL=core.esm.js.map
|