@leafer-ui/miniapp 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/dist/miniapp.cjs CHANGED
@@ -1099,9 +1099,14 @@ function fills(fills, ui, canvas) {
1099
1099
  }
1100
1100
  }
1101
1101
  canvas.fillStyle = item.style;
1102
- if (item.transform) {
1102
+ if (item.transform || item.scaleFixed) {
1103
1103
  canvas.save();
1104
- canvas.transform(item.transform);
1104
+ if (item.transform)
1105
+ canvas.transform(item.transform);
1106
+ if (item.scaleFixed) {
1107
+ const { scaleX, scaleY } = ui.getRenderScaleData(true);
1108
+ canvas.scale(1 / scaleX, 1 / scaleY);
1109
+ }
1105
1110
  if (item.blendMode)
1106
1111
  canvas.blendMode = item.blendMode;
1107
1112
  fillPathOrText(ui, canvas);
@@ -1137,8 +1142,13 @@ function strokeText(stroke, ui, canvas) {
1137
1142
  }
1138
1143
  function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
1139
1144
  const data = ui.__;
1140
- canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
1141
- data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
1145
+ if (typeof stroke === 'object') {
1146
+ drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
1147
+ }
1148
+ else {
1149
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
1150
+ drawTextStroke(ui, canvas);
1151
+ }
1142
1152
  }
1143
1153
  function drawAlign(stroke, align, ui, canvas) {
1144
1154
  const out = canvas.getSameCanvas(true, true);
@@ -1147,15 +1157,9 @@ function drawAlign(stroke, align, ui, canvas) {
1147
1157
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
1148
1158
  fillText(ui, out);
1149
1159
  out.blendMode = 'normal';
1150
- copyWorld(canvas, out, ui);
1160
+ core.LeafHelper.copyCanvasByWorld(ui, canvas, out);
1151
1161
  out.recycle(ui.__nowWorld);
1152
1162
  }
1153
- function copyWorld(canvas, out, ui) {
1154
- if (ui.__worldFlipped || core.Platform.fullImageShadow)
1155
- canvas.copyWorldByReset(out, ui.__nowWorld);
1156
- else
1157
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
1158
- }
1159
1163
  function drawTextStroke(ui, canvas) {
1160
1164
  let row, data = ui.__.__textDrawData;
1161
1165
  const { rows, decorationY } = data;
@@ -1171,14 +1175,21 @@ function drawTextStroke(ui, canvas) {
1171
1175
  rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
1172
1176
  }
1173
1177
  }
1174
- function drawStrokesStyle(strokes, isText, ui, canvas) {
1178
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
1175
1179
  let item;
1180
+ const data = ui.__, { __hasMultiStrokeStyle } = data;
1181
+ __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
1176
1182
  for (let i = 0, len = strokes.length; i < len; i++) {
1177
1183
  item = strokes[i];
1178
1184
  if (item.image && draw.PaintImage.checkImage(ui, canvas, item, false))
1179
1185
  continue;
1180
1186
  if (item.style) {
1181
- canvas.strokeStyle = item.style;
1187
+ if (__hasMultiStrokeStyle) {
1188
+ const { strokeStyle } = item;
1189
+ strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
1190
+ }
1191
+ else
1192
+ canvas.strokeStyle = item.style;
1182
1193
  if (item.blendMode) {
1183
1194
  canvas.saveBlendMode(item.blendMode);
1184
1195
  isText ? drawTextStroke(ui, canvas) : canvas.stroke();
@@ -1217,8 +1228,13 @@ function strokes(strokes, ui, canvas) {
1217
1228
  }
1218
1229
  function drawCenter(stroke, strokeWidthScale, ui, canvas) {
1219
1230
  const data = ui.__;
1220
- canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
1221
- data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
1231
+ if (typeof stroke === 'object') {
1232
+ drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
1233
+ }
1234
+ else {
1235
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
1236
+ canvas.stroke();
1237
+ }
1222
1238
  if (data.__useArrow)
1223
1239
  draw.Paint.strokeArrow(stroke, ui, canvas);
1224
1240
  }
@@ -1240,7 +1256,7 @@ function drawOutside(stroke, ui, canvas) {
1240
1256
  drawCenter(stroke, 2, ui, out);
1241
1257
  out.clipUI(data);
1242
1258
  out.clearWorld(renderBounds);
1243
- copyWorld(canvas, out, ui);
1259
+ core.LeafHelper.copyCanvasByWorld(ui, canvas, out);
1244
1260
  out.recycle(ui.__nowWorld);
1245
1261
  }
1246
1262
  }
@@ -1295,8 +1311,16 @@ function compute(attrName, ui) {
1295
1311
  if (!(paints instanceof Array))
1296
1312
  paints = [paints];
1297
1313
  recycleMap = draw.PaintImage.recycleImage(attrName, data);
1314
+ let maxChildStrokeWidth;
1298
1315
  for (let i = 0, len = paints.length, item; i < len; i++) {
1299
- (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
1316
+ if (item = getLeafPaint(attrName, paints[i], ui)) {
1317
+ leafPaints.push(item);
1318
+ if (item.strokeStyle) {
1319
+ maxChildStrokeWidth || (maxChildStrokeWidth = 1);
1320
+ if (item.strokeStyle.strokeWidth)
1321
+ maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
1322
+ }
1323
+ }
1300
1324
  }
1301
1325
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
1302
1326
  if (leafPaints.length) {
@@ -1313,6 +1337,7 @@ function compute(attrName, ui) {
1313
1337
  else {
1314
1338
  stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
1315
1339
  stintSet(data, '__isTransparentStroke', isTransparent);
1340
+ stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
1316
1341
  }
1317
1342
  }
1318
1343
  function getLeafPaint(attrName, paint, ui) {
@@ -1344,6 +1369,11 @@ function getLeafPaint(attrName, paint, ui) {
1344
1369
  if (data) {
1345
1370
  if (typeof data.style === 'string' && hasTransparent$1(data.style))
1346
1371
  data.isTransparent = true;
1372
+ if (paint.style) {
1373
+ if (paint.style.strokeWidth === 0)
1374
+ return undefined;
1375
+ data.strokeStyle = paint.style;
1376
+ }
1347
1377
  if (paint.blendMode)
1348
1378
  data.blendMode = paint.blendMode;
1349
1379
  }
@@ -1363,8 +1393,8 @@ const PaintModule = {
1363
1393
  shape
1364
1394
  };
1365
1395
 
1366
- let origin = {};
1367
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = core.MatrixHelper;
1396
+ let origin = {}, tempMatrix = core.getMatrixData();
1397
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = core.MatrixHelper;
1368
1398
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1369
1399
  const transform = get$3();
1370
1400
  translate$1(transform, box.x + x, box.y + y);
@@ -1373,13 +1403,19 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1373
1403
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
1374
1404
  data.transform = transform;
1375
1405
  }
1376
- function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
1406
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
1377
1407
  const transform = get$3();
1378
- translate$1(transform, box.x + x, box.y + y);
1379
- if (scaleX)
1380
- scaleHelper(transform, scaleX, scaleY);
1381
1408
  if (rotation)
1382
1409
  rotate(transform, rotation);
1410
+ if (skew)
1411
+ skewHelper(transform, skew.x, skew.y);
1412
+ if (scaleX)
1413
+ scaleHelper(transform, scaleX, scaleY);
1414
+ translate$1(transform, box.x + x, box.y + y);
1415
+ if (clipSize) {
1416
+ tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
1417
+ multiplyParent(transform, tempMatrix);
1418
+ }
1383
1419
  data.transform = transform;
1384
1420
  }
1385
1421
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -1416,11 +1452,15 @@ const tempBox = new core.Bounds();
1416
1452
  const tempScaleData = {};
1417
1453
  const tempImage = {};
1418
1454
  function createData(leafPaint, image, paint, box) {
1419
- const { changeful, sync } = paint;
1455
+ const { changeful, sync, editing, scaleFixed } = paint;
1420
1456
  if (changeful)
1421
1457
  leafPaint.changeful = changeful;
1422
1458
  if (sync)
1423
1459
  leafPaint.sync = sync;
1460
+ if (editing)
1461
+ leafPaint.editing = editing;
1462
+ if (scaleFixed)
1463
+ leafPaint.scaleFixed = scaleFixed;
1424
1464
  leafPaint.data = getPatternData(paint, box, image);
1425
1465
  }
1426
1466
  function getPatternData(paint, box, image) {
@@ -1429,7 +1469,7 @@ function getPatternData(paint, box, image) {
1429
1469
  if (paint.mode === 'strench')
1430
1470
  paint.mode = 'stretch';
1431
1471
  let { width, height } = image;
1432
- const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1472
+ const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
1433
1473
  const sameBox = box.width === width && box.height === height;
1434
1474
  const data = { mode };
1435
1475
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1463,8 +1503,8 @@ function getPatternData(paint, box, image) {
1463
1503
  break;
1464
1504
  case 'normal':
1465
1505
  case 'clip':
1466
- if (tempImage.x || tempImage.y || scaleX || rotation)
1467
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
1506
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
1507
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
1468
1508
  break;
1469
1509
  case 'repeat':
1470
1510
  if (!sameBox || scaleX || rotation)
@@ -1541,11 +1581,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
1541
1581
  }
1542
1582
  onLoadSuccess(ui, event);
1543
1583
  }
1544
- leafPaint.loadId = null;
1584
+ leafPaint.loadId = undefined;
1545
1585
  }, (error) => {
1546
1586
  ignoreRender(ui, false);
1547
1587
  onLoadError(ui, event, error);
1548
- leafPaint.loadId = null;
1588
+ leafPaint.loadId = undefined;
1549
1589
  });
1550
1590
  if (ui.placeholderColor) {
1551
1591
  if (!ui.placeholderDelay)
@@ -1601,16 +1641,16 @@ function ignoreRender(ui, value) {
1601
1641
  }
1602
1642
 
1603
1643
  const { get: get$1, scale, copy: copy$1 } = core.MatrixHelper;
1604
- const { ceil, abs: abs$1 } = Math;
1644
+ const { ceil, abs } = Math;
1605
1645
  function createPattern(ui, paint, pixelRatio) {
1606
- let { scaleX, scaleY } = core.ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1646
+ let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1607
1647
  const id = scaleX + '-' + scaleY + '-' + pixelRatio;
1608
1648
  if (paint.patternId !== id && !ui.destroyed) {
1609
- scaleX = abs$1(scaleX);
1610
- scaleY = abs$1(scaleY);
1611
1649
  const { image, data } = paint;
1612
1650
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1613
1651
  if (sx) {
1652
+ sx = abs(sx);
1653
+ sy = abs(sy);
1614
1654
  imageMatrix = get$1();
1615
1655
  copy$1(imageMatrix, transform);
1616
1656
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -1695,9 +1735,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1695
1735
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1696
1736
  };
1697
1737
 
1698
- const { abs } = Math;
1699
1738
  function checkImage(ui, canvas, paint, allowDraw) {
1700
- const { scaleX, scaleY } = core.ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1739
+ const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1701
1740
  const { pixelRatio } = canvas, { data } = paint;
1702
1741
  if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !draw.Export.running)) {
1703
1742
  return false;
@@ -1710,8 +1749,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
1710
1749
  else {
1711
1750
  if (!(paint.changeful || core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
1712
1751
  let { width, height } = data;
1713
- width *= abs(scaleX) * pixelRatio;
1714
- height *= abs(scaleY) * pixelRatio;
1752
+ width *= scaleX * pixelRatio;
1753
+ height *= scaleY * pixelRatio;
1715
1754
  if (data.scaleX) {
1716
1755
  width *= data.scaleX;
1717
1756
  height *= data.scaleY;
@@ -1721,6 +1760,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
1721
1760
  }
1722
1761
  }
1723
1762
  if (allowDraw) {
1763
+ if (ui.__.__isFastShadow) {
1764
+ canvas.fillStyle = paint.style || '#000';
1765
+ canvas.fill();
1766
+ }
1724
1767
  drawImage(ui, canvas, paint, data);
1725
1768
  return true;
1726
1769
  }
@@ -1909,10 +1952,7 @@ function shadow(ui, current, shape) {
1909
1952
  }
1910
1953
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
1911
1954
  }
1912
- if (ui.__worldFlipped)
1913
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1914
- else
1915
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1955
+ core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1916
1956
  if (end && index < end)
1917
1957
  other.clearWorld(copyBounds, true);
1918
1958
  });
@@ -1971,10 +2011,7 @@ function innerShadow(ui, current, shape) {
1971
2011
  copyBounds = bounds;
1972
2012
  }
1973
2013
  other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), 'source-in');
1974
- if (ui.__worldFlipped)
1975
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1976
- else
1977
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
2014
+ core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1978
2015
  if (end && index < end)
1979
2016
  other.clearWorld(copyBounds, true);
1980
2017
  });
@@ -2030,12 +2067,11 @@ draw.Group.prototype.__renderMask = function (canvas, options) {
2030
2067
  contentCanvas = getCanvas(canvas);
2031
2068
  child.__render(maskCanvas, options);
2032
2069
  }
2033
- if (!(mask === 'clipping' || mask === 'clipping-path'))
2034
- continue;
2035
- }
2036
- if (excludeRenderBounds(child, options))
2070
+ if (mask === 'clipping' || mask === 'clipping-path')
2071
+ excludeRenderBounds(child, options) || child.__render(canvas, options);
2037
2072
  continue;
2038
- child.__render(contentCanvas || canvas, options);
2073
+ }
2074
+ excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
2039
2075
  }
2040
2076
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
2041
2077
  };
@@ -1,4 +1,4 @@
1
- import { LeaferCanvasBase, Platform, canvasPatch, DataHelper, canvasSizeAttrs, ResizeEvent, FileHelper, Creator, LeaferImage, defineKey, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, BoundsHelper, Plugin, MatrixHelper, MathHelper, AlignHelper, PointHelper, ImageEvent, AroundHelper, Direction4 } from '@leafer/core';
1
+ import { LeaferCanvasBase, Platform, canvasPatch, DataHelper, canvasSizeAttrs, ResizeEvent, FileHelper, Creator, LeaferImage, defineKey, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, BoundsHelper, Plugin, getMatrixData, MatrixHelper, MathHelper, 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, HitCanvasManager } from '@leafer-ui/core';
@@ -1100,9 +1100,14 @@ function fills(fills, ui, canvas) {
1100
1100
  }
1101
1101
  }
1102
1102
  canvas.fillStyle = item.style;
1103
- if (item.transform) {
1103
+ if (item.transform || item.scaleFixed) {
1104
1104
  canvas.save();
1105
- canvas.transform(item.transform);
1105
+ if (item.transform)
1106
+ canvas.transform(item.transform);
1107
+ if (item.scaleFixed) {
1108
+ const { scaleX, scaleY } = ui.getRenderScaleData(true);
1109
+ canvas.scale(1 / scaleX, 1 / scaleY);
1110
+ }
1106
1111
  if (item.blendMode)
1107
1112
  canvas.blendMode = item.blendMode;
1108
1113
  fillPathOrText(ui, canvas);
@@ -1138,8 +1143,13 @@ function strokeText(stroke, ui, canvas) {
1138
1143
  }
1139
1144
  function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
1140
1145
  const data = ui.__;
1141
- canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
1142
- data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
1146
+ if (typeof stroke === 'object') {
1147
+ drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
1148
+ }
1149
+ else {
1150
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
1151
+ drawTextStroke(ui, canvas);
1152
+ }
1143
1153
  }
1144
1154
  function drawAlign(stroke, align, ui, canvas) {
1145
1155
  const out = canvas.getSameCanvas(true, true);
@@ -1148,15 +1158,9 @@ function drawAlign(stroke, align, ui, canvas) {
1148
1158
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
1149
1159
  fillText(ui, out);
1150
1160
  out.blendMode = 'normal';
1151
- copyWorld(canvas, out, ui);
1161
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
1152
1162
  out.recycle(ui.__nowWorld);
1153
1163
  }
1154
- function copyWorld(canvas, out, ui) {
1155
- if (ui.__worldFlipped || Platform.fullImageShadow)
1156
- canvas.copyWorldByReset(out, ui.__nowWorld);
1157
- else
1158
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
1159
- }
1160
1164
  function drawTextStroke(ui, canvas) {
1161
1165
  let row, data = ui.__.__textDrawData;
1162
1166
  const { rows, decorationY } = data;
@@ -1172,14 +1176,21 @@ function drawTextStroke(ui, canvas) {
1172
1176
  rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
1173
1177
  }
1174
1178
  }
1175
- function drawStrokesStyle(strokes, isText, ui, canvas) {
1179
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
1176
1180
  let item;
1181
+ const data = ui.__, { __hasMultiStrokeStyle } = data;
1182
+ __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
1177
1183
  for (let i = 0, len = strokes.length; i < len; i++) {
1178
1184
  item = strokes[i];
1179
1185
  if (item.image && PaintImage.checkImage(ui, canvas, item, false))
1180
1186
  continue;
1181
1187
  if (item.style) {
1182
- canvas.strokeStyle = item.style;
1188
+ if (__hasMultiStrokeStyle) {
1189
+ const { strokeStyle } = item;
1190
+ strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
1191
+ }
1192
+ else
1193
+ canvas.strokeStyle = item.style;
1183
1194
  if (item.blendMode) {
1184
1195
  canvas.saveBlendMode(item.blendMode);
1185
1196
  isText ? drawTextStroke(ui, canvas) : canvas.stroke();
@@ -1218,8 +1229,13 @@ function strokes(strokes, ui, canvas) {
1218
1229
  }
1219
1230
  function drawCenter(stroke, strokeWidthScale, ui, canvas) {
1220
1231
  const data = ui.__;
1221
- canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
1222
- data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
1232
+ if (typeof stroke === 'object') {
1233
+ drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
1234
+ }
1235
+ else {
1236
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
1237
+ canvas.stroke();
1238
+ }
1223
1239
  if (data.__useArrow)
1224
1240
  Paint.strokeArrow(stroke, ui, canvas);
1225
1241
  }
@@ -1241,7 +1257,7 @@ function drawOutside(stroke, ui, canvas) {
1241
1257
  drawCenter(stroke, 2, ui, out);
1242
1258
  out.clipUI(data);
1243
1259
  out.clearWorld(renderBounds);
1244
- copyWorld(canvas, out, ui);
1260
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
1245
1261
  out.recycle(ui.__nowWorld);
1246
1262
  }
1247
1263
  }
@@ -1296,8 +1312,16 @@ function compute(attrName, ui) {
1296
1312
  if (!(paints instanceof Array))
1297
1313
  paints = [paints];
1298
1314
  recycleMap = PaintImage.recycleImage(attrName, data);
1315
+ let maxChildStrokeWidth;
1299
1316
  for (let i = 0, len = paints.length, item; i < len; i++) {
1300
- (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
1317
+ if (item = getLeafPaint(attrName, paints[i], ui)) {
1318
+ leafPaints.push(item);
1319
+ if (item.strokeStyle) {
1320
+ maxChildStrokeWidth || (maxChildStrokeWidth = 1);
1321
+ if (item.strokeStyle.strokeWidth)
1322
+ maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
1323
+ }
1324
+ }
1301
1325
  }
1302
1326
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
1303
1327
  if (leafPaints.length) {
@@ -1314,6 +1338,7 @@ function compute(attrName, ui) {
1314
1338
  else {
1315
1339
  stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
1316
1340
  stintSet(data, '__isTransparentStroke', isTransparent);
1341
+ stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
1317
1342
  }
1318
1343
  }
1319
1344
  function getLeafPaint(attrName, paint, ui) {
@@ -1345,6 +1370,11 @@ function getLeafPaint(attrName, paint, ui) {
1345
1370
  if (data) {
1346
1371
  if (typeof data.style === 'string' && hasTransparent$1(data.style))
1347
1372
  data.isTransparent = true;
1373
+ if (paint.style) {
1374
+ if (paint.style.strokeWidth === 0)
1375
+ return undefined;
1376
+ data.strokeStyle = paint.style;
1377
+ }
1348
1378
  if (paint.blendMode)
1349
1379
  data.blendMode = paint.blendMode;
1350
1380
  }
@@ -1364,8 +1394,8 @@ const PaintModule = {
1364
1394
  shape
1365
1395
  };
1366
1396
 
1367
- let origin = {};
1368
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
1397
+ let origin = {}, tempMatrix = getMatrixData();
1398
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
1369
1399
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1370
1400
  const transform = get$3();
1371
1401
  translate$1(transform, box.x + x, box.y + y);
@@ -1374,13 +1404,19 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1374
1404
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
1375
1405
  data.transform = transform;
1376
1406
  }
1377
- function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
1407
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
1378
1408
  const transform = get$3();
1379
- translate$1(transform, box.x + x, box.y + y);
1380
- if (scaleX)
1381
- scaleHelper(transform, scaleX, scaleY);
1382
1409
  if (rotation)
1383
1410
  rotate(transform, rotation);
1411
+ if (skew)
1412
+ skewHelper(transform, skew.x, skew.y);
1413
+ if (scaleX)
1414
+ scaleHelper(transform, scaleX, scaleY);
1415
+ translate$1(transform, box.x + x, box.y + y);
1416
+ if (clipSize) {
1417
+ tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
1418
+ multiplyParent(transform, tempMatrix);
1419
+ }
1384
1420
  data.transform = transform;
1385
1421
  }
1386
1422
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -1417,11 +1453,15 @@ const tempBox = new Bounds();
1417
1453
  const tempScaleData = {};
1418
1454
  const tempImage = {};
1419
1455
  function createData(leafPaint, image, paint, box) {
1420
- const { changeful, sync } = paint;
1456
+ const { changeful, sync, editing, scaleFixed } = paint;
1421
1457
  if (changeful)
1422
1458
  leafPaint.changeful = changeful;
1423
1459
  if (sync)
1424
1460
  leafPaint.sync = sync;
1461
+ if (editing)
1462
+ leafPaint.editing = editing;
1463
+ if (scaleFixed)
1464
+ leafPaint.scaleFixed = scaleFixed;
1425
1465
  leafPaint.data = getPatternData(paint, box, image);
1426
1466
  }
1427
1467
  function getPatternData(paint, box, image) {
@@ -1430,7 +1470,7 @@ function getPatternData(paint, box, image) {
1430
1470
  if (paint.mode === 'strench')
1431
1471
  paint.mode = 'stretch';
1432
1472
  let { width, height } = image;
1433
- const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1473
+ const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
1434
1474
  const sameBox = box.width === width && box.height === height;
1435
1475
  const data = { mode };
1436
1476
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1464,8 +1504,8 @@ function getPatternData(paint, box, image) {
1464
1504
  break;
1465
1505
  case 'normal':
1466
1506
  case 'clip':
1467
- if (tempImage.x || tempImage.y || scaleX || rotation)
1468
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
1507
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
1508
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
1469
1509
  break;
1470
1510
  case 'repeat':
1471
1511
  if (!sameBox || scaleX || rotation)
@@ -1542,11 +1582,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
1542
1582
  }
1543
1583
  onLoadSuccess(ui, event);
1544
1584
  }
1545
- leafPaint.loadId = null;
1585
+ leafPaint.loadId = undefined;
1546
1586
  }, (error) => {
1547
1587
  ignoreRender(ui, false);
1548
1588
  onLoadError(ui, event, error);
1549
- leafPaint.loadId = null;
1589
+ leafPaint.loadId = undefined;
1550
1590
  });
1551
1591
  if (ui.placeholderColor) {
1552
1592
  if (!ui.placeholderDelay)
@@ -1602,16 +1642,16 @@ function ignoreRender(ui, value) {
1602
1642
  }
1603
1643
 
1604
1644
  const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
1605
- const { ceil, abs: abs$1 } = Math;
1645
+ const { ceil, abs } = Math;
1606
1646
  function createPattern(ui, paint, pixelRatio) {
1607
- let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1647
+ let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1608
1648
  const id = scaleX + '-' + scaleY + '-' + pixelRatio;
1609
1649
  if (paint.patternId !== id && !ui.destroyed) {
1610
- scaleX = abs$1(scaleX);
1611
- scaleY = abs$1(scaleY);
1612
1650
  const { image, data } = paint;
1613
1651
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1614
1652
  if (sx) {
1653
+ sx = abs(sx);
1654
+ sy = abs(sy);
1615
1655
  imageMatrix = get$1();
1616
1656
  copy$1(imageMatrix, transform);
1617
1657
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -1696,9 +1736,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1696
1736
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1697
1737
  };
1698
1738
 
1699
- const { abs } = Math;
1700
1739
  function checkImage(ui, canvas, paint, allowDraw) {
1701
- const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1740
+ const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1702
1741
  const { pixelRatio } = canvas, { data } = paint;
1703
1742
  if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
1704
1743
  return false;
@@ -1711,8 +1750,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
1711
1750
  else {
1712
1751
  if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
1713
1752
  let { width, height } = data;
1714
- width *= abs(scaleX) * pixelRatio;
1715
- height *= abs(scaleY) * pixelRatio;
1753
+ width *= scaleX * pixelRatio;
1754
+ height *= scaleY * pixelRatio;
1716
1755
  if (data.scaleX) {
1717
1756
  width *= data.scaleX;
1718
1757
  height *= data.scaleY;
@@ -1722,6 +1761,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
1722
1761
  }
1723
1762
  }
1724
1763
  if (allowDraw) {
1764
+ if (ui.__.__isFastShadow) {
1765
+ canvas.fillStyle = paint.style || '#000';
1766
+ canvas.fill();
1767
+ }
1725
1768
  drawImage(ui, canvas, paint, data);
1726
1769
  return true;
1727
1770
  }
@@ -1910,10 +1953,7 @@ function shadow(ui, current, shape) {
1910
1953
  }
1911
1954
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
1912
1955
  }
1913
- if (ui.__worldFlipped)
1914
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1915
- else
1916
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1956
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1917
1957
  if (end && index < end)
1918
1958
  other.clearWorld(copyBounds, true);
1919
1959
  });
@@ -1972,10 +2012,7 @@ function innerShadow(ui, current, shape) {
1972
2012
  copyBounds = bounds;
1973
2013
  }
1974
2014
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
1975
- if (ui.__worldFlipped)
1976
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1977
- else
1978
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
2015
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1979
2016
  if (end && index < end)
1980
2017
  other.clearWorld(copyBounds, true);
1981
2018
  });
@@ -2031,12 +2068,11 @@ Group.prototype.__renderMask = function (canvas, options) {
2031
2068
  contentCanvas = getCanvas(canvas);
2032
2069
  child.__render(maskCanvas, options);
2033
2070
  }
2034
- if (!(mask === 'clipping' || mask === 'clipping-path'))
2035
- continue;
2036
- }
2037
- if (excludeRenderBounds(child, options))
2071
+ if (mask === 'clipping' || mask === 'clipping-path')
2072
+ excludeRenderBounds(child, options) || child.__render(canvas, options);
2038
2073
  continue;
2039
- child.__render(contentCanvas || canvas, options);
2074
+ }
2075
+ excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
2040
2076
  }
2041
2077
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
2042
2078
  };