leafer-draw 1.9.7 → 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/web.cjs +107 -80
- package/dist/web.esm.js +109 -82
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +230 -168
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +238 -168
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.cjs
CHANGED
|
@@ -37,7 +37,7 @@ class LeaferCanvas extends core.LeaferCanvasBase {
|
|
|
37
37
|
}
|
|
38
38
|
if (core.Platform.syncDomFont && !this.parentView) {
|
|
39
39
|
style.display = "none";
|
|
40
|
-
document.body.appendChild(this.view);
|
|
40
|
+
if (document.body) document.body.appendChild(this.view);
|
|
41
41
|
}
|
|
42
42
|
this.__createContext();
|
|
43
43
|
if (!this.autoLayout) this.resize(config);
|
|
@@ -633,6 +633,7 @@ class Renderer {
|
|
|
633
633
|
usePartRender: true,
|
|
634
634
|
maxFPS: 120
|
|
635
635
|
};
|
|
636
|
+
this.frames = [];
|
|
636
637
|
this.target = target;
|
|
637
638
|
this.canvas = canvas;
|
|
638
639
|
if (userConfig) this.config = core.DataHelper.default(userConfig, this.config);
|
|
@@ -785,12 +786,15 @@ class Renderer {
|
|
|
785
786
|
const target = this.target;
|
|
786
787
|
if (this.requestTime || !target) return;
|
|
787
788
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
788
|
-
|
|
789
|
+
this.requestTime = this.frameTime || Date.now();
|
|
789
790
|
const render = () => {
|
|
790
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
791
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
791
792
|
const {maxFPS: maxFPS} = this.config;
|
|
792
|
-
if (maxFPS && nowFPS > maxFPS
|
|
793
|
-
|
|
793
|
+
if (maxFPS && nowFPS > maxFPS) return core.Platform.requestRender(render);
|
|
794
|
+
const {frames: frames} = this;
|
|
795
|
+
if (frames.length > 30) frames.shift();
|
|
796
|
+
frames.push(nowFPS);
|
|
797
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
794
798
|
this.requestTime = 0;
|
|
795
799
|
this.checkRender();
|
|
796
800
|
};
|
|
@@ -1057,24 +1061,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
1057
1061
|
}
|
|
1058
1062
|
}
|
|
1059
1063
|
|
|
1060
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
1064
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
1065
|
+
|
|
1066
|
+
const tempBounds$1 = {};
|
|
1061
1067
|
|
|
1062
1068
|
function shape(ui, current, options) {
|
|
1063
1069
|
const canvas = current.getSameCanvas();
|
|
1064
|
-
const nowWorld = ui.__nowWorld,
|
|
1065
|
-
|
|
1070
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
1071
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
1072
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
1073
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
1074
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
1066
1075
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
1067
|
-
if (currentBounds.includes(
|
|
1076
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
1068
1077
|
worldCanvas = canvas;
|
|
1069
|
-
bounds = shapeBounds =
|
|
1078
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
1079
|
+
renderBounds = nowWorld;
|
|
1070
1080
|
} else {
|
|
1071
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
1072
1081
|
let worldClipBounds;
|
|
1073
1082
|
if (core.Platform.fullImageShadow) {
|
|
1074
|
-
worldClipBounds =
|
|
1083
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
1075
1084
|
} else {
|
|
1076
|
-
const spreadBounds =
|
|
1077
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
1085
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, core.FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
1086
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
1078
1087
|
}
|
|
1079
1088
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
1080
1089
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -1084,8 +1093,10 @@ function shape(ui, current, options) {
|
|
|
1084
1093
|
scaleX *= fitScaleX;
|
|
1085
1094
|
scaleY *= fitScaleY;
|
|
1086
1095
|
}
|
|
1087
|
-
shapeBounds = getOuterOf(
|
|
1096
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
1088
1097
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1098
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
1099
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1089
1100
|
const userMatrix = options.matrix;
|
|
1090
1101
|
if (userMatrix) {
|
|
1091
1102
|
matrix = new core.Matrix(fitMatrix);
|
|
@@ -1104,6 +1115,7 @@ function shape(ui, current, options) {
|
|
|
1104
1115
|
matrix: matrix,
|
|
1105
1116
|
fitMatrix: fitMatrix,
|
|
1106
1117
|
bounds: bounds,
|
|
1118
|
+
renderBounds: renderBounds,
|
|
1107
1119
|
worldCanvas: worldCanvas,
|
|
1108
1120
|
shapeBounds: shapeBounds,
|
|
1109
1121
|
scaleX: scaleX,
|
|
@@ -1207,7 +1219,7 @@ const PaintModule = {
|
|
|
1207
1219
|
shape: shape
|
|
1208
1220
|
};
|
|
1209
1221
|
|
|
1210
|
-
let origin = {}, tempMatrix = core.getMatrixData();
|
|
1222
|
+
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
1211
1223
|
|
|
1212
1224
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1213
1225
|
|
|
@@ -1222,12 +1234,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1222
1234
|
data.transform = transform;
|
|
1223
1235
|
}
|
|
1224
1236
|
|
|
1225
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
1237
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
1226
1238
|
const transform = get$3();
|
|
1227
1239
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1228
|
-
if (
|
|
1229
|
-
tempMatrix.a =
|
|
1230
|
-
multiplyParent(transform, tempMatrix);
|
|
1240
|
+
if (clipScaleX) {
|
|
1241
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
1242
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1231
1243
|
}
|
|
1232
1244
|
data.transform = transform;
|
|
1233
1245
|
}
|
|
@@ -1328,7 +1340,12 @@ function getPatternData(paint, box, image) {
|
|
|
1328
1340
|
|
|
1329
1341
|
case "normal":
|
|
1330
1342
|
case "clip":
|
|
1331
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
1343
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
1344
|
+
let clipScaleX, clipScaleY;
|
|
1345
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1346
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1347
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1348
|
+
}
|
|
1332
1349
|
break;
|
|
1333
1350
|
|
|
1334
1351
|
case "repeat":
|
|
@@ -1486,7 +1503,7 @@ function ignoreRender(ui, value) {
|
|
|
1486
1503
|
|
|
1487
1504
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1488
1505
|
|
|
1489
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
1506
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1490
1507
|
|
|
1491
1508
|
function createPattern(ui, paint, pixelRatio) {
|
|
1492
1509
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1535,8 +1552,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1535
1552
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
1536
1553
|
const canvasWidth = width + (xGap || 0);
|
|
1537
1554
|
const canvasHeight = height + (yGap || 0);
|
|
1538
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
1539
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
1555
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
1556
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
1540
1557
|
if (!imageMatrix) {
|
|
1541
1558
|
imageMatrix = get$1();
|
|
1542
1559
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -1595,17 +1612,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1595
1612
|
if (allowDraw) {
|
|
1596
1613
|
if (data.repeat) {
|
|
1597
1614
|
allowDraw = false;
|
|
1598
|
-
} else {
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
height *= data.scaleY;
|
|
1606
|
-
}
|
|
1607
|
-
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1615
|
+
} else if (!(paint.changeful || core.Platform.name === "miniapp" && core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
|
|
1616
|
+
let {width: width, height: height} = data;
|
|
1617
|
+
width *= scaleX * pixelRatio;
|
|
1618
|
+
height *= scaleY * pixelRatio;
|
|
1619
|
+
if (data.scaleX) {
|
|
1620
|
+
width *= data.scaleX;
|
|
1621
|
+
height *= data.scaleY;
|
|
1608
1622
|
}
|
|
1623
|
+
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1609
1624
|
}
|
|
1610
1625
|
}
|
|
1611
1626
|
if (allowDraw) {
|
|
@@ -1785,20 +1800,20 @@ const PaintGradientModule = {
|
|
|
1785
1800
|
getTransform: getTransform
|
|
1786
1801
|
};
|
|
1787
1802
|
|
|
1788
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper;
|
|
1803
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
1789
1804
|
|
|
1790
|
-
const tempBounds = {};
|
|
1805
|
+
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
1791
1806
|
|
|
1792
1807
|
const offsetOutBounds$1 = {};
|
|
1793
1808
|
|
|
1794
1809
|
function shadow(ui, current, shape) {
|
|
1795
|
-
let copyBounds,
|
|
1796
|
-
const {__nowWorld: nowWorld
|
|
1810
|
+
let copyBounds, transform;
|
|
1811
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1797
1812
|
const {shadow: shadow} = ui.__;
|
|
1798
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1813
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1799
1814
|
const other = current.getSameCanvas();
|
|
1800
1815
|
const end = shadow.length - 1;
|
|
1801
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
1816
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
1802
1817
|
shadow.forEach((item, index) => {
|
|
1803
1818
|
let otherScale = 1;
|
|
1804
1819
|
if (item.scaleFixed) {
|
|
@@ -1806,54 +1821,61 @@ function shadow(ui, current, shape) {
|
|
|
1806
1821
|
if (sx > 1) otherScale = 1 / sx;
|
|
1807
1822
|
}
|
|
1808
1823
|
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));
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1824
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
1825
|
+
if (transform) other.setTransform(transform);
|
|
1826
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
1827
|
+
if (transform) other.resetTransform();
|
|
1828
|
+
copyBounds = renderBounds;
|
|
1812
1829
|
if (item.box) {
|
|
1813
1830
|
other.restore();
|
|
1814
1831
|
other.save();
|
|
1815
1832
|
if (worldCanvas) {
|
|
1816
|
-
other.copyWorld(other,
|
|
1833
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1817
1834
|
copyBounds = nowWorld;
|
|
1818
1835
|
}
|
|
1819
1836
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
1820
1837
|
}
|
|
1821
|
-
|
|
1838
|
+
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
1822
1839
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
1823
1840
|
});
|
|
1824
1841
|
other.recycle(copyBounds);
|
|
1825
1842
|
}
|
|
1826
1843
|
|
|
1827
|
-
function
|
|
1828
|
-
let
|
|
1829
|
-
shadow.forEach(item =>
|
|
1830
|
-
|
|
1844
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
1845
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
1846
|
+
shadow.forEach(item => {
|
|
1847
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
1848
|
+
top = max(top, spread + blur - y);
|
|
1849
|
+
right = max(right, spread + blur + x);
|
|
1850
|
+
bottom = max(bottom, spread + blur + y);
|
|
1851
|
+
left = max(left, spread + blur - x);
|
|
1852
|
+
});
|
|
1853
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
1857
|
+
if (shadow.spread) {
|
|
1858
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
1859
|
+
tempMatrix.set().scaleOfOuter({
|
|
1860
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
1861
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
1862
|
+
}, spreadScale);
|
|
1863
|
+
return tempMatrix;
|
|
1864
|
+
}
|
|
1865
|
+
return undefined;
|
|
1831
1866
|
}
|
|
1832
1867
|
|
|
1833
|
-
function drawWorldShadow(canvas, outBounds,
|
|
1834
|
-
const {
|
|
1868
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
1869
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
1870
|
+
let from, to;
|
|
1835
1871
|
if (core.Platform.fullImageShadow) {
|
|
1836
1872
|
copy(tempBounds, canvas.bounds);
|
|
1837
|
-
tempBounds.x
|
|
1838
|
-
|
|
1839
|
-
if (spreadScale) {
|
|
1840
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
1841
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
1842
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
1843
|
-
tempBounds.width *= spreadScale;
|
|
1844
|
-
tempBounds.height *= spreadScale;
|
|
1845
|
-
}
|
|
1846
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
1873
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
1874
|
+
from = canvas.bounds, to = tempBounds;
|
|
1847
1875
|
} else {
|
|
1848
|
-
|
|
1849
|
-
copy(tempBounds, outBounds);
|
|
1850
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
1851
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
1852
|
-
tempBounds.width *= spreadScale;
|
|
1853
|
-
tempBounds.height *= spreadScale;
|
|
1854
|
-
}
|
|
1855
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
1876
|
+
from = shapeBounds, to = outBounds;
|
|
1856
1877
|
}
|
|
1878
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
1857
1879
|
}
|
|
1858
1880
|
|
|
1859
1881
|
const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
@@ -1861,13 +1883,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
|
1861
1883
|
const offsetOutBounds = {};
|
|
1862
1884
|
|
|
1863
1885
|
function innerShadow(ui, current, shape) {
|
|
1864
|
-
let copyBounds,
|
|
1865
|
-
const {__nowWorld: nowWorld
|
|
1886
|
+
let copyBounds, transform;
|
|
1887
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1866
1888
|
const {innerShadow: innerShadow} = ui.__;
|
|
1867
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1889
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1868
1890
|
const other = current.getSameCanvas();
|
|
1869
1891
|
const end = innerShadow.length - 1;
|
|
1870
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
1892
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
1871
1893
|
innerShadow.forEach((item, index) => {
|
|
1872
1894
|
let otherScale = 1;
|
|
1873
1895
|
if (item.scaleFixed) {
|
|
@@ -1876,16 +1898,17 @@ function innerShadow(ui, current, shape) {
|
|
|
1876
1898
|
}
|
|
1877
1899
|
other.save();
|
|
1878
1900
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
1879
|
-
|
|
1880
|
-
|
|
1901
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1902
|
+
if (transform) other.setTransform(transform);
|
|
1903
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
1881
1904
|
other.restore();
|
|
1882
1905
|
if (worldCanvas) {
|
|
1883
|
-
other.copyWorld(other,
|
|
1906
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1884
1907
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
1885
1908
|
copyBounds = nowWorld;
|
|
1886
1909
|
} else {
|
|
1887
1910
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
1888
|
-
copyBounds =
|
|
1911
|
+
copyBounds = renderBounds;
|
|
1889
1912
|
}
|
|
1890
1913
|
other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), "source-in");
|
|
1891
1914
|
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -1894,6 +1917,8 @@ function innerShadow(ui, current, shape) {
|
|
|
1894
1917
|
other.recycle(copyBounds);
|
|
1895
1918
|
}
|
|
1896
1919
|
|
|
1920
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
1921
|
+
|
|
1897
1922
|
function blur(ui, current, origin) {
|
|
1898
1923
|
const {blur: blur} = ui.__;
|
|
1899
1924
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -1908,10 +1933,12 @@ const EffectModule = {
|
|
|
1908
1933
|
innerShadow: innerShadow,
|
|
1909
1934
|
blur: blur,
|
|
1910
1935
|
backgroundBlur: backgroundBlur,
|
|
1911
|
-
|
|
1936
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
1937
|
+
getShadowTransform: getShadowTransform,
|
|
1912
1938
|
isTransformShadow(_shadow) {
|
|
1913
1939
|
return undefined;
|
|
1914
|
-
}
|
|
1940
|
+
},
|
|
1941
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
1915
1942
|
};
|
|
1916
1943
|
|
|
1917
1944
|
const {excludeRenderBounds: excludeRenderBounds} = core.LeafBoundsHelper;
|
|
@@ -1928,6 +1955,7 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1928
1955
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
1929
1956
|
maskCanvas = contentCanvas = null;
|
|
1930
1957
|
}
|
|
1958
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1931
1959
|
maskOpacity = child.__.opacity;
|
|
1932
1960
|
usedGrayscaleAlpha = false;
|
|
1933
1961
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -1945,7 +1973,6 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1945
1973
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
1946
1974
|
child.__render(maskCanvas, options);
|
|
1947
1975
|
}
|
|
1948
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1949
1976
|
continue;
|
|
1950
1977
|
}
|
|
1951
1978
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|