@leafer-draw/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
@@ -836,9 +836,14 @@ function fills(fills, ui, canvas) {
836
836
  }
837
837
  }
838
838
  canvas.fillStyle = item.style;
839
- if (item.transform) {
839
+ if (item.transform || item.scaleFixed) {
840
840
  canvas.save();
841
- canvas.transform(item.transform);
841
+ if (item.transform)
842
+ canvas.transform(item.transform);
843
+ if (item.scaleFixed) {
844
+ const { scaleX, scaleY } = ui.getRenderScaleData(true);
845
+ canvas.scale(1 / scaleX, 1 / scaleY);
846
+ }
842
847
  if (item.blendMode)
843
848
  canvas.blendMode = item.blendMode;
844
849
  fillPathOrText(ui, canvas);
@@ -874,8 +879,13 @@ function strokeText(stroke, ui, canvas) {
874
879
  }
875
880
  function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
876
881
  const data = ui.__;
877
- canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
878
- data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
882
+ if (typeof stroke === 'object') {
883
+ drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
884
+ }
885
+ else {
886
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
887
+ drawTextStroke(ui, canvas);
888
+ }
879
889
  }
880
890
  function drawAlign(stroke, align, ui, canvas) {
881
891
  const out = canvas.getSameCanvas(true, true);
@@ -884,15 +894,9 @@ function drawAlign(stroke, align, ui, canvas) {
884
894
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
885
895
  fillText(ui, out);
886
896
  out.blendMode = 'normal';
887
- copyWorld(canvas, out, ui);
897
+ core.LeafHelper.copyCanvasByWorld(ui, canvas, out);
888
898
  out.recycle(ui.__nowWorld);
889
899
  }
890
- function copyWorld(canvas, out, ui) {
891
- if (ui.__worldFlipped || core.Platform.fullImageShadow)
892
- canvas.copyWorldByReset(out, ui.__nowWorld);
893
- else
894
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
895
- }
896
900
  function drawTextStroke(ui, canvas) {
897
901
  let row, data = ui.__.__textDrawData;
898
902
  const { rows, decorationY } = data;
@@ -908,14 +912,21 @@ function drawTextStroke(ui, canvas) {
908
912
  rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
909
913
  }
910
914
  }
911
- function drawStrokesStyle(strokes, isText, ui, canvas) {
915
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
912
916
  let item;
917
+ const data = ui.__, { __hasMultiStrokeStyle } = data;
918
+ __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
913
919
  for (let i = 0, len = strokes.length; i < len; i++) {
914
920
  item = strokes[i];
915
921
  if (item.image && draw.PaintImage.checkImage(ui, canvas, item, false))
916
922
  continue;
917
923
  if (item.style) {
918
- canvas.strokeStyle = item.style;
924
+ if (__hasMultiStrokeStyle) {
925
+ const { strokeStyle } = item;
926
+ strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
927
+ }
928
+ else
929
+ canvas.strokeStyle = item.style;
919
930
  if (item.blendMode) {
920
931
  canvas.saveBlendMode(item.blendMode);
921
932
  isText ? drawTextStroke(ui, canvas) : canvas.stroke();
@@ -954,8 +965,13 @@ function strokes(strokes, ui, canvas) {
954
965
  }
955
966
  function drawCenter(stroke, strokeWidthScale, ui, canvas) {
956
967
  const data = ui.__;
957
- canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
958
- data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
968
+ if (typeof stroke === 'object') {
969
+ drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
970
+ }
971
+ else {
972
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
973
+ canvas.stroke();
974
+ }
959
975
  if (data.__useArrow)
960
976
  draw.Paint.strokeArrow(stroke, ui, canvas);
961
977
  }
@@ -977,7 +993,7 @@ function drawOutside(stroke, ui, canvas) {
977
993
  drawCenter(stroke, 2, ui, out);
978
994
  out.clipUI(data);
979
995
  out.clearWorld(renderBounds);
980
- copyWorld(canvas, out, ui);
996
+ core.LeafHelper.copyCanvasByWorld(ui, canvas, out);
981
997
  out.recycle(ui.__nowWorld);
982
998
  }
983
999
  }
@@ -1032,8 +1048,16 @@ function compute(attrName, ui) {
1032
1048
  if (!(paints instanceof Array))
1033
1049
  paints = [paints];
1034
1050
  recycleMap = draw.PaintImage.recycleImage(attrName, data);
1051
+ let maxChildStrokeWidth;
1035
1052
  for (let i = 0, len = paints.length, item; i < len; i++) {
1036
- (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
1053
+ if (item = getLeafPaint(attrName, paints[i], ui)) {
1054
+ leafPaints.push(item);
1055
+ if (item.strokeStyle) {
1056
+ maxChildStrokeWidth || (maxChildStrokeWidth = 1);
1057
+ if (item.strokeStyle.strokeWidth)
1058
+ maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
1059
+ }
1060
+ }
1037
1061
  }
1038
1062
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
1039
1063
  if (leafPaints.length) {
@@ -1050,6 +1074,7 @@ function compute(attrName, ui) {
1050
1074
  else {
1051
1075
  stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
1052
1076
  stintSet(data, '__isTransparentStroke', isTransparent);
1077
+ stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
1053
1078
  }
1054
1079
  }
1055
1080
  function getLeafPaint(attrName, paint, ui) {
@@ -1081,6 +1106,11 @@ function getLeafPaint(attrName, paint, ui) {
1081
1106
  if (data) {
1082
1107
  if (typeof data.style === 'string' && hasTransparent$1(data.style))
1083
1108
  data.isTransparent = true;
1109
+ if (paint.style) {
1110
+ if (paint.style.strokeWidth === 0)
1111
+ return undefined;
1112
+ data.strokeStyle = paint.style;
1113
+ }
1084
1114
  if (paint.blendMode)
1085
1115
  data.blendMode = paint.blendMode;
1086
1116
  }
@@ -1100,8 +1130,8 @@ const PaintModule = {
1100
1130
  shape
1101
1131
  };
1102
1132
 
1103
- let origin = {};
1104
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = core.MatrixHelper;
1133
+ let origin = {}, tempMatrix = core.getMatrixData();
1134
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = core.MatrixHelper;
1105
1135
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1106
1136
  const transform = get$3();
1107
1137
  translate$1(transform, box.x + x, box.y + y);
@@ -1110,13 +1140,19 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1110
1140
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
1111
1141
  data.transform = transform;
1112
1142
  }
1113
- function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
1143
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
1114
1144
  const transform = get$3();
1115
- translate$1(transform, box.x + x, box.y + y);
1116
- if (scaleX)
1117
- scaleHelper(transform, scaleX, scaleY);
1118
1145
  if (rotation)
1119
1146
  rotate(transform, rotation);
1147
+ if (skew)
1148
+ skewHelper(transform, skew.x, skew.y);
1149
+ if (scaleX)
1150
+ scaleHelper(transform, scaleX, scaleY);
1151
+ translate$1(transform, box.x + x, box.y + y);
1152
+ if (clipSize) {
1153
+ tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
1154
+ multiplyParent(transform, tempMatrix);
1155
+ }
1120
1156
  data.transform = transform;
1121
1157
  }
1122
1158
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -1153,11 +1189,15 @@ const tempBox = new core.Bounds();
1153
1189
  const tempScaleData = {};
1154
1190
  const tempImage = {};
1155
1191
  function createData(leafPaint, image, paint, box) {
1156
- const { changeful, sync } = paint;
1192
+ const { changeful, sync, editing, scaleFixed } = paint;
1157
1193
  if (changeful)
1158
1194
  leafPaint.changeful = changeful;
1159
1195
  if (sync)
1160
1196
  leafPaint.sync = sync;
1197
+ if (editing)
1198
+ leafPaint.editing = editing;
1199
+ if (scaleFixed)
1200
+ leafPaint.scaleFixed = scaleFixed;
1161
1201
  leafPaint.data = getPatternData(paint, box, image);
1162
1202
  }
1163
1203
  function getPatternData(paint, box, image) {
@@ -1166,7 +1206,7 @@ function getPatternData(paint, box, image) {
1166
1206
  if (paint.mode === 'strench')
1167
1207
  paint.mode = 'stretch';
1168
1208
  let { width, height } = image;
1169
- const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1209
+ const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
1170
1210
  const sameBox = box.width === width && box.height === height;
1171
1211
  const data = { mode };
1172
1212
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1200,8 +1240,8 @@ function getPatternData(paint, box, image) {
1200
1240
  break;
1201
1241
  case 'normal':
1202
1242
  case 'clip':
1203
- if (tempImage.x || tempImage.y || scaleX || rotation)
1204
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
1243
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
1244
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
1205
1245
  break;
1206
1246
  case 'repeat':
1207
1247
  if (!sameBox || scaleX || rotation)
@@ -1278,11 +1318,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
1278
1318
  }
1279
1319
  onLoadSuccess(ui, event);
1280
1320
  }
1281
- leafPaint.loadId = null;
1321
+ leafPaint.loadId = undefined;
1282
1322
  }, (error) => {
1283
1323
  ignoreRender(ui, false);
1284
1324
  onLoadError(ui, event, error);
1285
- leafPaint.loadId = null;
1325
+ leafPaint.loadId = undefined;
1286
1326
  });
1287
1327
  if (ui.placeholderColor) {
1288
1328
  if (!ui.placeholderDelay)
@@ -1338,16 +1378,16 @@ function ignoreRender(ui, value) {
1338
1378
  }
1339
1379
 
1340
1380
  const { get: get$1, scale, copy: copy$1 } = core.MatrixHelper;
1341
- const { ceil, abs: abs$1 } = Math;
1381
+ const { ceil, abs } = Math;
1342
1382
  function createPattern(ui, paint, pixelRatio) {
1343
- let { scaleX, scaleY } = core.ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1383
+ let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1344
1384
  const id = scaleX + '-' + scaleY + '-' + pixelRatio;
1345
1385
  if (paint.patternId !== id && !ui.destroyed) {
1346
- scaleX = abs$1(scaleX);
1347
- scaleY = abs$1(scaleY);
1348
1386
  const { image, data } = paint;
1349
1387
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1350
1388
  if (sx) {
1389
+ sx = abs(sx);
1390
+ sy = abs(sy);
1351
1391
  imageMatrix = get$1();
1352
1392
  copy$1(imageMatrix, transform);
1353
1393
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -1432,9 +1472,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1432
1472
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1433
1473
  };
1434
1474
 
1435
- const { abs } = Math;
1436
1475
  function checkImage(ui, canvas, paint, allowDraw) {
1437
- const { scaleX, scaleY } = core.ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1476
+ const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1438
1477
  const { pixelRatio } = canvas, { data } = paint;
1439
1478
  if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !draw.Export.running)) {
1440
1479
  return false;
@@ -1447,8 +1486,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
1447
1486
  else {
1448
1487
  if (!(paint.changeful || core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
1449
1488
  let { width, height } = data;
1450
- width *= abs(scaleX) * pixelRatio;
1451
- height *= abs(scaleY) * pixelRatio;
1489
+ width *= scaleX * pixelRatio;
1490
+ height *= scaleY * pixelRatio;
1452
1491
  if (data.scaleX) {
1453
1492
  width *= data.scaleX;
1454
1493
  height *= data.scaleY;
@@ -1458,6 +1497,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
1458
1497
  }
1459
1498
  }
1460
1499
  if (allowDraw) {
1500
+ if (ui.__.__isFastShadow) {
1501
+ canvas.fillStyle = paint.style || '#000';
1502
+ canvas.fill();
1503
+ }
1461
1504
  drawImage(ui, canvas, paint, data);
1462
1505
  return true;
1463
1506
  }
@@ -1646,10 +1689,7 @@ function shadow(ui, current, shape) {
1646
1689
  }
1647
1690
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
1648
1691
  }
1649
- if (ui.__worldFlipped)
1650
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1651
- else
1652
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1692
+ core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1653
1693
  if (end && index < end)
1654
1694
  other.clearWorld(copyBounds, true);
1655
1695
  });
@@ -1708,10 +1748,7 @@ function innerShadow(ui, current, shape) {
1708
1748
  copyBounds = bounds;
1709
1749
  }
1710
1750
  other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), 'source-in');
1711
- if (ui.__worldFlipped)
1712
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1713
- else
1714
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1751
+ core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1715
1752
  if (end && index < end)
1716
1753
  other.clearWorld(copyBounds, true);
1717
1754
  });
@@ -1767,12 +1804,11 @@ draw.Group.prototype.__renderMask = function (canvas, options) {
1767
1804
  contentCanvas = getCanvas(canvas);
1768
1805
  child.__render(maskCanvas, options);
1769
1806
  }
1770
- if (!(mask === 'clipping' || mask === 'clipping-path'))
1771
- continue;
1772
- }
1773
- if (excludeRenderBounds(child, options))
1807
+ if (mask === 'clipping' || mask === 'clipping-path')
1808
+ excludeRenderBounds(child, options) || child.__render(canvas, options);
1774
1809
  continue;
1775
- child.__render(contentCanvas || canvas, options);
1810
+ }
1811
+ excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
1776
1812
  }
1777
1813
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
1778
1814
  };
@@ -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, 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, 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 { PaintImage, Paint, ColorConvert, PaintGradient, Export, Group, TextConvert, Effect } from '@leafer-ui/draw';
@@ -837,9 +837,14 @@ function fills(fills, ui, canvas) {
837
837
  }
838
838
  }
839
839
  canvas.fillStyle = item.style;
840
- if (item.transform) {
840
+ if (item.transform || item.scaleFixed) {
841
841
  canvas.save();
842
- canvas.transform(item.transform);
842
+ if (item.transform)
843
+ canvas.transform(item.transform);
844
+ if (item.scaleFixed) {
845
+ const { scaleX, scaleY } = ui.getRenderScaleData(true);
846
+ canvas.scale(1 / scaleX, 1 / scaleY);
847
+ }
843
848
  if (item.blendMode)
844
849
  canvas.blendMode = item.blendMode;
845
850
  fillPathOrText(ui, canvas);
@@ -875,8 +880,13 @@ function strokeText(stroke, ui, canvas) {
875
880
  }
876
881
  function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
877
882
  const data = ui.__;
878
- canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
879
- data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
883
+ if (typeof stroke === 'object') {
884
+ drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
885
+ }
886
+ else {
887
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
888
+ drawTextStroke(ui, canvas);
889
+ }
880
890
  }
881
891
  function drawAlign(stroke, align, ui, canvas) {
882
892
  const out = canvas.getSameCanvas(true, true);
@@ -885,15 +895,9 @@ function drawAlign(stroke, align, ui, canvas) {
885
895
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
886
896
  fillText(ui, out);
887
897
  out.blendMode = 'normal';
888
- copyWorld(canvas, out, ui);
898
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
889
899
  out.recycle(ui.__nowWorld);
890
900
  }
891
- function copyWorld(canvas, out, ui) {
892
- if (ui.__worldFlipped || Platform.fullImageShadow)
893
- canvas.copyWorldByReset(out, ui.__nowWorld);
894
- else
895
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
896
- }
897
901
  function drawTextStroke(ui, canvas) {
898
902
  let row, data = ui.__.__textDrawData;
899
903
  const { rows, decorationY } = data;
@@ -909,14 +913,21 @@ function drawTextStroke(ui, canvas) {
909
913
  rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
910
914
  }
911
915
  }
912
- function drawStrokesStyle(strokes, isText, ui, canvas) {
916
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
913
917
  let item;
918
+ const data = ui.__, { __hasMultiStrokeStyle } = data;
919
+ __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
914
920
  for (let i = 0, len = strokes.length; i < len; i++) {
915
921
  item = strokes[i];
916
922
  if (item.image && PaintImage.checkImage(ui, canvas, item, false))
917
923
  continue;
918
924
  if (item.style) {
919
- canvas.strokeStyle = item.style;
925
+ if (__hasMultiStrokeStyle) {
926
+ const { strokeStyle } = item;
927
+ strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
928
+ }
929
+ else
930
+ canvas.strokeStyle = item.style;
920
931
  if (item.blendMode) {
921
932
  canvas.saveBlendMode(item.blendMode);
922
933
  isText ? drawTextStroke(ui, canvas) : canvas.stroke();
@@ -955,8 +966,13 @@ function strokes(strokes, ui, canvas) {
955
966
  }
956
967
  function drawCenter(stroke, strokeWidthScale, ui, canvas) {
957
968
  const data = ui.__;
958
- canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
959
- data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
969
+ if (typeof stroke === 'object') {
970
+ drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
971
+ }
972
+ else {
973
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
974
+ canvas.stroke();
975
+ }
960
976
  if (data.__useArrow)
961
977
  Paint.strokeArrow(stroke, ui, canvas);
962
978
  }
@@ -978,7 +994,7 @@ function drawOutside(stroke, ui, canvas) {
978
994
  drawCenter(stroke, 2, ui, out);
979
995
  out.clipUI(data);
980
996
  out.clearWorld(renderBounds);
981
- copyWorld(canvas, out, ui);
997
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
982
998
  out.recycle(ui.__nowWorld);
983
999
  }
984
1000
  }
@@ -1033,8 +1049,16 @@ function compute(attrName, ui) {
1033
1049
  if (!(paints instanceof Array))
1034
1050
  paints = [paints];
1035
1051
  recycleMap = PaintImage.recycleImage(attrName, data);
1052
+ let maxChildStrokeWidth;
1036
1053
  for (let i = 0, len = paints.length, item; i < len; i++) {
1037
- (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
1054
+ if (item = getLeafPaint(attrName, paints[i], ui)) {
1055
+ leafPaints.push(item);
1056
+ if (item.strokeStyle) {
1057
+ maxChildStrokeWidth || (maxChildStrokeWidth = 1);
1058
+ if (item.strokeStyle.strokeWidth)
1059
+ maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
1060
+ }
1061
+ }
1038
1062
  }
1039
1063
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
1040
1064
  if (leafPaints.length) {
@@ -1051,6 +1075,7 @@ function compute(attrName, ui) {
1051
1075
  else {
1052
1076
  stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
1053
1077
  stintSet(data, '__isTransparentStroke', isTransparent);
1078
+ stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
1054
1079
  }
1055
1080
  }
1056
1081
  function getLeafPaint(attrName, paint, ui) {
@@ -1082,6 +1107,11 @@ function getLeafPaint(attrName, paint, ui) {
1082
1107
  if (data) {
1083
1108
  if (typeof data.style === 'string' && hasTransparent$1(data.style))
1084
1109
  data.isTransparent = true;
1110
+ if (paint.style) {
1111
+ if (paint.style.strokeWidth === 0)
1112
+ return undefined;
1113
+ data.strokeStyle = paint.style;
1114
+ }
1085
1115
  if (paint.blendMode)
1086
1116
  data.blendMode = paint.blendMode;
1087
1117
  }
@@ -1101,8 +1131,8 @@ const PaintModule = {
1101
1131
  shape
1102
1132
  };
1103
1133
 
1104
- let origin = {};
1105
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
1134
+ let origin = {}, tempMatrix = getMatrixData();
1135
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
1106
1136
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1107
1137
  const transform = get$3();
1108
1138
  translate$1(transform, box.x + x, box.y + y);
@@ -1111,13 +1141,19 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1111
1141
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
1112
1142
  data.transform = transform;
1113
1143
  }
1114
- function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
1144
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
1115
1145
  const transform = get$3();
1116
- translate$1(transform, box.x + x, box.y + y);
1117
- if (scaleX)
1118
- scaleHelper(transform, scaleX, scaleY);
1119
1146
  if (rotation)
1120
1147
  rotate(transform, rotation);
1148
+ if (skew)
1149
+ skewHelper(transform, skew.x, skew.y);
1150
+ if (scaleX)
1151
+ scaleHelper(transform, scaleX, scaleY);
1152
+ translate$1(transform, box.x + x, box.y + y);
1153
+ if (clipSize) {
1154
+ tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
1155
+ multiplyParent(transform, tempMatrix);
1156
+ }
1121
1157
  data.transform = transform;
1122
1158
  }
1123
1159
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -1154,11 +1190,15 @@ const tempBox = new Bounds();
1154
1190
  const tempScaleData = {};
1155
1191
  const tempImage = {};
1156
1192
  function createData(leafPaint, image, paint, box) {
1157
- const { changeful, sync } = paint;
1193
+ const { changeful, sync, editing, scaleFixed } = paint;
1158
1194
  if (changeful)
1159
1195
  leafPaint.changeful = changeful;
1160
1196
  if (sync)
1161
1197
  leafPaint.sync = sync;
1198
+ if (editing)
1199
+ leafPaint.editing = editing;
1200
+ if (scaleFixed)
1201
+ leafPaint.scaleFixed = scaleFixed;
1162
1202
  leafPaint.data = getPatternData(paint, box, image);
1163
1203
  }
1164
1204
  function getPatternData(paint, box, image) {
@@ -1167,7 +1207,7 @@ function getPatternData(paint, box, image) {
1167
1207
  if (paint.mode === 'strench')
1168
1208
  paint.mode = 'stretch';
1169
1209
  let { width, height } = image;
1170
- const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
1210
+ const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
1171
1211
  const sameBox = box.width === width && box.height === height;
1172
1212
  const data = { mode };
1173
1213
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1201,8 +1241,8 @@ function getPatternData(paint, box, image) {
1201
1241
  break;
1202
1242
  case 'normal':
1203
1243
  case 'clip':
1204
- if (tempImage.x || tempImage.y || scaleX || rotation)
1205
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
1244
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
1245
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
1206
1246
  break;
1207
1247
  case 'repeat':
1208
1248
  if (!sameBox || scaleX || rotation)
@@ -1279,11 +1319,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
1279
1319
  }
1280
1320
  onLoadSuccess(ui, event);
1281
1321
  }
1282
- leafPaint.loadId = null;
1322
+ leafPaint.loadId = undefined;
1283
1323
  }, (error) => {
1284
1324
  ignoreRender(ui, false);
1285
1325
  onLoadError(ui, event, error);
1286
- leafPaint.loadId = null;
1326
+ leafPaint.loadId = undefined;
1287
1327
  });
1288
1328
  if (ui.placeholderColor) {
1289
1329
  if (!ui.placeholderDelay)
@@ -1339,16 +1379,16 @@ function ignoreRender(ui, value) {
1339
1379
  }
1340
1380
 
1341
1381
  const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
1342
- const { ceil, abs: abs$1 } = Math;
1382
+ const { ceil, abs } = Math;
1343
1383
  function createPattern(ui, paint, pixelRatio) {
1344
- let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1384
+ let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1345
1385
  const id = scaleX + '-' + scaleY + '-' + pixelRatio;
1346
1386
  if (paint.patternId !== id && !ui.destroyed) {
1347
- scaleX = abs$1(scaleX);
1348
- scaleY = abs$1(scaleY);
1349
1387
  const { image, data } = paint;
1350
1388
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1351
1389
  if (sx) {
1390
+ sx = abs(sx);
1391
+ sy = abs(sy);
1352
1392
  imageMatrix = get$1();
1353
1393
  copy$1(imageMatrix, transform);
1354
1394
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -1433,9 +1473,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1433
1473
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1434
1474
  };
1435
1475
 
1436
- const { abs } = Math;
1437
1476
  function checkImage(ui, canvas, paint, allowDraw) {
1438
- const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1477
+ const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1439
1478
  const { pixelRatio } = canvas, { data } = paint;
1440
1479
  if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
1441
1480
  return false;
@@ -1448,8 +1487,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
1448
1487
  else {
1449
1488
  if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
1450
1489
  let { width, height } = data;
1451
- width *= abs(scaleX) * pixelRatio;
1452
- height *= abs(scaleY) * pixelRatio;
1490
+ width *= scaleX * pixelRatio;
1491
+ height *= scaleY * pixelRatio;
1453
1492
  if (data.scaleX) {
1454
1493
  width *= data.scaleX;
1455
1494
  height *= data.scaleY;
@@ -1459,6 +1498,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
1459
1498
  }
1460
1499
  }
1461
1500
  if (allowDraw) {
1501
+ if (ui.__.__isFastShadow) {
1502
+ canvas.fillStyle = paint.style || '#000';
1503
+ canvas.fill();
1504
+ }
1462
1505
  drawImage(ui, canvas, paint, data);
1463
1506
  return true;
1464
1507
  }
@@ -1647,10 +1690,7 @@ function shadow(ui, current, shape) {
1647
1690
  }
1648
1691
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
1649
1692
  }
1650
- if (ui.__worldFlipped)
1651
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1652
- else
1653
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1693
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1654
1694
  if (end && index < end)
1655
1695
  other.clearWorld(copyBounds, true);
1656
1696
  });
@@ -1709,10 +1749,7 @@ function innerShadow(ui, current, shape) {
1709
1749
  copyBounds = bounds;
1710
1750
  }
1711
1751
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
1712
- if (ui.__worldFlipped)
1713
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1714
- else
1715
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1752
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1716
1753
  if (end && index < end)
1717
1754
  other.clearWorld(copyBounds, true);
1718
1755
  });
@@ -1768,12 +1805,11 @@ Group.prototype.__renderMask = function (canvas, options) {
1768
1805
  contentCanvas = getCanvas(canvas);
1769
1806
  child.__render(maskCanvas, options);
1770
1807
  }
1771
- if (!(mask === 'clipping' || mask === 'clipping-path'))
1772
- continue;
1773
- }
1774
- if (excludeRenderBounds(child, options))
1808
+ if (mask === 'clipping' || mask === 'clipping-path')
1809
+ excludeRenderBounds(child, options) || child.__render(canvas, options);
1775
1810
  continue;
1776
- child.__render(contentCanvas || canvas, options);
1811
+ }
1812
+ excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
1777
1813
  }
1778
1814
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
1779
1815
  };