@leafer/core 1.4.0 → 1.4.2
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 +133 -92
- package/lib/core.cjs.map +1 -1
- package/lib/core.esm.js +133 -93
- package/lib/core.esm.js.map +1 -1
- package/lib/core.esm.min.js +1 -1
- package/lib/core.esm.min.js.map +1 -1
- package/lib/core.min.cjs +1 -1
- package/lib/core.min.cjs.map +1 -1
- package/package.json +17 -17
- 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,58 @@ 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
|
+
const r = R.map[key];
|
|
3639
|
+
if (r) {
|
|
3640
|
+
if (r.destroy)
|
|
3641
|
+
r.destroy();
|
|
3642
|
+
delete R.map[key];
|
|
3643
|
+
}
|
|
3644
|
+
},
|
|
3645
|
+
loadImage(key, format) {
|
|
3646
|
+
return new Promise((resolve, reject) => {
|
|
3647
|
+
const image = this.setImage(key, key, format);
|
|
3648
|
+
image.load(() => resolve(image), (e) => reject(e));
|
|
3649
|
+
});
|
|
3650
|
+
},
|
|
3651
|
+
setImage(key, value, format) {
|
|
3652
|
+
let config;
|
|
3653
|
+
if (typeof value === 'string')
|
|
3654
|
+
config = { url: value };
|
|
3655
|
+
else if (!value.url)
|
|
3656
|
+
config = { url: key, view: value };
|
|
3657
|
+
if (config)
|
|
3658
|
+
format && (config.format = format), value = Creator.image(config);
|
|
3659
|
+
R.set(key, value);
|
|
3660
|
+
return value;
|
|
3661
|
+
},
|
|
3662
|
+
destroy() {
|
|
3663
|
+
R.map = {};
|
|
3664
|
+
}
|
|
3665
|
+
};
|
|
3666
|
+
const R = Resource;
|
|
3667
|
+
|
|
3668
|
+
const ImageManager = {
|
|
3669
|
+
maxRecycled: 100,
|
|
3628
3670
|
recycledList: [],
|
|
3629
|
-
tasker: new TaskProcessor(),
|
|
3630
3671
|
patternTasker: new TaskProcessor(),
|
|
3631
|
-
get isComplete() { return I.tasker.isComplete; },
|
|
3632
3672
|
get(config) {
|
|
3633
|
-
let image =
|
|
3634
|
-
if (!image)
|
|
3635
|
-
image = Creator.image(config);
|
|
3636
|
-
I.map[config.url] = image;
|
|
3637
|
-
}
|
|
3673
|
+
let image = Resource.get(config.url);
|
|
3674
|
+
if (!image)
|
|
3675
|
+
Resource.set(config.url, image = Creator.image(config));
|
|
3638
3676
|
image.use++;
|
|
3639
3677
|
return image;
|
|
3640
3678
|
},
|
|
@@ -3645,13 +3683,8 @@ const ImageManager = {
|
|
|
3645
3683
|
},
|
|
3646
3684
|
clearRecycled() {
|
|
3647
3685
|
const list = I.recycledList;
|
|
3648
|
-
if (list.length >
|
|
3649
|
-
list.forEach(image =>
|
|
3650
|
-
if (!image.use && image.url) {
|
|
3651
|
-
delete I.map[image.url];
|
|
3652
|
-
image.destroy();
|
|
3653
|
-
}
|
|
3654
|
-
});
|
|
3686
|
+
if (list.length > I.maxRecycled) {
|
|
3687
|
+
list.forEach(image => (!image.use && image.url) && Resource.remove(image.url));
|
|
3655
3688
|
list.length = 0;
|
|
3656
3689
|
}
|
|
3657
3690
|
},
|
|
@@ -3675,7 +3708,6 @@ const ImageManager = {
|
|
|
3675
3708
|
return false;
|
|
3676
3709
|
},
|
|
3677
3710
|
destroy() {
|
|
3678
|
-
I.map = {};
|
|
3679
3711
|
I.recycledList = [];
|
|
3680
3712
|
}
|
|
3681
3713
|
};
|
|
@@ -3689,21 +3721,19 @@ class LeaferImage {
|
|
|
3689
3721
|
this.use = 0;
|
|
3690
3722
|
this.waitComplete = [];
|
|
3691
3723
|
this.innerId = create$1(IMAGE);
|
|
3692
|
-
this.config = config || { url: '' };
|
|
3693
|
-
|
|
3694
|
-
|
|
3724
|
+
this.config = config || (config = { url: '' });
|
|
3725
|
+
if (config.view) {
|
|
3726
|
+
const { view } = config;
|
|
3727
|
+
this.setView(view.config ? view.view : view);
|
|
3728
|
+
}
|
|
3729
|
+
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3730
|
+
ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
|
|
3695
3731
|
}
|
|
3696
3732
|
load(onSuccess, onError) {
|
|
3697
3733
|
if (!this.loading) {
|
|
3698
3734
|
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) => {
|
|
3735
|
+
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3736
|
+
return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
|
|
3707
3737
|
this.error = e;
|
|
3708
3738
|
this.onComplete(false);
|
|
3709
3739
|
});
|
|
@@ -3721,6 +3751,13 @@ class LeaferImage {
|
|
|
3721
3751
|
}
|
|
3722
3752
|
l[index] = l[index + 1] = undefined;
|
|
3723
3753
|
}
|
|
3754
|
+
setView(img) {
|
|
3755
|
+
this.ready = true;
|
|
3756
|
+
this.width = img.naturalWidth || img.width;
|
|
3757
|
+
this.height = img.naturalHeight || img.height;
|
|
3758
|
+
this.view = img;
|
|
3759
|
+
this.onComplete(true);
|
|
3760
|
+
}
|
|
3724
3761
|
onComplete(isSuccess) {
|
|
3725
3762
|
let odd;
|
|
3726
3763
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -3739,6 +3776,9 @@ class LeaferImage {
|
|
|
3739
3776
|
this.waitComplete.length = 0;
|
|
3740
3777
|
this.loading = false;
|
|
3741
3778
|
}
|
|
3779
|
+
getFull(_filters) {
|
|
3780
|
+
return this.view;
|
|
3781
|
+
}
|
|
3742
3782
|
getCanvas(width, height, opacity, _filters) {
|
|
3743
3783
|
width || (width = this.width);
|
|
3744
3784
|
height || (height = this.height);
|
|
@@ -5219,7 +5259,7 @@ const LeafRender = {
|
|
|
5219
5259
|
if (this.__.eraser === 'path')
|
|
5220
5260
|
return this.__renderEraser(canvas, options);
|
|
5221
5261
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5222
|
-
this.__draw(tempCanvas, options);
|
|
5262
|
+
this.__draw(tempCanvas, options, canvas);
|
|
5223
5263
|
if (this.__worldFlipped) {
|
|
5224
5264
|
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, this.__.__blendMode, true);
|
|
5225
5265
|
}
|
|
@@ -6012,7 +6052,7 @@ class LeafLevelList {
|
|
|
6012
6052
|
}
|
|
6013
6053
|
}
|
|
6014
6054
|
|
|
6015
|
-
const version = "1.4.
|
|
6055
|
+
const version = "1.4.2";
|
|
6016
6056
|
|
|
6017
|
-
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 };
|
|
6057
|
+
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 };
|
|
6018
6058
|
//# sourceMappingURL=core.esm.js.map
|