@leafer-draw/worker 1.0.0-rc.19 → 1.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.esm.js +65 -20
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +475 -434
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +469 -435
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.js
CHANGED
|
@@ -3,6 +3,7 @@ var LeaferUI = (function (exports) {
|
|
|
3
3
|
|
|
4
4
|
const Platform = {
|
|
5
5
|
image: {
|
|
6
|
+
hitCanvasSize: 100,
|
|
6
7
|
maxCacheSize: 2560 * 1600,
|
|
7
8
|
maxPatternSize: 4096 * 2160,
|
|
8
9
|
suffix: 'leaf',
|
|
@@ -44,7 +45,7 @@ var LeaferUI = (function (exports) {
|
|
|
44
45
|
minus(value, isFourNumber) {
|
|
45
46
|
if (value instanceof Array) {
|
|
46
47
|
if (isFourNumber)
|
|
47
|
-
value = MathHelper.fourNumber(value);
|
|
48
|
+
value = MathHelper.fourNumber(value, 0);
|
|
48
49
|
for (let i = 0; i < value.length; i++)
|
|
49
50
|
value[i] = -value[i];
|
|
50
51
|
}
|
|
@@ -58,7 +59,7 @@ var LeaferUI = (function (exports) {
|
|
|
58
59
|
if (num instanceof Array) {
|
|
59
60
|
switch (num.length) {
|
|
60
61
|
case 4:
|
|
61
|
-
data = num;
|
|
62
|
+
data = maxValue === undefined ? num : [...num];
|
|
62
63
|
break;
|
|
63
64
|
case 2:
|
|
64
65
|
data = [num[0], num[1], num[0], num[1]];
|
|
@@ -119,7 +120,7 @@ var LeaferUI = (function (exports) {
|
|
|
119
120
|
|
|
120
121
|
const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
|
|
121
122
|
const { float: float$1 } = MathHelper;
|
|
122
|
-
const tempPoint$
|
|
123
|
+
const tempPoint$3 = {};
|
|
123
124
|
function getWorld() {
|
|
124
125
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
|
|
125
126
|
}
|
|
@@ -160,8 +161,8 @@ var LeaferUI = (function (exports) {
|
|
|
160
161
|
t.d *= scaleY;
|
|
161
162
|
},
|
|
162
163
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
163
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
164
|
-
M$6.scaleOfInner(t, tempPoint$
|
|
164
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
165
|
+
M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
|
|
165
166
|
},
|
|
166
167
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
167
168
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -179,8 +180,8 @@ var LeaferUI = (function (exports) {
|
|
|
179
180
|
t.d = c * sinR + d * cosR;
|
|
180
181
|
},
|
|
181
182
|
rotateOfOuter(t, origin, rotation) {
|
|
182
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
183
|
-
M$6.rotateOfInner(t, tempPoint$
|
|
183
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
184
|
+
M$6.rotateOfInner(t, tempPoint$3, rotation);
|
|
184
185
|
},
|
|
185
186
|
rotateOfInner(t, origin, rotation) {
|
|
186
187
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -201,8 +202,8 @@ var LeaferUI = (function (exports) {
|
|
|
201
202
|
}
|
|
202
203
|
},
|
|
203
204
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
204
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
205
|
-
M$6.skewOfInner(t, tempPoint$
|
|
205
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
206
|
+
M$6.skewOfInner(t, tempPoint$3, skewX, skewY);
|
|
206
207
|
},
|
|
207
208
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
208
209
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -449,19 +450,19 @@ var LeaferUI = (function (exports) {
|
|
|
449
450
|
},
|
|
450
451
|
tempToInnerOf(t, matrix) {
|
|
451
452
|
const { tempPoint: temp } = P$5;
|
|
452
|
-
copy$
|
|
453
|
+
copy$a(temp, t);
|
|
453
454
|
toInnerPoint$2(matrix, temp, temp);
|
|
454
455
|
return temp;
|
|
455
456
|
},
|
|
456
457
|
tempToOuterOf(t, matrix) {
|
|
457
458
|
const { tempPoint: temp } = P$5;
|
|
458
|
-
copy$
|
|
459
|
+
copy$a(temp, t);
|
|
459
460
|
toOuterPoint$2(matrix, temp, temp);
|
|
460
461
|
return temp;
|
|
461
462
|
},
|
|
462
463
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
463
464
|
const { tempRadiusPoint: temp } = P$5;
|
|
464
|
-
copy$
|
|
465
|
+
copy$a(temp, t);
|
|
465
466
|
P$5.toInnerRadiusPointOf(t, matrix, temp);
|
|
466
467
|
return temp;
|
|
467
468
|
},
|
|
@@ -528,7 +529,7 @@ var LeaferUI = (function (exports) {
|
|
|
528
529
|
}
|
|
529
530
|
};
|
|
530
531
|
const P$5 = PointHelper;
|
|
531
|
-
const { getDistanceFrom, copy: copy$
|
|
532
|
+
const { getDistanceFrom, copy: copy$a, getAtan2 } = P$5;
|
|
532
533
|
|
|
533
534
|
class Point {
|
|
534
535
|
constructor(x, y) {
|
|
@@ -596,6 +597,7 @@ var LeaferUI = (function (exports) {
|
|
|
596
597
|
return this;
|
|
597
598
|
}
|
|
598
599
|
}
|
|
600
|
+
const tempPoint$2 = new Point();
|
|
599
601
|
|
|
600
602
|
class Matrix {
|
|
601
603
|
constructor(a, b, c, d, e, f) {
|
|
@@ -605,6 +607,12 @@ var LeaferUI = (function (exports) {
|
|
|
605
607
|
typeof a === 'object' ? MatrixHelper.copy(this, a) : MatrixHelper.set(this, a, b, c, d, e, f);
|
|
606
608
|
return this;
|
|
607
609
|
}
|
|
610
|
+
setWith(dataWithScale) {
|
|
611
|
+
MatrixHelper.copy(this, dataWithScale);
|
|
612
|
+
this.scaleX = dataWithScale.scaleX;
|
|
613
|
+
this.scaleY = dataWithScale.scaleY;
|
|
614
|
+
return this;
|
|
615
|
+
}
|
|
608
616
|
get() {
|
|
609
617
|
const { a, b, c, d, e, f } = this;
|
|
610
618
|
return { a, b, c, d, e, f };
|
|
@@ -624,6 +632,12 @@ var LeaferUI = (function (exports) {
|
|
|
624
632
|
MatrixHelper.scale(this, x, y);
|
|
625
633
|
return this;
|
|
626
634
|
}
|
|
635
|
+
scaleWith(x, y) {
|
|
636
|
+
MatrixHelper.scale(this, x, y);
|
|
637
|
+
this.scaleX *= x;
|
|
638
|
+
this.scaleY *= y || x;
|
|
639
|
+
return this;
|
|
640
|
+
}
|
|
627
641
|
scaleOfOuter(origin, x, y) {
|
|
628
642
|
MatrixHelper.scaleOfOuter(this, origin, x, y);
|
|
629
643
|
return this;
|
|
@@ -676,6 +690,12 @@ var LeaferUI = (function (exports) {
|
|
|
676
690
|
MatrixHelper.invert(this);
|
|
677
691
|
return this;
|
|
678
692
|
}
|
|
693
|
+
invertWith() {
|
|
694
|
+
MatrixHelper.invert(this);
|
|
695
|
+
this.scaleX = 1 / this.scaleX;
|
|
696
|
+
this.scaleY = 1 / this.scaleY;
|
|
697
|
+
return this;
|
|
698
|
+
}
|
|
679
699
|
toOuterPoint(inner, to, distance) {
|
|
680
700
|
MatrixHelper.toOuterPoint(this, inner, to, distance);
|
|
681
701
|
}
|
|
@@ -696,6 +716,7 @@ var LeaferUI = (function (exports) {
|
|
|
696
716
|
MatrixHelper.reset(this);
|
|
697
717
|
}
|
|
698
718
|
}
|
|
719
|
+
const tempMatrix = new Matrix();
|
|
699
720
|
|
|
700
721
|
const TwoPointBoundsHelper = {
|
|
701
722
|
tempPointBounds: {},
|
|
@@ -784,7 +805,7 @@ var LeaferUI = (function (exports) {
|
|
|
784
805
|
to = t;
|
|
785
806
|
}
|
|
786
807
|
else {
|
|
787
|
-
copy$
|
|
808
|
+
copy$9(to, t);
|
|
788
809
|
}
|
|
789
810
|
if (parent) {
|
|
790
811
|
to.offsetX = -(B.maxX(parent) - t.x);
|
|
@@ -859,8 +880,8 @@ var LeaferUI = (function (exports) {
|
|
|
859
880
|
B.move(to, -matrix.e, -matrix.f);
|
|
860
881
|
B.scale(to, 1 / matrix.a, 1 / matrix.d);
|
|
861
882
|
},
|
|
862
|
-
getFitMatrix(t, put) {
|
|
863
|
-
const scale = Math.min(
|
|
883
|
+
getFitMatrix(t, put, baseScale = 1) {
|
|
884
|
+
const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
|
|
864
885
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
865
886
|
},
|
|
866
887
|
getSpread(t, spreadX, spreadY) {
|
|
@@ -894,11 +915,15 @@ var LeaferUI = (function (exports) {
|
|
|
894
915
|
t.width = float(t.width, maxLength);
|
|
895
916
|
t.height = float(t.height, maxLength);
|
|
896
917
|
},
|
|
897
|
-
add(t, bounds) {
|
|
918
|
+
add(t, bounds, isPoint) {
|
|
898
919
|
right$1 = t.x + t.width;
|
|
899
920
|
bottom$1 = t.y + t.height;
|
|
900
|
-
boundsRight = bounds.x
|
|
901
|
-
boundsBottom = bounds.y
|
|
921
|
+
boundsRight = bounds.x;
|
|
922
|
+
boundsBottom = bounds.y;
|
|
923
|
+
if (!isPoint) {
|
|
924
|
+
boundsRight += bounds.width;
|
|
925
|
+
boundsBottom += bounds.height;
|
|
926
|
+
}
|
|
902
927
|
right$1 = right$1 > boundsRight ? right$1 : boundsRight;
|
|
903
928
|
bottom$1 = bottom$1 > boundsBottom ? bottom$1 : boundsBottom;
|
|
904
929
|
t.x = t.x < bounds.x ? t.x : bounds.x;
|
|
@@ -923,7 +948,7 @@ var LeaferUI = (function (exports) {
|
|
|
923
948
|
if (first) {
|
|
924
949
|
first = false;
|
|
925
950
|
if (!addMode)
|
|
926
|
-
copy$
|
|
951
|
+
copy$9(t, bounds);
|
|
927
952
|
}
|
|
928
953
|
else {
|
|
929
954
|
add$1(t, bounds);
|
|
@@ -937,6 +962,9 @@ var LeaferUI = (function (exports) {
|
|
|
937
962
|
points.forEach((point, index) => index === 0 ? setPoint$3(tempPointBounds$1, point.x, point.y) : addPoint$3(tempPointBounds$1, point.x, point.y));
|
|
938
963
|
toBounds$4(tempPointBounds$1, t);
|
|
939
964
|
},
|
|
965
|
+
addPoint(t, point) {
|
|
966
|
+
add$1(t, point, true);
|
|
967
|
+
},
|
|
940
968
|
getPoints(t) {
|
|
941
969
|
const { x, y, width, height } = t;
|
|
942
970
|
return [
|
|
@@ -998,7 +1026,7 @@ var LeaferUI = (function (exports) {
|
|
|
998
1026
|
}
|
|
999
1027
|
};
|
|
1000
1028
|
const B = BoundsHelper;
|
|
1001
|
-
const { add: add$1, copy: copy$
|
|
1029
|
+
const { add: add$1, copy: copy$9 } = B;
|
|
1002
1030
|
|
|
1003
1031
|
class Bounds {
|
|
1004
1032
|
get minX() { return BoundsHelper.minX(this); }
|
|
@@ -1039,8 +1067,8 @@ var LeaferUI = (function (exports) {
|
|
|
1039
1067
|
BoundsHelper.toInnerOf(this, matrix, to);
|
|
1040
1068
|
return this;
|
|
1041
1069
|
}
|
|
1042
|
-
getFitMatrix(put) {
|
|
1043
|
-
return BoundsHelper.getFitMatrix(this, put);
|
|
1070
|
+
getFitMatrix(put, baseScale) {
|
|
1071
|
+
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1044
1072
|
}
|
|
1045
1073
|
spread(fourNumber, spreadY) {
|
|
1046
1074
|
BoundsHelper.spread(this, fourNumber, spreadY);
|
|
@@ -1086,6 +1114,10 @@ var LeaferUI = (function (exports) {
|
|
|
1086
1114
|
BoundsHelper.setPoints(this, points);
|
|
1087
1115
|
return this;
|
|
1088
1116
|
}
|
|
1117
|
+
addPoint(point) {
|
|
1118
|
+
BoundsHelper.addPoint(this, point);
|
|
1119
|
+
return this;
|
|
1120
|
+
}
|
|
1089
1121
|
getPoints() {
|
|
1090
1122
|
return BoundsHelper.getPoints(this);
|
|
1091
1123
|
}
|
|
@@ -1118,6 +1150,7 @@ var LeaferUI = (function (exports) {
|
|
|
1118
1150
|
BoundsHelper.reset(this);
|
|
1119
1151
|
}
|
|
1120
1152
|
}
|
|
1153
|
+
const tempBounds$1 = new Bounds();
|
|
1121
1154
|
|
|
1122
1155
|
class AutoBounds {
|
|
1123
1156
|
constructor(top, right, bottom, left, width, height) {
|
|
@@ -1235,7 +1268,8 @@ var LeaferUI = (function (exports) {
|
|
|
1235
1268
|
this.warn(...messages);
|
|
1236
1269
|
}
|
|
1237
1270
|
warn(...messages) {
|
|
1238
|
-
|
|
1271
|
+
if (D$4.showWarn)
|
|
1272
|
+
console.warn(this.name, ...messages);
|
|
1239
1273
|
}
|
|
1240
1274
|
repeat(name, ...messages) {
|
|
1241
1275
|
if (!this.repeatMap[name]) {
|
|
@@ -1254,6 +1288,7 @@ var LeaferUI = (function (exports) {
|
|
|
1254
1288
|
}
|
|
1255
1289
|
Debug.filterList = [];
|
|
1256
1290
|
Debug.excludeList = [];
|
|
1291
|
+
Debug.showWarn = true;
|
|
1257
1292
|
function getNameList(name) {
|
|
1258
1293
|
if (!name)
|
|
1259
1294
|
name = [];
|
|
@@ -1263,7 +1298,7 @@ var LeaferUI = (function (exports) {
|
|
|
1263
1298
|
}
|
|
1264
1299
|
const D$4 = Debug;
|
|
1265
1300
|
|
|
1266
|
-
const debug$
|
|
1301
|
+
const debug$d = Debug.get('RunTime');
|
|
1267
1302
|
const Run = {
|
|
1268
1303
|
currentId: 0,
|
|
1269
1304
|
currentName: '',
|
|
@@ -1281,7 +1316,7 @@ var LeaferUI = (function (exports) {
|
|
|
1281
1316
|
const time = R.idMap[id], name = R.nameMap[id];
|
|
1282
1317
|
const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
|
|
1283
1318
|
R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
|
|
1284
|
-
debug$
|
|
1319
|
+
debug$d.log(name, duration, 'ms');
|
|
1285
1320
|
},
|
|
1286
1321
|
endOfName(name, microsecond) {
|
|
1287
1322
|
const id = R.nameToIdMap[name];
|
|
@@ -1291,13 +1326,13 @@ var LeaferUI = (function (exports) {
|
|
|
1291
1326
|
};
|
|
1292
1327
|
const R = Run;
|
|
1293
1328
|
|
|
1294
|
-
const debug$
|
|
1329
|
+
const debug$c = Debug.get('UICreator');
|
|
1295
1330
|
const UICreator = {
|
|
1296
1331
|
list: {},
|
|
1297
1332
|
register(UI) {
|
|
1298
1333
|
const { __tag: tag } = UI.prototype;
|
|
1299
1334
|
if (list$1[tag]) {
|
|
1300
|
-
debug$
|
|
1335
|
+
debug$c.repeat(tag);
|
|
1301
1336
|
}
|
|
1302
1337
|
else {
|
|
1303
1338
|
list$1[tag] = UI;
|
|
@@ -1319,7 +1354,7 @@ var LeaferUI = (function (exports) {
|
|
|
1319
1354
|
};
|
|
1320
1355
|
const { list: list$1 } = UICreator;
|
|
1321
1356
|
|
|
1322
|
-
const debug$
|
|
1357
|
+
const debug$b = Debug.get('EventCreator');
|
|
1323
1358
|
const EventCreator = {
|
|
1324
1359
|
nameList: {},
|
|
1325
1360
|
register(Event) {
|
|
@@ -1327,7 +1362,7 @@ var LeaferUI = (function (exports) {
|
|
|
1327
1362
|
Object.keys(Event).forEach(key => {
|
|
1328
1363
|
name = Event[key];
|
|
1329
1364
|
if (typeof name === 'string')
|
|
1330
|
-
nameList[name] ? debug$
|
|
1365
|
+
nameList[name] ? debug$b.repeat(name) : nameList[name] = Event;
|
|
1331
1366
|
});
|
|
1332
1367
|
},
|
|
1333
1368
|
changeName(oldName, newName) {
|
|
@@ -1538,36 +1573,7 @@ var LeaferUI = (function (exports) {
|
|
|
1538
1573
|
Answer[Answer["NoAndSkip"] = 2] = "NoAndSkip";
|
|
1539
1574
|
Answer[Answer["YesAndSkip"] = 3] = "YesAndSkip";
|
|
1540
1575
|
})(exports.Answer || (exports.Answer = {}));
|
|
1541
|
-
|
|
1542
|
-
const FileHelper = {
|
|
1543
|
-
opacityTypes: ['png', 'webp', 'svg'],
|
|
1544
|
-
upperCaseTypeMap: {},
|
|
1545
|
-
mineType(type) {
|
|
1546
|
-
if (!type || type.startsWith('image'))
|
|
1547
|
-
return type;
|
|
1548
|
-
if (type === 'jpg')
|
|
1549
|
-
type = 'jpeg';
|
|
1550
|
-
return 'image/' + type;
|
|
1551
|
-
},
|
|
1552
|
-
fileType(filename) {
|
|
1553
|
-
const l = filename.split('.');
|
|
1554
|
-
return l[l.length - 1];
|
|
1555
|
-
},
|
|
1556
|
-
isOpaqueImage(filename) {
|
|
1557
|
-
const type = F$4.fileType(filename);
|
|
1558
|
-
return ['jpg', 'jpeg'].some(item => item === type);
|
|
1559
|
-
},
|
|
1560
|
-
getExportOptions(options) {
|
|
1561
|
-
switch (typeof options) {
|
|
1562
|
-
case 'object': return options;
|
|
1563
|
-
case 'number': return { quality: options };
|
|
1564
|
-
case 'boolean': return { blob: options };
|
|
1565
|
-
default: return {};
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
};
|
|
1569
|
-
const F$4 = FileHelper;
|
|
1570
|
-
F$4.opacityTypes.forEach(type => F$4.upperCaseTypeMap[type] = type.toUpperCase());
|
|
1576
|
+
const emptyData = {};
|
|
1571
1577
|
|
|
1572
1578
|
/******************************************************************************
|
|
1573
1579
|
Copyright (c) Microsoft Corporation.
|
|
@@ -1891,10 +1897,8 @@ var LeaferUI = (function (exports) {
|
|
|
1891
1897
|
contextMethod()
|
|
1892
1898
|
], Canvas.prototype, "strokeText", null);
|
|
1893
1899
|
|
|
1894
|
-
const { copy: copy$
|
|
1895
|
-
const temp = new Bounds();
|
|
1900
|
+
const { copy: copy$8 } = MatrixHelper;
|
|
1896
1901
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
1897
|
-
const debug$9 = Debug.get('LeaferCanvasBase');
|
|
1898
1902
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
1899
1903
|
class LeaferCanvasBase extends Canvas {
|
|
1900
1904
|
get width() { return this.size.width; }
|
|
@@ -1921,44 +1925,15 @@ var LeaferUI = (function (exports) {
|
|
|
1921
1925
|
}
|
|
1922
1926
|
init() { }
|
|
1923
1927
|
__createContext() {
|
|
1924
|
-
|
|
1928
|
+
const { view } = this;
|
|
1929
|
+
const { contextSettings } = this.config;
|
|
1930
|
+
this.context = contextSettings ? view.getContext('2d', contextSettings) : view.getContext('2d');
|
|
1925
1931
|
this.__bindContext();
|
|
1926
1932
|
}
|
|
1927
|
-
export(
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
}
|
|
1932
|
-
else if (blob) {
|
|
1933
|
-
return this.toBlob(filename, quality);
|
|
1934
|
-
}
|
|
1935
|
-
else {
|
|
1936
|
-
return this.toDataURL(filename, quality);
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
toBlob(type, quality) {
|
|
1940
|
-
return new Promise((resolve) => {
|
|
1941
|
-
Platform.origin.canvasToBolb(this.view, type, quality).then((blob) => {
|
|
1942
|
-
resolve(blob);
|
|
1943
|
-
}).catch((e) => {
|
|
1944
|
-
debug$9.error(e);
|
|
1945
|
-
resolve(null);
|
|
1946
|
-
});
|
|
1947
|
-
});
|
|
1948
|
-
}
|
|
1949
|
-
toDataURL(type, quality) {
|
|
1950
|
-
return Platform.origin.canvasToDataURL(this.view, type, quality);
|
|
1951
|
-
}
|
|
1952
|
-
saveAs(filename, quality) {
|
|
1953
|
-
return new Promise((resolve) => {
|
|
1954
|
-
Platform.origin.canvasSaveAs(this.view, filename, quality).then(() => {
|
|
1955
|
-
resolve(true);
|
|
1956
|
-
}).catch((e) => {
|
|
1957
|
-
debug$9.error(e);
|
|
1958
|
-
resolve(false);
|
|
1959
|
-
});
|
|
1960
|
-
});
|
|
1961
|
-
}
|
|
1933
|
+
export(_filename, _options) { return undefined; }
|
|
1934
|
+
toBlob(_type, _quality) { return undefined; }
|
|
1935
|
+
toDataURL(_type, _quality) { return undefined; }
|
|
1936
|
+
saveAs(_filename, _quality) { return undefined; }
|
|
1962
1937
|
resize(size) {
|
|
1963
1938
|
if (this.isSameSize(size))
|
|
1964
1939
|
return;
|
|
@@ -2026,13 +2001,9 @@ var LeaferUI = (function (exports) {
|
|
|
2026
2001
|
restoreBlendMode() {
|
|
2027
2002
|
this.blendMode = this.savedBlendMode;
|
|
2028
2003
|
}
|
|
2029
|
-
hitFill(
|
|
2030
|
-
|
|
2031
|
-
}
|
|
2032
|
-
hitStroke(point, strokeWidth) {
|
|
2033
|
-
this.strokeWidth = strokeWidth;
|
|
2034
|
-
return this.context.isPointInStroke(point.x, point.y);
|
|
2035
|
-
}
|
|
2004
|
+
hitFill(_point, _fillRule) { return true; }
|
|
2005
|
+
hitStroke(_point, _strokeWidth) { return true; }
|
|
2006
|
+
hitPixel(_radiusPoint, _offset, _scale = 1) { return true; }
|
|
2036
2007
|
setWorldShadow(x, y, blur, color) {
|
|
2037
2008
|
const { pixelRatio } = this;
|
|
2038
2009
|
this.shadowOffsetX = x * pixelRatio;
|
|
@@ -2091,8 +2062,8 @@ var LeaferUI = (function (exports) {
|
|
|
2091
2062
|
if (blendMode)
|
|
2092
2063
|
this.blendMode = blendMode;
|
|
2093
2064
|
this.fillStyle = color;
|
|
2094
|
-
|
|
2095
|
-
this.fillRect(
|
|
2065
|
+
tempBounds$1.set(bounds).scale(this.pixelRatio);
|
|
2066
|
+
this.fillRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2096
2067
|
if (blendMode)
|
|
2097
2068
|
this.blendMode = 'source-over';
|
|
2098
2069
|
}
|
|
@@ -2100,23 +2071,23 @@ var LeaferUI = (function (exports) {
|
|
|
2100
2071
|
if (blendMode)
|
|
2101
2072
|
this.blendMode = blendMode;
|
|
2102
2073
|
this.strokeStyle = color;
|
|
2103
|
-
|
|
2104
|
-
this.strokeRect(
|
|
2074
|
+
tempBounds$1.set(bounds).scale(this.pixelRatio);
|
|
2075
|
+
this.strokeRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2105
2076
|
if (blendMode)
|
|
2106
2077
|
this.blendMode = 'source-over';
|
|
2107
2078
|
}
|
|
2108
2079
|
clearWorld(bounds, ceilPixel) {
|
|
2109
|
-
|
|
2080
|
+
tempBounds$1.set(bounds).scale(this.pixelRatio);
|
|
2110
2081
|
if (ceilPixel)
|
|
2111
|
-
|
|
2112
|
-
this.clearRect(
|
|
2082
|
+
tempBounds$1.ceil();
|
|
2083
|
+
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2113
2084
|
}
|
|
2114
2085
|
clipWorld(bounds, ceilPixel) {
|
|
2115
2086
|
this.beginPath();
|
|
2116
|
-
|
|
2087
|
+
tempBounds$1.set(bounds).scale(this.pixelRatio);
|
|
2117
2088
|
if (ceilPixel)
|
|
2118
|
-
|
|
2119
|
-
this.rect(
|
|
2089
|
+
tempBounds$1.ceil();
|
|
2090
|
+
this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2120
2091
|
this.clip();
|
|
2121
2092
|
}
|
|
2122
2093
|
clear() {
|
|
@@ -2130,7 +2101,7 @@ var LeaferUI = (function (exports) {
|
|
|
2130
2101
|
const canvas = this.manager ? this.manager.get(this.size) : Creator.canvas(Object.assign({}, this.size));
|
|
2131
2102
|
canvas.save();
|
|
2132
2103
|
if (useSameWorldTransform)
|
|
2133
|
-
copy$
|
|
2104
|
+
copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2134
2105
|
if (useSameSmooth)
|
|
2135
2106
|
canvas.smooth = this.smooth;
|
|
2136
2107
|
return canvas;
|
|
@@ -2500,10 +2471,10 @@ var LeaferUI = (function (exports) {
|
|
|
2500
2471
|
}
|
|
2501
2472
|
};
|
|
2502
2473
|
|
|
2503
|
-
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$
|
|
2474
|
+
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;
|
|
2504
2475
|
const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
|
|
2505
2476
|
const { ellipticalArc } = EllipseHelper;
|
|
2506
|
-
const debug$
|
|
2477
|
+
const debug$a = Debug.get('PathConvert');
|
|
2507
2478
|
const setEndPoint$1 = {};
|
|
2508
2479
|
const PathConvert = {
|
|
2509
2480
|
current: { dot: 0 },
|
|
@@ -2715,7 +2686,7 @@ var LeaferUI = (function (exports) {
|
|
|
2715
2686
|
y = setEndPoint$1.y;
|
|
2716
2687
|
i += 9;
|
|
2717
2688
|
break;
|
|
2718
|
-
case F$
|
|
2689
|
+
case F$4:
|
|
2719
2690
|
curveMode ? ellipse$4(data, old[i + 1], old[i + 2], old[i + 3], old[i + 4], 0, 0, 360, false) : copyData(data, old, i, 5);
|
|
2720
2691
|
x = old[i + 1] + old[i + 3];
|
|
2721
2692
|
y = old[i + 2];
|
|
@@ -2740,7 +2711,7 @@ var LeaferUI = (function (exports) {
|
|
|
2740
2711
|
i += 6;
|
|
2741
2712
|
break;
|
|
2742
2713
|
default:
|
|
2743
|
-
debug$
|
|
2714
|
+
debug$a.error(`command: ${command} [index:${i}]`, old);
|
|
2744
2715
|
return data;
|
|
2745
2716
|
}
|
|
2746
2717
|
lastCommand = command;
|
|
@@ -2764,7 +2735,7 @@ var LeaferUI = (function (exports) {
|
|
|
2764
2735
|
};
|
|
2765
2736
|
const { current, pushData, copyData } = PathConvert;
|
|
2766
2737
|
|
|
2767
|
-
const { M: M$3, L: L$4, C: C$3, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$
|
|
2738
|
+
const { M: M$3, L: L$4, C: C$3, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2 } = PathCommandMap;
|
|
2768
2739
|
const { getMinDistanceFrom, getRadianFrom } = PointHelper;
|
|
2769
2740
|
const { tan, min, abs: abs$2 } = Math;
|
|
2770
2741
|
const startPoint = {};
|
|
@@ -2806,7 +2777,7 @@ var LeaferUI = (function (exports) {
|
|
|
2806
2777
|
},
|
|
2807
2778
|
ellipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2808
2779
|
if (rotation === undefined) {
|
|
2809
|
-
data.push(F$
|
|
2780
|
+
data.push(F$3, x, y, radiusX, radiusY);
|
|
2810
2781
|
}
|
|
2811
2782
|
else {
|
|
2812
2783
|
if (startAngle === undefined)
|
|
@@ -2856,6 +2827,7 @@ var LeaferUI = (function (exports) {
|
|
|
2856
2827
|
set path(value) { this.__path = value; }
|
|
2857
2828
|
get path() { return this.__path; }
|
|
2858
2829
|
constructor(path) {
|
|
2830
|
+
this.clearPath = this.beginPath;
|
|
2859
2831
|
this.set(path);
|
|
2860
2832
|
}
|
|
2861
2833
|
set(path) {
|
|
@@ -2925,8 +2897,8 @@ var LeaferUI = (function (exports) {
|
|
|
2925
2897
|
}
|
|
2926
2898
|
}
|
|
2927
2899
|
|
|
2928
|
-
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$
|
|
2929
|
-
const debug$
|
|
2900
|
+
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;
|
|
2901
|
+
const debug$9 = Debug.get('PathDrawer');
|
|
2930
2902
|
const PathDrawer = {
|
|
2931
2903
|
drawPathByData(drawer, data) {
|
|
2932
2904
|
if (!data)
|
|
@@ -2972,7 +2944,7 @@ var LeaferUI = (function (exports) {
|
|
|
2972
2944
|
drawer.ellipse(data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5] * OneRadian, data[i + 6] * OneRadian, data[i + 7] * OneRadian, data[i + 8]);
|
|
2973
2945
|
i += 9;
|
|
2974
2946
|
break;
|
|
2975
|
-
case F$
|
|
2947
|
+
case F$2:
|
|
2976
2948
|
drawer.ellipse(data[i + 1], data[i + 2], data[i + 3], data[i + 4], 0, 0, PI2, false);
|
|
2977
2949
|
i += 5;
|
|
2978
2950
|
break;
|
|
@@ -2989,17 +2961,17 @@ var LeaferUI = (function (exports) {
|
|
|
2989
2961
|
i += 6;
|
|
2990
2962
|
break;
|
|
2991
2963
|
default:
|
|
2992
|
-
debug$
|
|
2964
|
+
debug$9.error(`command: ${command} [index:${i}]`, data);
|
|
2993
2965
|
return;
|
|
2994
2966
|
}
|
|
2995
2967
|
}
|
|
2996
2968
|
}
|
|
2997
2969
|
};
|
|
2998
2970
|
|
|
2999
|
-
const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F, O, P, U } = PathCommandMap;
|
|
2971
|
+
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;
|
|
3000
2972
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
|
|
3001
|
-
const { addPointBounds, copy: copy$
|
|
3002
|
-
const debug$
|
|
2973
|
+
const { addPointBounds, copy: copy$7, addPoint: addPoint$1, setPoint: setPoint$1, addBounds, toBounds: toBounds$3 } = TwoPointBoundsHelper;
|
|
2974
|
+
const debug$8 = Debug.get('PathBounds');
|
|
3003
2975
|
let radius, radiusX, radiusY;
|
|
3004
2976
|
const tempPointBounds = {};
|
|
3005
2977
|
const setPointBounds = {};
|
|
@@ -3071,12 +3043,12 @@ var LeaferUI = (function (exports) {
|
|
|
3071
3043
|
break;
|
|
3072
3044
|
case G:
|
|
3073
3045
|
ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
|
|
3074
|
-
i === 0 ? copy$
|
|
3046
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3075
3047
|
x = setEndPoint.x;
|
|
3076
3048
|
y = setEndPoint.y;
|
|
3077
3049
|
i += 9;
|
|
3078
3050
|
break;
|
|
3079
|
-
case F:
|
|
3051
|
+
case F$1:
|
|
3080
3052
|
x = data[i + 1];
|
|
3081
3053
|
y = data[i + 2];
|
|
3082
3054
|
radiusX = data[i + 3];
|
|
@@ -3087,7 +3059,7 @@ var LeaferUI = (function (exports) {
|
|
|
3087
3059
|
break;
|
|
3088
3060
|
case O:
|
|
3089
3061
|
arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
|
|
3090
|
-
i === 0 ? copy$
|
|
3062
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3091
3063
|
x = setEndPoint.x;
|
|
3092
3064
|
y = setEndPoint.y;
|
|
3093
3065
|
i += 7;
|
|
@@ -3102,13 +3074,13 @@ var LeaferUI = (function (exports) {
|
|
|
3102
3074
|
break;
|
|
3103
3075
|
case U:
|
|
3104
3076
|
arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3105
|
-
i === 0 ? copy$
|
|
3077
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3106
3078
|
x = setEndPoint.x;
|
|
3107
3079
|
y = setEndPoint.y;
|
|
3108
3080
|
i += 6;
|
|
3109
3081
|
break;
|
|
3110
3082
|
default:
|
|
3111
|
-
debug$
|
|
3083
|
+
debug$8.error(`command: ${command} [index:${i}]`, data);
|
|
3112
3084
|
return;
|
|
3113
3085
|
}
|
|
3114
3086
|
}
|
|
@@ -3194,7 +3166,37 @@ var LeaferUI = (function (exports) {
|
|
|
3194
3166
|
roundRect(drawer);
|
|
3195
3167
|
}
|
|
3196
3168
|
|
|
3197
|
-
const
|
|
3169
|
+
const FileHelper = {
|
|
3170
|
+
opacityTypes: ['png', 'webp', 'svg'],
|
|
3171
|
+
upperCaseTypeMap: {},
|
|
3172
|
+
mineType(type) {
|
|
3173
|
+
if (!type || type.startsWith('image'))
|
|
3174
|
+
return type;
|
|
3175
|
+
if (type === 'jpg')
|
|
3176
|
+
type = 'jpeg';
|
|
3177
|
+
return 'image/' + type;
|
|
3178
|
+
},
|
|
3179
|
+
fileType(filename) {
|
|
3180
|
+
const l = filename.split('.');
|
|
3181
|
+
return l[l.length - 1];
|
|
3182
|
+
},
|
|
3183
|
+
isOpaqueImage(filename) {
|
|
3184
|
+
const type = F.fileType(filename);
|
|
3185
|
+
return ['jpg', 'jpeg'].some(item => item === type);
|
|
3186
|
+
},
|
|
3187
|
+
getExportOptions(options) {
|
|
3188
|
+
switch (typeof options) {
|
|
3189
|
+
case 'object': return options;
|
|
3190
|
+
case 'number': return { quality: options };
|
|
3191
|
+
case 'boolean': return { blob: options };
|
|
3192
|
+
default: return {};
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
};
|
|
3196
|
+
const F = FileHelper;
|
|
3197
|
+
F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3198
|
+
|
|
3199
|
+
const debug$7 = Debug.get('TaskProcessor');
|
|
3198
3200
|
class TaskItem {
|
|
3199
3201
|
constructor(task) {
|
|
3200
3202
|
this.parallel = true;
|
|
@@ -3209,7 +3211,7 @@ var LeaferUI = (function (exports) {
|
|
|
3209
3211
|
yield this.task();
|
|
3210
3212
|
}
|
|
3211
3213
|
catch (error) {
|
|
3212
|
-
debug$
|
|
3214
|
+
debug$7.error(error);
|
|
3213
3215
|
}
|
|
3214
3216
|
});
|
|
3215
3217
|
}
|
|
@@ -3493,6 +3495,7 @@ var LeaferUI = (function (exports) {
|
|
|
3493
3495
|
},
|
|
3494
3496
|
destroy() {
|
|
3495
3497
|
I.map = {};
|
|
3498
|
+
I.recycledList = [];
|
|
3496
3499
|
}
|
|
3497
3500
|
};
|
|
3498
3501
|
const I = ImageManager;
|
|
@@ -3607,84 +3610,75 @@ var LeaferUI = (function (exports) {
|
|
|
3607
3610
|
return Object.getOwnPropertyNames(object);
|
|
3608
3611
|
}
|
|
3609
3612
|
|
|
3610
|
-
function
|
|
3613
|
+
function decorateLeafAttr(defaultValue, descriptorFn) {
|
|
3614
|
+
return (target, key) => defineLeafAttr(target, key, defaultValue, descriptorFn && descriptorFn(key));
|
|
3615
|
+
}
|
|
3616
|
+
function attr(partDescriptor) {
|
|
3617
|
+
return partDescriptor;
|
|
3618
|
+
}
|
|
3619
|
+
function defineLeafAttr(target, key, defaultValue, partDescriptor) {
|
|
3611
3620
|
const defaultDescriptor = {
|
|
3612
3621
|
get() { return this.__getAttr(key); },
|
|
3613
3622
|
set(value) { this.__setAttr(key, value); },
|
|
3614
3623
|
configurable: true,
|
|
3615
3624
|
enumerable: true
|
|
3616
3625
|
};
|
|
3617
|
-
defineKey(target, key, Object.assign(defaultDescriptor,
|
|
3626
|
+
defineKey(target, key, Object.assign(defaultDescriptor, partDescriptor || {}));
|
|
3618
3627
|
defineDataProcessor(target, key, defaultValue);
|
|
3619
3628
|
}
|
|
3620
3629
|
function dataType(defaultValue) {
|
|
3621
|
-
return (
|
|
3622
|
-
defineLeafAttr(target, key, defaultValue);
|
|
3623
|
-
};
|
|
3630
|
+
return decorateLeafAttr(defaultValue);
|
|
3624
3631
|
}
|
|
3625
|
-
function positionType(defaultValue) {
|
|
3626
|
-
return (
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
});
|
|
3633
|
-
};
|
|
3632
|
+
function positionType(defaultValue, checkFiniteNumber) {
|
|
3633
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3634
|
+
set(value) {
|
|
3635
|
+
this.__setAttr(key, value, checkFiniteNumber);
|
|
3636
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3637
|
+
}
|
|
3638
|
+
}));
|
|
3634
3639
|
}
|
|
3635
3640
|
function autoLayoutType(defaultValue) {
|
|
3636
|
-
return (
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
});
|
|
3646
|
-
};
|
|
3641
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3642
|
+
set(value) {
|
|
3643
|
+
this.__setAttr(key, value);
|
|
3644
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3645
|
+
this.__hasAutoLayout = !!value;
|
|
3646
|
+
if (!this.__local)
|
|
3647
|
+
this.__layout.createLocal();
|
|
3648
|
+
}
|
|
3649
|
+
}));
|
|
3647
3650
|
}
|
|
3648
|
-
function scaleType(defaultValue) {
|
|
3649
|
-
return (
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
});
|
|
3656
|
-
};
|
|
3651
|
+
function scaleType(defaultValue, checkFiniteNumber) {
|
|
3652
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3653
|
+
set(value) {
|
|
3654
|
+
this.__setAttr(key, value, checkFiniteNumber);
|
|
3655
|
+
this.__layout.scaleChanged || this.__layout.scaleChange();
|
|
3656
|
+
}
|
|
3657
|
+
}));
|
|
3657
3658
|
}
|
|
3658
|
-
function rotationType(defaultValue) {
|
|
3659
|
-
return (
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
});
|
|
3666
|
-
};
|
|
3659
|
+
function rotationType(defaultValue, checkFiniteNumber) {
|
|
3660
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3661
|
+
set(value) {
|
|
3662
|
+
this.__setAttr(key, value, checkFiniteNumber);
|
|
3663
|
+
this.__layout.rotationChanged || this.__layout.rotationChange();
|
|
3664
|
+
}
|
|
3665
|
+
}));
|
|
3667
3666
|
}
|
|
3668
|
-
function boundsType(defaultValue) {
|
|
3669
|
-
return (
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
}
|
|
3675
|
-
});
|
|
3676
|
-
};
|
|
3667
|
+
function boundsType(defaultValue, checkFiniteNumber) {
|
|
3668
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3669
|
+
set(value) {
|
|
3670
|
+
this.__setAttr(key, value, checkFiniteNumber) && doBoundsType(this);
|
|
3671
|
+
}
|
|
3672
|
+
}));
|
|
3677
3673
|
}
|
|
3678
3674
|
function naturalBoundsType(defaultValue) {
|
|
3679
|
-
return (
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
});
|
|
3687
|
-
};
|
|
3675
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3676
|
+
set(value) {
|
|
3677
|
+
this.__setAttr(key, value);
|
|
3678
|
+
doBoundsType(this);
|
|
3679
|
+
this.__.__removeNaturalSize();
|
|
3680
|
+
}
|
|
3681
|
+
}));
|
|
3688
3682
|
}
|
|
3689
3683
|
function doBoundsType(leaf) {
|
|
3690
3684
|
leaf.__layout.boxChanged || leaf.__layout.boxChange();
|
|
@@ -3692,27 +3686,22 @@ var LeaferUI = (function (exports) {
|
|
|
3692
3686
|
leaf.__layout.matrixChanged || leaf.__layout.matrixChange();
|
|
3693
3687
|
}
|
|
3694
3688
|
function pathInputType(defaultValue) {
|
|
3695
|
-
return (
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
});
|
|
3704
|
-
};
|
|
3689
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3690
|
+
set(value) {
|
|
3691
|
+
if (this.__.__pathInputed !== 2)
|
|
3692
|
+
this.__.__pathInputed = value ? 1 : 0;
|
|
3693
|
+
this.__setAttr(key, value);
|
|
3694
|
+
doBoundsType(this);
|
|
3695
|
+
}
|
|
3696
|
+
}));
|
|
3705
3697
|
}
|
|
3706
3698
|
const pathType = boundsType;
|
|
3707
3699
|
function affectStrokeBoundsType(defaultValue) {
|
|
3708
|
-
return (
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
}
|
|
3714
|
-
});
|
|
3715
|
-
};
|
|
3700
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3701
|
+
set(value) {
|
|
3702
|
+
this.__setAttr(key, value) && doStrokeType(this);
|
|
3703
|
+
}
|
|
3704
|
+
}));
|
|
3716
3705
|
}
|
|
3717
3706
|
function doStrokeType(leaf) {
|
|
3718
3707
|
leaf.__layout.strokeChanged || leaf.__layout.strokeChange();
|
|
@@ -3721,91 +3710,75 @@ var LeaferUI = (function (exports) {
|
|
|
3721
3710
|
}
|
|
3722
3711
|
const strokeType = affectStrokeBoundsType;
|
|
3723
3712
|
function affectRenderBoundsType(defaultValue) {
|
|
3724
|
-
return (
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
});
|
|
3731
|
-
};
|
|
3713
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3714
|
+
set(value) {
|
|
3715
|
+
this.__setAttr(key, value);
|
|
3716
|
+
this.__layout.renderChanged || this.__layout.renderChange();
|
|
3717
|
+
}
|
|
3718
|
+
}));
|
|
3732
3719
|
}
|
|
3733
3720
|
function surfaceType(defaultValue) {
|
|
3734
|
-
return (
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
});
|
|
3741
|
-
};
|
|
3721
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3722
|
+
set(value) {
|
|
3723
|
+
this.__setAttr(key, value);
|
|
3724
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3725
|
+
}
|
|
3726
|
+
}));
|
|
3742
3727
|
}
|
|
3743
3728
|
function opacityType(defaultValue) {
|
|
3744
|
-
return (
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
});
|
|
3751
|
-
};
|
|
3729
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3730
|
+
set(value) {
|
|
3731
|
+
this.__setAttr(key, value);
|
|
3732
|
+
this.__layout.opacityChanged || this.__layout.opacityChange();
|
|
3733
|
+
}
|
|
3734
|
+
}));
|
|
3752
3735
|
}
|
|
3753
3736
|
function sortType(defaultValue) {
|
|
3754
|
-
return (
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
});
|
|
3762
|
-
};
|
|
3737
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3738
|
+
set(value) {
|
|
3739
|
+
this.__setAttr(key, value);
|
|
3740
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3741
|
+
this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
|
|
3742
|
+
}
|
|
3743
|
+
}));
|
|
3763
3744
|
}
|
|
3764
3745
|
function maskType(defaultValue) {
|
|
3765
|
-
return (
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
});
|
|
3773
|
-
};
|
|
3746
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3747
|
+
set(value) {
|
|
3748
|
+
this.__setAttr(key, value);
|
|
3749
|
+
this.__layout.boxChanged || this.__layout.boxChange();
|
|
3750
|
+
this.waitParent(() => { this.parent.__updateMask(value); });
|
|
3751
|
+
}
|
|
3752
|
+
}));
|
|
3774
3753
|
}
|
|
3775
3754
|
function eraserType(defaultValue) {
|
|
3776
|
-
return (
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
});
|
|
3783
|
-
};
|
|
3755
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3756
|
+
set(value) {
|
|
3757
|
+
this.__setAttr(key, value);
|
|
3758
|
+
this.waitParent(() => { this.parent.__updateEraser(value); });
|
|
3759
|
+
}
|
|
3760
|
+
}));
|
|
3784
3761
|
}
|
|
3785
3762
|
function hitType(defaultValue) {
|
|
3786
|
-
return (
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3792
|
-
}
|
|
3793
|
-
if (this.leafer)
|
|
3794
|
-
this.leafer.updateCursor();
|
|
3763
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3764
|
+
set(value) {
|
|
3765
|
+
this.__setAttr(key, value);
|
|
3766
|
+
if (Debug.showHitView) {
|
|
3767
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3795
3768
|
}
|
|
3796
|
-
|
|
3797
|
-
|
|
3769
|
+
if (this.leafer)
|
|
3770
|
+
this.leafer.updateCursor();
|
|
3771
|
+
}
|
|
3772
|
+
}));
|
|
3798
3773
|
}
|
|
3799
3774
|
function cursorType(defaultValue) {
|
|
3800
|
-
return (
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
});
|
|
3808
|
-
};
|
|
3775
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3776
|
+
set(value) {
|
|
3777
|
+
this.__setAttr(key, value);
|
|
3778
|
+
if (this.leafer)
|
|
3779
|
+
this.leafer.updateCursor();
|
|
3780
|
+
}
|
|
3781
|
+
}));
|
|
3809
3782
|
}
|
|
3810
3783
|
function dataProcessor(processor) {
|
|
3811
3784
|
return (target, _key) => {
|
|
@@ -3868,7 +3841,7 @@ var LeaferUI = (function (exports) {
|
|
|
3868
3841
|
Object.defineProperty(data, key, property);
|
|
3869
3842
|
}
|
|
3870
3843
|
|
|
3871
|
-
const debug$
|
|
3844
|
+
const debug$6 = new Debug('rewrite');
|
|
3872
3845
|
const list = [];
|
|
3873
3846
|
const excludeNames = ['destroy', 'constructor'];
|
|
3874
3847
|
function rewrite(method) {
|
|
@@ -3885,7 +3858,7 @@ var LeaferUI = (function (exports) {
|
|
|
3885
3858
|
if (list.length) {
|
|
3886
3859
|
list.forEach(item => {
|
|
3887
3860
|
if (error)
|
|
3888
|
-
debug$
|
|
3861
|
+
debug$6.error(item.name, '需在Class上装饰@rewriteAble()');
|
|
3889
3862
|
item.run();
|
|
3890
3863
|
});
|
|
3891
3864
|
list.length = 0;
|
|
@@ -3921,7 +3894,7 @@ var LeaferUI = (function (exports) {
|
|
|
3921
3894
|
};
|
|
3922
3895
|
}
|
|
3923
3896
|
|
|
3924
|
-
const { copy: copy$
|
|
3897
|
+
const { copy: copy$6, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
3925
3898
|
const matrix = {};
|
|
3926
3899
|
const LeafHelper = {
|
|
3927
3900
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4000,7 +3973,7 @@ var LeaferUI = (function (exports) {
|
|
|
4000
3973
|
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
4001
3974
|
},
|
|
4002
3975
|
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4003
|
-
copy$
|
|
3976
|
+
copy$6(matrix, t.__localMatrix);
|
|
4004
3977
|
scaleOfOuter$3(matrix, origin, scaleX, scaleY);
|
|
4005
3978
|
moveByMatrix(t, matrix);
|
|
4006
3979
|
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
@@ -4009,7 +3982,7 @@ var LeaferUI = (function (exports) {
|
|
|
4009
3982
|
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4010
3983
|
},
|
|
4011
3984
|
rotateOfLocal(t, origin, angle) {
|
|
4012
|
-
copy$
|
|
3985
|
+
copy$6(matrix, t.__localMatrix);
|
|
4013
3986
|
rotateOfOuter$3(matrix, origin, angle);
|
|
4014
3987
|
moveByMatrix(t, matrix);
|
|
4015
3988
|
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
@@ -4018,19 +3991,19 @@ var LeaferUI = (function (exports) {
|
|
|
4018
3991
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
4019
3992
|
},
|
|
4020
3993
|
skewOfLocal(t, origin, skewX, skewY = 0, resize) {
|
|
4021
|
-
copy$
|
|
3994
|
+
copy$6(matrix, t.__localMatrix);
|
|
4022
3995
|
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4023
3996
|
L.setTransform(t, matrix, resize);
|
|
4024
3997
|
},
|
|
4025
3998
|
transformWorld(t, transform, resize) {
|
|
4026
|
-
copy$
|
|
3999
|
+
copy$6(matrix, t.worldTransform);
|
|
4027
4000
|
multiplyParent$2(matrix, transform);
|
|
4028
4001
|
if (t.parent)
|
|
4029
4002
|
divideParent(matrix, t.parent.worldTransform);
|
|
4030
4003
|
L.setTransform(t, matrix, resize);
|
|
4031
4004
|
},
|
|
4032
4005
|
transform(t, transform, resize) {
|
|
4033
|
-
copy$
|
|
4006
|
+
copy$6(matrix, t.localTransform);
|
|
4034
4007
|
multiplyParent$2(matrix, transform);
|
|
4035
4008
|
L.setTransform(t, matrix, resize);
|
|
4036
4009
|
},
|
|
@@ -4044,7 +4017,7 @@ var LeaferUI = (function (exports) {
|
|
|
4044
4017
|
t.set(layout);
|
|
4045
4018
|
},
|
|
4046
4019
|
getRelativeWorld(t, relative, temp) {
|
|
4047
|
-
copy$
|
|
4020
|
+
copy$6(matrix, t.worldTransform);
|
|
4048
4021
|
divideParent(matrix, relative.worldTransform);
|
|
4049
4022
|
return temp ? matrix : Object.assign({}, matrix);
|
|
4050
4023
|
},
|
|
@@ -4186,7 +4159,7 @@ var LeaferUI = (function (exports) {
|
|
|
4186
4159
|
|
|
4187
4160
|
const WaitHelper = {
|
|
4188
4161
|
run(wait) {
|
|
4189
|
-
if (wait.length) {
|
|
4162
|
+
if (wait && wait.length) {
|
|
4190
4163
|
const len = wait.length;
|
|
4191
4164
|
for (let i = 0; i < len; i++) {
|
|
4192
4165
|
wait[i]();
|
|
@@ -4197,7 +4170,7 @@ var LeaferUI = (function (exports) {
|
|
|
4197
4170
|
};
|
|
4198
4171
|
|
|
4199
4172
|
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4200
|
-
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$
|
|
4173
|
+
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
|
|
4201
4174
|
class LeafLayout {
|
|
4202
4175
|
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4203
4176
|
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
@@ -4342,7 +4315,7 @@ var LeaferUI = (function (exports) {
|
|
|
4342
4315
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4343
4316
|
}
|
|
4344
4317
|
const layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4345
|
-
copy$
|
|
4318
|
+
copy$5(layoutBounds, bounds);
|
|
4346
4319
|
PointHelper.copy(layoutBounds, point);
|
|
4347
4320
|
if (unscale) {
|
|
4348
4321
|
const { scaleX, scaleY } = layoutBounds;
|
|
@@ -4736,10 +4709,16 @@ var LeaferUI = (function (exports) {
|
|
|
4736
4709
|
LeaferEvent.RESTART = 'leafer.restart';
|
|
4737
4710
|
LeaferEvent.END = 'leafer.end';
|
|
4738
4711
|
|
|
4712
|
+
const { isFinite } = Number;
|
|
4713
|
+
const debug$5 = Debug.get('setAttr');
|
|
4739
4714
|
const LeafDataProxy = {
|
|
4740
|
-
__setAttr(name, newValue) {
|
|
4715
|
+
__setAttr(name, newValue, checkFiniteNumber) {
|
|
4741
4716
|
if (this.leafer && this.leafer.created) {
|
|
4742
4717
|
const oldValue = this.__.__getInput(name);
|
|
4718
|
+
if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
|
|
4719
|
+
debug$5.warn(this.innerName, name, newValue);
|
|
4720
|
+
newValue = undefined;
|
|
4721
|
+
}
|
|
4743
4722
|
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4744
4723
|
this.__[name] = newValue;
|
|
4745
4724
|
if (this.__proxyData)
|
|
@@ -4754,12 +4733,17 @@ var LeaferUI = (function (exports) {
|
|
|
4754
4733
|
this.emitEvent(event);
|
|
4755
4734
|
}
|
|
4756
4735
|
this.leafer.emitEvent(event);
|
|
4736
|
+
return true;
|
|
4737
|
+
}
|
|
4738
|
+
else {
|
|
4739
|
+
return false;
|
|
4757
4740
|
}
|
|
4758
4741
|
}
|
|
4759
4742
|
else {
|
|
4760
4743
|
this.__[name] = newValue;
|
|
4761
4744
|
if (this.__proxyData)
|
|
4762
4745
|
this.setProxyAttr(name, newValue);
|
|
4746
|
+
return true;
|
|
4763
4747
|
}
|
|
4764
4748
|
},
|
|
4765
4749
|
__getAttr(name) {
|
|
@@ -4797,7 +4781,7 @@ var LeaferUI = (function (exports) {
|
|
|
4797
4781
|
|
|
4798
4782
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2, hasParentAutoLayout } = LeafHelper;
|
|
4799
4783
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
4800
|
-
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
|
|
4784
|
+
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } = BoundsHelper;
|
|
4801
4785
|
const { toBounds: toBounds$2 } = PathBounds;
|
|
4802
4786
|
const LeafBounds = {
|
|
4803
4787
|
__updateWorldBounds() {
|
|
@@ -4915,7 +4899,8 @@ var LeaferUI = (function (exports) {
|
|
|
4915
4899
|
copyAndSpread$1(this.__layout.strokeBounds, this.__layout.boxBounds, this.__layout.strokeSpread);
|
|
4916
4900
|
},
|
|
4917
4901
|
__updateRenderBounds() {
|
|
4918
|
-
|
|
4902
|
+
const { renderSpread, strokeBounds, renderBounds } = this.__layout;
|
|
4903
|
+
renderSpread > 0 ? copyAndSpread$1(renderBounds, strokeBounds, renderSpread) : copy$4(renderBounds, strokeBounds);
|
|
4919
4904
|
},
|
|
4920
4905
|
};
|
|
4921
4906
|
|
|
@@ -5101,7 +5086,7 @@ var LeaferUI = (function (exports) {
|
|
|
5101
5086
|
toString() {
|
|
5102
5087
|
return JSON.stringify(this.toJSON());
|
|
5103
5088
|
}
|
|
5104
|
-
__setAttr(_attrName, _newValue) { }
|
|
5089
|
+
__setAttr(_attrName, _newValue) { return true; }
|
|
5105
5090
|
__getAttr(_attrName) { return undefined; }
|
|
5106
5091
|
setProxyAttr(_attrName, _newValue) { }
|
|
5107
5092
|
getProxyAttr(_attrName) { return undefined; }
|
|
@@ -5285,24 +5270,16 @@ var LeaferUI = (function (exports) {
|
|
|
5285
5270
|
__scaleResize(_scaleX, _scaleY) { }
|
|
5286
5271
|
__hitWorld(_point) { return true; }
|
|
5287
5272
|
__hit(_local) { return true; }
|
|
5288
|
-
__hitFill(
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
}
|
|
5292
|
-
__hitStroke(inner, strokeWidth) {
|
|
5293
|
-
var _a;
|
|
5294
|
-
return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth);
|
|
5295
|
-
}
|
|
5296
|
-
__drawHitPath(canvas) {
|
|
5297
|
-
if (canvas)
|
|
5298
|
-
this.__drawRenderPath(canvas);
|
|
5299
|
-
}
|
|
5273
|
+
__hitFill(_inner) { return true; }
|
|
5274
|
+
__hitStroke(_inner, _strokeWidth) { return true; }
|
|
5275
|
+
__hitPixel(_inner) { return true; }
|
|
5276
|
+
__drawHitPath(_canvas) { }
|
|
5300
5277
|
__updateHitCanvas() { }
|
|
5301
5278
|
__render(_canvas, _options) { }
|
|
5302
5279
|
__drawFast(_canvas, _options) { }
|
|
5303
5280
|
__draw(_canvas, _options) { }
|
|
5304
5281
|
__clip(_canvas, _options) { }
|
|
5305
|
-
__renderShape(_canvas, _options) { }
|
|
5282
|
+
__renderShape(_canvas, _options, _ignoreFill, _ignoreStroke) { }
|
|
5306
5283
|
__updateWorldOpacity() { }
|
|
5307
5284
|
__updateChange() { }
|
|
5308
5285
|
__drawPath(_canvas) { }
|
|
@@ -5684,6 +5661,7 @@ var LeaferUI = (function (exports) {
|
|
|
5684
5661
|
},
|
|
5685
5662
|
canvasToBolb: (canvas, type, quality) => canvas.convertToBlob({ type: mineType(type), quality }),
|
|
5686
5663
|
canvasSaveAs: (_canvas, _filename, _quality) => new Promise((resolve) => resolve()),
|
|
5664
|
+
download(_url, _filename) { return undefined; },
|
|
5687
5665
|
loadImage(src) {
|
|
5688
5666
|
return new Promise((resolve, reject) => {
|
|
5689
5667
|
if (!src.startsWith('data:') && Platform.image.suffix)
|
|
@@ -5910,7 +5888,7 @@ var LeaferUI = (function (exports) {
|
|
|
5910
5888
|
}
|
|
5911
5889
|
|
|
5912
5890
|
const { updateAllMatrix, updateAllChange } = LeafHelper;
|
|
5913
|
-
const debug$
|
|
5891
|
+
const debug$4 = Debug.get('Layouter');
|
|
5914
5892
|
class Layouter {
|
|
5915
5893
|
constructor(target, userConfig) {
|
|
5916
5894
|
this.totalTimes = 0;
|
|
@@ -5945,7 +5923,7 @@ var LeaferUI = (function (exports) {
|
|
|
5945
5923
|
target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
|
|
5946
5924
|
}
|
|
5947
5925
|
catch (e) {
|
|
5948
|
-
debug$
|
|
5926
|
+
debug$4.error(e);
|
|
5949
5927
|
}
|
|
5950
5928
|
this.layoutedBlocks = null;
|
|
5951
5929
|
}
|
|
@@ -5959,9 +5937,9 @@ var LeaferUI = (function (exports) {
|
|
|
5959
5937
|
}
|
|
5960
5938
|
layoutOnce() {
|
|
5961
5939
|
if (this.layouting)
|
|
5962
|
-
return debug$
|
|
5940
|
+
return debug$4.warn('layouting');
|
|
5963
5941
|
if (this.times > 3)
|
|
5964
|
-
return debug$
|
|
5942
|
+
return debug$4.warn('layout max times');
|
|
5965
5943
|
this.times++;
|
|
5966
5944
|
this.totalTimes++;
|
|
5967
5945
|
this.layouting = true;
|
|
@@ -6065,7 +6043,7 @@ var LeaferUI = (function (exports) {
|
|
|
6065
6043
|
}
|
|
6066
6044
|
}
|
|
6067
6045
|
|
|
6068
|
-
const debug$
|
|
6046
|
+
const debug$3 = Debug.get('Renderer');
|
|
6069
6047
|
class Renderer {
|
|
6070
6048
|
get needFill() { return !!(!this.canvas.allowBackgroundColor && this.config.fill); }
|
|
6071
6049
|
constructor(target, canvas, userConfig) {
|
|
@@ -6103,7 +6081,7 @@ var LeaferUI = (function (exports) {
|
|
|
6103
6081
|
const { target } = this;
|
|
6104
6082
|
this.times = 0;
|
|
6105
6083
|
this.totalBounds = new Bounds();
|
|
6106
|
-
debug$
|
|
6084
|
+
debug$3.log(target.innerName, '--->');
|
|
6107
6085
|
try {
|
|
6108
6086
|
this.emitRender(RenderEvent.START);
|
|
6109
6087
|
this.renderOnce(callback);
|
|
@@ -6112,9 +6090,9 @@ var LeaferUI = (function (exports) {
|
|
|
6112
6090
|
}
|
|
6113
6091
|
catch (e) {
|
|
6114
6092
|
this.rendering = false;
|
|
6115
|
-
debug$
|
|
6093
|
+
debug$3.error(e);
|
|
6116
6094
|
}
|
|
6117
|
-
debug$
|
|
6095
|
+
debug$3.log('-------------|');
|
|
6118
6096
|
}
|
|
6119
6097
|
renderAgain() {
|
|
6120
6098
|
if (this.rendering) {
|
|
@@ -6126,9 +6104,9 @@ var LeaferUI = (function (exports) {
|
|
|
6126
6104
|
}
|
|
6127
6105
|
renderOnce(callback) {
|
|
6128
6106
|
if (this.rendering)
|
|
6129
|
-
return debug$
|
|
6107
|
+
return debug$3.warn('rendering');
|
|
6130
6108
|
if (this.times > 3)
|
|
6131
|
-
return debug$
|
|
6109
|
+
return debug$3.warn('render max times');
|
|
6132
6110
|
this.times++;
|
|
6133
6111
|
this.totalTimes++;
|
|
6134
6112
|
this.rendering = true;
|
|
@@ -6165,7 +6143,7 @@ var LeaferUI = (function (exports) {
|
|
|
6165
6143
|
partRender() {
|
|
6166
6144
|
const { canvas, updateBlocks: list } = this;
|
|
6167
6145
|
if (!list)
|
|
6168
|
-
return debug$
|
|
6146
|
+
return debug$3.warn('PartRender: need update attr');
|
|
6169
6147
|
this.mergeBlocks();
|
|
6170
6148
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6171
6149
|
this.clipRender(block); });
|
|
@@ -6265,7 +6243,7 @@ var LeaferUI = (function (exports) {
|
|
|
6265
6243
|
empty = (!leaf.__world.width || !leaf.__world.height);
|
|
6266
6244
|
if (empty) {
|
|
6267
6245
|
if (!leaf.isLeafer)
|
|
6268
|
-
debug$
|
|
6246
|
+
debug$3.tip(leaf.innerName, ': empty');
|
|
6269
6247
|
empty = (!leaf.isBranch || leaf.isBranchLeaf);
|
|
6270
6248
|
}
|
|
6271
6249
|
return empty;
|
|
@@ -6317,51 +6295,42 @@ var LeaferUI = (function (exports) {
|
|
|
6317
6295
|
const State = {};
|
|
6318
6296
|
|
|
6319
6297
|
function stateType(defaultValue) {
|
|
6320
|
-
return (
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
}
|
|
6328
|
-
});
|
|
6329
|
-
};
|
|
6298
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6299
|
+
set(value) {
|
|
6300
|
+
this.__setAttr(key, value);
|
|
6301
|
+
this.waitLeafer(() => { if (State.setStyle)
|
|
6302
|
+
State.setStyle(this, key + 'Style', value); });
|
|
6303
|
+
}
|
|
6304
|
+
}));
|
|
6330
6305
|
}
|
|
6331
6306
|
function arrowType(defaultValue) {
|
|
6332
|
-
return (
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
});
|
|
6341
|
-
};
|
|
6307
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6308
|
+
set(value) {
|
|
6309
|
+
this.__setAttr(key, value);
|
|
6310
|
+
const data = this.__;
|
|
6311
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6312
|
+
doStrokeType(this);
|
|
6313
|
+
}
|
|
6314
|
+
}));
|
|
6342
6315
|
}
|
|
6343
6316
|
function effectType(defaultValue) {
|
|
6344
|
-
return (
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
});
|
|
6353
|
-
};
|
|
6317
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6318
|
+
set(value) {
|
|
6319
|
+
this.__setAttr(key, value);
|
|
6320
|
+
if (value)
|
|
6321
|
+
this.__.__useEffect = true;
|
|
6322
|
+
this.__layout.renderChanged || this.__layout.renderChange();
|
|
6323
|
+
}
|
|
6324
|
+
}));
|
|
6354
6325
|
}
|
|
6355
6326
|
function resizeType(defaultValue) {
|
|
6356
|
-
return (
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
});
|
|
6364
|
-
};
|
|
6327
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6328
|
+
set(value) {
|
|
6329
|
+
this.__setAttr(key, value);
|
|
6330
|
+
this.__layout.boxChanged || this.__layout.boxChange();
|
|
6331
|
+
this.__updateSize();
|
|
6332
|
+
}
|
|
6333
|
+
}));
|
|
6365
6334
|
}
|
|
6366
6335
|
function zoomLayerType() {
|
|
6367
6336
|
return (target, key) => {
|
|
@@ -6376,12 +6345,13 @@ var LeaferUI = (function (exports) {
|
|
|
6376
6345
|
|
|
6377
6346
|
const { parse } = PathConvert;
|
|
6378
6347
|
const emptyPaint = {};
|
|
6379
|
-
const debug$
|
|
6348
|
+
const debug$2 = Debug.get('UIData');
|
|
6380
6349
|
class UIData extends LeafData {
|
|
6381
6350
|
get __strokeWidth() {
|
|
6382
6351
|
const { strokeWidth, strokeWidthFixed } = this;
|
|
6383
6352
|
if (strokeWidthFixed) {
|
|
6384
|
-
|
|
6353
|
+
const ui = this.__leaf;
|
|
6354
|
+
let { scaleX } = ui.__nowWorld || ui.__world;
|
|
6385
6355
|
if (scaleX < 0)
|
|
6386
6356
|
scaleX = -scaleX;
|
|
6387
6357
|
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
@@ -6403,7 +6373,7 @@ var LeaferUI = (function (exports) {
|
|
|
6403
6373
|
if (value < 0) {
|
|
6404
6374
|
this._width = -value;
|
|
6405
6375
|
this.__leaf.scaleX *= -1;
|
|
6406
|
-
debug$
|
|
6376
|
+
debug$2.warn('width < 0, instead -scaleX ', this);
|
|
6407
6377
|
}
|
|
6408
6378
|
else {
|
|
6409
6379
|
this._width = value;
|
|
@@ -6413,7 +6383,7 @@ var LeaferUI = (function (exports) {
|
|
|
6413
6383
|
if (value < 0) {
|
|
6414
6384
|
this._height = -value;
|
|
6415
6385
|
this.__leaf.scaleY *= -1;
|
|
6416
|
-
debug$
|
|
6386
|
+
debug$2.warn('height < 0, instead -scaleY', this);
|
|
6417
6387
|
}
|
|
6418
6388
|
else {
|
|
6419
6389
|
this._height = value;
|
|
@@ -6700,14 +6670,14 @@ var LeaferUI = (function (exports) {
|
|
|
6700
6670
|
}
|
|
6701
6671
|
}
|
|
6702
6672
|
},
|
|
6703
|
-
__renderShape(canvas, options) {
|
|
6673
|
+
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
6704
6674
|
if (this.__worldOpacity) {
|
|
6705
6675
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
6706
6676
|
const { fill, stroke } = this.__;
|
|
6707
6677
|
this.__drawRenderPath(canvas);
|
|
6708
|
-
if (fill)
|
|
6678
|
+
if (fill && !ignoreFill)
|
|
6709
6679
|
this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
6710
|
-
if (stroke)
|
|
6680
|
+
if (stroke && !ignoreStroke)
|
|
6711
6681
|
this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
6712
6682
|
}
|
|
6713
6683
|
}
|
|
@@ -6805,10 +6775,7 @@ var LeaferUI = (function (exports) {
|
|
|
6805
6775
|
__onUpdateSize() {
|
|
6806
6776
|
if (this.__.__input) {
|
|
6807
6777
|
const data = this.__;
|
|
6808
|
-
data.__needComputePaint = true;
|
|
6809
|
-
if (data.lazy && this.leafer && !this.leafer.canvas.bounds.hit(this.__world))
|
|
6810
|
-
return;
|
|
6811
|
-
data.__computePaint();
|
|
6778
|
+
(data.lazy && this.leafer && this.leafer.created && !this.leafer.lazyBounds.hit(this.__world)) ? data.__needComputePaint = true : data.__computePaint();
|
|
6812
6779
|
}
|
|
6813
6780
|
}
|
|
6814
6781
|
__updateRenderPath() {
|
|
@@ -6910,31 +6877,31 @@ var LeaferUI = (function (exports) {
|
|
|
6910
6877
|
eraserType(false)
|
|
6911
6878
|
], exports.UI.prototype, "eraser", void 0);
|
|
6912
6879
|
__decorate([
|
|
6913
|
-
positionType(0)
|
|
6880
|
+
positionType(0, true)
|
|
6914
6881
|
], exports.UI.prototype, "x", void 0);
|
|
6915
6882
|
__decorate([
|
|
6916
|
-
positionType(0)
|
|
6883
|
+
positionType(0, true)
|
|
6917
6884
|
], exports.UI.prototype, "y", void 0);
|
|
6918
6885
|
__decorate([
|
|
6919
|
-
boundsType(100)
|
|
6886
|
+
boundsType(100, true)
|
|
6920
6887
|
], exports.UI.prototype, "width", void 0);
|
|
6921
6888
|
__decorate([
|
|
6922
|
-
boundsType(100)
|
|
6889
|
+
boundsType(100, true)
|
|
6923
6890
|
], exports.UI.prototype, "height", void 0);
|
|
6924
6891
|
__decorate([
|
|
6925
|
-
scaleType(1)
|
|
6892
|
+
scaleType(1, true)
|
|
6926
6893
|
], exports.UI.prototype, "scaleX", void 0);
|
|
6927
6894
|
__decorate([
|
|
6928
|
-
scaleType(1)
|
|
6895
|
+
scaleType(1, true)
|
|
6929
6896
|
], exports.UI.prototype, "scaleY", void 0);
|
|
6930
6897
|
__decorate([
|
|
6931
|
-
rotationType(0)
|
|
6898
|
+
rotationType(0, true)
|
|
6932
6899
|
], exports.UI.prototype, "rotation", void 0);
|
|
6933
6900
|
__decorate([
|
|
6934
|
-
rotationType(0)
|
|
6901
|
+
rotationType(0, true)
|
|
6935
6902
|
], exports.UI.prototype, "skewX", void 0);
|
|
6936
6903
|
__decorate([
|
|
6937
|
-
rotationType(0)
|
|
6904
|
+
rotationType(0, true)
|
|
6938
6905
|
], exports.UI.prototype, "skewY", void 0);
|
|
6939
6906
|
__decorate([
|
|
6940
6907
|
autoLayoutType()
|
|
@@ -6948,6 +6915,9 @@ var LeaferUI = (function (exports) {
|
|
|
6948
6915
|
__decorate([
|
|
6949
6916
|
dataType('size')
|
|
6950
6917
|
], exports.UI.prototype, "editSize", void 0);
|
|
6918
|
+
__decorate([
|
|
6919
|
+
dataType()
|
|
6920
|
+
], exports.UI.prototype, "editorStyle", void 0);
|
|
6951
6921
|
__decorate([
|
|
6952
6922
|
hitType(true)
|
|
6953
6923
|
], exports.UI.prototype, "hittable", void 0);
|
|
@@ -7014,6 +6984,9 @@ var LeaferUI = (function (exports) {
|
|
|
7014
6984
|
__decorate([
|
|
7015
6985
|
pathType()
|
|
7016
6986
|
], exports.UI.prototype, "windingRule", void 0);
|
|
6987
|
+
__decorate([
|
|
6988
|
+
pathType(true)
|
|
6989
|
+
], exports.UI.prototype, "closed", void 0);
|
|
7017
6990
|
__decorate([
|
|
7018
6991
|
arrowType('none')
|
|
7019
6992
|
], exports.UI.prototype, "startArrow", void 0);
|
|
@@ -7133,14 +7106,17 @@ var LeaferUI = (function (exports) {
|
|
|
7133
7106
|
registerUI()
|
|
7134
7107
|
], exports.Group);
|
|
7135
7108
|
|
|
7136
|
-
|
|
7137
|
-
|
|
7109
|
+
var Leafer_1;
|
|
7110
|
+
const debug$1 = Debug.get('Leafer');
|
|
7111
|
+
exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
7112
|
+
static get version() { return '1.0.0-rc.21'; }
|
|
7138
7113
|
get __tag() { return 'Leafer'; }
|
|
7139
7114
|
get isApp() { return false; }
|
|
7140
7115
|
get app() { return this.parent || this; }
|
|
7141
7116
|
get isLeafer() { return true; }
|
|
7142
7117
|
get imageReady() { return this.viewReady && ImageManager.isComplete; }
|
|
7143
7118
|
get layoutLocked() { return !this.layouter.running; }
|
|
7119
|
+
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7144
7120
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7145
7121
|
constructor(userConfig, data) {
|
|
7146
7122
|
super(data);
|
|
@@ -7149,6 +7125,7 @@ var LeaferUI = (function (exports) {
|
|
|
7149
7125
|
start: true,
|
|
7150
7126
|
hittable: true,
|
|
7151
7127
|
smooth: true,
|
|
7128
|
+
lazySpeard: 100,
|
|
7152
7129
|
zoom: {
|
|
7153
7130
|
min: 0.01,
|
|
7154
7131
|
max: 256
|
|
@@ -7169,6 +7146,7 @@ var LeaferUI = (function (exports) {
|
|
|
7169
7146
|
this.userConfig = userConfig;
|
|
7170
7147
|
if (userConfig && (userConfig.view || userConfig.width))
|
|
7171
7148
|
this.init(userConfig);
|
|
7149
|
+
Leafer_1.list.add(this);
|
|
7172
7150
|
}
|
|
7173
7151
|
init(userConfig, parentApp) {
|
|
7174
7152
|
if (this.canvas)
|
|
@@ -7179,19 +7157,20 @@ var LeaferUI = (function (exports) {
|
|
|
7179
7157
|
let start;
|
|
7180
7158
|
const { config } = this;
|
|
7181
7159
|
this.initType(config.type);
|
|
7182
|
-
this.canvas = Creator.canvas(config);
|
|
7183
|
-
this.__controllers.push(this.renderer = Creator.renderer(this,
|
|
7160
|
+
const canvas = this.canvas = Creator.canvas(config);
|
|
7161
|
+
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
7184
7162
|
if (this.isApp)
|
|
7185
7163
|
this.__setApp();
|
|
7186
7164
|
this.__checkAutoLayout(config);
|
|
7187
|
-
this.
|
|
7165
|
+
this.updateLazyBounds();
|
|
7166
|
+
this.view = canvas.view;
|
|
7188
7167
|
if (parentApp) {
|
|
7189
7168
|
this.__bindApp(parentApp);
|
|
7190
7169
|
start = parentApp.running;
|
|
7191
7170
|
}
|
|
7192
7171
|
else {
|
|
7193
7172
|
this.selector = Creator.selector(this);
|
|
7194
|
-
this.interaction = Creator.interaction(this,
|
|
7173
|
+
this.interaction = Creator.interaction(this, canvas, this.selector, config);
|
|
7195
7174
|
if (this.interaction) {
|
|
7196
7175
|
this.__controllers.unshift(this.interaction);
|
|
7197
7176
|
this.hitCanvasManager = Creator.hitCanvasManager();
|
|
@@ -7201,23 +7180,17 @@ var LeaferUI = (function (exports) {
|
|
|
7201
7180
|
}
|
|
7202
7181
|
this.hittable = config.hittable;
|
|
7203
7182
|
this.fill = config.fill;
|
|
7204
|
-
this.canvasManager.add(
|
|
7183
|
+
this.canvasManager.add(canvas);
|
|
7205
7184
|
this.__listenEvents();
|
|
7206
7185
|
if (start)
|
|
7207
7186
|
this.__startTimer = setTimeout(this.start.bind(this));
|
|
7187
|
+
WaitHelper.run(this.__initWait);
|
|
7208
7188
|
this.onInit();
|
|
7209
7189
|
}
|
|
7210
7190
|
onInit() { }
|
|
7211
7191
|
initType(_type) { }
|
|
7212
7192
|
set(data) {
|
|
7213
|
-
|
|
7214
|
-
setTimeout(() => {
|
|
7215
|
-
super.set(data);
|
|
7216
|
-
});
|
|
7217
|
-
}
|
|
7218
|
-
else {
|
|
7219
|
-
super.set(data);
|
|
7220
|
-
}
|
|
7193
|
+
this.waitInit(() => { super.set(data); });
|
|
7221
7194
|
}
|
|
7222
7195
|
start() {
|
|
7223
7196
|
clearTimeout(this.__startTimer);
|
|
@@ -7262,11 +7235,16 @@ var LeaferUI = (function (exports) {
|
|
|
7262
7235
|
if (i)
|
|
7263
7236
|
cursor ? i.setCursor(cursor) : i.updateCursor();
|
|
7264
7237
|
}
|
|
7238
|
+
updateLazyBounds() {
|
|
7239
|
+
this.lazyBounds = this.canvas.bounds.clone().spread(this.config.lazySpeard);
|
|
7240
|
+
}
|
|
7265
7241
|
__doResize(size) {
|
|
7266
|
-
|
|
7242
|
+
const { canvas } = this;
|
|
7243
|
+
if (!canvas || canvas.isSameSize(size))
|
|
7267
7244
|
return;
|
|
7268
7245
|
const old = DataHelper.copyAttrs({}, this.canvas, canvasSizeAttrs);
|
|
7269
|
-
|
|
7246
|
+
canvas.resize(size);
|
|
7247
|
+
this.updateLazyBounds();
|
|
7270
7248
|
this.__onResize(new ResizeEvent(size, old));
|
|
7271
7249
|
}
|
|
7272
7250
|
__onResize(event) {
|
|
@@ -7304,7 +7282,7 @@ var LeaferUI = (function (exports) {
|
|
|
7304
7282
|
this.canvas.hittable = newValue;
|
|
7305
7283
|
}
|
|
7306
7284
|
}
|
|
7307
|
-
super.__setAttr(attrName, newValue);
|
|
7285
|
+
return super.__setAttr(attrName, newValue);
|
|
7308
7286
|
}
|
|
7309
7287
|
__getAttr(attrName) {
|
|
7310
7288
|
if (this.canvas && canvasSizeAttrs.includes(attrName))
|
|
@@ -7371,6 +7349,13 @@ var LeaferUI = (function (exports) {
|
|
|
7371
7349
|
this.nextRender(() => this.interaction.updateCursor());
|
|
7372
7350
|
}
|
|
7373
7351
|
}
|
|
7352
|
+
waitInit(item, bind) {
|
|
7353
|
+
if (bind)
|
|
7354
|
+
item = item.bind(bind);
|
|
7355
|
+
if (!this.__initWait)
|
|
7356
|
+
this.__initWait = [];
|
|
7357
|
+
this.canvas ? item() : this.__initWait.push(item);
|
|
7358
|
+
}
|
|
7374
7359
|
waitReady(item, bind) {
|
|
7375
7360
|
if (bind)
|
|
7376
7361
|
item = item.bind(bind);
|
|
@@ -7410,14 +7395,8 @@ var LeaferUI = (function (exports) {
|
|
|
7410
7395
|
}
|
|
7411
7396
|
}
|
|
7412
7397
|
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
if (absScale < min)
|
|
7416
|
-
changeScale = min / scaleX;
|
|
7417
|
-
else if (absScale > max)
|
|
7418
|
-
changeScale = max / scaleX;
|
|
7419
|
-
return changeScale;
|
|
7420
|
-
}
|
|
7398
|
+
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7399
|
+
getValidScale(changeScale) { return changeScale; }
|
|
7421
7400
|
__checkUpdateLayout() {
|
|
7422
7401
|
this.__layout.update();
|
|
7423
7402
|
}
|
|
@@ -7436,9 +7415,10 @@ var LeaferUI = (function (exports) {
|
|
|
7436
7415
|
this.off_(this.__eventIds);
|
|
7437
7416
|
this.__eventIds.length = 0;
|
|
7438
7417
|
}
|
|
7439
|
-
destroy() {
|
|
7440
|
-
|
|
7418
|
+
destroy(sync) {
|
|
7419
|
+
const doDestory = () => {
|
|
7441
7420
|
if (!this.destroyed) {
|
|
7421
|
+
Leafer_1.list.remove(this);
|
|
7442
7422
|
try {
|
|
7443
7423
|
this.stop();
|
|
7444
7424
|
this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
|
|
@@ -7463,19 +7443,21 @@ var LeaferUI = (function (exports) {
|
|
|
7463
7443
|
setTimeout(() => { ImageManager.clearRecycled(); }, 100);
|
|
7464
7444
|
}
|
|
7465
7445
|
catch (e) {
|
|
7466
|
-
debug.error(e);
|
|
7446
|
+
debug$1.error(e);
|
|
7467
7447
|
}
|
|
7468
7448
|
}
|
|
7469
|
-
}
|
|
7449
|
+
};
|
|
7450
|
+
sync ? doDestory() : setTimeout(doDestory);
|
|
7470
7451
|
}
|
|
7471
7452
|
};
|
|
7453
|
+
exports.Leafer.list = new LeafList();
|
|
7472
7454
|
__decorate([
|
|
7473
7455
|
dataProcessor(LeaferData)
|
|
7474
7456
|
], exports.Leafer.prototype, "__", void 0);
|
|
7475
7457
|
__decorate([
|
|
7476
7458
|
boundsType()
|
|
7477
7459
|
], exports.Leafer.prototype, "pixelRatio", void 0);
|
|
7478
|
-
exports.Leafer = __decorate([
|
|
7460
|
+
exports.Leafer = Leafer_1 = __decorate([
|
|
7479
7461
|
registerUI()
|
|
7480
7462
|
], exports.Leafer);
|
|
7481
7463
|
|
|
@@ -7508,11 +7490,9 @@ var LeaferUI = (function (exports) {
|
|
|
7508
7490
|
__updateStrokeSpread() { return 0; }
|
|
7509
7491
|
__updateRectRenderSpread() { return 0; }
|
|
7510
7492
|
__updateRenderSpread() {
|
|
7511
|
-
|
|
7512
|
-
this.__.__drawAfterFill = this.__.overflow === 'hide';
|
|
7513
|
-
|
|
7514
|
-
width = this.__.__drawAfterFill ? 0 : 1;
|
|
7515
|
-
return width;
|
|
7493
|
+
const width = this.__updateRectRenderSpread();
|
|
7494
|
+
const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
|
|
7495
|
+
return (width || hide) ? width : -1;
|
|
7516
7496
|
}
|
|
7517
7497
|
__updateRectBoxBounds() { }
|
|
7518
7498
|
__updateBoxBounds() {
|
|
@@ -7706,7 +7686,7 @@ var LeaferUI = (function (exports) {
|
|
|
7706
7686
|
__updatePath() {
|
|
7707
7687
|
const path = this.__.path = [];
|
|
7708
7688
|
if (this.__.points) {
|
|
7709
|
-
drawPoints$1(path, this.__.points,
|
|
7689
|
+
drawPoints$1(path, this.__.points, this.__.closed);
|
|
7710
7690
|
}
|
|
7711
7691
|
else {
|
|
7712
7692
|
moveTo$2(path, 0, 0);
|
|
@@ -7716,7 +7696,7 @@ var LeaferUI = (function (exports) {
|
|
|
7716
7696
|
__updateRenderPath() {
|
|
7717
7697
|
const data = this.__;
|
|
7718
7698
|
if (!this.pathInputed && data.points && data.curve) {
|
|
7719
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve,
|
|
7699
|
+
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
7720
7700
|
if (data.__useArrow)
|
|
7721
7701
|
PathArrow.addArrows(this, false);
|
|
7722
7702
|
}
|
|
@@ -7748,6 +7728,9 @@ var LeaferUI = (function (exports) {
|
|
|
7748
7728
|
__decorate([
|
|
7749
7729
|
pathType(0)
|
|
7750
7730
|
], exports.Line.prototype, "curve", void 0);
|
|
7731
|
+
__decorate([
|
|
7732
|
+
pathType(false)
|
|
7733
|
+
], exports.Line.prototype, "closed", void 0);
|
|
7751
7734
|
exports.Line = __decorate([
|
|
7752
7735
|
registerUI()
|
|
7753
7736
|
], exports.Line);
|
|
@@ -7759,7 +7742,6 @@ var LeaferUI = (function (exports) {
|
|
|
7759
7742
|
get __tag() { return 'Polygon'; }
|
|
7760
7743
|
constructor(data) {
|
|
7761
7744
|
super(data);
|
|
7762
|
-
this.pathClosed = true;
|
|
7763
7745
|
}
|
|
7764
7746
|
__updatePath() {
|
|
7765
7747
|
const path = this.__.path = [];
|
|
@@ -7929,6 +7911,9 @@ var LeaferUI = (function (exports) {
|
|
|
7929
7911
|
__decorate([
|
|
7930
7912
|
resizeType(true)
|
|
7931
7913
|
], exports.Canvas.prototype, "smooth", void 0);
|
|
7914
|
+
__decorate([
|
|
7915
|
+
resizeType()
|
|
7916
|
+
], exports.Canvas.prototype, "contextSettings", void 0);
|
|
7932
7917
|
__decorate([
|
|
7933
7918
|
hitType('all')
|
|
7934
7919
|
], exports.Canvas.prototype, "hitFill", void 0);
|
|
@@ -8005,6 +7990,8 @@ var LeaferUI = (function (exports) {
|
|
|
8005
7990
|
else {
|
|
8006
7991
|
super.__updateBoxBounds();
|
|
8007
7992
|
}
|
|
7993
|
+
if (italic)
|
|
7994
|
+
b.width += fontSize * 0.16;
|
|
8008
7995
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
8009
7996
|
if (contentBounds !== layout.contentBounds) {
|
|
8010
7997
|
layout.contentBounds = contentBounds;
|
|
@@ -8142,6 +8129,7 @@ var LeaferUI = (function (exports) {
|
|
|
8142
8129
|
drawEllipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { return this; }
|
|
8143
8130
|
drawArc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) { return this; }
|
|
8144
8131
|
drawPoints(_points, _curve, _close) { return this; }
|
|
8132
|
+
clearPath() { return this; }
|
|
8145
8133
|
paint() {
|
|
8146
8134
|
this.pathElement.forceUpdate('path');
|
|
8147
8135
|
}
|
|
@@ -8153,7 +8141,7 @@ var LeaferUI = (function (exports) {
|
|
|
8153
8141
|
penPathType()
|
|
8154
8142
|
], exports.Pen.prototype, "path", void 0);
|
|
8155
8143
|
exports.Pen = __decorate([
|
|
8156
|
-
useModule(PathCreator, ['beginPath', 'path']),
|
|
8144
|
+
useModule(PathCreator, ['set', 'beginPath', 'path']),
|
|
8157
8145
|
registerUI()
|
|
8158
8146
|
], exports.Pen);
|
|
8159
8147
|
function penPathType() {
|
|
@@ -8164,6 +8152,8 @@ var LeaferUI = (function (exports) {
|
|
|
8164
8152
|
};
|
|
8165
8153
|
}
|
|
8166
8154
|
|
|
8155
|
+
const version = "1.0.0-rc.21";
|
|
8156
|
+
|
|
8167
8157
|
function fillText(ui, canvas) {
|
|
8168
8158
|
let row;
|
|
8169
8159
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
@@ -8525,8 +8515,11 @@ var LeaferUI = (function (exports) {
|
|
|
8525
8515
|
}
|
|
8526
8516
|
|
|
8527
8517
|
const { get: get$3, translate } = MatrixHelper;
|
|
8518
|
+
const tempBox = new Bounds();
|
|
8528
8519
|
function createData(leafPaint, image, paint, box) {
|
|
8529
8520
|
let { width, height } = image;
|
|
8521
|
+
if (paint.padding)
|
|
8522
|
+
box = tempBox.set(box).shrink(paint.padding);
|
|
8530
8523
|
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8531
8524
|
const sameBox = box.width === width && box.height === height;
|
|
8532
8525
|
if (blendMode)
|
|
@@ -8610,8 +8603,11 @@ var LeaferUI = (function (exports) {
|
|
|
8610
8603
|
leafPaint.loadId = image.load(() => {
|
|
8611
8604
|
ignoreRender(ui, false);
|
|
8612
8605
|
if (!ui.destroyed) {
|
|
8613
|
-
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds))
|
|
8606
|
+
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
8607
|
+
if (image.hasOpacityPixel)
|
|
8608
|
+
ui.__layout.hitCanvasChanged = true;
|
|
8614
8609
|
ui.forceUpdate('surface');
|
|
8610
|
+
}
|
|
8615
8611
|
onLoadSuccess(ui, event);
|
|
8616
8612
|
}
|
|
8617
8613
|
leafPaint.loadId = null;
|
|
@@ -8665,7 +8661,7 @@ var LeaferUI = (function (exports) {
|
|
|
8665
8661
|
const { get: get$2, scale, copy: copy$1 } = MatrixHelper;
|
|
8666
8662
|
const { ceil, abs: abs$1 } = Math;
|
|
8667
8663
|
function createPattern(ui, paint, pixelRatio) {
|
|
8668
|
-
let { scaleX, scaleY } = ui.__nowWorld;
|
|
8664
|
+
let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
8669
8665
|
const id = scaleX + '-' + scaleY;
|
|
8670
8666
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
8671
8667
|
scaleX = abs$1(scaleX);
|
|
@@ -8727,7 +8723,7 @@ var LeaferUI = (function (exports) {
|
|
|
8727
8723
|
|
|
8728
8724
|
const { abs } = Math;
|
|
8729
8725
|
function checkImage(ui, canvas, paint, allowPaint) {
|
|
8730
|
-
const { scaleX, scaleY } = ui.__nowWorld;
|
|
8726
|
+
const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
8731
8727
|
if (!paint.data || paint.patternId === scaleX + '-' + scaleY) {
|
|
8732
8728
|
return false;
|
|
8733
8729
|
}
|
|
@@ -9632,7 +9628,7 @@ var LeaferUI = (function (exports) {
|
|
|
9632
9628
|
const scale = options.scale || 1;
|
|
9633
9629
|
const pixelRatio = options.pixelRatio || 1;
|
|
9634
9630
|
const screenshot = options.screenshot || leaf.isApp;
|
|
9635
|
-
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill :
|
|
9631
|
+
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
9636
9632
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
9637
9633
|
if (screenshot) {
|
|
9638
9634
|
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
@@ -9643,10 +9639,10 @@ var LeaferUI = (function (exports) {
|
|
|
9643
9639
|
scaleY = worldTransform.scaleY;
|
|
9644
9640
|
switch (relative) {
|
|
9645
9641
|
case 'inner':
|
|
9646
|
-
matrix.set(worldTransform)
|
|
9642
|
+
matrix.set(worldTransform);
|
|
9647
9643
|
break;
|
|
9648
9644
|
case 'local':
|
|
9649
|
-
matrix.set(worldTransform).divide(leaf.localTransform)
|
|
9645
|
+
matrix.set(worldTransform).divide(leaf.localTransform);
|
|
9650
9646
|
scaleX /= leaf.scaleX;
|
|
9651
9647
|
scaleY /= leaf.scaleY;
|
|
9652
9648
|
break;
|
|
@@ -9657,7 +9653,7 @@ var LeaferUI = (function (exports) {
|
|
|
9657
9653
|
case 'page':
|
|
9658
9654
|
relative = leaf.leafer;
|
|
9659
9655
|
default:
|
|
9660
|
-
matrix.set(worldTransform).divide(leaf.getTransform(relative))
|
|
9656
|
+
matrix.set(worldTransform).divide(leaf.getTransform(relative));
|
|
9661
9657
|
const l = relative.worldTransform;
|
|
9662
9658
|
scaleX /= scaleX / l.scaleX;
|
|
9663
9659
|
scaleY /= scaleY / l.scaleY;
|
|
@@ -9666,7 +9662,7 @@ var LeaferUI = (function (exports) {
|
|
|
9666
9662
|
}
|
|
9667
9663
|
const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
|
|
9668
9664
|
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio });
|
|
9669
|
-
const renderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
|
|
9665
|
+
const renderOptions = { matrix: matrix.scale(1 / scale).invert().translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
|
|
9670
9666
|
if (slice) {
|
|
9671
9667
|
leaf = leafer;
|
|
9672
9668
|
renderOptions.bounds = canvas.bounds;
|
|
@@ -9712,6 +9708,44 @@ var LeaferUI = (function (exports) {
|
|
|
9712
9708
|
});
|
|
9713
9709
|
}
|
|
9714
9710
|
|
|
9711
|
+
const canvas = LeaferCanvasBase.prototype;
|
|
9712
|
+
const debug = Debug.get('@leafer-ui/export');
|
|
9713
|
+
canvas.export = function (filename, options) {
|
|
9714
|
+
const { quality, blob } = FileHelper.getExportOptions(options);
|
|
9715
|
+
if (filename.includes('.')) {
|
|
9716
|
+
return this.saveAs(filename, quality);
|
|
9717
|
+
}
|
|
9718
|
+
else if (blob) {
|
|
9719
|
+
return this.toBlob(filename, quality);
|
|
9720
|
+
}
|
|
9721
|
+
else {
|
|
9722
|
+
return this.toDataURL(filename, quality);
|
|
9723
|
+
}
|
|
9724
|
+
};
|
|
9725
|
+
canvas.toBlob = function (type, quality) {
|
|
9726
|
+
return new Promise((resolve) => {
|
|
9727
|
+
Platform.origin.canvasToBolb(this.view, type, quality).then((blob) => {
|
|
9728
|
+
resolve(blob);
|
|
9729
|
+
}).catch((e) => {
|
|
9730
|
+
debug.error(e);
|
|
9731
|
+
resolve(null);
|
|
9732
|
+
});
|
|
9733
|
+
});
|
|
9734
|
+
};
|
|
9735
|
+
canvas.toDataURL = function (type, quality) {
|
|
9736
|
+
return Platform.origin.canvasToDataURL(this.view, type, quality);
|
|
9737
|
+
};
|
|
9738
|
+
canvas.saveAs = function (filename, quality) {
|
|
9739
|
+
return new Promise((resolve) => {
|
|
9740
|
+
Platform.origin.canvasSaveAs(this.view, filename, quality).then(() => {
|
|
9741
|
+
resolve(true);
|
|
9742
|
+
}).catch((e) => {
|
|
9743
|
+
debug.error(e);
|
|
9744
|
+
resolve(false);
|
|
9745
|
+
});
|
|
9746
|
+
});
|
|
9747
|
+
};
|
|
9748
|
+
|
|
9715
9749
|
Object.assign(TextConvert, TextConvertModule);
|
|
9716
9750
|
Object.assign(ColorConvert, ColorConvertModule);
|
|
9717
9751
|
Object.assign(Paint, PaintModule);
|
|
@@ -9824,6 +9858,7 @@ var LeaferUI = (function (exports) {
|
|
|
9824
9858
|
exports.affectRenderBoundsType = affectRenderBoundsType;
|
|
9825
9859
|
exports.affectStrokeBoundsType = affectStrokeBoundsType;
|
|
9826
9860
|
exports.arrowType = arrowType;
|
|
9861
|
+
exports.attr = attr;
|
|
9827
9862
|
exports.autoLayoutType = autoLayoutType;
|
|
9828
9863
|
exports.boundsType = boundsType;
|
|
9829
9864
|
exports.canvasPatch = canvasPatch;
|
|
@@ -9831,12 +9866,14 @@ var LeaferUI = (function (exports) {
|
|
|
9831
9866
|
exports.cursorType = cursorType;
|
|
9832
9867
|
exports.dataProcessor = dataProcessor;
|
|
9833
9868
|
exports.dataType = dataType;
|
|
9869
|
+
exports.decorateLeafAttr = decorateLeafAttr;
|
|
9834
9870
|
exports.defineDataProcessor = defineDataProcessor;
|
|
9835
9871
|
exports.defineKey = defineKey;
|
|
9836
9872
|
exports.defineLeafAttr = defineLeafAttr;
|
|
9837
9873
|
exports.doBoundsType = doBoundsType;
|
|
9838
9874
|
exports.doStrokeType = doStrokeType;
|
|
9839
9875
|
exports.effectType = effectType;
|
|
9876
|
+
exports.emptyData = emptyData;
|
|
9840
9877
|
exports.eraserType = eraserType;
|
|
9841
9878
|
exports.getBoundsData = getBoundsData;
|
|
9842
9879
|
exports.getDescriptor = getDescriptor;
|
|
@@ -9862,8 +9899,12 @@ var LeaferUI = (function (exports) {
|
|
|
9862
9899
|
exports.stateType = stateType;
|
|
9863
9900
|
exports.strokeType = strokeType;
|
|
9864
9901
|
exports.surfaceType = surfaceType;
|
|
9902
|
+
exports.tempBounds = tempBounds$1;
|
|
9903
|
+
exports.tempMatrix = tempMatrix;
|
|
9904
|
+
exports.tempPoint = tempPoint$2;
|
|
9865
9905
|
exports.useCanvas = useCanvas;
|
|
9866
9906
|
exports.useModule = useModule;
|
|
9907
|
+
exports.version = version;
|
|
9867
9908
|
exports.zoomLayerType = zoomLayerType;
|
|
9868
9909
|
|
|
9869
9910
|
return exports;
|