leafer-ui 1.6.7 → 1.8.0
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 +10 -4
- package/dist/web.cjs +100 -61
- package/dist/web.esm.js +101 -62
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +329 -203
- 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 +327 -203
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Debug, LeaferCanvasBase, Platform, DataHelper, canvasSizeAttrs, ResizeEvent, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, LeafLevelList, LayoutEvent, Run, ImageManager, BoundsHelper, Plugin, MathHelper, MatrixHelper, AlignHelper, PointHelper, ImageEvent, AroundHelper, Direction4 } from '@leafer/core';
|
|
1
|
+
import { Debug, LeaferCanvasBase, Platform, DataHelper, canvasSizeAttrs, ResizeEvent, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, LeafLevelList, LayoutEvent, Run, ImageManager, BoundsHelper, Plugin, MathHelper, getMatrixData, MatrixHelper, AlignHelper, PointHelper, ImageEvent, AroundHelper, Direction4 } from '@leafer/core';
|
|
2
2
|
export * from '@leafer/core';
|
|
3
3
|
export { LeaferImage } from '@leafer/core';
|
|
4
4
|
import { InteractionHelper, InteractionBase, Cursor, HitCanvasManager } from '@leafer-ui/core';
|
|
@@ -1035,6 +1035,9 @@ const KeyEventHelper = {
|
|
|
1035
1035
|
|
|
1036
1036
|
const { pathCanDrag } = InteractionHelper;
|
|
1037
1037
|
class Interaction extends InteractionBase {
|
|
1038
|
+
get notPointer() { const { p } = this; return p.type !== 'pointer' || p.touch || this.useMultiTouch; }
|
|
1039
|
+
get notTouch() { const { p } = this; return p.type === 'mouse' || this.usePointer; }
|
|
1040
|
+
get notMouse() { return this.usePointer || this.useTouch; }
|
|
1038
1041
|
__listenEvents() {
|
|
1039
1042
|
super.__listenEvents();
|
|
1040
1043
|
const view = this.view = this.canvas.view;
|
|
@@ -1120,13 +1123,13 @@ class Interaction extends InteractionBase {
|
|
|
1120
1123
|
}
|
|
1121
1124
|
onPointerDown(e) {
|
|
1122
1125
|
this.preventDefaultPointer(e);
|
|
1123
|
-
if (this.
|
|
1126
|
+
if (this.notPointer)
|
|
1124
1127
|
return;
|
|
1125
1128
|
this.usePointer || (this.usePointer = true);
|
|
1126
1129
|
this.pointerDown(PointerEventHelper.convert(e, this.getLocal(e)));
|
|
1127
1130
|
}
|
|
1128
1131
|
onPointerMove(e, isLeave) {
|
|
1129
|
-
if (this.
|
|
1132
|
+
if (this.notPointer || this.preventWindowPointer(e))
|
|
1130
1133
|
return;
|
|
1131
1134
|
this.usePointer || (this.usePointer = true);
|
|
1132
1135
|
const data = PointerEventHelper.convert(e, this.getLocal(e, true));
|
|
@@ -1138,7 +1141,7 @@ class Interaction extends InteractionBase {
|
|
|
1138
1141
|
onPointerUp(e) {
|
|
1139
1142
|
if (this.downData)
|
|
1140
1143
|
this.preventDefaultPointer(e);
|
|
1141
|
-
if (this.
|
|
1144
|
+
if (this.notPointer || this.preventWindowPointer(e))
|
|
1142
1145
|
return;
|
|
1143
1146
|
this.pointerUp(PointerEventHelper.convert(e, this.getLocal(e)));
|
|
1144
1147
|
}
|
|
@@ -1149,24 +1152,24 @@ class Interaction extends InteractionBase {
|
|
|
1149
1152
|
}
|
|
1150
1153
|
onMouseDown(e) {
|
|
1151
1154
|
this.preventDefaultPointer(e);
|
|
1152
|
-
if (this.
|
|
1155
|
+
if (this.notMouse)
|
|
1153
1156
|
return;
|
|
1154
1157
|
this.pointerDown(PointerEventHelper.convertMouse(e, this.getLocal(e)));
|
|
1155
1158
|
}
|
|
1156
1159
|
onMouseMove(e) {
|
|
1157
|
-
if (this.
|
|
1160
|
+
if (this.notMouse || this.preventWindowPointer(e))
|
|
1158
1161
|
return;
|
|
1159
1162
|
this.pointerMove(PointerEventHelper.convertMouse(e, this.getLocal(e, true)));
|
|
1160
1163
|
}
|
|
1161
1164
|
onMouseUp(e) {
|
|
1162
1165
|
if (this.downData)
|
|
1163
1166
|
this.preventDefaultPointer(e);
|
|
1164
|
-
if (this.
|
|
1167
|
+
if (this.notMouse || this.preventWindowPointer(e))
|
|
1165
1168
|
return;
|
|
1166
1169
|
this.pointerUp(PointerEventHelper.convertMouse(e, this.getLocal(e)));
|
|
1167
1170
|
}
|
|
1168
1171
|
onMouseCancel() {
|
|
1169
|
-
if (this.
|
|
1172
|
+
if (this.notMouse)
|
|
1170
1173
|
return;
|
|
1171
1174
|
this.pointerCancel();
|
|
1172
1175
|
}
|
|
@@ -1177,7 +1180,7 @@ class Interaction extends InteractionBase {
|
|
|
1177
1180
|
if (preventDefault === true || (preventDefault === 'auto' && pathCanDrag(this.findPath(local))))
|
|
1178
1181
|
e.preventDefault();
|
|
1179
1182
|
this.multiTouchStart(e);
|
|
1180
|
-
if (this.
|
|
1183
|
+
if (this.notTouch)
|
|
1181
1184
|
return;
|
|
1182
1185
|
if (this.touchTimer) {
|
|
1183
1186
|
window.clearTimeout(this.touchTimer);
|
|
@@ -1188,14 +1191,14 @@ class Interaction extends InteractionBase {
|
|
|
1188
1191
|
}
|
|
1189
1192
|
onTouchMove(e) {
|
|
1190
1193
|
this.multiTouchMove(e);
|
|
1191
|
-
if (this.
|
|
1194
|
+
if (this.notTouch || this.preventWindowPointer(e))
|
|
1192
1195
|
return;
|
|
1193
1196
|
const touch = PointerEventHelper.getTouch(e);
|
|
1194
1197
|
this.pointerMove(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
|
|
1195
1198
|
}
|
|
1196
1199
|
onTouchEnd(e) {
|
|
1197
1200
|
this.multiTouchEnd();
|
|
1198
|
-
if (this.
|
|
1201
|
+
if (this.notTouch || this.preventWindowPointer(e))
|
|
1199
1202
|
return;
|
|
1200
1203
|
if (this.touchTimer)
|
|
1201
1204
|
clearTimeout(this.touchTimer);
|
|
@@ -1206,7 +1209,7 @@ class Interaction extends InteractionBase {
|
|
|
1206
1209
|
this.pointerUp(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
|
|
1207
1210
|
}
|
|
1208
1211
|
onTouchCancel() {
|
|
1209
|
-
if (this.
|
|
1212
|
+
if (this.notTouch)
|
|
1210
1213
|
return;
|
|
1211
1214
|
this.pointerCancel();
|
|
1212
1215
|
}
|
|
@@ -1346,9 +1349,14 @@ function fills(fills, ui, canvas) {
|
|
|
1346
1349
|
}
|
|
1347
1350
|
}
|
|
1348
1351
|
canvas.fillStyle = item.style;
|
|
1349
|
-
if (item.transform) {
|
|
1352
|
+
if (item.transform || item.scaleFixed) {
|
|
1350
1353
|
canvas.save();
|
|
1351
|
-
|
|
1354
|
+
if (item.transform)
|
|
1355
|
+
canvas.transform(item.transform);
|
|
1356
|
+
if (item.scaleFixed) {
|
|
1357
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true);
|
|
1358
|
+
canvas.scale(1 / scaleX, 1 / scaleY);
|
|
1359
|
+
}
|
|
1352
1360
|
if (item.blendMode)
|
|
1353
1361
|
canvas.blendMode = item.blendMode;
|
|
1354
1362
|
fillPathOrText(ui, canvas);
|
|
@@ -1384,8 +1392,13 @@ function strokeText(stroke, ui, canvas) {
|
|
|
1384
1392
|
}
|
|
1385
1393
|
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
1386
1394
|
const data = ui.__;
|
|
1387
|
-
|
|
1388
|
-
|
|
1395
|
+
if (typeof stroke === 'object') {
|
|
1396
|
+
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
1397
|
+
}
|
|
1398
|
+
else {
|
|
1399
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
1400
|
+
drawTextStroke(ui, canvas);
|
|
1401
|
+
}
|
|
1389
1402
|
}
|
|
1390
1403
|
function drawAlign(stroke, align, ui, canvas) {
|
|
1391
1404
|
const out = canvas.getSameCanvas(true, true);
|
|
@@ -1394,15 +1407,9 @@ function drawAlign(stroke, align, ui, canvas) {
|
|
|
1394
1407
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
1395
1408
|
fillText(ui, out);
|
|
1396
1409
|
out.blendMode = 'normal';
|
|
1397
|
-
|
|
1410
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
1398
1411
|
out.recycle(ui.__nowWorld);
|
|
1399
1412
|
}
|
|
1400
|
-
function copyWorld(canvas, out, ui) {
|
|
1401
|
-
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
1402
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1403
|
-
else
|
|
1404
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1405
|
-
}
|
|
1406
1413
|
function drawTextStroke(ui, canvas) {
|
|
1407
1414
|
let row, data = ui.__.__textDrawData;
|
|
1408
1415
|
const { rows, decorationY } = data;
|
|
@@ -1418,14 +1425,21 @@ function drawTextStroke(ui, canvas) {
|
|
|
1418
1425
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
1419
1426
|
}
|
|
1420
1427
|
}
|
|
1421
|
-
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
1428
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
1422
1429
|
let item;
|
|
1430
|
+
const data = ui.__, { __hasMultiStrokeStyle } = data;
|
|
1431
|
+
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
1423
1432
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
1424
1433
|
item = strokes[i];
|
|
1425
1434
|
if (item.image && PaintImage.checkImage(ui, canvas, item, false))
|
|
1426
1435
|
continue;
|
|
1427
1436
|
if (item.style) {
|
|
1428
|
-
|
|
1437
|
+
if (__hasMultiStrokeStyle) {
|
|
1438
|
+
const { strokeStyle } = item;
|
|
1439
|
+
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
1440
|
+
}
|
|
1441
|
+
else
|
|
1442
|
+
canvas.strokeStyle = item.style;
|
|
1429
1443
|
if (item.blendMode) {
|
|
1430
1444
|
canvas.saveBlendMode(item.blendMode);
|
|
1431
1445
|
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
@@ -1464,8 +1478,13 @@ function strokes(strokes, ui, canvas) {
|
|
|
1464
1478
|
}
|
|
1465
1479
|
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
1466
1480
|
const data = ui.__;
|
|
1467
|
-
|
|
1468
|
-
|
|
1481
|
+
if (typeof stroke === 'object') {
|
|
1482
|
+
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
1483
|
+
}
|
|
1484
|
+
else {
|
|
1485
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
1486
|
+
canvas.stroke();
|
|
1487
|
+
}
|
|
1469
1488
|
if (data.__useArrow)
|
|
1470
1489
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
1471
1490
|
}
|
|
@@ -1487,7 +1506,7 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
1487
1506
|
drawCenter(stroke, 2, ui, out);
|
|
1488
1507
|
out.clipUI(data);
|
|
1489
1508
|
out.clearWorld(renderBounds);
|
|
1490
|
-
|
|
1509
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
1491
1510
|
out.recycle(ui.__nowWorld);
|
|
1492
1511
|
}
|
|
1493
1512
|
}
|
|
@@ -1542,8 +1561,16 @@ function compute(attrName, ui) {
|
|
|
1542
1561
|
if (!(paints instanceof Array))
|
|
1543
1562
|
paints = [paints];
|
|
1544
1563
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
1564
|
+
let maxChildStrokeWidth;
|
|
1545
1565
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
1546
|
-
(item = getLeafPaint(attrName, paints[i], ui))
|
|
1566
|
+
if (item = getLeafPaint(attrName, paints[i], ui)) {
|
|
1567
|
+
leafPaints.push(item);
|
|
1568
|
+
if (item.strokeStyle) {
|
|
1569
|
+
maxChildStrokeWidth || (maxChildStrokeWidth = 1);
|
|
1570
|
+
if (item.strokeStyle.strokeWidth)
|
|
1571
|
+
maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1547
1574
|
}
|
|
1548
1575
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1549
1576
|
if (leafPaints.length) {
|
|
@@ -1560,6 +1587,7 @@ function compute(attrName, ui) {
|
|
|
1560
1587
|
else {
|
|
1561
1588
|
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
1562
1589
|
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
1590
|
+
stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
|
|
1563
1591
|
}
|
|
1564
1592
|
}
|
|
1565
1593
|
function getLeafPaint(attrName, paint, ui) {
|
|
@@ -1591,6 +1619,11 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
1591
1619
|
if (data) {
|
|
1592
1620
|
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
1593
1621
|
data.isTransparent = true;
|
|
1622
|
+
if (paint.style) {
|
|
1623
|
+
if (paint.style.strokeWidth === 0)
|
|
1624
|
+
return undefined;
|
|
1625
|
+
data.strokeStyle = paint.style;
|
|
1626
|
+
}
|
|
1594
1627
|
if (paint.blendMode)
|
|
1595
1628
|
data.blendMode = paint.blendMode;
|
|
1596
1629
|
}
|
|
@@ -1610,8 +1643,8 @@ const PaintModule = {
|
|
|
1610
1643
|
shape
|
|
1611
1644
|
};
|
|
1612
1645
|
|
|
1613
|
-
let origin = {};
|
|
1614
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
|
|
1646
|
+
let origin = {}, tempMatrix = getMatrixData();
|
|
1647
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
1615
1648
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1616
1649
|
const transform = get$3();
|
|
1617
1650
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -1620,13 +1653,19 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1620
1653
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
1621
1654
|
data.transform = transform;
|
|
1622
1655
|
}
|
|
1623
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1656
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
|
|
1624
1657
|
const transform = get$3();
|
|
1625
|
-
translate$1(transform, box.x + x, box.y + y);
|
|
1626
|
-
if (scaleX)
|
|
1627
|
-
scaleHelper(transform, scaleX, scaleY);
|
|
1628
1658
|
if (rotation)
|
|
1629
1659
|
rotate(transform, rotation);
|
|
1660
|
+
if (skew)
|
|
1661
|
+
skewHelper(transform, skew.x, skew.y);
|
|
1662
|
+
if (scaleX)
|
|
1663
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
1664
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
1665
|
+
if (clipSize) {
|
|
1666
|
+
tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
|
|
1667
|
+
multiplyParent(transform, tempMatrix);
|
|
1668
|
+
}
|
|
1630
1669
|
data.transform = transform;
|
|
1631
1670
|
}
|
|
1632
1671
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -1663,11 +1702,15 @@ const tempBox = new Bounds();
|
|
|
1663
1702
|
const tempScaleData = {};
|
|
1664
1703
|
const tempImage = {};
|
|
1665
1704
|
function createData(leafPaint, image, paint, box) {
|
|
1666
|
-
const { changeful, sync } = paint;
|
|
1705
|
+
const { changeful, sync, editing, scaleFixed } = paint;
|
|
1667
1706
|
if (changeful)
|
|
1668
1707
|
leafPaint.changeful = changeful;
|
|
1669
1708
|
if (sync)
|
|
1670
1709
|
leafPaint.sync = sync;
|
|
1710
|
+
if (editing)
|
|
1711
|
+
leafPaint.editing = editing;
|
|
1712
|
+
if (scaleFixed)
|
|
1713
|
+
leafPaint.scaleFixed = scaleFixed;
|
|
1671
1714
|
leafPaint.data = getPatternData(paint, box, image);
|
|
1672
1715
|
}
|
|
1673
1716
|
function getPatternData(paint, box, image) {
|
|
@@ -1676,7 +1719,7 @@ function getPatternData(paint, box, image) {
|
|
|
1676
1719
|
if (paint.mode === 'strench')
|
|
1677
1720
|
paint.mode = 'stretch';
|
|
1678
1721
|
let { width, height } = image;
|
|
1679
|
-
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
1722
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
|
|
1680
1723
|
const sameBox = box.width === width && box.height === height;
|
|
1681
1724
|
const data = { mode };
|
|
1682
1725
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -1710,8 +1753,8 @@ function getPatternData(paint, box, image) {
|
|
|
1710
1753
|
break;
|
|
1711
1754
|
case 'normal':
|
|
1712
1755
|
case 'clip':
|
|
1713
|
-
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
1714
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
1756
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
1757
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
|
|
1715
1758
|
break;
|
|
1716
1759
|
case 'repeat':
|
|
1717
1760
|
if (!sameBox || scaleX || rotation)
|
|
@@ -1788,11 +1831,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
1788
1831
|
}
|
|
1789
1832
|
onLoadSuccess(ui, event);
|
|
1790
1833
|
}
|
|
1791
|
-
leafPaint.loadId =
|
|
1834
|
+
leafPaint.loadId = undefined;
|
|
1792
1835
|
}, (error) => {
|
|
1793
1836
|
ignoreRender(ui, false);
|
|
1794
1837
|
onLoadError(ui, event, error);
|
|
1795
|
-
leafPaint.loadId =
|
|
1838
|
+
leafPaint.loadId = undefined;
|
|
1796
1839
|
});
|
|
1797
1840
|
if (ui.placeholderColor) {
|
|
1798
1841
|
if (!ui.placeholderDelay)
|
|
@@ -1848,16 +1891,16 @@ function ignoreRender(ui, value) {
|
|
|
1848
1891
|
}
|
|
1849
1892
|
|
|
1850
1893
|
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
1851
|
-
const { ceil, abs
|
|
1894
|
+
const { ceil, abs } = Math;
|
|
1852
1895
|
function createPattern(ui, paint, pixelRatio) {
|
|
1853
|
-
let { scaleX, scaleY } =
|
|
1896
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
1854
1897
|
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
1855
1898
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
1856
|
-
scaleX = abs$1(scaleX);
|
|
1857
|
-
scaleY = abs$1(scaleY);
|
|
1858
1899
|
const { image, data } = paint;
|
|
1859
1900
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
1860
1901
|
if (sx) {
|
|
1902
|
+
sx = abs(sx);
|
|
1903
|
+
sy = abs(sy);
|
|
1861
1904
|
imageMatrix = get$1();
|
|
1862
1905
|
copy$1(imageMatrix, transform);
|
|
1863
1906
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -1942,9 +1985,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
1942
1985
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1943
1986
|
};
|
|
1944
1987
|
|
|
1945
|
-
const { abs } = Math;
|
|
1946
1988
|
function checkImage(ui, canvas, paint, allowDraw) {
|
|
1947
|
-
const { scaleX, scaleY } =
|
|
1989
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
1948
1990
|
const { pixelRatio } = canvas, { data } = paint;
|
|
1949
1991
|
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
1950
1992
|
return false;
|
|
@@ -1957,8 +1999,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1957
1999
|
else {
|
|
1958
2000
|
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
1959
2001
|
let { width, height } = data;
|
|
1960
|
-
width *=
|
|
1961
|
-
height *=
|
|
2002
|
+
width *= scaleX * pixelRatio;
|
|
2003
|
+
height *= scaleY * pixelRatio;
|
|
1962
2004
|
if (data.scaleX) {
|
|
1963
2005
|
width *= data.scaleX;
|
|
1964
2006
|
height *= data.scaleY;
|
|
@@ -1968,6 +2010,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1968
2010
|
}
|
|
1969
2011
|
}
|
|
1970
2012
|
if (allowDraw) {
|
|
2013
|
+
if (ui.__.__isFastShadow) {
|
|
2014
|
+
canvas.fillStyle = paint.style || '#000';
|
|
2015
|
+
canvas.fill();
|
|
2016
|
+
}
|
|
1971
2017
|
drawImage(ui, canvas, paint, data);
|
|
1972
2018
|
return true;
|
|
1973
2019
|
}
|
|
@@ -2156,10 +2202,7 @@ function shadow(ui, current, shape) {
|
|
|
2156
2202
|
}
|
|
2157
2203
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
2158
2204
|
}
|
|
2159
|
-
|
|
2160
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
2161
|
-
else
|
|
2162
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
2205
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
2163
2206
|
if (end && index < end)
|
|
2164
2207
|
other.clearWorld(copyBounds, true);
|
|
2165
2208
|
});
|
|
@@ -2218,10 +2261,7 @@ function innerShadow(ui, current, shape) {
|
|
|
2218
2261
|
copyBounds = bounds;
|
|
2219
2262
|
}
|
|
2220
2263
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
2221
|
-
|
|
2222
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
2223
|
-
else
|
|
2224
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
2264
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
2225
2265
|
if (end && index < end)
|
|
2226
2266
|
other.clearWorld(copyBounds, true);
|
|
2227
2267
|
});
|
|
@@ -2277,12 +2317,11 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
2277
2317
|
contentCanvas = getCanvas(canvas);
|
|
2278
2318
|
child.__render(maskCanvas, options);
|
|
2279
2319
|
}
|
|
2280
|
-
if (
|
|
2281
|
-
|
|
2282
|
-
}
|
|
2283
|
-
if (excludeRenderBounds(child, options))
|
|
2320
|
+
if (mask === 'clipping' || mask === 'clipping-path')
|
|
2321
|
+
excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
2284
2322
|
continue;
|
|
2285
|
-
|
|
2323
|
+
}
|
|
2324
|
+
excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
|
|
2286
2325
|
}
|
|
2287
2326
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
2288
2327
|
};
|