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/README.md
CHANGED
|
@@ -113,7 +113,10 @@ LeaferJS 致力于实现一套简洁、开放、现代化的 UI 绘图语言标
|
|
|
113
113
|
|
|
114
114
|
<p><h3 align="center">金牌赞助商</h3></p>
|
|
115
115
|
<p style="display: flex;flex-wrap: wrap;justify-content: center;gap: 15px;">
|
|
116
|
-
<a target="_blank" href="https://
|
|
116
|
+
<a target="_blank" href="https://xpai.design">
|
|
117
|
+
<img width="180" title="迅排设计" src="https://www.leaferjs.com/image/sponsor/gold/xp.jpg" loading="lazy" />
|
|
118
|
+
</a>
|
|
119
|
+
<a target="_blank" href="https://github.com/dromara/yft-design">
|
|
117
120
|
<img width="180" title="yft-design" src="https://www.leaferjs.com/image/sponsor/gold/yft.jpg" loading="lazy" />
|
|
118
121
|
</a>
|
|
119
122
|
<a target="_blank" href="https://www.finclip.com/landing/miniappgame?from=leafer">
|
|
@@ -143,12 +146,15 @@ LeaferJS 致力于实现一套简洁、开放、现代化的 UI 绘图语言标
|
|
|
143
146
|
</p>
|
|
144
147
|
<p><h3 align="center">银牌赞助</h3></p>
|
|
145
148
|
<p style="display: flex;flex-wrap: wrap;justify-content: center;gap: 5px;">
|
|
146
|
-
|
|
147
|
-
<img width="40" title="
|
|
149
|
+
<a target="_blank" href="">
|
|
150
|
+
<img width="40" title="goosen" src="https://www.leaferjs.com/image/sponsor/user/122.jpeg" loading="lazy" />
|
|
148
151
|
</a>
|
|
149
152
|
<a target="_blank" href="">
|
|
150
153
|
<img width="40" title="dev_chen" src="https://www.leaferjs.com/image/sponsor/user/137.jpg" loading="lazy" />
|
|
151
154
|
</a>
|
|
155
|
+
<a target="_blank" href="https://www.u-tools.cn/plugins/detail/%E6%88%AA%E5%9B%BE%E5%B7%A5%E5%85%B7%20Plus/index.html">
|
|
156
|
+
<img width="40" title="截图工具 Plus" src="https://www.leaferjs.com/image/sponsor/user/135.png" loading="lazy" />
|
|
157
|
+
</a>
|
|
152
158
|
<a target="_blank" href="https://frameelf.com/">
|
|
153
159
|
<img width="40" title="边框水印精灵" src="https://www.leaferjs.com/image/sponsor/user/134.jpg" loading="lazy" />
|
|
154
160
|
</a>
|
|
@@ -296,7 +302,7 @@ LeaferJS 致力于实现一套简洁、开放、现代化的 UI 绘图语言标
|
|
|
296
302
|
</p>
|
|
297
303
|
<p><h3 align="center">铜牌赞助</h3></p>
|
|
298
304
|
<p style="display: flex;flex-wrap: wrap;justify-content: center;gap: 15px;">
|
|
299
|
-
|
|
305
|
+
黑色摩天仑 Charm Lauginwing 在路上 张余🌈 Jerry 李狗嗨。💢 李维亮 朝夕 SaltedFish zhk 格子 等等 goosen 建伟F4nniu 梁福斌 江万江 杨超 ToB Dev 前端之虎陈随易 A☀️云☀️A ʚ LMT ɞ 爱发电用户_c9c82 轻简历 爱发电用户_0fac0 wangyesheji.cn 风间 爱发电用户_Tqsm 爱发电用户_6KpE dongdong zwm 爱发电用户_3725c Noth1ng 纳西妲の√ 爱发电用户_Ahb9 爱发电用户_7617d 冷漠 爱发电用户_9RXB 今日值得读 爱发电用户_49sT 爱发电用户_NFCS 爱发电用户_43ad8 爱发电用户_30455 xiaozhang 砖吐筷筷 爱发电用户_b47b3 longbow1998 爱发电用户_5d755 爱发电用户_b76b8 爱发电用户_e70c2 爱发电用户_039dc 花祁 爱发电用户_99f39 坤坤 爱发电用户_X6hp 爱发电用户_s5u9 曹吉美爸爸 啸沧海 Ronny Biu 王志强 PD.新城คิดถึง 糖颂缘冥倾 ALBERT. 爱发电用户_UXEV SaltedFish 爱发电用户_76f9d Leafer 爱发电用户_Pbm7 </p>
|
|
300
306
|
|
|
301
307
|
## License
|
|
302
308
|
|
package/dist/web.cjs
CHANGED
|
@@ -1034,6 +1034,9 @@ const KeyEventHelper = {
|
|
|
1034
1034
|
|
|
1035
1035
|
const { pathCanDrag } = core$1.InteractionHelper;
|
|
1036
1036
|
class Interaction extends core$1.InteractionBase {
|
|
1037
|
+
get notPointer() { const { p } = this; return p.type !== 'pointer' || p.touch || this.useMultiTouch; }
|
|
1038
|
+
get notTouch() { const { p } = this; return p.type === 'mouse' || this.usePointer; }
|
|
1039
|
+
get notMouse() { return this.usePointer || this.useTouch; }
|
|
1037
1040
|
__listenEvents() {
|
|
1038
1041
|
super.__listenEvents();
|
|
1039
1042
|
const view = this.view = this.canvas.view;
|
|
@@ -1119,13 +1122,13 @@ class Interaction extends core$1.InteractionBase {
|
|
|
1119
1122
|
}
|
|
1120
1123
|
onPointerDown(e) {
|
|
1121
1124
|
this.preventDefaultPointer(e);
|
|
1122
|
-
if (this.
|
|
1125
|
+
if (this.notPointer)
|
|
1123
1126
|
return;
|
|
1124
1127
|
this.usePointer || (this.usePointer = true);
|
|
1125
1128
|
this.pointerDown(PointerEventHelper.convert(e, this.getLocal(e)));
|
|
1126
1129
|
}
|
|
1127
1130
|
onPointerMove(e, isLeave) {
|
|
1128
|
-
if (this.
|
|
1131
|
+
if (this.notPointer || this.preventWindowPointer(e))
|
|
1129
1132
|
return;
|
|
1130
1133
|
this.usePointer || (this.usePointer = true);
|
|
1131
1134
|
const data = PointerEventHelper.convert(e, this.getLocal(e, true));
|
|
@@ -1137,7 +1140,7 @@ class Interaction extends core$1.InteractionBase {
|
|
|
1137
1140
|
onPointerUp(e) {
|
|
1138
1141
|
if (this.downData)
|
|
1139
1142
|
this.preventDefaultPointer(e);
|
|
1140
|
-
if (this.
|
|
1143
|
+
if (this.notPointer || this.preventWindowPointer(e))
|
|
1141
1144
|
return;
|
|
1142
1145
|
this.pointerUp(PointerEventHelper.convert(e, this.getLocal(e)));
|
|
1143
1146
|
}
|
|
@@ -1148,24 +1151,24 @@ class Interaction extends core$1.InteractionBase {
|
|
|
1148
1151
|
}
|
|
1149
1152
|
onMouseDown(e) {
|
|
1150
1153
|
this.preventDefaultPointer(e);
|
|
1151
|
-
if (this.
|
|
1154
|
+
if (this.notMouse)
|
|
1152
1155
|
return;
|
|
1153
1156
|
this.pointerDown(PointerEventHelper.convertMouse(e, this.getLocal(e)));
|
|
1154
1157
|
}
|
|
1155
1158
|
onMouseMove(e) {
|
|
1156
|
-
if (this.
|
|
1159
|
+
if (this.notMouse || this.preventWindowPointer(e))
|
|
1157
1160
|
return;
|
|
1158
1161
|
this.pointerMove(PointerEventHelper.convertMouse(e, this.getLocal(e, true)));
|
|
1159
1162
|
}
|
|
1160
1163
|
onMouseUp(e) {
|
|
1161
1164
|
if (this.downData)
|
|
1162
1165
|
this.preventDefaultPointer(e);
|
|
1163
|
-
if (this.
|
|
1166
|
+
if (this.notMouse || this.preventWindowPointer(e))
|
|
1164
1167
|
return;
|
|
1165
1168
|
this.pointerUp(PointerEventHelper.convertMouse(e, this.getLocal(e)));
|
|
1166
1169
|
}
|
|
1167
1170
|
onMouseCancel() {
|
|
1168
|
-
if (this.
|
|
1171
|
+
if (this.notMouse)
|
|
1169
1172
|
return;
|
|
1170
1173
|
this.pointerCancel();
|
|
1171
1174
|
}
|
|
@@ -1176,7 +1179,7 @@ class Interaction extends core$1.InteractionBase {
|
|
|
1176
1179
|
if (preventDefault === true || (preventDefault === 'auto' && pathCanDrag(this.findPath(local))))
|
|
1177
1180
|
e.preventDefault();
|
|
1178
1181
|
this.multiTouchStart(e);
|
|
1179
|
-
if (this.
|
|
1182
|
+
if (this.notTouch)
|
|
1180
1183
|
return;
|
|
1181
1184
|
if (this.touchTimer) {
|
|
1182
1185
|
window.clearTimeout(this.touchTimer);
|
|
@@ -1187,14 +1190,14 @@ class Interaction extends core$1.InteractionBase {
|
|
|
1187
1190
|
}
|
|
1188
1191
|
onTouchMove(e) {
|
|
1189
1192
|
this.multiTouchMove(e);
|
|
1190
|
-
if (this.
|
|
1193
|
+
if (this.notTouch || this.preventWindowPointer(e))
|
|
1191
1194
|
return;
|
|
1192
1195
|
const touch = PointerEventHelper.getTouch(e);
|
|
1193
1196
|
this.pointerMove(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
|
|
1194
1197
|
}
|
|
1195
1198
|
onTouchEnd(e) {
|
|
1196
1199
|
this.multiTouchEnd();
|
|
1197
|
-
if (this.
|
|
1200
|
+
if (this.notTouch || this.preventWindowPointer(e))
|
|
1198
1201
|
return;
|
|
1199
1202
|
if (this.touchTimer)
|
|
1200
1203
|
clearTimeout(this.touchTimer);
|
|
@@ -1205,7 +1208,7 @@ class Interaction extends core$1.InteractionBase {
|
|
|
1205
1208
|
this.pointerUp(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
|
|
1206
1209
|
}
|
|
1207
1210
|
onTouchCancel() {
|
|
1208
|
-
if (this.
|
|
1211
|
+
if (this.notTouch)
|
|
1209
1212
|
return;
|
|
1210
1213
|
this.pointerCancel();
|
|
1211
1214
|
}
|
|
@@ -1345,9 +1348,14 @@ function fills(fills, ui, canvas) {
|
|
|
1345
1348
|
}
|
|
1346
1349
|
}
|
|
1347
1350
|
canvas.fillStyle = item.style;
|
|
1348
|
-
if (item.transform) {
|
|
1351
|
+
if (item.transform || item.scaleFixed) {
|
|
1349
1352
|
canvas.save();
|
|
1350
|
-
|
|
1353
|
+
if (item.transform)
|
|
1354
|
+
canvas.transform(item.transform);
|
|
1355
|
+
if (item.scaleFixed) {
|
|
1356
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true);
|
|
1357
|
+
canvas.scale(1 / scaleX, 1 / scaleY);
|
|
1358
|
+
}
|
|
1351
1359
|
if (item.blendMode)
|
|
1352
1360
|
canvas.blendMode = item.blendMode;
|
|
1353
1361
|
fillPathOrText(ui, canvas);
|
|
@@ -1383,8 +1391,13 @@ function strokeText(stroke, ui, canvas) {
|
|
|
1383
1391
|
}
|
|
1384
1392
|
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
1385
1393
|
const data = ui.__;
|
|
1386
|
-
|
|
1387
|
-
|
|
1394
|
+
if (typeof stroke === 'object') {
|
|
1395
|
+
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
1396
|
+
}
|
|
1397
|
+
else {
|
|
1398
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
1399
|
+
drawTextStroke(ui, canvas);
|
|
1400
|
+
}
|
|
1388
1401
|
}
|
|
1389
1402
|
function drawAlign(stroke, align, ui, canvas) {
|
|
1390
1403
|
const out = canvas.getSameCanvas(true, true);
|
|
@@ -1393,15 +1406,9 @@ function drawAlign(stroke, align, ui, canvas) {
|
|
|
1393
1406
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
1394
1407
|
fillText(ui, out);
|
|
1395
1408
|
out.blendMode = 'normal';
|
|
1396
|
-
|
|
1409
|
+
core.LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
1397
1410
|
out.recycle(ui.__nowWorld);
|
|
1398
1411
|
}
|
|
1399
|
-
function copyWorld(canvas, out, ui) {
|
|
1400
|
-
if (ui.__worldFlipped || core.Platform.fullImageShadow)
|
|
1401
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1402
|
-
else
|
|
1403
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1404
|
-
}
|
|
1405
1412
|
function drawTextStroke(ui, canvas) {
|
|
1406
1413
|
let row, data = ui.__.__textDrawData;
|
|
1407
1414
|
const { rows, decorationY } = data;
|
|
@@ -1417,14 +1424,21 @@ function drawTextStroke(ui, canvas) {
|
|
|
1417
1424
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
1418
1425
|
}
|
|
1419
1426
|
}
|
|
1420
|
-
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
1427
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
1421
1428
|
let item;
|
|
1429
|
+
const data = ui.__, { __hasMultiStrokeStyle } = data;
|
|
1430
|
+
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
1422
1431
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
1423
1432
|
item = strokes[i];
|
|
1424
1433
|
if (item.image && draw.PaintImage.checkImage(ui, canvas, item, false))
|
|
1425
1434
|
continue;
|
|
1426
1435
|
if (item.style) {
|
|
1427
|
-
|
|
1436
|
+
if (__hasMultiStrokeStyle) {
|
|
1437
|
+
const { strokeStyle } = item;
|
|
1438
|
+
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
1439
|
+
}
|
|
1440
|
+
else
|
|
1441
|
+
canvas.strokeStyle = item.style;
|
|
1428
1442
|
if (item.blendMode) {
|
|
1429
1443
|
canvas.saveBlendMode(item.blendMode);
|
|
1430
1444
|
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
@@ -1463,8 +1477,13 @@ function strokes(strokes, ui, canvas) {
|
|
|
1463
1477
|
}
|
|
1464
1478
|
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
1465
1479
|
const data = ui.__;
|
|
1466
|
-
|
|
1467
|
-
|
|
1480
|
+
if (typeof stroke === 'object') {
|
|
1481
|
+
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
1482
|
+
}
|
|
1483
|
+
else {
|
|
1484
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
1485
|
+
canvas.stroke();
|
|
1486
|
+
}
|
|
1468
1487
|
if (data.__useArrow)
|
|
1469
1488
|
draw.Paint.strokeArrow(stroke, ui, canvas);
|
|
1470
1489
|
}
|
|
@@ -1486,7 +1505,7 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
1486
1505
|
drawCenter(stroke, 2, ui, out);
|
|
1487
1506
|
out.clipUI(data);
|
|
1488
1507
|
out.clearWorld(renderBounds);
|
|
1489
|
-
|
|
1508
|
+
core.LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
1490
1509
|
out.recycle(ui.__nowWorld);
|
|
1491
1510
|
}
|
|
1492
1511
|
}
|
|
@@ -1541,8 +1560,16 @@ function compute(attrName, ui) {
|
|
|
1541
1560
|
if (!(paints instanceof Array))
|
|
1542
1561
|
paints = [paints];
|
|
1543
1562
|
recycleMap = draw.PaintImage.recycleImage(attrName, data);
|
|
1563
|
+
let maxChildStrokeWidth;
|
|
1544
1564
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
1545
|
-
(item = getLeafPaint(attrName, paints[i], ui))
|
|
1565
|
+
if (item = getLeafPaint(attrName, paints[i], ui)) {
|
|
1566
|
+
leafPaints.push(item);
|
|
1567
|
+
if (item.strokeStyle) {
|
|
1568
|
+
maxChildStrokeWidth || (maxChildStrokeWidth = 1);
|
|
1569
|
+
if (item.strokeStyle.strokeWidth)
|
|
1570
|
+
maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1546
1573
|
}
|
|
1547
1574
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1548
1575
|
if (leafPaints.length) {
|
|
@@ -1559,6 +1586,7 @@ function compute(attrName, ui) {
|
|
|
1559
1586
|
else {
|
|
1560
1587
|
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
1561
1588
|
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
1589
|
+
stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
|
|
1562
1590
|
}
|
|
1563
1591
|
}
|
|
1564
1592
|
function getLeafPaint(attrName, paint, ui) {
|
|
@@ -1590,6 +1618,11 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
1590
1618
|
if (data) {
|
|
1591
1619
|
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
1592
1620
|
data.isTransparent = true;
|
|
1621
|
+
if (paint.style) {
|
|
1622
|
+
if (paint.style.strokeWidth === 0)
|
|
1623
|
+
return undefined;
|
|
1624
|
+
data.strokeStyle = paint.style;
|
|
1625
|
+
}
|
|
1593
1626
|
if (paint.blendMode)
|
|
1594
1627
|
data.blendMode = paint.blendMode;
|
|
1595
1628
|
}
|
|
@@ -1609,8 +1642,8 @@ const PaintModule = {
|
|
|
1609
1642
|
shape
|
|
1610
1643
|
};
|
|
1611
1644
|
|
|
1612
|
-
let origin = {};
|
|
1613
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = core.MatrixHelper;
|
|
1645
|
+
let origin = {}, tempMatrix = core.getMatrixData();
|
|
1646
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = core.MatrixHelper;
|
|
1614
1647
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1615
1648
|
const transform = get$3();
|
|
1616
1649
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -1619,13 +1652,19 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1619
1652
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
1620
1653
|
data.transform = transform;
|
|
1621
1654
|
}
|
|
1622
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1655
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
|
|
1623
1656
|
const transform = get$3();
|
|
1624
|
-
translate$1(transform, box.x + x, box.y + y);
|
|
1625
|
-
if (scaleX)
|
|
1626
|
-
scaleHelper(transform, scaleX, scaleY);
|
|
1627
1657
|
if (rotation)
|
|
1628
1658
|
rotate(transform, rotation);
|
|
1659
|
+
if (skew)
|
|
1660
|
+
skewHelper(transform, skew.x, skew.y);
|
|
1661
|
+
if (scaleX)
|
|
1662
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
1663
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
1664
|
+
if (clipSize) {
|
|
1665
|
+
tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
|
|
1666
|
+
multiplyParent(transform, tempMatrix);
|
|
1667
|
+
}
|
|
1629
1668
|
data.transform = transform;
|
|
1630
1669
|
}
|
|
1631
1670
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -1662,11 +1701,15 @@ const tempBox = new core.Bounds();
|
|
|
1662
1701
|
const tempScaleData = {};
|
|
1663
1702
|
const tempImage = {};
|
|
1664
1703
|
function createData(leafPaint, image, paint, box) {
|
|
1665
|
-
const { changeful, sync } = paint;
|
|
1704
|
+
const { changeful, sync, editing, scaleFixed } = paint;
|
|
1666
1705
|
if (changeful)
|
|
1667
1706
|
leafPaint.changeful = changeful;
|
|
1668
1707
|
if (sync)
|
|
1669
1708
|
leafPaint.sync = sync;
|
|
1709
|
+
if (editing)
|
|
1710
|
+
leafPaint.editing = editing;
|
|
1711
|
+
if (scaleFixed)
|
|
1712
|
+
leafPaint.scaleFixed = scaleFixed;
|
|
1670
1713
|
leafPaint.data = getPatternData(paint, box, image);
|
|
1671
1714
|
}
|
|
1672
1715
|
function getPatternData(paint, box, image) {
|
|
@@ -1675,7 +1718,7 @@ function getPatternData(paint, box, image) {
|
|
|
1675
1718
|
if (paint.mode === 'strench')
|
|
1676
1719
|
paint.mode = 'stretch';
|
|
1677
1720
|
let { width, height } = image;
|
|
1678
|
-
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
1721
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
|
|
1679
1722
|
const sameBox = box.width === width && box.height === height;
|
|
1680
1723
|
const data = { mode };
|
|
1681
1724
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -1709,8 +1752,8 @@ function getPatternData(paint, box, image) {
|
|
|
1709
1752
|
break;
|
|
1710
1753
|
case 'normal':
|
|
1711
1754
|
case 'clip':
|
|
1712
|
-
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
1713
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
1755
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
1756
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
|
|
1714
1757
|
break;
|
|
1715
1758
|
case 'repeat':
|
|
1716
1759
|
if (!sameBox || scaleX || rotation)
|
|
@@ -1787,11 +1830,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
1787
1830
|
}
|
|
1788
1831
|
onLoadSuccess(ui, event);
|
|
1789
1832
|
}
|
|
1790
|
-
leafPaint.loadId =
|
|
1833
|
+
leafPaint.loadId = undefined;
|
|
1791
1834
|
}, (error) => {
|
|
1792
1835
|
ignoreRender(ui, false);
|
|
1793
1836
|
onLoadError(ui, event, error);
|
|
1794
|
-
leafPaint.loadId =
|
|
1837
|
+
leafPaint.loadId = undefined;
|
|
1795
1838
|
});
|
|
1796
1839
|
if (ui.placeholderColor) {
|
|
1797
1840
|
if (!ui.placeholderDelay)
|
|
@@ -1847,16 +1890,16 @@ function ignoreRender(ui, value) {
|
|
|
1847
1890
|
}
|
|
1848
1891
|
|
|
1849
1892
|
const { get: get$1, scale, copy: copy$1 } = core.MatrixHelper;
|
|
1850
|
-
const { ceil, abs
|
|
1893
|
+
const { ceil, abs } = Math;
|
|
1851
1894
|
function createPattern(ui, paint, pixelRatio) {
|
|
1852
|
-
let { scaleX, scaleY } =
|
|
1895
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
1853
1896
|
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
1854
1897
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
1855
|
-
scaleX = abs$1(scaleX);
|
|
1856
|
-
scaleY = abs$1(scaleY);
|
|
1857
1898
|
const { image, data } = paint;
|
|
1858
1899
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
1859
1900
|
if (sx) {
|
|
1901
|
+
sx = abs(sx);
|
|
1902
|
+
sy = abs(sy);
|
|
1860
1903
|
imageMatrix = get$1();
|
|
1861
1904
|
copy$1(imageMatrix, transform);
|
|
1862
1905
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -1941,9 +1984,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
1941
1984
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1942
1985
|
};
|
|
1943
1986
|
|
|
1944
|
-
const { abs } = Math;
|
|
1945
1987
|
function checkImage(ui, canvas, paint, allowDraw) {
|
|
1946
|
-
const { scaleX, scaleY } =
|
|
1988
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
1947
1989
|
const { pixelRatio } = canvas, { data } = paint;
|
|
1948
1990
|
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !draw.Export.running)) {
|
|
1949
1991
|
return false;
|
|
@@ -1956,8 +1998,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1956
1998
|
else {
|
|
1957
1999
|
if (!(paint.changeful || core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
|
|
1958
2000
|
let { width, height } = data;
|
|
1959
|
-
width *=
|
|
1960
|
-
height *=
|
|
2001
|
+
width *= scaleX * pixelRatio;
|
|
2002
|
+
height *= scaleY * pixelRatio;
|
|
1961
2003
|
if (data.scaleX) {
|
|
1962
2004
|
width *= data.scaleX;
|
|
1963
2005
|
height *= data.scaleY;
|
|
@@ -1967,6 +2009,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1967
2009
|
}
|
|
1968
2010
|
}
|
|
1969
2011
|
if (allowDraw) {
|
|
2012
|
+
if (ui.__.__isFastShadow) {
|
|
2013
|
+
canvas.fillStyle = paint.style || '#000';
|
|
2014
|
+
canvas.fill();
|
|
2015
|
+
}
|
|
1970
2016
|
drawImage(ui, canvas, paint, data);
|
|
1971
2017
|
return true;
|
|
1972
2018
|
}
|
|
@@ -2155,10 +2201,7 @@ function shadow(ui, current, shape) {
|
|
|
2155
2201
|
}
|
|
2156
2202
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
2157
2203
|
}
|
|
2158
|
-
|
|
2159
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
2160
|
-
else
|
|
2161
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
2204
|
+
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
2162
2205
|
if (end && index < end)
|
|
2163
2206
|
other.clearWorld(copyBounds, true);
|
|
2164
2207
|
});
|
|
@@ -2217,10 +2260,7 @@ function innerShadow(ui, current, shape) {
|
|
|
2217
2260
|
copyBounds = bounds;
|
|
2218
2261
|
}
|
|
2219
2262
|
other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), 'source-in');
|
|
2220
|
-
|
|
2221
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
2222
|
-
else
|
|
2223
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
2263
|
+
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
2224
2264
|
if (end && index < end)
|
|
2225
2265
|
other.clearWorld(copyBounds, true);
|
|
2226
2266
|
});
|
|
@@ -2276,12 +2316,11 @@ draw.Group.prototype.__renderMask = function (canvas, options) {
|
|
|
2276
2316
|
contentCanvas = getCanvas(canvas);
|
|
2277
2317
|
child.__render(maskCanvas, options);
|
|
2278
2318
|
}
|
|
2279
|
-
if (
|
|
2280
|
-
|
|
2281
|
-
}
|
|
2282
|
-
if (excludeRenderBounds(child, options))
|
|
2319
|
+
if (mask === 'clipping' || mask === 'clipping-path')
|
|
2320
|
+
excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
2283
2321
|
continue;
|
|
2284
|
-
|
|
2322
|
+
}
|
|
2323
|
+
excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
|
|
2285
2324
|
}
|
|
2286
2325
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
2287
2326
|
};
|