@leafer-draw/miniapp 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniapp.cjs +31 -12
- package/dist/miniapp.cjs.map +1 -1
- package/dist/miniapp.esm.js +31 -12
- package/dist/miniapp.esm.js.map +1 -1
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +109 -58
- package/dist/miniapp.module.js.map +1 -1
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +8 -8
package/dist/miniapp.esm.js
CHANGED
|
@@ -818,16 +818,20 @@ Object.assign(Creator, {
|
|
|
818
818
|
Platform.layout = Layouter.fullLayout;
|
|
819
819
|
|
|
820
820
|
function fillText(ui, canvas) {
|
|
821
|
-
let row;
|
|
822
|
-
const { rows, decorationY
|
|
821
|
+
let row, data = ui.__.__textDrawData;
|
|
822
|
+
const { rows, decorationY } = data;
|
|
823
823
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
824
824
|
row = rows[i];
|
|
825
825
|
if (row.text)
|
|
826
826
|
canvas.fillText(row.text, row.x, row.y);
|
|
827
827
|
else if (row.data)
|
|
828
828
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
829
|
-
|
|
830
|
-
|
|
829
|
+
}
|
|
830
|
+
if (decorationY) {
|
|
831
|
+
const { decorationColor, decorationHeight } = data;
|
|
832
|
+
if (decorationColor)
|
|
833
|
+
canvas.fillStyle = decorationColor;
|
|
834
|
+
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
831
835
|
}
|
|
832
836
|
}
|
|
833
837
|
|
|
@@ -898,16 +902,18 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
898
902
|
out.recycle(ui.__nowWorld);
|
|
899
903
|
}
|
|
900
904
|
function drawTextStroke(ui, canvas) {
|
|
901
|
-
let row;
|
|
902
|
-
const { rows, decorationY
|
|
905
|
+
let row, data = ui.__.__textDrawData;
|
|
906
|
+
const { rows, decorationY } = data;
|
|
903
907
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
904
908
|
row = rows[i];
|
|
905
909
|
if (row.text)
|
|
906
910
|
canvas.strokeText(row.text, row.x, row.y);
|
|
907
911
|
else if (row.data)
|
|
908
912
|
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
909
|
-
|
|
910
|
-
|
|
913
|
+
}
|
|
914
|
+
if (decorationY) {
|
|
915
|
+
const { decorationHeight } = data;
|
|
916
|
+
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
911
917
|
}
|
|
912
918
|
}
|
|
913
919
|
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
@@ -1505,6 +1511,8 @@ function recycleImage(attrName, data) {
|
|
|
1505
1511
|
}
|
|
1506
1512
|
image.unload(paints[i].loadId, !input.some((item) => item.url === url));
|
|
1507
1513
|
}
|
|
1514
|
+
else
|
|
1515
|
+
paints[i].style = null;
|
|
1508
1516
|
}
|
|
1509
1517
|
}
|
|
1510
1518
|
return recycleMap;
|
|
@@ -2237,14 +2245,25 @@ function toTextChar(row) {
|
|
|
2237
2245
|
}
|
|
2238
2246
|
|
|
2239
2247
|
function decorationText(drawData, style) {
|
|
2240
|
-
|
|
2248
|
+
let type;
|
|
2249
|
+
const { fontSize, textDecoration } = style;
|
|
2241
2250
|
drawData.decorationHeight = fontSize / 11;
|
|
2242
|
-
|
|
2251
|
+
if (typeof textDecoration === 'object') {
|
|
2252
|
+
type = textDecoration.type;
|
|
2253
|
+
if (textDecoration.color)
|
|
2254
|
+
drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
2255
|
+
}
|
|
2256
|
+
else
|
|
2257
|
+
type = textDecoration;
|
|
2258
|
+
switch (type) {
|
|
2243
2259
|
case 'under':
|
|
2244
|
-
drawData.decorationY = fontSize * 0.15;
|
|
2260
|
+
drawData.decorationY = [fontSize * 0.15];
|
|
2245
2261
|
break;
|
|
2246
2262
|
case 'delete':
|
|
2247
|
-
drawData.decorationY = -fontSize * 0.35;
|
|
2263
|
+
drawData.decorationY = [-fontSize * 0.35];
|
|
2264
|
+
break;
|
|
2265
|
+
case 'under-delete':
|
|
2266
|
+
drawData.decorationY = [fontSize * 0.15, -fontSize * 0.35];
|
|
2248
2267
|
}
|
|
2249
2268
|
}
|
|
2250
2269
|
|