@leafer-ui/node 1.9.6 → 1.9.8

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/node.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { LeaferCanvasBase, Platform, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, isArray, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, ResizeEvent, BoundsHelper, Plugin, isObject, Matrix, isUndefined, isString, getMatrixData, MatrixHelper, MathHelper, AlignHelper, PointHelper, ImageEvent, AroundHelper, Direction4, isNumber } from "@leafer/core";
1
+ import { LeaferCanvasBase, Platform, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, isArray, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, ResizeEvent, BoundsHelper, Plugin, isObject, FourNumberHelper, Matrix, isUndefined, isString, getMatrixData, MatrixHelper, MathHelper, AlignHelper, PointHelper, ImageEvent, AroundHelper, Direction4, isNumber } from "@leafer/core";
2
2
 
3
3
  export * from "@leafer/core";
4
4
 
@@ -10,7 +10,7 @@ import { HitCanvasManager, InteractionBase } from "@leafer-ui/core";
10
10
 
11
11
  export * from "@leafer-ui/core";
12
12
 
13
- import { PaintImage, Paint, ColorConvert, PaintGradient, Export, Effect, Group, TextConvert, TwoPointBoundsHelper, Bounds as Bounds$1, FileHelper as FileHelper$1, Platform as Platform$1, isUndefined as isUndefined$1, Matrix as Matrix$1, MathHelper as MathHelper$1, Creator as Creator$1, TaskProcessor, Resource, LeaferCanvasBase as LeaferCanvasBase$1, Debug as Debug$1, Plugin as Plugin$1, UI } from "@leafer-ui/draw";
13
+ import { PaintImage, Paint, ColorConvert, PaintGradient, Export, Group, TextConvert, Effect, TwoPointBoundsHelper, Bounds as Bounds$1, FileHelper as FileHelper$1, Platform as Platform$1, isUndefined as isUndefined$1, Matrix as Matrix$1, MathHelper as MathHelper$1, Creator as Creator$1, TaskProcessor, Resource, LeaferCanvasBase as LeaferCanvasBase$1, Debug as Debug$1, Plugin as Plugin$1, UI } from "@leafer-ui/draw";
14
14
 
15
15
  function __awaiter(thisArg, _arguments, P, generator) {
16
16
  function adopt(value) {
@@ -458,6 +458,7 @@ class Renderer {
458
458
  usePartRender: true,
459
459
  maxFPS: 120
460
460
  };
461
+ this.frames = [];
461
462
  this.target = target;
462
463
  this.canvas = canvas;
463
464
  if (userConfig) this.config = DataHelper.default(userConfig, this.config);
@@ -587,7 +588,7 @@ class Renderer {
587
588
  };
588
589
  if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
589
590
  if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
590
- this.target.__render(canvas, options);
591
+ Platform.render(this.target, canvas, options);
591
592
  this.renderBounds = realBounds = realBounds || bounds;
592
593
  this.renderOptions = options;
593
594
  this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
@@ -610,12 +611,15 @@ class Renderer {
610
611
  const target = this.target;
611
612
  if (this.requestTime || !target) return;
612
613
  if (target.parentApp) return target.parentApp.requestRender(false);
613
- const requestTime = this.requestTime = Date.now();
614
+ this.requestTime = this.frameTime || Date.now();
614
615
  const render = () => {
615
- const nowFPS = 1e3 / (Date.now() - requestTime);
616
+ const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
616
617
  const {maxFPS: maxFPS} = this.config;
617
- if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
618
- this.FPS = Math.min(120, Math.ceil(nowFPS));
618
+ if (maxFPS && nowFPS > maxFPS) return Platform.requestRender(render);
619
+ const {frames: frames} = this;
620
+ if (frames.length > 30) frames.shift();
621
+ frames.push(nowFPS);
622
+ this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
619
623
  this.requestTime = 0;
620
624
  this.checkRender();
621
625
  };
@@ -863,6 +867,15 @@ Object.assign(Creator, {
863
867
 
864
868
  Platform.layout = Layouter.fullLayout;
865
869
 
870
+ Platform.render = function(target, canvas, options) {
871
+ const topOptions = Object.assign(Object.assign({}, options), {
872
+ topRendering: true
873
+ });
874
+ options.topList = new LeafList;
875
+ target.__render(canvas, options);
876
+ if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
877
+ };
878
+
866
879
  function fillText(ui, canvas) {
867
880
  const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
868
881
  if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
@@ -1056,24 +1069,29 @@ function drawOutside(stroke, ui, canvas) {
1056
1069
  }
1057
1070
  }
1058
1071
 
1059
- const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
1072
+ const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = BoundsHelper;
1073
+
1074
+ const tempBounds$1 = {};
1060
1075
 
1061
1076
  function shape(ui, current, options) {
1062
1077
  const canvas = current.getSameCanvas();
1063
- const nowWorld = ui.__nowWorld, currentBounds = current.bounds;
1064
- let bounds, matrix, fitMatrix, shapeBounds, worldCanvas;
1078
+ const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
1079
+ const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
1080
+ toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
1081
+ tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
1082
+ let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
1065
1083
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
1066
- if (currentBounds.includes(nowWorld)) {
1084
+ if (currentBounds.includes(nowWorldShapeBounds)) {
1067
1085
  worldCanvas = canvas;
1068
- bounds = shapeBounds = nowWorld;
1086
+ bounds = shapeBounds = nowWorldShapeBounds;
1087
+ renderBounds = nowWorld;
1069
1088
  } else {
1070
- const {renderShapeSpread: spread} = ui.__layout;
1071
1089
  let worldClipBounds;
1072
1090
  if (Platform.fullImageShadow) {
1073
- worldClipBounds = nowWorld;
1091
+ worldClipBounds = nowWorldShapeBounds;
1074
1092
  } else {
1075
- const spreadBounds = spread ? getSpread(currentBounds, scaleX === scaleY ? spread * scaleX : [ spread * scaleY, spread * scaleX ]) : currentBounds;
1076
- worldClipBounds = getIntersectData(spreadBounds, nowWorld);
1093
+ const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
1094
+ worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
1077
1095
  }
1078
1096
  fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
1079
1097
  let {a: fitScaleX, d: fitScaleY} = fitMatrix;
@@ -1083,8 +1101,10 @@ function shape(ui, current, options) {
1083
1101
  scaleX *= fitScaleX;
1084
1102
  scaleY *= fitScaleY;
1085
1103
  }
1086
- shapeBounds = getOuterOf(nowWorld, fitMatrix);
1104
+ shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
1087
1105
  bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
1106
+ renderBounds = getOuterOf(nowWorld, fitMatrix);
1107
+ move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
1088
1108
  const userMatrix = options.matrix;
1089
1109
  if (userMatrix) {
1090
1110
  matrix = new Matrix(fitMatrix);
@@ -1103,6 +1123,7 @@ function shape(ui, current, options) {
1103
1123
  matrix: matrix,
1104
1124
  fitMatrix: fitMatrix,
1105
1125
  bounds: bounds,
1126
+ renderBounds: renderBounds,
1106
1127
  worldCanvas: worldCanvas,
1107
1128
  shapeBounds: shapeBounds,
1108
1129
  scaleX: scaleX,
@@ -1206,7 +1227,7 @@ const PaintModule = {
1206
1227
  shape: shape
1207
1228
  };
1208
1229
 
1209
- let origin = {}, tempMatrix = getMatrixData();
1230
+ let origin = {}, tempMatrix$1 = getMatrixData();
1210
1231
 
1211
1232
  const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
1212
1233
 
@@ -1221,12 +1242,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
1221
1242
  data.transform = transform;
1222
1243
  }
1223
1244
 
1224
- function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
1245
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
1225
1246
  const transform = get$3();
1226
1247
  layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
1227
- if (clipSize) {
1228
- tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
1229
- multiplyParent(transform, tempMatrix);
1248
+ if (clipScaleX) {
1249
+ tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
1250
+ multiplyParent(transform, tempMatrix$1);
1230
1251
  }
1231
1252
  data.transform = transform;
1232
1253
  }
@@ -1327,7 +1348,12 @@ function getPatternData(paint, box, image) {
1327
1348
 
1328
1349
  case "normal":
1329
1350
  case "clip":
1330
- if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
1351
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
1352
+ let clipScaleX, clipScaleY;
1353
+ if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
1354
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
1355
+ if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
1356
+ }
1331
1357
  break;
1332
1358
 
1333
1359
  case "repeat":
@@ -1485,7 +1511,7 @@ function ignoreRender(ui, value) {
1485
1511
 
1486
1512
  const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
1487
1513
 
1488
- const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
1514
+ const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
1489
1515
 
1490
1516
  function createPattern(ui, paint, pixelRatio) {
1491
1517
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
@@ -1534,8 +1560,8 @@ function createPattern(ui, paint, pixelRatio) {
1534
1560
  if (transform || scaleX !== 1 || scaleY !== 1) {
1535
1561
  const canvasWidth = width + (xGap || 0);
1536
1562
  const canvasHeight = height + (yGap || 0);
1537
- scaleX /= canvasWidth / max(floor(canvasWidth), 1);
1538
- scaleY /= canvasHeight / max(floor(canvasHeight), 1);
1563
+ scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
1564
+ scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
1539
1565
  if (!imageMatrix) {
1540
1566
  imageMatrix = get$1();
1541
1567
  if (transform) copy$1(imageMatrix, transform);
@@ -1561,17 +1587,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
1561
1587
  if (allowDraw) {
1562
1588
  if (data.repeat) {
1563
1589
  allowDraw = false;
1564
- } else {
1565
- if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
1566
- let {width: width, height: height} = data;
1567
- width *= scaleX * pixelRatio;
1568
- height *= scaleY * pixelRatio;
1569
- if (data.scaleX) {
1570
- width *= data.scaleX;
1571
- height *= data.scaleY;
1572
- }
1573
- allowDraw = width * height > Platform.image.maxCacheSize;
1590
+ } else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
1591
+ let {width: width, height: height} = data;
1592
+ width *= scaleX * pixelRatio;
1593
+ height *= scaleY * pixelRatio;
1594
+ if (data.scaleX) {
1595
+ width *= data.scaleX;
1596
+ height *= data.scaleY;
1574
1597
  }
1598
+ allowDraw = width * height > Platform.image.maxCacheSize;
1575
1599
  }
1576
1600
  }
1577
1601
  if (allowDraw) {
@@ -1751,20 +1775,20 @@ const PaintGradientModule = {
1751
1775
  getTransform: getTransform
1752
1776
  };
1753
1777
 
1754
- const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
1778
+ const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
1755
1779
 
1756
- const tempBounds = {};
1780
+ const tempBounds = {}, tempMatrix = new Matrix;
1757
1781
 
1758
1782
  const offsetOutBounds$1 = {};
1759
1783
 
1760
1784
  function shadow(ui, current, shape) {
1761
- let copyBounds, spreadScale;
1762
- const {__nowWorld: nowWorld, __layout: __layout} = ui;
1785
+ let copyBounds, transform;
1786
+ const {__nowWorld: nowWorld} = ui;
1763
1787
  const {shadow: shadow} = ui.__;
1764
- const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
1788
+ const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
1765
1789
  const other = current.getSameCanvas();
1766
1790
  const end = shadow.length - 1;
1767
- toOffsetOutBounds$1(bounds, offsetOutBounds$1);
1791
+ toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
1768
1792
  shadow.forEach((item, index) => {
1769
1793
  let otherScale = 1;
1770
1794
  if (item.scaleFixed) {
@@ -1772,54 +1796,61 @@ function shadow(ui, current, shape) {
1772
1796
  if (sx > 1) otherScale = 1 / sx;
1773
1797
  }
1774
1798
  other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
1775
- spreadScale = item.spread ? 1 + item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) * otherScale : 0;
1776
- drawWorldShadow(other, offsetOutBounds$1, spreadScale, shape);
1777
- copyBounds = bounds;
1799
+ transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
1800
+ if (transform) other.setTransform(transform);
1801
+ drawWorldShadow(other, offsetOutBounds$1, shape);
1802
+ if (transform) other.resetTransform();
1803
+ copyBounds = renderBounds;
1778
1804
  if (item.box) {
1779
1805
  other.restore();
1780
1806
  other.save();
1781
1807
  if (worldCanvas) {
1782
- other.copyWorld(other, bounds, nowWorld, "copy");
1808
+ other.copyWorld(other, renderBounds, nowWorld, "copy");
1783
1809
  copyBounds = nowWorld;
1784
1810
  }
1785
1811
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
1786
1812
  }
1787
- if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1813
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
1788
1814
  if (end && index < end) other.clearWorld(copyBounds);
1789
1815
  });
1790
1816
  other.recycle(copyBounds);
1791
1817
  }
1792
1818
 
1793
- function getShadowSpread(_ui, shadow) {
1794
- let width = 0;
1795
- shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
1796
- return width;
1819
+ function getShadowRenderSpread(_ui, shadow) {
1820
+ let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
1821
+ shadow.forEach(item => {
1822
+ x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
1823
+ top = max(top, spread + blur - y);
1824
+ right = max(right, spread + blur + x);
1825
+ bottom = max(bottom, spread + blur + y);
1826
+ left = max(left, spread + blur - x);
1827
+ });
1828
+ return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
1829
+ }
1830
+
1831
+ function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
1832
+ if (shadow.spread) {
1833
+ const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
1834
+ tempMatrix.set().scaleOfOuter({
1835
+ x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
1836
+ y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
1837
+ }, spreadScale);
1838
+ return tempMatrix;
1839
+ }
1840
+ return undefined;
1797
1841
  }
1798
1842
 
1799
- function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
1800
- const {bounds: bounds, shapeBounds: shapeBounds} = shape;
1843
+ function drawWorldShadow(canvas, outBounds, shape) {
1844
+ const {shapeBounds: shapeBounds} = shape;
1845
+ let from, to;
1801
1846
  if (Platform.fullImageShadow) {
1802
1847
  copy(tempBounds, canvas.bounds);
1803
- tempBounds.x += outBounds.x - shapeBounds.x;
1804
- tempBounds.y += outBounds.y - shapeBounds.y;
1805
- if (spreadScale) {
1806
- const {fitMatrix: fitMatrix} = shape;
1807
- tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
1808
- tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
1809
- tempBounds.width *= spreadScale;
1810
- tempBounds.height *= spreadScale;
1811
- }
1812
- canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
1848
+ move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
1849
+ from = canvas.bounds, to = tempBounds;
1813
1850
  } else {
1814
- if (spreadScale) {
1815
- copy(tempBounds, outBounds);
1816
- tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
1817
- tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
1818
- tempBounds.width *= spreadScale;
1819
- tempBounds.height *= spreadScale;
1820
- }
1821
- canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
1851
+ from = shapeBounds, to = outBounds;
1822
1852
  }
1853
+ canvas.copyWorld(shape.canvas, from, to);
1823
1854
  }
1824
1855
 
1825
1856
  const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
@@ -1827,13 +1858,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
1827
1858
  const offsetOutBounds = {};
1828
1859
 
1829
1860
  function innerShadow(ui, current, shape) {
1830
- let copyBounds, spreadScale;
1831
- const {__nowWorld: nowWorld, __layout: __layout} = ui;
1861
+ let copyBounds, transform;
1862
+ const {__nowWorld: nowWorld} = ui;
1832
1863
  const {innerShadow: innerShadow} = ui.__;
1833
- const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
1864
+ const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
1834
1865
  const other = current.getSameCanvas();
1835
1866
  const end = innerShadow.length - 1;
1836
- toOffsetOutBounds(bounds, offsetOutBounds);
1867
+ toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
1837
1868
  innerShadow.forEach((item, index) => {
1838
1869
  let otherScale = 1;
1839
1870
  if (item.scaleFixed) {
@@ -1842,16 +1873,17 @@ function innerShadow(ui, current, shape) {
1842
1873
  }
1843
1874
  other.save();
1844
1875
  other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
1845
- spreadScale = item.spread ? 1 - item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) * otherScale : 0;
1846
- drawWorldShadow(other, offsetOutBounds, spreadScale, shape);
1876
+ transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
1877
+ if (transform) other.setTransform(transform);
1878
+ drawWorldShadow(other, offsetOutBounds, shape);
1847
1879
  other.restore();
1848
1880
  if (worldCanvas) {
1849
- other.copyWorld(other, bounds, nowWorld, "copy");
1881
+ other.copyWorld(other, renderBounds, nowWorld, "copy");
1850
1882
  other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
1851
1883
  copyBounds = nowWorld;
1852
1884
  } else {
1853
1885
  other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
1854
- copyBounds = bounds;
1886
+ copyBounds = renderBounds;
1855
1887
  }
1856
1888
  other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
1857
1889
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
@@ -1860,6 +1892,8 @@ function innerShadow(ui, current, shape) {
1860
1892
  other.recycle(copyBounds);
1861
1893
  }
1862
1894
 
1895
+ const getInnerShadowSpread = getShadowRenderSpread;
1896
+
1863
1897
  function blur(ui, current, origin) {
1864
1898
  const {blur: blur} = ui.__;
1865
1899
  origin.setWorldBlur(blur * ui.__nowWorld.a);
@@ -1874,10 +1908,12 @@ const EffectModule = {
1874
1908
  innerShadow: innerShadow,
1875
1909
  blur: blur,
1876
1910
  backgroundBlur: backgroundBlur,
1877
- getShadowSpread: getShadowSpread,
1911
+ getShadowRenderSpread: getShadowRenderSpread,
1912
+ getShadowTransform: getShadowTransform,
1878
1913
  isTransformShadow(_shadow) {
1879
1914
  return undefined;
1880
- }
1915
+ },
1916
+ getInnerShadowSpread: getInnerShadowSpread
1881
1917
  };
1882
1918
 
1883
1919
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -1894,6 +1930,7 @@ Group.prototype.__renderMask = function(canvas, options) {
1894
1930
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
1895
1931
  maskCanvas = contentCanvas = null;
1896
1932
  }
1933
+ if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
1897
1934
  maskOpacity = child.__.opacity;
1898
1935
  usedGrayscaleAlpha = false;
1899
1936
  if (mask === "path" || mask === "clipping-path") {
@@ -1911,7 +1948,6 @@ Group.prototype.__renderMask = function(canvas, options) {
1911
1948
  if (!contentCanvas) contentCanvas = getCanvas(canvas);
1912
1949
  child.__render(maskCanvas, options);
1913
1950
  }
1914
- if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
1915
1951
  continue;
1916
1952
  }
1917
1953
  const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
@@ -2609,14 +2645,10 @@ const ExportModule = {
2609
2645
  renderOptions.bounds = canvas.bounds;
2610
2646
  }
2611
2647
  canvas.save();
2612
- if (isFrame && !isUndefined$1(fill)) {
2613
- const oldFill = leaf.get("fill");
2614
- leaf.fill = "";
2615
- leaf.__render(canvas, renderOptions);
2616
- leaf.fill = oldFill;
2617
- } else {
2618
- leaf.__render(canvas, renderOptions);
2619
- }
2648
+ const igroneFill = isFrame && !isUndefined$1(fill), oldFill = leaf.get("fill");
2649
+ if (igroneFill) leaf.fill = "";
2650
+ Platform$1.render(leaf, canvas, renderOptions);
2651
+ if (igroneFill) leaf.fill = oldFill;
2620
2652
  canvas.restore();
2621
2653
  if (sliceLeaf) sliceLeaf.__updateWorldOpacity();
2622
2654
  if (trim) {