@leafer-ui/worker 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/worker.cjs +116 -80
- package/dist/worker.esm.js +118 -82
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +280 -187
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +289 -187
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.cjs
CHANGED
|
@@ -429,6 +429,7 @@ class Renderer {
|
|
|
429
429
|
usePartRender: true,
|
|
430
430
|
maxFPS: 120
|
|
431
431
|
};
|
|
432
|
+
this.frames = [];
|
|
432
433
|
this.target = target;
|
|
433
434
|
this.canvas = canvas;
|
|
434
435
|
if (userConfig) this.config = core.DataHelper.default(userConfig, this.config);
|
|
@@ -558,7 +559,7 @@ class Renderer {
|
|
|
558
559
|
};
|
|
559
560
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
560
561
|
if (core.Debug.showRepaint) core.Debug.drawRepaint(canvas, bounds);
|
|
561
|
-
this.target
|
|
562
|
+
core.Platform.render(this.target, canvas, options);
|
|
562
563
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
563
564
|
this.renderOptions = options;
|
|
564
565
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -581,12 +582,15 @@ class Renderer {
|
|
|
581
582
|
const target = this.target;
|
|
582
583
|
if (this.requestTime || !target) return;
|
|
583
584
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
584
|
-
|
|
585
|
+
this.requestTime = this.frameTime || Date.now();
|
|
585
586
|
const render = () => {
|
|
586
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
587
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
587
588
|
const {maxFPS: maxFPS} = this.config;
|
|
588
|
-
if (maxFPS && nowFPS > maxFPS
|
|
589
|
-
|
|
589
|
+
if (maxFPS && nowFPS > maxFPS) return core.Platform.requestRender(render);
|
|
590
|
+
const {frames: frames} = this;
|
|
591
|
+
if (frames.length > 30) frames.shift();
|
|
592
|
+
frames.push(nowFPS);
|
|
593
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
590
594
|
this.requestTime = 0;
|
|
591
595
|
this.checkRender();
|
|
592
596
|
};
|
|
@@ -834,6 +838,15 @@ Object.assign(core.Creator, {
|
|
|
834
838
|
|
|
835
839
|
core.Platform.layout = Layouter.fullLayout;
|
|
836
840
|
|
|
841
|
+
core.Platform.render = function(target, canvas, options) {
|
|
842
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
843
|
+
topRendering: true
|
|
844
|
+
});
|
|
845
|
+
options.topList = new core.LeafList;
|
|
846
|
+
target.__render(canvas, options);
|
|
847
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
848
|
+
};
|
|
849
|
+
|
|
837
850
|
function fillText(ui, canvas) {
|
|
838
851
|
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
839
852
|
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
@@ -1027,24 +1040,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
1027
1040
|
}
|
|
1028
1041
|
}
|
|
1029
1042
|
|
|
1030
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
1043
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
1044
|
+
|
|
1045
|
+
const tempBounds$1 = {};
|
|
1031
1046
|
|
|
1032
1047
|
function shape(ui, current, options) {
|
|
1033
1048
|
const canvas = current.getSameCanvas();
|
|
1034
|
-
const nowWorld = ui.__nowWorld,
|
|
1035
|
-
|
|
1049
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
1050
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
1051
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
1052
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
1053
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
1036
1054
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
1037
|
-
if (currentBounds.includes(
|
|
1055
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
1038
1056
|
worldCanvas = canvas;
|
|
1039
|
-
bounds = shapeBounds =
|
|
1057
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
1058
|
+
renderBounds = nowWorld;
|
|
1040
1059
|
} else {
|
|
1041
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
1042
1060
|
let worldClipBounds;
|
|
1043
1061
|
if (core.Platform.fullImageShadow) {
|
|
1044
|
-
worldClipBounds =
|
|
1062
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
1045
1063
|
} else {
|
|
1046
|
-
const spreadBounds =
|
|
1047
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
1064
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, core.FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
1065
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
1048
1066
|
}
|
|
1049
1067
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
1050
1068
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -1054,8 +1072,10 @@ function shape(ui, current, options) {
|
|
|
1054
1072
|
scaleX *= fitScaleX;
|
|
1055
1073
|
scaleY *= fitScaleY;
|
|
1056
1074
|
}
|
|
1057
|
-
shapeBounds = getOuterOf(
|
|
1075
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
1058
1076
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1077
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
1078
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1059
1079
|
const userMatrix = options.matrix;
|
|
1060
1080
|
if (userMatrix) {
|
|
1061
1081
|
matrix = new core.Matrix(fitMatrix);
|
|
@@ -1074,6 +1094,7 @@ function shape(ui, current, options) {
|
|
|
1074
1094
|
matrix: matrix,
|
|
1075
1095
|
fitMatrix: fitMatrix,
|
|
1076
1096
|
bounds: bounds,
|
|
1097
|
+
renderBounds: renderBounds,
|
|
1077
1098
|
worldCanvas: worldCanvas,
|
|
1078
1099
|
shapeBounds: shapeBounds,
|
|
1079
1100
|
scaleX: scaleX,
|
|
@@ -1177,7 +1198,7 @@ const PaintModule = {
|
|
|
1177
1198
|
shape: shape
|
|
1178
1199
|
};
|
|
1179
1200
|
|
|
1180
|
-
let origin = {}, tempMatrix = core.getMatrixData();
|
|
1201
|
+
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
1181
1202
|
|
|
1182
1203
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1183
1204
|
|
|
@@ -1192,12 +1213,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1192
1213
|
data.transform = transform;
|
|
1193
1214
|
}
|
|
1194
1215
|
|
|
1195
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
1216
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
1196
1217
|
const transform = get$3();
|
|
1197
1218
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1198
|
-
if (
|
|
1199
|
-
tempMatrix.a =
|
|
1200
|
-
multiplyParent(transform, tempMatrix);
|
|
1219
|
+
if (clipScaleX) {
|
|
1220
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
1221
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1201
1222
|
}
|
|
1202
1223
|
data.transform = transform;
|
|
1203
1224
|
}
|
|
@@ -1298,7 +1319,12 @@ function getPatternData(paint, box, image) {
|
|
|
1298
1319
|
|
|
1299
1320
|
case "normal":
|
|
1300
1321
|
case "clip":
|
|
1301
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
1322
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
1323
|
+
let clipScaleX, clipScaleY;
|
|
1324
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1325
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1326
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1327
|
+
}
|
|
1302
1328
|
break;
|
|
1303
1329
|
|
|
1304
1330
|
case "repeat":
|
|
@@ -1456,7 +1482,7 @@ function ignoreRender(ui, value) {
|
|
|
1456
1482
|
|
|
1457
1483
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1458
1484
|
|
|
1459
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
1485
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1460
1486
|
|
|
1461
1487
|
function createPattern(ui, paint, pixelRatio) {
|
|
1462
1488
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1505,8 +1531,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1505
1531
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
1506
1532
|
const canvasWidth = width + (xGap || 0);
|
|
1507
1533
|
const canvasHeight = height + (yGap || 0);
|
|
1508
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
1509
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
1534
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
1535
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
1510
1536
|
if (!imageMatrix) {
|
|
1511
1537
|
imageMatrix = get$1();
|
|
1512
1538
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -1565,17 +1591,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1565
1591
|
if (allowDraw) {
|
|
1566
1592
|
if (data.repeat) {
|
|
1567
1593
|
allowDraw = false;
|
|
1568
|
-
} else {
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
height *= data.scaleY;
|
|
1576
|
-
}
|
|
1577
|
-
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1594
|
+
} else if (!(paint.changeful || core.Platform.name === "miniapp" && core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
|
|
1595
|
+
let {width: width, height: height} = data;
|
|
1596
|
+
width *= scaleX * pixelRatio;
|
|
1597
|
+
height *= scaleY * pixelRatio;
|
|
1598
|
+
if (data.scaleX) {
|
|
1599
|
+
width *= data.scaleX;
|
|
1600
|
+
height *= data.scaleY;
|
|
1578
1601
|
}
|
|
1602
|
+
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1579
1603
|
}
|
|
1580
1604
|
}
|
|
1581
1605
|
if (allowDraw) {
|
|
@@ -1755,20 +1779,20 @@ const PaintGradientModule = {
|
|
|
1755
1779
|
getTransform: getTransform
|
|
1756
1780
|
};
|
|
1757
1781
|
|
|
1758
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper;
|
|
1782
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
1759
1783
|
|
|
1760
|
-
const tempBounds = {};
|
|
1784
|
+
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
1761
1785
|
|
|
1762
1786
|
const offsetOutBounds$1 = {};
|
|
1763
1787
|
|
|
1764
1788
|
function shadow(ui, current, shape) {
|
|
1765
|
-
let copyBounds,
|
|
1766
|
-
const {__nowWorld: nowWorld
|
|
1789
|
+
let copyBounds, transform;
|
|
1790
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1767
1791
|
const {shadow: shadow} = ui.__;
|
|
1768
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1792
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1769
1793
|
const other = current.getSameCanvas();
|
|
1770
1794
|
const end = shadow.length - 1;
|
|
1771
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
1795
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
1772
1796
|
shadow.forEach((item, index) => {
|
|
1773
1797
|
let otherScale = 1;
|
|
1774
1798
|
if (item.scaleFixed) {
|
|
@@ -1776,54 +1800,61 @@ function shadow(ui, current, shape) {
|
|
|
1776
1800
|
if (sx > 1) otherScale = 1 / sx;
|
|
1777
1801
|
}
|
|
1778
1802
|
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, draw.ColorConvert.string(item.color));
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1803
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
1804
|
+
if (transform) other.setTransform(transform);
|
|
1805
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
1806
|
+
if (transform) other.resetTransform();
|
|
1807
|
+
copyBounds = renderBounds;
|
|
1782
1808
|
if (item.box) {
|
|
1783
1809
|
other.restore();
|
|
1784
1810
|
other.save();
|
|
1785
1811
|
if (worldCanvas) {
|
|
1786
|
-
other.copyWorld(other,
|
|
1812
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1787
1813
|
copyBounds = nowWorld;
|
|
1788
1814
|
}
|
|
1789
1815
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
1790
1816
|
}
|
|
1791
|
-
|
|
1817
|
+
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
1792
1818
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
1793
1819
|
});
|
|
1794
1820
|
other.recycle(copyBounds);
|
|
1795
1821
|
}
|
|
1796
1822
|
|
|
1797
|
-
function
|
|
1798
|
-
let
|
|
1799
|
-
shadow.forEach(item =>
|
|
1800
|
-
|
|
1823
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
1824
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
1825
|
+
shadow.forEach(item => {
|
|
1826
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
1827
|
+
top = max(top, spread + blur - y);
|
|
1828
|
+
right = max(right, spread + blur + x);
|
|
1829
|
+
bottom = max(bottom, spread + blur + y);
|
|
1830
|
+
left = max(left, spread + blur - x);
|
|
1831
|
+
});
|
|
1832
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
1801
1833
|
}
|
|
1802
1834
|
|
|
1803
|
-
function
|
|
1804
|
-
|
|
1835
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
1836
|
+
if (shadow.spread) {
|
|
1837
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
1838
|
+
tempMatrix.set().scaleOfOuter({
|
|
1839
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
1840
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
1841
|
+
}, spreadScale);
|
|
1842
|
+
return tempMatrix;
|
|
1843
|
+
}
|
|
1844
|
+
return undefined;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
1848
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
1849
|
+
let from, to;
|
|
1805
1850
|
if (core.Platform.fullImageShadow) {
|
|
1806
1851
|
copy(tempBounds, canvas.bounds);
|
|
1807
|
-
tempBounds.x
|
|
1808
|
-
|
|
1809
|
-
if (spreadScale) {
|
|
1810
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
1811
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
1812
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
1813
|
-
tempBounds.width *= spreadScale;
|
|
1814
|
-
tempBounds.height *= spreadScale;
|
|
1815
|
-
}
|
|
1816
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
1852
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
1853
|
+
from = canvas.bounds, to = tempBounds;
|
|
1817
1854
|
} else {
|
|
1818
|
-
|
|
1819
|
-
copy(tempBounds, outBounds);
|
|
1820
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
1821
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
1822
|
-
tempBounds.width *= spreadScale;
|
|
1823
|
-
tempBounds.height *= spreadScale;
|
|
1824
|
-
}
|
|
1825
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
1855
|
+
from = shapeBounds, to = outBounds;
|
|
1826
1856
|
}
|
|
1857
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
1827
1858
|
}
|
|
1828
1859
|
|
|
1829
1860
|
const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
@@ -1831,13 +1862,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
|
1831
1862
|
const offsetOutBounds = {};
|
|
1832
1863
|
|
|
1833
1864
|
function innerShadow(ui, current, shape) {
|
|
1834
|
-
let copyBounds,
|
|
1835
|
-
const {__nowWorld: nowWorld
|
|
1865
|
+
let copyBounds, transform;
|
|
1866
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1836
1867
|
const {innerShadow: innerShadow} = ui.__;
|
|
1837
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1868
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1838
1869
|
const other = current.getSameCanvas();
|
|
1839
1870
|
const end = innerShadow.length - 1;
|
|
1840
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
1871
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
1841
1872
|
innerShadow.forEach((item, index) => {
|
|
1842
1873
|
let otherScale = 1;
|
|
1843
1874
|
if (item.scaleFixed) {
|
|
@@ -1846,16 +1877,17 @@ function innerShadow(ui, current, shape) {
|
|
|
1846
1877
|
}
|
|
1847
1878
|
other.save();
|
|
1848
1879
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
1849
|
-
|
|
1850
|
-
|
|
1880
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1881
|
+
if (transform) other.setTransform(transform);
|
|
1882
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
1851
1883
|
other.restore();
|
|
1852
1884
|
if (worldCanvas) {
|
|
1853
|
-
other.copyWorld(other,
|
|
1885
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1854
1886
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
1855
1887
|
copyBounds = nowWorld;
|
|
1856
1888
|
} else {
|
|
1857
1889
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
1858
|
-
copyBounds =
|
|
1890
|
+
copyBounds = renderBounds;
|
|
1859
1891
|
}
|
|
1860
1892
|
other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), "source-in");
|
|
1861
1893
|
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -1864,6 +1896,8 @@ function innerShadow(ui, current, shape) {
|
|
|
1864
1896
|
other.recycle(copyBounds);
|
|
1865
1897
|
}
|
|
1866
1898
|
|
|
1899
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
1900
|
+
|
|
1867
1901
|
function blur(ui, current, origin) {
|
|
1868
1902
|
const {blur: blur} = ui.__;
|
|
1869
1903
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -1878,10 +1912,12 @@ const EffectModule = {
|
|
|
1878
1912
|
innerShadow: innerShadow,
|
|
1879
1913
|
blur: blur,
|
|
1880
1914
|
backgroundBlur: backgroundBlur,
|
|
1881
|
-
|
|
1915
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
1916
|
+
getShadowTransform: getShadowTransform,
|
|
1882
1917
|
isTransformShadow(_shadow) {
|
|
1883
1918
|
return undefined;
|
|
1884
|
-
}
|
|
1919
|
+
},
|
|
1920
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
1885
1921
|
};
|
|
1886
1922
|
|
|
1887
1923
|
const {excludeRenderBounds: excludeRenderBounds} = core.LeafBoundsHelper;
|
|
@@ -1898,6 +1934,7 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1898
1934
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
1899
1935
|
maskCanvas = contentCanvas = null;
|
|
1900
1936
|
}
|
|
1937
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1901
1938
|
maskOpacity = child.__.opacity;
|
|
1902
1939
|
usedGrayscaleAlpha = false;
|
|
1903
1940
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -1915,7 +1952,6 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1915
1952
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
1916
1953
|
child.__render(maskCanvas, options);
|
|
1917
1954
|
}
|
|
1918
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1919
1955
|
continue;
|
|
1920
1956
|
}
|
|
1921
1957
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|