@leafer-ui/worker 1.7.0 → 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/worker.cjs CHANGED
@@ -855,9 +855,14 @@ function fills(fills, ui, canvas) {
855
855
  }
856
856
  }
857
857
  canvas.fillStyle = item.style;
858
- if (item.transform) {
858
+ if (item.transform || item.scaleFixed) {
859
859
  canvas.save();
860
- canvas.transform(item.transform);
860
+ if (item.transform)
861
+ canvas.transform(item.transform);
862
+ if (item.scaleFixed) {
863
+ const { scaleX, scaleY } = ui.getRenderScaleData(true);
864
+ canvas.scale(1 / scaleX, 1 / scaleY);
865
+ }
861
866
  if (item.blendMode)
862
867
  canvas.blendMode = item.blendMode;
863
868
  fillPathOrText(ui, canvas);
@@ -893,8 +898,13 @@ function strokeText(stroke, ui, canvas) {
893
898
  }
894
899
  function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
895
900
  const data = ui.__;
896
- canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
897
- data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
901
+ if (typeof stroke === 'object') {
902
+ drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
903
+ }
904
+ else {
905
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
906
+ drawTextStroke(ui, canvas);
907
+ }
898
908
  }
899
909
  function drawAlign(stroke, align, ui, canvas) {
900
910
  const out = canvas.getSameCanvas(true, true);
@@ -903,15 +913,9 @@ function drawAlign(stroke, align, ui, canvas) {
903
913
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
904
914
  fillText(ui, out);
905
915
  out.blendMode = 'normal';
906
- copyWorld(canvas, out, ui);
916
+ core.LeafHelper.copyCanvasByWorld(ui, canvas, out);
907
917
  out.recycle(ui.__nowWorld);
908
918
  }
909
- function copyWorld(canvas, out, ui) {
910
- if (ui.__worldFlipped || core.Platform.fullImageShadow)
911
- canvas.copyWorldByReset(out, ui.__nowWorld);
912
- else
913
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
914
- }
915
919
  function drawTextStroke(ui, canvas) {
916
920
  let row, data = ui.__.__textDrawData;
917
921
  const { rows, decorationY } = data;
@@ -927,14 +931,21 @@ function drawTextStroke(ui, canvas) {
927
931
  rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
928
932
  }
929
933
  }
930
- function drawStrokesStyle(strokes, isText, ui, canvas) {
934
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
931
935
  let item;
936
+ const data = ui.__, { __hasMultiStrokeStyle } = data;
937
+ __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
932
938
  for (let i = 0, len = strokes.length; i < len; i++) {
933
939
  item = strokes[i];
934
940
  if (item.image && draw.PaintImage.checkImage(ui, canvas, item, false))
935
941
  continue;
936
942
  if (item.style) {
937
- canvas.strokeStyle = item.style;
943
+ if (__hasMultiStrokeStyle) {
944
+ const { strokeStyle } = item;
945
+ strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
946
+ }
947
+ else
948
+ canvas.strokeStyle = item.style;
938
949
  if (item.blendMode) {
939
950
  canvas.saveBlendMode(item.blendMode);
940
951
  isText ? drawTextStroke(ui, canvas) : canvas.stroke();
@@ -973,8 +984,13 @@ function strokes(strokes, ui, canvas) {
973
984
  }
974
985
  function drawCenter(stroke, strokeWidthScale, ui, canvas) {
975
986
  const data = ui.__;
976
- canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
977
- data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
987
+ if (typeof stroke === 'object') {
988
+ drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
989
+ }
990
+ else {
991
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
992
+ canvas.stroke();
993
+ }
978
994
  if (data.__useArrow)
979
995
  draw.Paint.strokeArrow(stroke, ui, canvas);
980
996
  }
@@ -996,7 +1012,7 @@ function drawOutside(stroke, ui, canvas) {
996
1012
  drawCenter(stroke, 2, ui, out);
997
1013
  out.clipUI(data);
998
1014
  out.clearWorld(renderBounds);
999
- copyWorld(canvas, out, ui);
1015
+ core.LeafHelper.copyCanvasByWorld(ui, canvas, out);
1000
1016
  out.recycle(ui.__nowWorld);
1001
1017
  }
1002
1018
  }
@@ -1051,8 +1067,16 @@ function compute(attrName, ui) {
1051
1067
  if (!(paints instanceof Array))
1052
1068
  paints = [paints];
1053
1069
  recycleMap = draw.PaintImage.recycleImage(attrName, data);
1070
+ let maxChildStrokeWidth;
1054
1071
  for (let i = 0, len = paints.length, item; i < len; i++) {
1055
- (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
1072
+ if (item = getLeafPaint(attrName, paints[i], ui)) {
1073
+ leafPaints.push(item);
1074
+ if (item.strokeStyle) {
1075
+ maxChildStrokeWidth || (maxChildStrokeWidth = 1);
1076
+ if (item.strokeStyle.strokeWidth)
1077
+ maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
1078
+ }
1079
+ }
1056
1080
  }
1057
1081
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
1058
1082
  if (leafPaints.length) {
@@ -1069,6 +1093,7 @@ function compute(attrName, ui) {
1069
1093
  else {
1070
1094
  stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
1071
1095
  stintSet(data, '__isTransparentStroke', isTransparent);
1096
+ stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
1072
1097
  }
1073
1098
  }
1074
1099
  function getLeafPaint(attrName, paint, ui) {
@@ -1100,6 +1125,11 @@ function getLeafPaint(attrName, paint, ui) {
1100
1125
  if (data) {
1101
1126
  if (typeof data.style === 'string' && hasTransparent$1(data.style))
1102
1127
  data.isTransparent = true;
1128
+ if (paint.style) {
1129
+ if (paint.style.strokeWidth === 0)
1130
+ return undefined;
1131
+ data.strokeStyle = paint.style;
1132
+ }
1103
1133
  if (paint.blendMode)
1104
1134
  data.blendMode = paint.blendMode;
1105
1135
  }
@@ -1119,8 +1149,8 @@ const PaintModule = {
1119
1149
  shape
1120
1150
  };
1121
1151
 
1122
- let origin = {};
1123
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = core.MatrixHelper;
1152
+ let origin = {}, tempMatrix = core.getMatrixData();
1153
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = core.MatrixHelper;
1124
1154
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1125
1155
  const transform = get$3();
1126
1156
  translate$1(transform, box.x + x, box.y + y);
@@ -1129,7 +1159,7 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1129
1159
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
1130
1160
  data.transform = transform;
1131
1161
  }
1132
- function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
1162
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
1133
1163
  const transform = get$3();
1134
1164
  if (rotation)
1135
1165
  rotate(transform, rotation);
@@ -1138,6 +1168,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
1138
1168
  if (scaleX)
1139
1169
  scaleHelper(transform, scaleX, scaleY);
1140
1170
  translate$1(transform, box.x + x, box.y + y);
1171
+ if (clipSize) {
1172
+ tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
1173
+ multiplyParent(transform, tempMatrix);
1174
+ }
1141
1175
  data.transform = transform;
1142
1176
  }
1143
1177
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -1174,13 +1208,15 @@ const tempBox = new core.Bounds();
1174
1208
  const tempScaleData = {};
1175
1209
  const tempImage = {};
1176
1210
  function createData(leafPaint, image, paint, box) {
1177
- const { changeful, sync, editing } = paint;
1211
+ const { changeful, sync, editing, scaleFixed } = paint;
1178
1212
  if (changeful)
1179
1213
  leafPaint.changeful = changeful;
1180
1214
  if (sync)
1181
1215
  leafPaint.sync = sync;
1182
1216
  if (editing)
1183
1217
  leafPaint.editing = editing;
1218
+ if (scaleFixed)
1219
+ leafPaint.scaleFixed = scaleFixed;
1184
1220
  leafPaint.data = getPatternData(paint, box, image);
1185
1221
  }
1186
1222
  function getPatternData(paint, box, image) {
@@ -1189,7 +1225,7 @@ function getPatternData(paint, box, image) {
1189
1225
  if (paint.mode === 'strench')
1190
1226
  paint.mode = 'stretch';
1191
1227
  let { width, height } = image;
1192
- const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
1228
+ const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
1193
1229
  const sameBox = box.width === width && box.height === height;
1194
1230
  const data = { mode };
1195
1231
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1223,8 +1259,8 @@ function getPatternData(paint, box, image) {
1223
1259
  break;
1224
1260
  case 'normal':
1225
1261
  case 'clip':
1226
- if (tempImage.x || tempImage.y || scaleX || rotation || skew)
1227
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
1262
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
1263
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
1228
1264
  break;
1229
1265
  case 'repeat':
1230
1266
  if (!sameBox || scaleX || rotation)
@@ -1361,18 +1397,16 @@ function ignoreRender(ui, value) {
1361
1397
  }
1362
1398
 
1363
1399
  const { get: get$1, scale, copy: copy$1 } = core.MatrixHelper;
1364
- const { ceil, abs: abs$1 } = Math;
1400
+ const { ceil, abs } = Math;
1365
1401
  function createPattern(ui, paint, pixelRatio) {
1366
- let { scaleX, scaleY } = core.ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1402
+ let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1367
1403
  const id = scaleX + '-' + scaleY + '-' + pixelRatio;
1368
1404
  if (paint.patternId !== id && !ui.destroyed) {
1369
- scaleX = abs$1(scaleX);
1370
- scaleY = abs$1(scaleY);
1371
1405
  const { image, data } = paint;
1372
1406
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1373
1407
  if (sx) {
1374
- sx = abs$1(sx);
1375
- sy = abs$1(sy);
1408
+ sx = abs(sx);
1409
+ sy = abs(sy);
1376
1410
  imageMatrix = get$1();
1377
1411
  copy$1(imageMatrix, transform);
1378
1412
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -1457,9 +1491,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1457
1491
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1458
1492
  };
1459
1493
 
1460
- const { abs } = Math;
1461
1494
  function checkImage(ui, canvas, paint, allowDraw) {
1462
- const { scaleX, scaleY } = core.ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1495
+ const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1463
1496
  const { pixelRatio } = canvas, { data } = paint;
1464
1497
  if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !draw.Export.running)) {
1465
1498
  return false;
@@ -1472,8 +1505,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
1472
1505
  else {
1473
1506
  if (!(paint.changeful || core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
1474
1507
  let { width, height } = data;
1475
- width *= abs(scaleX) * pixelRatio;
1476
- height *= abs(scaleY) * pixelRatio;
1508
+ width *= scaleX * pixelRatio;
1509
+ height *= scaleY * pixelRatio;
1477
1510
  if (data.scaleX) {
1478
1511
  width *= data.scaleX;
1479
1512
  height *= data.scaleY;
@@ -1483,6 +1516,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
1483
1516
  }
1484
1517
  }
1485
1518
  if (allowDraw) {
1519
+ if (ui.__.__isFastShadow) {
1520
+ canvas.fillStyle = paint.style || '#000';
1521
+ canvas.fill();
1522
+ }
1486
1523
  drawImage(ui, canvas, paint, data);
1487
1524
  return true;
1488
1525
  }
@@ -1671,10 +1708,7 @@ function shadow(ui, current, shape) {
1671
1708
  }
1672
1709
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
1673
1710
  }
1674
- if (ui.__worldFlipped)
1675
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1676
- else
1677
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1711
+ core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1678
1712
  if (end && index < end)
1679
1713
  other.clearWorld(copyBounds, true);
1680
1714
  });
@@ -1733,10 +1767,7 @@ function innerShadow(ui, current, shape) {
1733
1767
  copyBounds = bounds;
1734
1768
  }
1735
1769
  other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), 'source-in');
1736
- if (ui.__worldFlipped)
1737
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1738
- else
1739
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1770
+ core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1740
1771
  if (end && index < end)
1741
1772
  other.clearWorld(copyBounds, true);
1742
1773
  });
@@ -1792,12 +1823,11 @@ draw.Group.prototype.__renderMask = function (canvas, options) {
1792
1823
  contentCanvas = getCanvas(canvas);
1793
1824
  child.__render(maskCanvas, options);
1794
1825
  }
1795
- if (!(mask === 'clipping' || mask === 'clipping-path'))
1796
- continue;
1797
- }
1798
- if (excludeRenderBounds(child, options))
1826
+ if (mask === 'clipping' || mask === 'clipping-path')
1827
+ excludeRenderBounds(child, options) || child.__render(canvas, options);
1799
1828
  continue;
1800
- child.__render(contentCanvas || canvas, options);
1829
+ }
1830
+ excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
1801
1831
  }
1802
1832
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
1803
1833
  };
@@ -1,4 +1,4 @@
1
- import { LeaferCanvasBase, Platform, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, ResizeEvent, BoundsHelper, Plugin, MatrixHelper, MathHelper, AlignHelper, PointHelper, ImageEvent, AroundHelper, Direction4 } from '@leafer/core';
1
+ import { LeaferCanvasBase, Platform, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, ResizeEvent, 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 { HitCanvasManager, InteractionBase } from '@leafer-ui/core';
@@ -856,9 +856,14 @@ function fills(fills, ui, canvas) {
856
856
  }
857
857
  }
858
858
  canvas.fillStyle = item.style;
859
- if (item.transform) {
859
+ if (item.transform || item.scaleFixed) {
860
860
  canvas.save();
861
- canvas.transform(item.transform);
861
+ if (item.transform)
862
+ canvas.transform(item.transform);
863
+ if (item.scaleFixed) {
864
+ const { scaleX, scaleY } = ui.getRenderScaleData(true);
865
+ canvas.scale(1 / scaleX, 1 / scaleY);
866
+ }
862
867
  if (item.blendMode)
863
868
  canvas.blendMode = item.blendMode;
864
869
  fillPathOrText(ui, canvas);
@@ -894,8 +899,13 @@ function strokeText(stroke, ui, canvas) {
894
899
  }
895
900
  function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
896
901
  const data = ui.__;
897
- canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
898
- data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
902
+ if (typeof stroke === 'object') {
903
+ drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
904
+ }
905
+ else {
906
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
907
+ drawTextStroke(ui, canvas);
908
+ }
899
909
  }
900
910
  function drawAlign(stroke, align, ui, canvas) {
901
911
  const out = canvas.getSameCanvas(true, true);
@@ -904,15 +914,9 @@ function drawAlign(stroke, align, ui, canvas) {
904
914
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
905
915
  fillText(ui, out);
906
916
  out.blendMode = 'normal';
907
- copyWorld(canvas, out, ui);
917
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
908
918
  out.recycle(ui.__nowWorld);
909
919
  }
910
- function copyWorld(canvas, out, ui) {
911
- if (ui.__worldFlipped || Platform.fullImageShadow)
912
- canvas.copyWorldByReset(out, ui.__nowWorld);
913
- else
914
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
915
- }
916
920
  function drawTextStroke(ui, canvas) {
917
921
  let row, data = ui.__.__textDrawData;
918
922
  const { rows, decorationY } = data;
@@ -928,14 +932,21 @@ function drawTextStroke(ui, canvas) {
928
932
  rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
929
933
  }
930
934
  }
931
- function drawStrokesStyle(strokes, isText, ui, canvas) {
935
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
932
936
  let item;
937
+ const data = ui.__, { __hasMultiStrokeStyle } = data;
938
+ __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
933
939
  for (let i = 0, len = strokes.length; i < len; i++) {
934
940
  item = strokes[i];
935
941
  if (item.image && PaintImage.checkImage(ui, canvas, item, false))
936
942
  continue;
937
943
  if (item.style) {
938
- canvas.strokeStyle = item.style;
944
+ if (__hasMultiStrokeStyle) {
945
+ const { strokeStyle } = item;
946
+ strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
947
+ }
948
+ else
949
+ canvas.strokeStyle = item.style;
939
950
  if (item.blendMode) {
940
951
  canvas.saveBlendMode(item.blendMode);
941
952
  isText ? drawTextStroke(ui, canvas) : canvas.stroke();
@@ -974,8 +985,13 @@ function strokes(strokes, ui, canvas) {
974
985
  }
975
986
  function drawCenter(stroke, strokeWidthScale, ui, canvas) {
976
987
  const data = ui.__;
977
- canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
978
- data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
988
+ if (typeof stroke === 'object') {
989
+ drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
990
+ }
991
+ else {
992
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
993
+ canvas.stroke();
994
+ }
979
995
  if (data.__useArrow)
980
996
  Paint.strokeArrow(stroke, ui, canvas);
981
997
  }
@@ -997,7 +1013,7 @@ function drawOutside(stroke, ui, canvas) {
997
1013
  drawCenter(stroke, 2, ui, out);
998
1014
  out.clipUI(data);
999
1015
  out.clearWorld(renderBounds);
1000
- copyWorld(canvas, out, ui);
1016
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
1001
1017
  out.recycle(ui.__nowWorld);
1002
1018
  }
1003
1019
  }
@@ -1052,8 +1068,16 @@ function compute(attrName, ui) {
1052
1068
  if (!(paints instanceof Array))
1053
1069
  paints = [paints];
1054
1070
  recycleMap = PaintImage.recycleImage(attrName, data);
1071
+ let maxChildStrokeWidth;
1055
1072
  for (let i = 0, len = paints.length, item; i < len; i++) {
1056
- (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
1073
+ if (item = getLeafPaint(attrName, paints[i], ui)) {
1074
+ leafPaints.push(item);
1075
+ if (item.strokeStyle) {
1076
+ maxChildStrokeWidth || (maxChildStrokeWidth = 1);
1077
+ if (item.strokeStyle.strokeWidth)
1078
+ maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
1079
+ }
1080
+ }
1057
1081
  }
1058
1082
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
1059
1083
  if (leafPaints.length) {
@@ -1070,6 +1094,7 @@ function compute(attrName, ui) {
1070
1094
  else {
1071
1095
  stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
1072
1096
  stintSet(data, '__isTransparentStroke', isTransparent);
1097
+ stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
1073
1098
  }
1074
1099
  }
1075
1100
  function getLeafPaint(attrName, paint, ui) {
@@ -1101,6 +1126,11 @@ function getLeafPaint(attrName, paint, ui) {
1101
1126
  if (data) {
1102
1127
  if (typeof data.style === 'string' && hasTransparent$1(data.style))
1103
1128
  data.isTransparent = true;
1129
+ if (paint.style) {
1130
+ if (paint.style.strokeWidth === 0)
1131
+ return undefined;
1132
+ data.strokeStyle = paint.style;
1133
+ }
1104
1134
  if (paint.blendMode)
1105
1135
  data.blendMode = paint.blendMode;
1106
1136
  }
@@ -1120,8 +1150,8 @@ const PaintModule = {
1120
1150
  shape
1121
1151
  };
1122
1152
 
1123
- let origin = {};
1124
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
1153
+ let origin = {}, tempMatrix = getMatrixData();
1154
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
1125
1155
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1126
1156
  const transform = get$3();
1127
1157
  translate$1(transform, box.x + x, box.y + y);
@@ -1130,7 +1160,7 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1130
1160
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
1131
1161
  data.transform = transform;
1132
1162
  }
1133
- function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
1163
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
1134
1164
  const transform = get$3();
1135
1165
  if (rotation)
1136
1166
  rotate(transform, rotation);
@@ -1139,6 +1169,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
1139
1169
  if (scaleX)
1140
1170
  scaleHelper(transform, scaleX, scaleY);
1141
1171
  translate$1(transform, box.x + x, box.y + y);
1172
+ if (clipSize) {
1173
+ tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
1174
+ multiplyParent(transform, tempMatrix);
1175
+ }
1142
1176
  data.transform = transform;
1143
1177
  }
1144
1178
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -1175,13 +1209,15 @@ const tempBox = new Bounds();
1175
1209
  const tempScaleData = {};
1176
1210
  const tempImage = {};
1177
1211
  function createData(leafPaint, image, paint, box) {
1178
- const { changeful, sync, editing } = paint;
1212
+ const { changeful, sync, editing, scaleFixed } = paint;
1179
1213
  if (changeful)
1180
1214
  leafPaint.changeful = changeful;
1181
1215
  if (sync)
1182
1216
  leafPaint.sync = sync;
1183
1217
  if (editing)
1184
1218
  leafPaint.editing = editing;
1219
+ if (scaleFixed)
1220
+ leafPaint.scaleFixed = scaleFixed;
1185
1221
  leafPaint.data = getPatternData(paint, box, image);
1186
1222
  }
1187
1223
  function getPatternData(paint, box, image) {
@@ -1190,7 +1226,7 @@ function getPatternData(paint, box, image) {
1190
1226
  if (paint.mode === 'strench')
1191
1227
  paint.mode = 'stretch';
1192
1228
  let { width, height } = image;
1193
- const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
1229
+ const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
1194
1230
  const sameBox = box.width === width && box.height === height;
1195
1231
  const data = { mode };
1196
1232
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -1224,8 +1260,8 @@ function getPatternData(paint, box, image) {
1224
1260
  break;
1225
1261
  case 'normal':
1226
1262
  case 'clip':
1227
- if (tempImage.x || tempImage.y || scaleX || rotation || skew)
1228
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
1263
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
1264
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
1229
1265
  break;
1230
1266
  case 'repeat':
1231
1267
  if (!sameBox || scaleX || rotation)
@@ -1362,18 +1398,16 @@ function ignoreRender(ui, value) {
1362
1398
  }
1363
1399
 
1364
1400
  const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
1365
- const { ceil, abs: abs$1 } = Math;
1401
+ const { ceil, abs } = Math;
1366
1402
  function createPattern(ui, paint, pixelRatio) {
1367
- let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1403
+ let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1368
1404
  const id = scaleX + '-' + scaleY + '-' + pixelRatio;
1369
1405
  if (paint.patternId !== id && !ui.destroyed) {
1370
- scaleX = abs$1(scaleX);
1371
- scaleY = abs$1(scaleY);
1372
1406
  const { image, data } = paint;
1373
1407
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
1374
1408
  if (sx) {
1375
- sx = abs$1(sx);
1376
- sy = abs$1(sy);
1409
+ sx = abs(sx);
1410
+ sy = abs(sy);
1377
1411
  imageMatrix = get$1();
1378
1412
  copy$1(imageMatrix, transform);
1379
1413
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -1458,9 +1492,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1458
1492
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1459
1493
  };
1460
1494
 
1461
- const { abs } = Math;
1462
1495
  function checkImage(ui, canvas, paint, allowDraw) {
1463
- const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1496
+ const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
1464
1497
  const { pixelRatio } = canvas, { data } = paint;
1465
1498
  if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
1466
1499
  return false;
@@ -1473,8 +1506,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
1473
1506
  else {
1474
1507
  if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
1475
1508
  let { width, height } = data;
1476
- width *= abs(scaleX) * pixelRatio;
1477
- height *= abs(scaleY) * pixelRatio;
1509
+ width *= scaleX * pixelRatio;
1510
+ height *= scaleY * pixelRatio;
1478
1511
  if (data.scaleX) {
1479
1512
  width *= data.scaleX;
1480
1513
  height *= data.scaleY;
@@ -1484,6 +1517,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
1484
1517
  }
1485
1518
  }
1486
1519
  if (allowDraw) {
1520
+ if (ui.__.__isFastShadow) {
1521
+ canvas.fillStyle = paint.style || '#000';
1522
+ canvas.fill();
1523
+ }
1487
1524
  drawImage(ui, canvas, paint, data);
1488
1525
  return true;
1489
1526
  }
@@ -1672,10 +1709,7 @@ function shadow(ui, current, shape) {
1672
1709
  }
1673
1710
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
1674
1711
  }
1675
- if (ui.__worldFlipped)
1676
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1677
- else
1678
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1712
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1679
1713
  if (end && index < end)
1680
1714
  other.clearWorld(copyBounds, true);
1681
1715
  });
@@ -1734,10 +1768,7 @@ function innerShadow(ui, current, shape) {
1734
1768
  copyBounds = bounds;
1735
1769
  }
1736
1770
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
1737
- if (ui.__worldFlipped)
1738
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
1739
- else
1740
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
1771
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1741
1772
  if (end && index < end)
1742
1773
  other.clearWorld(copyBounds, true);
1743
1774
  });
@@ -1793,12 +1824,11 @@ Group.prototype.__renderMask = function (canvas, options) {
1793
1824
  contentCanvas = getCanvas(canvas);
1794
1825
  child.__render(maskCanvas, options);
1795
1826
  }
1796
- if (!(mask === 'clipping' || mask === 'clipping-path'))
1797
- continue;
1798
- }
1799
- if (excludeRenderBounds(child, options))
1827
+ if (mask === 'clipping' || mask === 'clipping-path')
1828
+ excludeRenderBounds(child, options) || child.__render(canvas, options);
1800
1829
  continue;
1801
- child.__render(contentCanvas || canvas, options);
1830
+ }
1831
+ excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
1802
1832
  }
1803
1833
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
1804
1834
  };