leafer-ui 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/README.md +4 -4
- package/dist/web.cjs +33 -14
- package/dist/web.cjs.map +1 -1
- package/dist/web.esm.js +33 -14
- package/dist/web.esm.js.map +1 -1
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +111 -59
- package/dist/web.js.map +1 -1
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +111 -60
- package/dist/web.module.js.map +1 -1
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/web.esm.js
CHANGED
|
@@ -125,7 +125,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
125
125
|
else {
|
|
126
126
|
window.addEventListener('resize', this.windowListener = () => {
|
|
127
127
|
const pixelRatio = Platform.devicePixelRatio;
|
|
128
|
-
if (this.pixelRatio !== pixelRatio) {
|
|
128
|
+
if (!this.config.pixelRatio && this.pixelRatio !== pixelRatio) {
|
|
129
129
|
const { width, height } = this;
|
|
130
130
|
this.emitResize({ width, height, pixelRatio });
|
|
131
131
|
}
|
|
@@ -142,7 +142,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
142
142
|
checkAutoBounds(parentSize) {
|
|
143
143
|
const view = this.view;
|
|
144
144
|
const { x, y, width, height } = this.autoBounds.getBoundsFrom(parentSize);
|
|
145
|
-
const size = { width, height, pixelRatio: Platform.devicePixelRatio };
|
|
145
|
+
const size = { width, height, pixelRatio: this.config.pixelRatio ? this.pixelRatio : Platform.devicePixelRatio };
|
|
146
146
|
if (!this.isSameSize(size)) {
|
|
147
147
|
const { style } = view;
|
|
148
148
|
style.marginLeft = x + 'px';
|
|
@@ -1327,16 +1327,20 @@ class Interaction extends InteractionBase {
|
|
|
1327
1327
|
}
|
|
1328
1328
|
|
|
1329
1329
|
function fillText(ui, canvas) {
|
|
1330
|
-
let row;
|
|
1331
|
-
const { rows, decorationY
|
|
1330
|
+
let row, data = ui.__.__textDrawData;
|
|
1331
|
+
const { rows, decorationY } = data;
|
|
1332
1332
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
1333
1333
|
row = rows[i];
|
|
1334
1334
|
if (row.text)
|
|
1335
1335
|
canvas.fillText(row.text, row.x, row.y);
|
|
1336
1336
|
else if (row.data)
|
|
1337
1337
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
1338
|
-
|
|
1339
|
-
|
|
1338
|
+
}
|
|
1339
|
+
if (decorationY) {
|
|
1340
|
+
const { decorationColor, decorationHeight } = data;
|
|
1341
|
+
if (decorationColor)
|
|
1342
|
+
canvas.fillStyle = decorationColor;
|
|
1343
|
+
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
1340
1344
|
}
|
|
1341
1345
|
}
|
|
1342
1346
|
|
|
@@ -1407,16 +1411,18 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
1407
1411
|
out.recycle(ui.__nowWorld);
|
|
1408
1412
|
}
|
|
1409
1413
|
function drawTextStroke(ui, canvas) {
|
|
1410
|
-
let row;
|
|
1411
|
-
const { rows, decorationY
|
|
1414
|
+
let row, data = ui.__.__textDrawData;
|
|
1415
|
+
const { rows, decorationY } = data;
|
|
1412
1416
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
1413
1417
|
row = rows[i];
|
|
1414
1418
|
if (row.text)
|
|
1415
1419
|
canvas.strokeText(row.text, row.x, row.y);
|
|
1416
1420
|
else if (row.data)
|
|
1417
1421
|
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
1418
|
-
|
|
1419
|
-
|
|
1422
|
+
}
|
|
1423
|
+
if (decorationY) {
|
|
1424
|
+
const { decorationHeight } = data;
|
|
1425
|
+
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
1420
1426
|
}
|
|
1421
1427
|
}
|
|
1422
1428
|
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
@@ -2014,6 +2020,8 @@ function recycleImage(attrName, data) {
|
|
|
2014
2020
|
}
|
|
2015
2021
|
image.unload(paints[i].loadId, !input.some((item) => item.url === url));
|
|
2016
2022
|
}
|
|
2023
|
+
else
|
|
2024
|
+
paints[i].style = null;
|
|
2017
2025
|
}
|
|
2018
2026
|
}
|
|
2019
2027
|
return recycleMap;
|
|
@@ -2746,14 +2754,25 @@ function toTextChar(row) {
|
|
|
2746
2754
|
}
|
|
2747
2755
|
|
|
2748
2756
|
function decorationText(drawData, style) {
|
|
2749
|
-
|
|
2757
|
+
let type;
|
|
2758
|
+
const { fontSize, textDecoration } = style;
|
|
2750
2759
|
drawData.decorationHeight = fontSize / 11;
|
|
2751
|
-
|
|
2760
|
+
if (typeof textDecoration === 'object') {
|
|
2761
|
+
type = textDecoration.type;
|
|
2762
|
+
if (textDecoration.color)
|
|
2763
|
+
drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
2764
|
+
}
|
|
2765
|
+
else
|
|
2766
|
+
type = textDecoration;
|
|
2767
|
+
switch (type) {
|
|
2752
2768
|
case 'under':
|
|
2753
|
-
drawData.decorationY = fontSize * 0.15;
|
|
2769
|
+
drawData.decorationY = [fontSize * 0.15];
|
|
2754
2770
|
break;
|
|
2755
2771
|
case 'delete':
|
|
2756
|
-
drawData.decorationY = -fontSize * 0.35;
|
|
2772
|
+
drawData.decorationY = [-fontSize * 0.35];
|
|
2773
|
+
break;
|
|
2774
|
+
case 'under-delete':
|
|
2775
|
+
drawData.decorationY = [fontSize * 0.15, -fontSize * 0.35];
|
|
2757
2776
|
}
|
|
2758
2777
|
}
|
|
2759
2778
|
|