@leafer-draw/miniapp 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/miniapp.cjs +116 -80
- package/dist/miniapp.esm.js +118 -82
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +282 -180
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/miniapp.cjs
CHANGED
|
@@ -580,6 +580,7 @@ class Renderer {
|
|
|
580
580
|
usePartRender: true,
|
|
581
581
|
maxFPS: 120
|
|
582
582
|
};
|
|
583
|
+
this.frames = [];
|
|
583
584
|
this.target = target;
|
|
584
585
|
this.canvas = canvas;
|
|
585
586
|
if (userConfig) this.config = core.DataHelper.default(userConfig, this.config);
|
|
@@ -709,7 +710,7 @@ class Renderer {
|
|
|
709
710
|
};
|
|
710
711
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
711
712
|
if (core.Debug.showRepaint) core.Debug.drawRepaint(canvas, bounds);
|
|
712
|
-
this.target
|
|
713
|
+
core.Platform.render(this.target, canvas, options);
|
|
713
714
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
714
715
|
this.renderOptions = options;
|
|
715
716
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -732,12 +733,15 @@ class Renderer {
|
|
|
732
733
|
const target = this.target;
|
|
733
734
|
if (this.requestTime || !target) return;
|
|
734
735
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
735
|
-
|
|
736
|
+
this.requestTime = this.frameTime || Date.now();
|
|
736
737
|
const render = () => {
|
|
737
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
738
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
738
739
|
const {maxFPS: maxFPS} = this.config;
|
|
739
|
-
if (maxFPS && nowFPS > maxFPS
|
|
740
|
-
|
|
740
|
+
if (maxFPS && nowFPS > maxFPS) return core.Platform.requestRender(render);
|
|
741
|
+
const {frames: frames} = this;
|
|
742
|
+
if (frames.length > 30) frames.shift();
|
|
743
|
+
frames.push(nowFPS);
|
|
744
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
741
745
|
this.requestTime = 0;
|
|
742
746
|
this.checkRender();
|
|
743
747
|
};
|
|
@@ -802,6 +806,15 @@ Object.assign(core.Creator, {
|
|
|
802
806
|
|
|
803
807
|
core.Platform.layout = Layouter.fullLayout;
|
|
804
808
|
|
|
809
|
+
core.Platform.render = function(target, canvas, options) {
|
|
810
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
811
|
+
topRendering: true
|
|
812
|
+
});
|
|
813
|
+
options.topList = new core.LeafList;
|
|
814
|
+
target.__render(canvas, options);
|
|
815
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
816
|
+
};
|
|
817
|
+
|
|
805
818
|
function fillText(ui, canvas) {
|
|
806
819
|
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
807
820
|
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
@@ -995,24 +1008,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
995
1008
|
}
|
|
996
1009
|
}
|
|
997
1010
|
|
|
998
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
1011
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
1012
|
+
|
|
1013
|
+
const tempBounds$1 = {};
|
|
999
1014
|
|
|
1000
1015
|
function shape(ui, current, options) {
|
|
1001
1016
|
const canvas = current.getSameCanvas();
|
|
1002
|
-
const nowWorld = ui.__nowWorld,
|
|
1003
|
-
|
|
1017
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
1018
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
1019
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
1020
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
1021
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
1004
1022
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
1005
|
-
if (currentBounds.includes(
|
|
1023
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
1006
1024
|
worldCanvas = canvas;
|
|
1007
|
-
bounds = shapeBounds =
|
|
1025
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
1026
|
+
renderBounds = nowWorld;
|
|
1008
1027
|
} else {
|
|
1009
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
1010
1028
|
let worldClipBounds;
|
|
1011
1029
|
if (core.Platform.fullImageShadow) {
|
|
1012
|
-
worldClipBounds =
|
|
1030
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
1013
1031
|
} else {
|
|
1014
|
-
const spreadBounds =
|
|
1015
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
1032
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, core.FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
1033
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
1016
1034
|
}
|
|
1017
1035
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
1018
1036
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -1022,8 +1040,10 @@ function shape(ui, current, options) {
|
|
|
1022
1040
|
scaleX *= fitScaleX;
|
|
1023
1041
|
scaleY *= fitScaleY;
|
|
1024
1042
|
}
|
|
1025
|
-
shapeBounds = getOuterOf(
|
|
1043
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
1026
1044
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1045
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
1046
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1027
1047
|
const userMatrix = options.matrix;
|
|
1028
1048
|
if (userMatrix) {
|
|
1029
1049
|
matrix = new core.Matrix(fitMatrix);
|
|
@@ -1042,6 +1062,7 @@ function shape(ui, current, options) {
|
|
|
1042
1062
|
matrix: matrix,
|
|
1043
1063
|
fitMatrix: fitMatrix,
|
|
1044
1064
|
bounds: bounds,
|
|
1065
|
+
renderBounds: renderBounds,
|
|
1045
1066
|
worldCanvas: worldCanvas,
|
|
1046
1067
|
shapeBounds: shapeBounds,
|
|
1047
1068
|
scaleX: scaleX,
|
|
@@ -1145,7 +1166,7 @@ const PaintModule = {
|
|
|
1145
1166
|
shape: shape
|
|
1146
1167
|
};
|
|
1147
1168
|
|
|
1148
|
-
let origin = {}, tempMatrix = core.getMatrixData();
|
|
1169
|
+
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
1149
1170
|
|
|
1150
1171
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1151
1172
|
|
|
@@ -1160,12 +1181,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1160
1181
|
data.transform = transform;
|
|
1161
1182
|
}
|
|
1162
1183
|
|
|
1163
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
1184
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
1164
1185
|
const transform = get$3();
|
|
1165
1186
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1166
|
-
if (
|
|
1167
|
-
tempMatrix.a =
|
|
1168
|
-
multiplyParent(transform, tempMatrix);
|
|
1187
|
+
if (clipScaleX) {
|
|
1188
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
1189
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1169
1190
|
}
|
|
1170
1191
|
data.transform = transform;
|
|
1171
1192
|
}
|
|
@@ -1266,7 +1287,12 @@ function getPatternData(paint, box, image) {
|
|
|
1266
1287
|
|
|
1267
1288
|
case "normal":
|
|
1268
1289
|
case "clip":
|
|
1269
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
1290
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
1291
|
+
let clipScaleX, clipScaleY;
|
|
1292
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1293
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1294
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1295
|
+
}
|
|
1270
1296
|
break;
|
|
1271
1297
|
|
|
1272
1298
|
case "repeat":
|
|
@@ -1424,7 +1450,7 @@ function ignoreRender(ui, value) {
|
|
|
1424
1450
|
|
|
1425
1451
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1426
1452
|
|
|
1427
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
1453
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1428
1454
|
|
|
1429
1455
|
function createPattern(ui, paint, pixelRatio) {
|
|
1430
1456
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1473,8 +1499,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1473
1499
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
1474
1500
|
const canvasWidth = width + (xGap || 0);
|
|
1475
1501
|
const canvasHeight = height + (yGap || 0);
|
|
1476
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
1477
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
1502
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
1503
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
1478
1504
|
if (!imageMatrix) {
|
|
1479
1505
|
imageMatrix = get$1();
|
|
1480
1506
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -1533,17 +1559,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1533
1559
|
if (allowDraw) {
|
|
1534
1560
|
if (data.repeat) {
|
|
1535
1561
|
allowDraw = false;
|
|
1536
|
-
} else {
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
height *= data.scaleY;
|
|
1544
|
-
}
|
|
1545
|
-
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1562
|
+
} else if (!(paint.changeful || core.Platform.name === "miniapp" && core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
|
|
1563
|
+
let {width: width, height: height} = data;
|
|
1564
|
+
width *= scaleX * pixelRatio;
|
|
1565
|
+
height *= scaleY * pixelRatio;
|
|
1566
|
+
if (data.scaleX) {
|
|
1567
|
+
width *= data.scaleX;
|
|
1568
|
+
height *= data.scaleY;
|
|
1546
1569
|
}
|
|
1570
|
+
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1547
1571
|
}
|
|
1548
1572
|
}
|
|
1549
1573
|
if (allowDraw) {
|
|
@@ -1723,20 +1747,20 @@ const PaintGradientModule = {
|
|
|
1723
1747
|
getTransform: getTransform
|
|
1724
1748
|
};
|
|
1725
1749
|
|
|
1726
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper;
|
|
1750
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
1727
1751
|
|
|
1728
|
-
const tempBounds = {};
|
|
1752
|
+
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
1729
1753
|
|
|
1730
1754
|
const offsetOutBounds$1 = {};
|
|
1731
1755
|
|
|
1732
1756
|
function shadow(ui, current, shape) {
|
|
1733
|
-
let copyBounds,
|
|
1734
|
-
const {__nowWorld: nowWorld
|
|
1757
|
+
let copyBounds, transform;
|
|
1758
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1735
1759
|
const {shadow: shadow} = ui.__;
|
|
1736
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1760
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1737
1761
|
const other = current.getSameCanvas();
|
|
1738
1762
|
const end = shadow.length - 1;
|
|
1739
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
1763
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
1740
1764
|
shadow.forEach((item, index) => {
|
|
1741
1765
|
let otherScale = 1;
|
|
1742
1766
|
if (item.scaleFixed) {
|
|
@@ -1744,54 +1768,61 @@ function shadow(ui, current, shape) {
|
|
|
1744
1768
|
if (sx > 1) otherScale = 1 / sx;
|
|
1745
1769
|
}
|
|
1746
1770
|
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));
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1771
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
1772
|
+
if (transform) other.setTransform(transform);
|
|
1773
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
1774
|
+
if (transform) other.resetTransform();
|
|
1775
|
+
copyBounds = renderBounds;
|
|
1750
1776
|
if (item.box) {
|
|
1751
1777
|
other.restore();
|
|
1752
1778
|
other.save();
|
|
1753
1779
|
if (worldCanvas) {
|
|
1754
|
-
other.copyWorld(other,
|
|
1780
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1755
1781
|
copyBounds = nowWorld;
|
|
1756
1782
|
}
|
|
1757
1783
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
1758
1784
|
}
|
|
1759
|
-
|
|
1785
|
+
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
1760
1786
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
1761
1787
|
});
|
|
1762
1788
|
other.recycle(copyBounds);
|
|
1763
1789
|
}
|
|
1764
1790
|
|
|
1765
|
-
function
|
|
1766
|
-
let
|
|
1767
|
-
shadow.forEach(item =>
|
|
1768
|
-
|
|
1791
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
1792
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
1793
|
+
shadow.forEach(item => {
|
|
1794
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
1795
|
+
top = max(top, spread + blur - y);
|
|
1796
|
+
right = max(right, spread + blur + x);
|
|
1797
|
+
bottom = max(bottom, spread + blur + y);
|
|
1798
|
+
left = max(left, spread + blur - x);
|
|
1799
|
+
});
|
|
1800
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
1769
1801
|
}
|
|
1770
1802
|
|
|
1771
|
-
function
|
|
1772
|
-
|
|
1803
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
1804
|
+
if (shadow.spread) {
|
|
1805
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
1806
|
+
tempMatrix.set().scaleOfOuter({
|
|
1807
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
1808
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
1809
|
+
}, spreadScale);
|
|
1810
|
+
return tempMatrix;
|
|
1811
|
+
}
|
|
1812
|
+
return undefined;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
1816
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
1817
|
+
let from, to;
|
|
1773
1818
|
if (core.Platform.fullImageShadow) {
|
|
1774
1819
|
copy(tempBounds, canvas.bounds);
|
|
1775
|
-
tempBounds.x
|
|
1776
|
-
|
|
1777
|
-
if (spreadScale) {
|
|
1778
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
1779
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
1780
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
1781
|
-
tempBounds.width *= spreadScale;
|
|
1782
|
-
tempBounds.height *= spreadScale;
|
|
1783
|
-
}
|
|
1784
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
1820
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
1821
|
+
from = canvas.bounds, to = tempBounds;
|
|
1785
1822
|
} else {
|
|
1786
|
-
|
|
1787
|
-
copy(tempBounds, outBounds);
|
|
1788
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
1789
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
1790
|
-
tempBounds.width *= spreadScale;
|
|
1791
|
-
tempBounds.height *= spreadScale;
|
|
1792
|
-
}
|
|
1793
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
1823
|
+
from = shapeBounds, to = outBounds;
|
|
1794
1824
|
}
|
|
1825
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
1795
1826
|
}
|
|
1796
1827
|
|
|
1797
1828
|
const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
@@ -1799,13 +1830,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
|
1799
1830
|
const offsetOutBounds = {};
|
|
1800
1831
|
|
|
1801
1832
|
function innerShadow(ui, current, shape) {
|
|
1802
|
-
let copyBounds,
|
|
1803
|
-
const {__nowWorld: nowWorld
|
|
1833
|
+
let copyBounds, transform;
|
|
1834
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1804
1835
|
const {innerShadow: innerShadow} = ui.__;
|
|
1805
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1836
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1806
1837
|
const other = current.getSameCanvas();
|
|
1807
1838
|
const end = innerShadow.length - 1;
|
|
1808
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
1839
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
1809
1840
|
innerShadow.forEach((item, index) => {
|
|
1810
1841
|
let otherScale = 1;
|
|
1811
1842
|
if (item.scaleFixed) {
|
|
@@ -1814,16 +1845,17 @@ function innerShadow(ui, current, shape) {
|
|
|
1814
1845
|
}
|
|
1815
1846
|
other.save();
|
|
1816
1847
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
1817
|
-
|
|
1818
|
-
|
|
1848
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1849
|
+
if (transform) other.setTransform(transform);
|
|
1850
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
1819
1851
|
other.restore();
|
|
1820
1852
|
if (worldCanvas) {
|
|
1821
|
-
other.copyWorld(other,
|
|
1853
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1822
1854
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
1823
1855
|
copyBounds = nowWorld;
|
|
1824
1856
|
} else {
|
|
1825
1857
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
1826
|
-
copyBounds =
|
|
1858
|
+
copyBounds = renderBounds;
|
|
1827
1859
|
}
|
|
1828
1860
|
other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), "source-in");
|
|
1829
1861
|
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -1832,6 +1864,8 @@ function innerShadow(ui, current, shape) {
|
|
|
1832
1864
|
other.recycle(copyBounds);
|
|
1833
1865
|
}
|
|
1834
1866
|
|
|
1867
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
1868
|
+
|
|
1835
1869
|
function blur(ui, current, origin) {
|
|
1836
1870
|
const {blur: blur} = ui.__;
|
|
1837
1871
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -1846,10 +1880,12 @@ const EffectModule = {
|
|
|
1846
1880
|
innerShadow: innerShadow,
|
|
1847
1881
|
blur: blur,
|
|
1848
1882
|
backgroundBlur: backgroundBlur,
|
|
1849
|
-
|
|
1883
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
1884
|
+
getShadowTransform: getShadowTransform,
|
|
1850
1885
|
isTransformShadow(_shadow) {
|
|
1851
1886
|
return undefined;
|
|
1852
|
-
}
|
|
1887
|
+
},
|
|
1888
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
1853
1889
|
};
|
|
1854
1890
|
|
|
1855
1891
|
const {excludeRenderBounds: excludeRenderBounds} = core.LeafBoundsHelper;
|
|
@@ -1866,6 +1902,7 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1866
1902
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
1867
1903
|
maskCanvas = contentCanvas = null;
|
|
1868
1904
|
}
|
|
1905
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1869
1906
|
maskOpacity = child.__.opacity;
|
|
1870
1907
|
usedGrayscaleAlpha = false;
|
|
1871
1908
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -1883,7 +1920,6 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1883
1920
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
1884
1921
|
child.__render(maskCanvas, options);
|
|
1885
1922
|
}
|
|
1886
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1887
1923
|
continue;
|
|
1888
1924
|
}
|
|
1889
1925
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|