leafer-draw 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/web.cjs +117 -81
- package/dist/web.esm.js +119 -83
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +274 -181
- 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 +283 -181
- 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);
|
|
@@ -762,7 +763,7 @@ class Renderer {
|
|
|
762
763
|
};
|
|
763
764
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
764
765
|
if (core.Debug.showRepaint) core.Debug.drawRepaint(canvas, bounds);
|
|
765
|
-
this.target
|
|
766
|
+
core.Platform.render(this.target, canvas, options);
|
|
766
767
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
767
768
|
this.renderOptions = options;
|
|
768
769
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -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
|
};
|
|
@@ -855,6 +859,15 @@ Object.assign(core.Creator, {
|
|
|
855
859
|
|
|
856
860
|
core.Platform.layout = Layouter.fullLayout;
|
|
857
861
|
|
|
862
|
+
core.Platform.render = function(target, canvas, options) {
|
|
863
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
864
|
+
topRendering: true
|
|
865
|
+
});
|
|
866
|
+
options.topList = new core.LeafList;
|
|
867
|
+
target.__render(canvas, options);
|
|
868
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
869
|
+
};
|
|
870
|
+
|
|
858
871
|
function fillText(ui, canvas) {
|
|
859
872
|
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
860
873
|
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
@@ -1048,24 +1061,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
1048
1061
|
}
|
|
1049
1062
|
}
|
|
1050
1063
|
|
|
1051
|
-
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 = {};
|
|
1052
1067
|
|
|
1053
1068
|
function shape(ui, current, options) {
|
|
1054
1069
|
const canvas = current.getSameCanvas();
|
|
1055
|
-
const nowWorld = ui.__nowWorld,
|
|
1056
|
-
|
|
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;
|
|
1057
1075
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
1058
|
-
if (currentBounds.includes(
|
|
1076
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
1059
1077
|
worldCanvas = canvas;
|
|
1060
|
-
bounds = shapeBounds =
|
|
1078
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
1079
|
+
renderBounds = nowWorld;
|
|
1061
1080
|
} else {
|
|
1062
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
1063
1081
|
let worldClipBounds;
|
|
1064
1082
|
if (core.Platform.fullImageShadow) {
|
|
1065
|
-
worldClipBounds =
|
|
1083
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
1066
1084
|
} else {
|
|
1067
|
-
const spreadBounds =
|
|
1068
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
1085
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, core.FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
1086
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
1069
1087
|
}
|
|
1070
1088
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
1071
1089
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -1075,8 +1093,10 @@ function shape(ui, current, options) {
|
|
|
1075
1093
|
scaleX *= fitScaleX;
|
|
1076
1094
|
scaleY *= fitScaleY;
|
|
1077
1095
|
}
|
|
1078
|
-
shapeBounds = getOuterOf(
|
|
1096
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
1079
1097
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1098
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
1099
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1080
1100
|
const userMatrix = options.matrix;
|
|
1081
1101
|
if (userMatrix) {
|
|
1082
1102
|
matrix = new core.Matrix(fitMatrix);
|
|
@@ -1095,6 +1115,7 @@ function shape(ui, current, options) {
|
|
|
1095
1115
|
matrix: matrix,
|
|
1096
1116
|
fitMatrix: fitMatrix,
|
|
1097
1117
|
bounds: bounds,
|
|
1118
|
+
renderBounds: renderBounds,
|
|
1098
1119
|
worldCanvas: worldCanvas,
|
|
1099
1120
|
shapeBounds: shapeBounds,
|
|
1100
1121
|
scaleX: scaleX,
|
|
@@ -1198,7 +1219,7 @@ const PaintModule = {
|
|
|
1198
1219
|
shape: shape
|
|
1199
1220
|
};
|
|
1200
1221
|
|
|
1201
|
-
let origin = {}, tempMatrix = core.getMatrixData();
|
|
1222
|
+
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
1202
1223
|
|
|
1203
1224
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1204
1225
|
|
|
@@ -1213,12 +1234,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1213
1234
|
data.transform = transform;
|
|
1214
1235
|
}
|
|
1215
1236
|
|
|
1216
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
1237
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
1217
1238
|
const transform = get$3();
|
|
1218
1239
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1219
|
-
if (
|
|
1220
|
-
tempMatrix.a =
|
|
1221
|
-
multiplyParent(transform, tempMatrix);
|
|
1240
|
+
if (clipScaleX) {
|
|
1241
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
1242
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1222
1243
|
}
|
|
1223
1244
|
data.transform = transform;
|
|
1224
1245
|
}
|
|
@@ -1319,7 +1340,12 @@ function getPatternData(paint, box, image) {
|
|
|
1319
1340
|
|
|
1320
1341
|
case "normal":
|
|
1321
1342
|
case "clip":
|
|
1322
|
-
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
|
+
}
|
|
1323
1349
|
break;
|
|
1324
1350
|
|
|
1325
1351
|
case "repeat":
|
|
@@ -1477,7 +1503,7 @@ function ignoreRender(ui, value) {
|
|
|
1477
1503
|
|
|
1478
1504
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1479
1505
|
|
|
1480
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
1506
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1481
1507
|
|
|
1482
1508
|
function createPattern(ui, paint, pixelRatio) {
|
|
1483
1509
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1526,8 +1552,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1526
1552
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
1527
1553
|
const canvasWidth = width + (xGap || 0);
|
|
1528
1554
|
const canvasHeight = height + (yGap || 0);
|
|
1529
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
1530
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
1555
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
1556
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
1531
1557
|
if (!imageMatrix) {
|
|
1532
1558
|
imageMatrix = get$1();
|
|
1533
1559
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -1586,17 +1612,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1586
1612
|
if (allowDraw) {
|
|
1587
1613
|
if (data.repeat) {
|
|
1588
1614
|
allowDraw = false;
|
|
1589
|
-
} else {
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
height *= data.scaleY;
|
|
1597
|
-
}
|
|
1598
|
-
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;
|
|
1599
1622
|
}
|
|
1623
|
+
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1600
1624
|
}
|
|
1601
1625
|
}
|
|
1602
1626
|
if (allowDraw) {
|
|
@@ -1776,20 +1800,20 @@ const PaintGradientModule = {
|
|
|
1776
1800
|
getTransform: getTransform
|
|
1777
1801
|
};
|
|
1778
1802
|
|
|
1779
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper;
|
|
1803
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
1780
1804
|
|
|
1781
|
-
const tempBounds = {};
|
|
1805
|
+
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
1782
1806
|
|
|
1783
1807
|
const offsetOutBounds$1 = {};
|
|
1784
1808
|
|
|
1785
1809
|
function shadow(ui, current, shape) {
|
|
1786
|
-
let copyBounds,
|
|
1787
|
-
const {__nowWorld: nowWorld
|
|
1810
|
+
let copyBounds, transform;
|
|
1811
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1788
1812
|
const {shadow: shadow} = ui.__;
|
|
1789
|
-
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;
|
|
1790
1814
|
const other = current.getSameCanvas();
|
|
1791
1815
|
const end = shadow.length - 1;
|
|
1792
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
1816
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
1793
1817
|
shadow.forEach((item, index) => {
|
|
1794
1818
|
let otherScale = 1;
|
|
1795
1819
|
if (item.scaleFixed) {
|
|
@@ -1797,54 +1821,61 @@ function shadow(ui, current, shape) {
|
|
|
1797
1821
|
if (sx > 1) otherScale = 1 / sx;
|
|
1798
1822
|
}
|
|
1799
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));
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
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;
|
|
1803
1829
|
if (item.box) {
|
|
1804
1830
|
other.restore();
|
|
1805
1831
|
other.save();
|
|
1806
1832
|
if (worldCanvas) {
|
|
1807
|
-
other.copyWorld(other,
|
|
1833
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1808
1834
|
copyBounds = nowWorld;
|
|
1809
1835
|
}
|
|
1810
1836
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
1811
1837
|
}
|
|
1812
|
-
|
|
1838
|
+
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
1813
1839
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
1814
1840
|
});
|
|
1815
1841
|
other.recycle(copyBounds);
|
|
1816
1842
|
}
|
|
1817
1843
|
|
|
1818
|
-
function
|
|
1819
|
-
let
|
|
1820
|
-
shadow.forEach(item =>
|
|
1821
|
-
|
|
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 ];
|
|
1822
1854
|
}
|
|
1823
1855
|
|
|
1824
|
-
function
|
|
1825
|
-
|
|
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;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
1869
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
1870
|
+
let from, to;
|
|
1826
1871
|
if (core.Platform.fullImageShadow) {
|
|
1827
1872
|
copy(tempBounds, canvas.bounds);
|
|
1828
|
-
tempBounds.x
|
|
1829
|
-
|
|
1830
|
-
if (spreadScale) {
|
|
1831
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
1832
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
1833
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
1834
|
-
tempBounds.width *= spreadScale;
|
|
1835
|
-
tempBounds.height *= spreadScale;
|
|
1836
|
-
}
|
|
1837
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
1873
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
1874
|
+
from = canvas.bounds, to = tempBounds;
|
|
1838
1875
|
} else {
|
|
1839
|
-
|
|
1840
|
-
copy(tempBounds, outBounds);
|
|
1841
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
1842
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
1843
|
-
tempBounds.width *= spreadScale;
|
|
1844
|
-
tempBounds.height *= spreadScale;
|
|
1845
|
-
}
|
|
1846
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
1876
|
+
from = shapeBounds, to = outBounds;
|
|
1847
1877
|
}
|
|
1878
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
1848
1879
|
}
|
|
1849
1880
|
|
|
1850
1881
|
const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
@@ -1852,13 +1883,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
|
1852
1883
|
const offsetOutBounds = {};
|
|
1853
1884
|
|
|
1854
1885
|
function innerShadow(ui, current, shape) {
|
|
1855
|
-
let copyBounds,
|
|
1856
|
-
const {__nowWorld: nowWorld
|
|
1886
|
+
let copyBounds, transform;
|
|
1887
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1857
1888
|
const {innerShadow: innerShadow} = ui.__;
|
|
1858
|
-
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;
|
|
1859
1890
|
const other = current.getSameCanvas();
|
|
1860
1891
|
const end = innerShadow.length - 1;
|
|
1861
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
1892
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
1862
1893
|
innerShadow.forEach((item, index) => {
|
|
1863
1894
|
let otherScale = 1;
|
|
1864
1895
|
if (item.scaleFixed) {
|
|
@@ -1867,16 +1898,17 @@ function innerShadow(ui, current, shape) {
|
|
|
1867
1898
|
}
|
|
1868
1899
|
other.save();
|
|
1869
1900
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
1870
|
-
|
|
1871
|
-
|
|
1901
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1902
|
+
if (transform) other.setTransform(transform);
|
|
1903
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
1872
1904
|
other.restore();
|
|
1873
1905
|
if (worldCanvas) {
|
|
1874
|
-
other.copyWorld(other,
|
|
1906
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1875
1907
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
1876
1908
|
copyBounds = nowWorld;
|
|
1877
1909
|
} else {
|
|
1878
1910
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
1879
|
-
copyBounds =
|
|
1911
|
+
copyBounds = renderBounds;
|
|
1880
1912
|
}
|
|
1881
1913
|
other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), "source-in");
|
|
1882
1914
|
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -1885,6 +1917,8 @@ function innerShadow(ui, current, shape) {
|
|
|
1885
1917
|
other.recycle(copyBounds);
|
|
1886
1918
|
}
|
|
1887
1919
|
|
|
1920
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
1921
|
+
|
|
1888
1922
|
function blur(ui, current, origin) {
|
|
1889
1923
|
const {blur: blur} = ui.__;
|
|
1890
1924
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -1899,10 +1933,12 @@ const EffectModule = {
|
|
|
1899
1933
|
innerShadow: innerShadow,
|
|
1900
1934
|
blur: blur,
|
|
1901
1935
|
backgroundBlur: backgroundBlur,
|
|
1902
|
-
|
|
1936
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
1937
|
+
getShadowTransform: getShadowTransform,
|
|
1903
1938
|
isTransformShadow(_shadow) {
|
|
1904
1939
|
return undefined;
|
|
1905
|
-
}
|
|
1940
|
+
},
|
|
1941
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
1906
1942
|
};
|
|
1907
1943
|
|
|
1908
1944
|
const {excludeRenderBounds: excludeRenderBounds} = core.LeafBoundsHelper;
|
|
@@ -1919,6 +1955,7 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1919
1955
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
1920
1956
|
maskCanvas = contentCanvas = null;
|
|
1921
1957
|
}
|
|
1958
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1922
1959
|
maskOpacity = child.__.opacity;
|
|
1923
1960
|
usedGrayscaleAlpha = false;
|
|
1924
1961
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -1936,7 +1973,6 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1936
1973
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
1937
1974
|
child.__render(maskCanvas, options);
|
|
1938
1975
|
}
|
|
1939
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1940
1976
|
continue;
|
|
1941
1977
|
}
|
|
1942
1978
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|