@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.cjs
CHANGED
|
@@ -1376,7 +1376,7 @@ function getNameList(name) {
|
|
|
1376
1376
|
}
|
|
1377
1377
|
const D$4 = Debug;
|
|
1378
1378
|
|
|
1379
|
-
const debug$
|
|
1379
|
+
const debug$a = Debug.get('RunTime');
|
|
1380
1380
|
const Run = {
|
|
1381
1381
|
currentId: 0,
|
|
1382
1382
|
currentName: '',
|
|
@@ -1385,24 +1385,24 @@ const Run = {
|
|
|
1385
1385
|
nameToIdMap: {},
|
|
1386
1386
|
start(name, microsecond) {
|
|
1387
1387
|
const id = IncrementId.create(IncrementId.RUNTIME);
|
|
1388
|
-
R.currentId = R.idMap[id] = microsecond ? performance.now() : Date.now();
|
|
1389
|
-
R.currentName = R.nameMap[id] = name;
|
|
1390
|
-
R.nameToIdMap[name] = id;
|
|
1388
|
+
R$1.currentId = R$1.idMap[id] = microsecond ? performance.now() : Date.now();
|
|
1389
|
+
R$1.currentName = R$1.nameMap[id] = name;
|
|
1390
|
+
R$1.nameToIdMap[name] = id;
|
|
1391
1391
|
return id;
|
|
1392
1392
|
},
|
|
1393
1393
|
end(id, microsecond) {
|
|
1394
|
-
const time = R.idMap[id], name = R.nameMap[id];
|
|
1394
|
+
const time = R$1.idMap[id], name = R$1.nameMap[id];
|
|
1395
1395
|
const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
|
|
1396
|
-
R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
|
|
1397
|
-
debug$
|
|
1396
|
+
R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
|
|
1397
|
+
debug$a.log(name, duration, 'ms');
|
|
1398
1398
|
},
|
|
1399
1399
|
endOfName(name, microsecond) {
|
|
1400
|
-
const id = R.nameToIdMap[name];
|
|
1400
|
+
const id = R$1.nameToIdMap[name];
|
|
1401
1401
|
if (id !== undefined)
|
|
1402
|
-
R.end(id, microsecond);
|
|
1402
|
+
R$1.end(id, microsecond);
|
|
1403
1403
|
}
|
|
1404
1404
|
};
|
|
1405
|
-
const R = Run;
|
|
1405
|
+
const R$1 = Run;
|
|
1406
1406
|
|
|
1407
1407
|
const check = [];
|
|
1408
1408
|
const Plugin = {
|
|
@@ -1423,18 +1423,18 @@ const Plugin = {
|
|
|
1423
1423
|
};
|
|
1424
1424
|
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
1425
1425
|
|
|
1426
|
-
const debug$
|
|
1426
|
+
const debug$9 = Debug.get('UICreator');
|
|
1427
1427
|
const UICreator = {
|
|
1428
1428
|
list: {},
|
|
1429
1429
|
register(UI) {
|
|
1430
1430
|
const { __tag: tag } = UI.prototype;
|
|
1431
1431
|
if (list$1[tag])
|
|
1432
|
-
debug$
|
|
1432
|
+
debug$9.repeat(tag);
|
|
1433
1433
|
list$1[tag] = UI;
|
|
1434
1434
|
},
|
|
1435
1435
|
get(tag, data, x, y, width, height) {
|
|
1436
1436
|
if (!list$1[tag])
|
|
1437
|
-
debug$
|
|
1437
|
+
debug$9.error('not register ' + tag);
|
|
1438
1438
|
const ui = new list$1[tag](data);
|
|
1439
1439
|
if (x !== undefined) {
|
|
1440
1440
|
ui.x = x;
|
|
@@ -1450,7 +1450,7 @@ const UICreator = {
|
|
|
1450
1450
|
};
|
|
1451
1451
|
const { list: list$1 } = UICreator;
|
|
1452
1452
|
|
|
1453
|
-
const debug$
|
|
1453
|
+
const debug$8 = Debug.get('EventCreator');
|
|
1454
1454
|
const EventCreator = {
|
|
1455
1455
|
nameList: {},
|
|
1456
1456
|
register(Event) {
|
|
@@ -1458,7 +1458,7 @@ const EventCreator = {
|
|
|
1458
1458
|
Object.keys(Event).forEach(key => {
|
|
1459
1459
|
name = Event[key];
|
|
1460
1460
|
if (typeof name === 'string')
|
|
1461
|
-
nameList[name] && debug$
|
|
1461
|
+
nameList[name] && debug$8.repeat(name), nameList[name] = Event;
|
|
1462
1462
|
});
|
|
1463
1463
|
},
|
|
1464
1464
|
changeName(oldName, newName) {
|
|
@@ -1535,10 +1535,10 @@ const DataHelper = {
|
|
|
1535
1535
|
Object.keys(merge).forEach(key => {
|
|
1536
1536
|
var _a, _b;
|
|
1537
1537
|
value = merge[key];
|
|
1538
|
-
if ((value === null || value ===
|
|
1538
|
+
if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object)
|
|
1539
1539
|
return assign(t[key], merge[key], exclude && exclude[key]);
|
|
1540
1540
|
if (exclude && (key in exclude)) {
|
|
1541
|
-
if (((_b = exclude[key]) === null || _b ===
|
|
1541
|
+
if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object)
|
|
1542
1542
|
assign(t[key] = {}, merge[key], exclude[key]);
|
|
1543
1543
|
return;
|
|
1544
1544
|
}
|
|
@@ -1662,7 +1662,7 @@ class LeafData {
|
|
|
1662
1662
|
const t = this;
|
|
1663
1663
|
if (t.blendMode === 'pass-through') {
|
|
1664
1664
|
const leaf = this.__leaf;
|
|
1665
|
-
if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser) {
|
|
1665
|
+
if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser || t.filter) {
|
|
1666
1666
|
t.__single = true;
|
|
1667
1667
|
}
|
|
1668
1668
|
else if (t.__single) {
|
|
@@ -1775,7 +1775,7 @@ class Canvas {
|
|
|
1775
1775
|
}
|
|
1776
1776
|
setTransform(_a, _b, _c, _d, _e, _f) { }
|
|
1777
1777
|
resetTransform() { }
|
|
1778
|
-
getTransform() { return
|
|
1778
|
+
getTransform() { return void 0; }
|
|
1779
1779
|
save() { }
|
|
1780
1780
|
restore() { }
|
|
1781
1781
|
transform(a, b, c, d, e, f) {
|
|
@@ -1832,12 +1832,12 @@ class Canvas {
|
|
|
1832
1832
|
ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { }
|
|
1833
1833
|
rect(_x, _y, _width, _height) { }
|
|
1834
1834
|
roundRect(_x, _y, _width, _height, _radius) { }
|
|
1835
|
-
createConicGradient(_startAngle, _x, _y) { return
|
|
1836
|
-
createLinearGradient(_x0, _y0, _x1, _y1) { return
|
|
1837
|
-
createPattern(_image, _repetition) { return
|
|
1838
|
-
createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return
|
|
1835
|
+
createConicGradient(_startAngle, _x, _y) { return void 0; }
|
|
1836
|
+
createLinearGradient(_x0, _y0, _x1, _y1) { return void 0; }
|
|
1837
|
+
createPattern(_image, _repetition) { return void 0; }
|
|
1838
|
+
createRadialGradient(_x0, _y0, _r0, _x1, _y1, _r1) { return void 0; }
|
|
1839
1839
|
fillText(_text, _x, _y, _maxWidth) { }
|
|
1840
|
-
measureText(_text) { return
|
|
1840
|
+
measureText(_text) { return void 0; }
|
|
1841
1841
|
strokeText(_text, _x, _y, _maxWidth) { }
|
|
1842
1842
|
destroy() {
|
|
1843
1843
|
this.context = null;
|
|
@@ -1845,79 +1845,79 @@ class Canvas {
|
|
|
1845
1845
|
}
|
|
1846
1846
|
__decorate([
|
|
1847
1847
|
contextAttr('imageSmoothingEnabled')
|
|
1848
|
-
], Canvas.prototype, "smooth",
|
|
1848
|
+
], Canvas.prototype, "smooth", void 0);
|
|
1849
1849
|
__decorate([
|
|
1850
1850
|
contextAttr('imageSmoothingQuality')
|
|
1851
|
-
], Canvas.prototype, "smoothLevel",
|
|
1851
|
+
], Canvas.prototype, "smoothLevel", void 0);
|
|
1852
1852
|
__decorate([
|
|
1853
1853
|
contextAttr('globalAlpha')
|
|
1854
|
-
], Canvas.prototype, "opacity",
|
|
1854
|
+
], Canvas.prototype, "opacity", void 0);
|
|
1855
1855
|
__decorate([
|
|
1856
1856
|
contextAttr()
|
|
1857
|
-
], Canvas.prototype, "fillStyle",
|
|
1857
|
+
], Canvas.prototype, "fillStyle", void 0);
|
|
1858
1858
|
__decorate([
|
|
1859
1859
|
contextAttr()
|
|
1860
|
-
], Canvas.prototype, "strokeStyle",
|
|
1860
|
+
], Canvas.prototype, "strokeStyle", void 0);
|
|
1861
1861
|
__decorate([
|
|
1862
1862
|
contextAttr('lineWidth')
|
|
1863
|
-
], Canvas.prototype, "strokeWidth",
|
|
1863
|
+
], Canvas.prototype, "strokeWidth", void 0);
|
|
1864
1864
|
__decorate([
|
|
1865
1865
|
contextAttr('lineCap')
|
|
1866
|
-
], Canvas.prototype, "strokeCap",
|
|
1866
|
+
], Canvas.prototype, "strokeCap", void 0);
|
|
1867
1867
|
__decorate([
|
|
1868
1868
|
contextAttr('lineJoin')
|
|
1869
|
-
], Canvas.prototype, "strokeJoin",
|
|
1869
|
+
], Canvas.prototype, "strokeJoin", void 0);
|
|
1870
1870
|
__decorate([
|
|
1871
1871
|
contextAttr('lineDashOffset')
|
|
1872
|
-
], Canvas.prototype, "dashOffset",
|
|
1872
|
+
], Canvas.prototype, "dashOffset", void 0);
|
|
1873
1873
|
__decorate([
|
|
1874
1874
|
contextAttr()
|
|
1875
|
-
], Canvas.prototype, "miterLimit",
|
|
1875
|
+
], Canvas.prototype, "miterLimit", void 0);
|
|
1876
1876
|
__decorate([
|
|
1877
1877
|
contextAttr()
|
|
1878
|
-
], Canvas.prototype, "shadowBlur",
|
|
1878
|
+
], Canvas.prototype, "shadowBlur", void 0);
|
|
1879
1879
|
__decorate([
|
|
1880
1880
|
contextAttr()
|
|
1881
|
-
], Canvas.prototype, "shadowColor",
|
|
1881
|
+
], Canvas.prototype, "shadowColor", void 0);
|
|
1882
1882
|
__decorate([
|
|
1883
1883
|
contextAttr()
|
|
1884
|
-
], Canvas.prototype, "shadowOffsetX",
|
|
1884
|
+
], Canvas.prototype, "shadowOffsetX", void 0);
|
|
1885
1885
|
__decorate([
|
|
1886
1886
|
contextAttr()
|
|
1887
|
-
], Canvas.prototype, "shadowOffsetY",
|
|
1887
|
+
], Canvas.prototype, "shadowOffsetY", void 0);
|
|
1888
1888
|
__decorate([
|
|
1889
1889
|
contextAttr()
|
|
1890
|
-
], Canvas.prototype, "filter",
|
|
1890
|
+
], Canvas.prototype, "filter", void 0);
|
|
1891
1891
|
__decorate([
|
|
1892
1892
|
contextAttr()
|
|
1893
|
-
], Canvas.prototype, "font",
|
|
1893
|
+
], Canvas.prototype, "font", void 0);
|
|
1894
1894
|
__decorate([
|
|
1895
1895
|
contextAttr()
|
|
1896
|
-
], Canvas.prototype, "fontKerning",
|
|
1896
|
+
], Canvas.prototype, "fontKerning", void 0);
|
|
1897
1897
|
__decorate([
|
|
1898
1898
|
contextAttr()
|
|
1899
|
-
], Canvas.prototype, "fontStretch",
|
|
1899
|
+
], Canvas.prototype, "fontStretch", void 0);
|
|
1900
1900
|
__decorate([
|
|
1901
1901
|
contextAttr()
|
|
1902
|
-
], Canvas.prototype, "fontVariantCaps",
|
|
1902
|
+
], Canvas.prototype, "fontVariantCaps", void 0);
|
|
1903
1903
|
__decorate([
|
|
1904
1904
|
contextAttr()
|
|
1905
|
-
], Canvas.prototype, "textAlign",
|
|
1905
|
+
], Canvas.prototype, "textAlign", void 0);
|
|
1906
1906
|
__decorate([
|
|
1907
1907
|
contextAttr()
|
|
1908
|
-
], Canvas.prototype, "textBaseline",
|
|
1908
|
+
], Canvas.prototype, "textBaseline", void 0);
|
|
1909
1909
|
__decorate([
|
|
1910
1910
|
contextAttr()
|
|
1911
|
-
], Canvas.prototype, "textRendering",
|
|
1911
|
+
], Canvas.prototype, "textRendering", void 0);
|
|
1912
1912
|
__decorate([
|
|
1913
1913
|
contextAttr()
|
|
1914
|
-
], Canvas.prototype, "wordSpacing",
|
|
1914
|
+
], Canvas.prototype, "wordSpacing", void 0);
|
|
1915
1915
|
__decorate([
|
|
1916
1916
|
contextAttr()
|
|
1917
|
-
], Canvas.prototype, "letterSpacing",
|
|
1917
|
+
], Canvas.prototype, "letterSpacing", void 0);
|
|
1918
1918
|
__decorate([
|
|
1919
1919
|
contextAttr()
|
|
1920
|
-
], Canvas.prototype, "direction",
|
|
1920
|
+
], Canvas.prototype, "direction", void 0);
|
|
1921
1921
|
__decorate([
|
|
1922
1922
|
contextMethod()
|
|
1923
1923
|
], Canvas.prototype, "setTransform", null);
|
|
@@ -2614,7 +2614,7 @@ const EllipseHelper = {
|
|
|
2614
2614
|
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;
|
|
2615
2615
|
const { rect: rect$1, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$3, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
|
|
2616
2616
|
const { ellipticalArc } = EllipseHelper;
|
|
2617
|
-
const debug$
|
|
2617
|
+
const debug$7 = Debug.get('PathConvert');
|
|
2618
2618
|
const setEndPoint$1 = {};
|
|
2619
2619
|
const PathConvert = {
|
|
2620
2620
|
current: { dot: 0 },
|
|
@@ -2855,7 +2855,7 @@ const PathConvert = {
|
|
|
2855
2855
|
i += 6;
|
|
2856
2856
|
break;
|
|
2857
2857
|
default:
|
|
2858
|
-
debug$
|
|
2858
|
+
debug$7.error(`command: ${command} [index:${i}]`, old);
|
|
2859
2859
|
return data;
|
|
2860
2860
|
}
|
|
2861
2861
|
lastCommand = command;
|
|
@@ -2964,12 +2964,10 @@ const PathCommandDataHelper = {
|
|
|
2964
2964
|
},
|
|
2965
2965
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
2966
2966
|
if (lastX !== undefined) {
|
|
2967
|
-
const
|
|
2968
|
-
|
|
2969
|
-
}
|
|
2970
|
-
else {
|
|
2971
|
-
data.push(U$2, x1, y1, x2, y2, radius);
|
|
2967
|
+
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
2968
|
+
radius = min(radius, min(d / 2, d / 2 * abs(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
2972
2969
|
}
|
|
2970
|
+
data.push(U$2, x1, y1, x2, y2, radius);
|
|
2973
2971
|
},
|
|
2974
2972
|
drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2975
2973
|
BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation === undefined ? 0 : rotation, startAngle === undefined ? 0 : startAngle, endAngle === undefined ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
@@ -3080,7 +3078,7 @@ class PathCreator {
|
|
|
3080
3078
|
}
|
|
3081
3079
|
|
|
3082
3080
|
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;
|
|
3083
|
-
const debug$
|
|
3081
|
+
const debug$6 = Debug.get('PathDrawer');
|
|
3084
3082
|
const PathDrawer = {
|
|
3085
3083
|
drawPathByData(drawer, data) {
|
|
3086
3084
|
if (!data)
|
|
@@ -3143,7 +3141,7 @@ const PathDrawer = {
|
|
|
3143
3141
|
i += 6;
|
|
3144
3142
|
break;
|
|
3145
3143
|
default:
|
|
3146
|
-
debug$
|
|
3144
|
+
debug$6.error(`command: ${command} [index:${i}]`, data);
|
|
3147
3145
|
return;
|
|
3148
3146
|
}
|
|
3149
3147
|
}
|
|
@@ -3153,7 +3151,7 @@ const PathDrawer = {
|
|
|
3153
3151
|
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;
|
|
3154
3152
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse } = BezierHelper;
|
|
3155
3153
|
const { addPointBounds, copy: copy$4, addPoint, setPoint, addBounds, toBounds: toBounds$1 } = TwoPointBoundsHelper;
|
|
3156
|
-
const debug$
|
|
3154
|
+
const debug$5 = Debug.get('PathBounds');
|
|
3157
3155
|
let radius, radiusX, radiusY;
|
|
3158
3156
|
const tempPointBounds = {};
|
|
3159
3157
|
const setPointBounds = {};
|
|
@@ -3261,7 +3259,7 @@ const PathBounds = {
|
|
|
3261
3259
|
i += 6;
|
|
3262
3260
|
break;
|
|
3263
3261
|
default:
|
|
3264
|
-
debug$
|
|
3262
|
+
debug$5.error(`command: ${command} [index:${i}]`, data);
|
|
3265
3263
|
return;
|
|
3266
3264
|
}
|
|
3267
3265
|
}
|
|
@@ -3377,7 +3375,7 @@ const FileHelper = {
|
|
|
3377
3375
|
const F = FileHelper;
|
|
3378
3376
|
F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3379
3377
|
|
|
3380
|
-
const debug$
|
|
3378
|
+
const debug$4 = Debug.get('TaskProcessor');
|
|
3381
3379
|
class TaskItem {
|
|
3382
3380
|
constructor(task) {
|
|
3383
3381
|
this.parallel = true;
|
|
@@ -3386,13 +3384,13 @@ class TaskItem {
|
|
|
3386
3384
|
this.task = task;
|
|
3387
3385
|
}
|
|
3388
3386
|
run() {
|
|
3389
|
-
return __awaiter(this,
|
|
3387
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3390
3388
|
try {
|
|
3391
3389
|
if (this.task && !this.isComplete && this.parent.running)
|
|
3392
3390
|
yield this.task();
|
|
3393
3391
|
}
|
|
3394
3392
|
catch (error) {
|
|
3395
|
-
debug$
|
|
3393
|
+
debug$4.error(error);
|
|
3396
3394
|
}
|
|
3397
3395
|
});
|
|
3398
3396
|
}
|
|
@@ -3625,18 +3623,52 @@ class TaskProcessor {
|
|
|
3625
3623
|
}
|
|
3626
3624
|
}
|
|
3627
3625
|
|
|
3628
|
-
const
|
|
3626
|
+
const debug$3 = Debug.get('Resource');
|
|
3627
|
+
const Resource = {
|
|
3628
|
+
tasker: new TaskProcessor(),
|
|
3629
3629
|
map: {},
|
|
3630
|
+
get isComplete() { return R.tasker.isComplete; },
|
|
3631
|
+
set(key, value) {
|
|
3632
|
+
if (R.map[key])
|
|
3633
|
+
debug$3.repeat(key);
|
|
3634
|
+
R.map[key] = value;
|
|
3635
|
+
},
|
|
3636
|
+
get(key) {
|
|
3637
|
+
return R.map[key];
|
|
3638
|
+
},
|
|
3639
|
+
remove(key) {
|
|
3640
|
+
delete R.map[key];
|
|
3641
|
+
},
|
|
3642
|
+
loadImage(key, format) {
|
|
3643
|
+
return new Promise((resolve, reject) => {
|
|
3644
|
+
const image = this.setImage(key, key, format);
|
|
3645
|
+
image.load(() => resolve(image), (e) => reject(e));
|
|
3646
|
+
});
|
|
3647
|
+
},
|
|
3648
|
+
setImage(key, value, format) {
|
|
3649
|
+
let config;
|
|
3650
|
+
if (typeof value === 'string')
|
|
3651
|
+
config = { url: value };
|
|
3652
|
+
else if (!value.url)
|
|
3653
|
+
config = { url: key, view: value };
|
|
3654
|
+
if (config)
|
|
3655
|
+
format && (config.format = format), value = Creator.image(config);
|
|
3656
|
+
R.set(key, value);
|
|
3657
|
+
return value;
|
|
3658
|
+
},
|
|
3659
|
+
destroy() {
|
|
3660
|
+
R.map = {};
|
|
3661
|
+
}
|
|
3662
|
+
};
|
|
3663
|
+
const R = Resource;
|
|
3664
|
+
|
|
3665
|
+
const ImageManager = {
|
|
3630
3666
|
recycledList: [],
|
|
3631
|
-
tasker: new TaskProcessor(),
|
|
3632
3667
|
patternTasker: new TaskProcessor(),
|
|
3633
|
-
get isComplete() { return I.tasker.isComplete; },
|
|
3634
3668
|
get(config) {
|
|
3635
|
-
let image =
|
|
3636
|
-
if (!image)
|
|
3637
|
-
image = Creator.image(config);
|
|
3638
|
-
I.map[config.url] = image;
|
|
3639
|
-
}
|
|
3669
|
+
let image = Resource.get(config.url);
|
|
3670
|
+
if (!image)
|
|
3671
|
+
Resource.set(config.url, image = Creator.image(config));
|
|
3640
3672
|
image.use++;
|
|
3641
3673
|
return image;
|
|
3642
3674
|
},
|
|
@@ -3650,7 +3682,7 @@ const ImageManager = {
|
|
|
3650
3682
|
if (list.length > 100) {
|
|
3651
3683
|
list.forEach(image => {
|
|
3652
3684
|
if (!image.use && image.url) {
|
|
3653
|
-
|
|
3685
|
+
Resource.remove(image.url);
|
|
3654
3686
|
image.destroy();
|
|
3655
3687
|
}
|
|
3656
3688
|
});
|
|
@@ -3677,7 +3709,6 @@ const ImageManager = {
|
|
|
3677
3709
|
return false;
|
|
3678
3710
|
},
|
|
3679
3711
|
destroy() {
|
|
3680
|
-
I.map = {};
|
|
3681
3712
|
I.recycledList = [];
|
|
3682
3713
|
}
|
|
3683
3714
|
};
|
|
@@ -3691,21 +3722,19 @@ class LeaferImage {
|
|
|
3691
3722
|
this.use = 0;
|
|
3692
3723
|
this.waitComplete = [];
|
|
3693
3724
|
this.innerId = create$1(IMAGE);
|
|
3694
|
-
this.config = config || { url: '' };
|
|
3695
|
-
|
|
3696
|
-
|
|
3725
|
+
this.config = config || (config = { url: '' });
|
|
3726
|
+
if (config.view) {
|
|
3727
|
+
const { view } = config;
|
|
3728
|
+
this.setView(view.config ? view.view : view);
|
|
3729
|
+
}
|
|
3730
|
+
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3731
|
+
ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
|
|
3697
3732
|
}
|
|
3698
3733
|
load(onSuccess, onError) {
|
|
3699
3734
|
if (!this.loading) {
|
|
3700
3735
|
this.loading = true;
|
|
3701
|
-
|
|
3702
|
-
return yield Platform.origin.loadImage(this.url).then((img) => {
|
|
3703
|
-
this.ready = true;
|
|
3704
|
-
this.width = img.naturalWidth || img.width;
|
|
3705
|
-
this.height = img.naturalHeight || img.height;
|
|
3706
|
-
this.view = img;
|
|
3707
|
-
this.onComplete(true);
|
|
3708
|
-
}).catch((e) => {
|
|
3736
|
+
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3737
|
+
return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
|
|
3709
3738
|
this.error = e;
|
|
3710
3739
|
this.onComplete(false);
|
|
3711
3740
|
});
|
|
@@ -3723,6 +3752,13 @@ class LeaferImage {
|
|
|
3723
3752
|
}
|
|
3724
3753
|
l[index] = l[index + 1] = undefined;
|
|
3725
3754
|
}
|
|
3755
|
+
setView(img) {
|
|
3756
|
+
this.ready = true;
|
|
3757
|
+
this.width = img.naturalWidth || img.width;
|
|
3758
|
+
this.height = img.naturalHeight || img.height;
|
|
3759
|
+
this.view = img;
|
|
3760
|
+
this.onComplete(true);
|
|
3761
|
+
}
|
|
3726
3762
|
onComplete(isSuccess) {
|
|
3727
3763
|
let odd;
|
|
3728
3764
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -3741,6 +3777,9 @@ class LeaferImage {
|
|
|
3741
3777
|
this.waitComplete.length = 0;
|
|
3742
3778
|
this.loading = false;
|
|
3743
3779
|
}
|
|
3780
|
+
getFull(_filters) {
|
|
3781
|
+
return this.view;
|
|
3782
|
+
}
|
|
3744
3783
|
getCanvas(width, height, opacity, _filters) {
|
|
3745
3784
|
width || (width = this.width);
|
|
3746
3785
|
height || (height = this.height);
|
|
@@ -3823,10 +3862,10 @@ function autoLayoutType(defaultValue) {
|
|
|
3823
3862
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3824
3863
|
set(value) {
|
|
3825
3864
|
if (this.__setAttr(key, value)) {
|
|
3826
|
-
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3827
3865
|
this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
|
|
3828
3866
|
if (!this.__local)
|
|
3829
3867
|
this.__layout.createLocal();
|
|
3868
|
+
doBoundsType(this);
|
|
3830
3869
|
}
|
|
3831
3870
|
}
|
|
3832
3871
|
}));
|
|
@@ -4209,55 +4248,62 @@ const LeafHelper = {
|
|
|
4209
4248
|
y += t.y;
|
|
4210
4249
|
transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
|
|
4211
4250
|
},
|
|
4212
|
-
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
4213
|
-
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
4251
|
+
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
4252
|
+
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
|
|
4214
4253
|
},
|
|
4215
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4216
|
-
|
|
4254
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
|
|
4255
|
+
const o = t.__localMatrix;
|
|
4256
|
+
if (typeof scaleY !== 'number') {
|
|
4257
|
+
if (scaleY)
|
|
4258
|
+
transition = scaleY;
|
|
4259
|
+
scaleY = scaleX;
|
|
4260
|
+
}
|
|
4261
|
+
copy$3(matrix, o);
|
|
4217
4262
|
scaleOfOuter(matrix, origin, scaleX, scaleY);
|
|
4218
4263
|
if (t.origin || t.around) {
|
|
4219
|
-
L.setTransform(t, matrix, resize);
|
|
4264
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4220
4265
|
}
|
|
4221
4266
|
else {
|
|
4222
|
-
|
|
4223
|
-
|
|
4267
|
+
const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
|
|
4268
|
+
if (transition && !resize)
|
|
4269
|
+
t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
|
|
4270
|
+
else
|
|
4271
|
+
t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4224
4272
|
}
|
|
4225
4273
|
},
|
|
4226
|
-
rotateOfWorld(t, origin, angle) {
|
|
4227
|
-
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4274
|
+
rotateOfWorld(t, origin, angle, transition) {
|
|
4275
|
+
L.rotateOfLocal(t, getTempLocal(t, origin), angle, transition);
|
|
4228
4276
|
},
|
|
4229
|
-
rotateOfLocal(t, origin, angle) {
|
|
4230
|
-
|
|
4277
|
+
rotateOfLocal(t, origin, angle, transition) {
|
|
4278
|
+
const o = t.__localMatrix;
|
|
4279
|
+
copy$3(matrix, o);
|
|
4231
4280
|
rotateOfOuter(matrix, origin, angle);
|
|
4232
|
-
if (t.origin || t.around)
|
|
4233
|
-
L.setTransform(t, matrix);
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
moveByMatrix(t, matrix);
|
|
4237
|
-
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4238
|
-
}
|
|
4281
|
+
if (t.origin || t.around)
|
|
4282
|
+
L.setTransform(t, matrix, false, transition);
|
|
4283
|
+
else
|
|
4284
|
+
t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
|
|
4239
4285
|
},
|
|
4240
|
-
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4241
|
-
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
4286
|
+
skewOfWorld(t, origin, skewX, skewY, resize, transition) {
|
|
4287
|
+
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4242
4288
|
},
|
|
4243
|
-
skewOfLocal(t, origin, skewX, skewY = 0, resize) {
|
|
4289
|
+
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4244
4290
|
copy$3(matrix, t.__localMatrix);
|
|
4245
4291
|
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4246
|
-
L.setTransform(t, matrix, resize);
|
|
4292
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4247
4293
|
},
|
|
4248
|
-
transformWorld(t, transform, resize) {
|
|
4294
|
+
transformWorld(t, transform, resize, transition) {
|
|
4249
4295
|
copy$3(matrix, t.worldTransform);
|
|
4250
4296
|
multiplyParent$2(matrix, transform);
|
|
4251
4297
|
if (t.parent)
|
|
4252
4298
|
divideParent(matrix, t.parent.worldTransform);
|
|
4253
|
-
L.setTransform(t, matrix, resize);
|
|
4299
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4254
4300
|
},
|
|
4255
|
-
transform(t, transform, resize) {
|
|
4301
|
+
transform(t, transform, resize, transition) {
|
|
4256
4302
|
copy$3(matrix, t.localTransform);
|
|
4257
4303
|
multiplyParent$2(matrix, transform);
|
|
4258
|
-
L.setTransform(t, matrix, resize);
|
|
4304
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4259
4305
|
},
|
|
4260
|
-
setTransform(t, transform, resize) {
|
|
4306
|
+
setTransform(t, transform, resize, transition) {
|
|
4261
4307
|
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
4262
4308
|
const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
|
|
4263
4309
|
if (resize) {
|
|
@@ -4272,7 +4318,7 @@ const LeafHelper = {
|
|
|
4272
4318
|
t.scaleResize(scaleX, scaleY, false);
|
|
4273
4319
|
}
|
|
4274
4320
|
else
|
|
4275
|
-
t.set(layout);
|
|
4321
|
+
t.set(layout, transition);
|
|
4276
4322
|
},
|
|
4277
4323
|
getFlipTransform(t, axis) {
|
|
4278
4324
|
const m = getMatrixData();
|
|
@@ -4309,11 +4355,6 @@ const LeafHelper = {
|
|
|
4309
4355
|
};
|
|
4310
4356
|
const L = LeafHelper;
|
|
4311
4357
|
const { updateAllMatrix: updateAllMatrix$1, updateMatrix: updateMatrix$1, updateAllWorldOpacity, updateAllChange } = L;
|
|
4312
|
-
function moveByMatrix(t, matrix) {
|
|
4313
|
-
const { e, f } = t.__localMatrix;
|
|
4314
|
-
t.x += matrix.e - e;
|
|
4315
|
-
t.y += matrix.f - f;
|
|
4316
|
-
}
|
|
4317
4358
|
function getTempLocal(t, world) {
|
|
4318
4359
|
t.__layout.update();
|
|
4319
4360
|
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
@@ -5219,7 +5260,7 @@ const LeafRender = {
|
|
|
5219
5260
|
if (this.__.eraser === 'path')
|
|
5220
5261
|
return this.__renderEraser(canvas, options);
|
|
5221
5262
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5222
|
-
this.__draw(tempCanvas, options);
|
|
5263
|
+
this.__draw(tempCanvas, options, canvas);
|
|
5223
5264
|
if (this.__worldFlipped) {
|
|
5224
5265
|
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, this.__.__blendMode, true);
|
|
5225
5266
|
}
|
|
@@ -5587,11 +5628,11 @@ exports.Leaf = class Leaf {
|
|
|
5587
5628
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
5588
5629
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
5589
5630
|
}
|
|
5590
|
-
setTransform(matrix, resize) {
|
|
5591
|
-
setTransform(this, matrix, resize);
|
|
5631
|
+
setTransform(matrix, resize, transition) {
|
|
5632
|
+
setTransform(this, matrix, resize, transition);
|
|
5592
5633
|
}
|
|
5593
|
-
transform(matrix, resize) {
|
|
5594
|
-
transform(this, matrix, resize);
|
|
5634
|
+
transform(matrix, resize, transition) {
|
|
5635
|
+
transform(this, matrix, resize, transition);
|
|
5595
5636
|
}
|
|
5596
5637
|
move(x, y, transition) {
|
|
5597
5638
|
moveLocal(this, x, y, transition);
|
|
@@ -5599,32 +5640,32 @@ exports.Leaf = class Leaf {
|
|
|
5599
5640
|
moveInner(x, y, transition) {
|
|
5600
5641
|
moveWorld(this, x, y, true, transition);
|
|
5601
5642
|
}
|
|
5602
|
-
scaleOf(origin, scaleX, scaleY, resize) {
|
|
5603
|
-
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
|
|
5643
|
+
scaleOf(origin, scaleX, scaleY, resize, transition) {
|
|
5644
|
+
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
|
|
5604
5645
|
}
|
|
5605
|
-
rotateOf(origin, rotation) {
|
|
5606
|
-
rotateOfLocal(this, getLocalOrigin(this, origin), rotation);
|
|
5646
|
+
rotateOf(origin, rotation, transition) {
|
|
5647
|
+
rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
|
|
5607
5648
|
}
|
|
5608
|
-
skewOf(origin, skewX, skewY, resize) {
|
|
5609
|
-
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize);
|
|
5649
|
+
skewOf(origin, skewX, skewY, resize, transition) {
|
|
5650
|
+
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
|
|
5610
5651
|
}
|
|
5611
|
-
transformWorld(worldTransform, resize) {
|
|
5612
|
-
transformWorld(this, worldTransform, resize);
|
|
5652
|
+
transformWorld(worldTransform, resize, transition) {
|
|
5653
|
+
transformWorld(this, worldTransform, resize, transition);
|
|
5613
5654
|
}
|
|
5614
5655
|
moveWorld(x, y, transition) {
|
|
5615
5656
|
moveWorld(this, x, y, false, transition);
|
|
5616
5657
|
}
|
|
5617
|
-
scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
|
|
5618
|
-
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
|
|
5658
|
+
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
|
|
5659
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
|
|
5619
5660
|
}
|
|
5620
5661
|
rotateOfWorld(worldOrigin, rotation) {
|
|
5621
5662
|
rotateOfWorld(this, worldOrigin, rotation);
|
|
5622
5663
|
}
|
|
5623
|
-
skewOfWorld(worldOrigin, skewX, skewY, resize) {
|
|
5624
|
-
skewOfWorld(this, worldOrigin, skewX, skewY, resize);
|
|
5664
|
+
skewOfWorld(worldOrigin, skewX, skewY, resize, transition) {
|
|
5665
|
+
skewOfWorld(this, worldOrigin, skewX, skewY, resize, transition);
|
|
5625
5666
|
}
|
|
5626
|
-
flip(axis) {
|
|
5627
|
-
transform(this, getFlipTransform(this, axis));
|
|
5667
|
+
flip(axis, transition) {
|
|
5668
|
+
transform(this, getFlipTransform(this, axis), false, transition);
|
|
5628
5669
|
}
|
|
5629
5670
|
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
5630
5671
|
this.scaleX *= scaleX;
|
|
@@ -6012,7 +6053,7 @@ class LeafLevelList {
|
|
|
6012
6053
|
}
|
|
6013
6054
|
}
|
|
6014
6055
|
|
|
6015
|
-
const version = "1.
|
|
6056
|
+
const version = "1.4.1";
|
|
6016
6057
|
|
|
6017
6058
|
exports.AlignHelper = AlignHelper;
|
|
6018
6059
|
exports.AroundHelper = AroundHelper;
|
|
@@ -6075,6 +6116,7 @@ exports.PropertyEvent = PropertyEvent;
|
|
|
6075
6116
|
exports.RectHelper = RectHelper;
|
|
6076
6117
|
exports.RenderEvent = RenderEvent;
|
|
6077
6118
|
exports.ResizeEvent = ResizeEvent;
|
|
6119
|
+
exports.Resource = Resource;
|
|
6078
6120
|
exports.Run = Run;
|
|
6079
6121
|
exports.StringNumberMap = StringNumberMap;
|
|
6080
6122
|
exports.TaskItem = TaskItem;
|
|
@@ -6130,3 +6172,4 @@ exports.tempPoint = tempPoint$2;
|
|
|
6130
6172
|
exports.useModule = useModule;
|
|
6131
6173
|
exports.version = version;
|
|
6132
6174
|
exports.visibleType = visibleType;
|
|
6175
|
+
//# sourceMappingURL=core.cjs.map
|