@leafer-draw/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 +273 -180
- 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 +282 -180
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/worker.cjs
CHANGED
|
@@ -427,6 +427,7 @@ class Renderer {
|
|
|
427
427
|
usePartRender: true,
|
|
428
428
|
maxFPS: 120
|
|
429
429
|
};
|
|
430
|
+
this.frames = [];
|
|
430
431
|
this.target = target;
|
|
431
432
|
this.canvas = canvas;
|
|
432
433
|
if (userConfig) this.config = core.DataHelper.default(userConfig, this.config);
|
|
@@ -556,7 +557,7 @@ class Renderer {
|
|
|
556
557
|
};
|
|
557
558
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
558
559
|
if (core.Debug.showRepaint) core.Debug.drawRepaint(canvas, bounds);
|
|
559
|
-
this.target
|
|
560
|
+
core.Platform.render(this.target, canvas, options);
|
|
560
561
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
561
562
|
this.renderOptions = options;
|
|
562
563
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -579,12 +580,15 @@ class Renderer {
|
|
|
579
580
|
const target = this.target;
|
|
580
581
|
if (this.requestTime || !target) return;
|
|
581
582
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
582
|
-
|
|
583
|
+
this.requestTime = this.frameTime || Date.now();
|
|
583
584
|
const render = () => {
|
|
584
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
585
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
585
586
|
const {maxFPS: maxFPS} = this.config;
|
|
586
|
-
if (maxFPS && nowFPS > maxFPS
|
|
587
|
-
|
|
587
|
+
if (maxFPS && nowFPS > maxFPS) return core.Platform.requestRender(render);
|
|
588
|
+
const {frames: frames} = this;
|
|
589
|
+
if (frames.length > 30) frames.shift();
|
|
590
|
+
frames.push(nowFPS);
|
|
591
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
588
592
|
this.requestTime = 0;
|
|
589
593
|
this.checkRender();
|
|
590
594
|
};
|
|
@@ -649,6 +653,15 @@ Object.assign(core.Creator, {
|
|
|
649
653
|
|
|
650
654
|
core.Platform.layout = Layouter.fullLayout;
|
|
651
655
|
|
|
656
|
+
core.Platform.render = function(target, canvas, options) {
|
|
657
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
658
|
+
topRendering: true
|
|
659
|
+
});
|
|
660
|
+
options.topList = new core.LeafList;
|
|
661
|
+
target.__render(canvas, options);
|
|
662
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
663
|
+
};
|
|
664
|
+
|
|
652
665
|
function fillText(ui, canvas) {
|
|
653
666
|
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
654
667
|
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
@@ -842,24 +855,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
842
855
|
}
|
|
843
856
|
}
|
|
844
857
|
|
|
845
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
858
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
859
|
+
|
|
860
|
+
const tempBounds$1 = {};
|
|
846
861
|
|
|
847
862
|
function shape(ui, current, options) {
|
|
848
863
|
const canvas = current.getSameCanvas();
|
|
849
|
-
const nowWorld = ui.__nowWorld,
|
|
850
|
-
|
|
864
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
865
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
866
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
867
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
868
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
851
869
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
852
|
-
if (currentBounds.includes(
|
|
870
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
853
871
|
worldCanvas = canvas;
|
|
854
|
-
bounds = shapeBounds =
|
|
872
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
873
|
+
renderBounds = nowWorld;
|
|
855
874
|
} else {
|
|
856
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
857
875
|
let worldClipBounds;
|
|
858
876
|
if (core.Platform.fullImageShadow) {
|
|
859
|
-
worldClipBounds =
|
|
877
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
860
878
|
} else {
|
|
861
|
-
const spreadBounds =
|
|
862
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
879
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, core.FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
880
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
863
881
|
}
|
|
864
882
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
865
883
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -869,8 +887,10 @@ function shape(ui, current, options) {
|
|
|
869
887
|
scaleX *= fitScaleX;
|
|
870
888
|
scaleY *= fitScaleY;
|
|
871
889
|
}
|
|
872
|
-
shapeBounds = getOuterOf(
|
|
890
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
873
891
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
892
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
893
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
874
894
|
const userMatrix = options.matrix;
|
|
875
895
|
if (userMatrix) {
|
|
876
896
|
matrix = new core.Matrix(fitMatrix);
|
|
@@ -889,6 +909,7 @@ function shape(ui, current, options) {
|
|
|
889
909
|
matrix: matrix,
|
|
890
910
|
fitMatrix: fitMatrix,
|
|
891
911
|
bounds: bounds,
|
|
912
|
+
renderBounds: renderBounds,
|
|
892
913
|
worldCanvas: worldCanvas,
|
|
893
914
|
shapeBounds: shapeBounds,
|
|
894
915
|
scaleX: scaleX,
|
|
@@ -992,7 +1013,7 @@ const PaintModule = {
|
|
|
992
1013
|
shape: shape
|
|
993
1014
|
};
|
|
994
1015
|
|
|
995
|
-
let origin = {}, tempMatrix = core.getMatrixData();
|
|
1016
|
+
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
996
1017
|
|
|
997
1018
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
998
1019
|
|
|
@@ -1007,12 +1028,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1007
1028
|
data.transform = transform;
|
|
1008
1029
|
}
|
|
1009
1030
|
|
|
1010
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
1031
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
1011
1032
|
const transform = get$3();
|
|
1012
1033
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1013
|
-
if (
|
|
1014
|
-
tempMatrix.a =
|
|
1015
|
-
multiplyParent(transform, tempMatrix);
|
|
1034
|
+
if (clipScaleX) {
|
|
1035
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
1036
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1016
1037
|
}
|
|
1017
1038
|
data.transform = transform;
|
|
1018
1039
|
}
|
|
@@ -1113,7 +1134,12 @@ function getPatternData(paint, box, image) {
|
|
|
1113
1134
|
|
|
1114
1135
|
case "normal":
|
|
1115
1136
|
case "clip":
|
|
1116
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
1137
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
1138
|
+
let clipScaleX, clipScaleY;
|
|
1139
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1140
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1141
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1142
|
+
}
|
|
1117
1143
|
break;
|
|
1118
1144
|
|
|
1119
1145
|
case "repeat":
|
|
@@ -1271,7 +1297,7 @@ function ignoreRender(ui, value) {
|
|
|
1271
1297
|
|
|
1272
1298
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1273
1299
|
|
|
1274
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
1300
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1275
1301
|
|
|
1276
1302
|
function createPattern(ui, paint, pixelRatio) {
|
|
1277
1303
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1320,8 +1346,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1320
1346
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
1321
1347
|
const canvasWidth = width + (xGap || 0);
|
|
1322
1348
|
const canvasHeight = height + (yGap || 0);
|
|
1323
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
1324
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
1349
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
1350
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
1325
1351
|
if (!imageMatrix) {
|
|
1326
1352
|
imageMatrix = get$1();
|
|
1327
1353
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -1380,17 +1406,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1380
1406
|
if (allowDraw) {
|
|
1381
1407
|
if (data.repeat) {
|
|
1382
1408
|
allowDraw = false;
|
|
1383
|
-
} else {
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
height *= data.scaleY;
|
|
1391
|
-
}
|
|
1392
|
-
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1409
|
+
} else if (!(paint.changeful || core.Platform.name === "miniapp" && core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
|
|
1410
|
+
let {width: width, height: height} = data;
|
|
1411
|
+
width *= scaleX * pixelRatio;
|
|
1412
|
+
height *= scaleY * pixelRatio;
|
|
1413
|
+
if (data.scaleX) {
|
|
1414
|
+
width *= data.scaleX;
|
|
1415
|
+
height *= data.scaleY;
|
|
1393
1416
|
}
|
|
1417
|
+
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1394
1418
|
}
|
|
1395
1419
|
}
|
|
1396
1420
|
if (allowDraw) {
|
|
@@ -1570,20 +1594,20 @@ const PaintGradientModule = {
|
|
|
1570
1594
|
getTransform: getTransform
|
|
1571
1595
|
};
|
|
1572
1596
|
|
|
1573
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper;
|
|
1597
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
1574
1598
|
|
|
1575
|
-
const tempBounds = {};
|
|
1599
|
+
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
1576
1600
|
|
|
1577
1601
|
const offsetOutBounds$1 = {};
|
|
1578
1602
|
|
|
1579
1603
|
function shadow(ui, current, shape) {
|
|
1580
|
-
let copyBounds,
|
|
1581
|
-
const {__nowWorld: nowWorld
|
|
1604
|
+
let copyBounds, transform;
|
|
1605
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1582
1606
|
const {shadow: shadow} = ui.__;
|
|
1583
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1607
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1584
1608
|
const other = current.getSameCanvas();
|
|
1585
1609
|
const end = shadow.length - 1;
|
|
1586
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
1610
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
1587
1611
|
shadow.forEach((item, index) => {
|
|
1588
1612
|
let otherScale = 1;
|
|
1589
1613
|
if (item.scaleFixed) {
|
|
@@ -1591,54 +1615,61 @@ function shadow(ui, current, shape) {
|
|
|
1591
1615
|
if (sx > 1) otherScale = 1 / sx;
|
|
1592
1616
|
}
|
|
1593
1617
|
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));
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1618
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
1619
|
+
if (transform) other.setTransform(transform);
|
|
1620
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
1621
|
+
if (transform) other.resetTransform();
|
|
1622
|
+
copyBounds = renderBounds;
|
|
1597
1623
|
if (item.box) {
|
|
1598
1624
|
other.restore();
|
|
1599
1625
|
other.save();
|
|
1600
1626
|
if (worldCanvas) {
|
|
1601
|
-
other.copyWorld(other,
|
|
1627
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1602
1628
|
copyBounds = nowWorld;
|
|
1603
1629
|
}
|
|
1604
1630
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
1605
1631
|
}
|
|
1606
|
-
|
|
1632
|
+
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
1607
1633
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
1608
1634
|
});
|
|
1609
1635
|
other.recycle(copyBounds);
|
|
1610
1636
|
}
|
|
1611
1637
|
|
|
1612
|
-
function
|
|
1613
|
-
let
|
|
1614
|
-
shadow.forEach(item =>
|
|
1615
|
-
|
|
1638
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
1639
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
1640
|
+
shadow.forEach(item => {
|
|
1641
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
1642
|
+
top = max(top, spread + blur - y);
|
|
1643
|
+
right = max(right, spread + blur + x);
|
|
1644
|
+
bottom = max(bottom, spread + blur + y);
|
|
1645
|
+
left = max(left, spread + blur - x);
|
|
1646
|
+
});
|
|
1647
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
1616
1648
|
}
|
|
1617
1649
|
|
|
1618
|
-
function
|
|
1619
|
-
|
|
1650
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
1651
|
+
if (shadow.spread) {
|
|
1652
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
1653
|
+
tempMatrix.set().scaleOfOuter({
|
|
1654
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
1655
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
1656
|
+
}, spreadScale);
|
|
1657
|
+
return tempMatrix;
|
|
1658
|
+
}
|
|
1659
|
+
return undefined;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
1663
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
1664
|
+
let from, to;
|
|
1620
1665
|
if (core.Platform.fullImageShadow) {
|
|
1621
1666
|
copy(tempBounds, canvas.bounds);
|
|
1622
|
-
tempBounds.x
|
|
1623
|
-
|
|
1624
|
-
if (spreadScale) {
|
|
1625
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
1626
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
1627
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
1628
|
-
tempBounds.width *= spreadScale;
|
|
1629
|
-
tempBounds.height *= spreadScale;
|
|
1630
|
-
}
|
|
1631
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
1667
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
1668
|
+
from = canvas.bounds, to = tempBounds;
|
|
1632
1669
|
} else {
|
|
1633
|
-
|
|
1634
|
-
copy(tempBounds, outBounds);
|
|
1635
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
1636
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
1637
|
-
tempBounds.width *= spreadScale;
|
|
1638
|
-
tempBounds.height *= spreadScale;
|
|
1639
|
-
}
|
|
1640
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
1670
|
+
from = shapeBounds, to = outBounds;
|
|
1641
1671
|
}
|
|
1672
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
1642
1673
|
}
|
|
1643
1674
|
|
|
1644
1675
|
const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
@@ -1646,13 +1677,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
|
1646
1677
|
const offsetOutBounds = {};
|
|
1647
1678
|
|
|
1648
1679
|
function innerShadow(ui, current, shape) {
|
|
1649
|
-
let copyBounds,
|
|
1650
|
-
const {__nowWorld: nowWorld
|
|
1680
|
+
let copyBounds, transform;
|
|
1681
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1651
1682
|
const {innerShadow: innerShadow} = ui.__;
|
|
1652
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1683
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1653
1684
|
const other = current.getSameCanvas();
|
|
1654
1685
|
const end = innerShadow.length - 1;
|
|
1655
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
1686
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
1656
1687
|
innerShadow.forEach((item, index) => {
|
|
1657
1688
|
let otherScale = 1;
|
|
1658
1689
|
if (item.scaleFixed) {
|
|
@@ -1661,16 +1692,17 @@ function innerShadow(ui, current, shape) {
|
|
|
1661
1692
|
}
|
|
1662
1693
|
other.save();
|
|
1663
1694
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
1664
|
-
|
|
1665
|
-
|
|
1695
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1696
|
+
if (transform) other.setTransform(transform);
|
|
1697
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
1666
1698
|
other.restore();
|
|
1667
1699
|
if (worldCanvas) {
|
|
1668
|
-
other.copyWorld(other,
|
|
1700
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1669
1701
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
1670
1702
|
copyBounds = nowWorld;
|
|
1671
1703
|
} else {
|
|
1672
1704
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
1673
|
-
copyBounds =
|
|
1705
|
+
copyBounds = renderBounds;
|
|
1674
1706
|
}
|
|
1675
1707
|
other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), "source-in");
|
|
1676
1708
|
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -1679,6 +1711,8 @@ function innerShadow(ui, current, shape) {
|
|
|
1679
1711
|
other.recycle(copyBounds);
|
|
1680
1712
|
}
|
|
1681
1713
|
|
|
1714
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
1715
|
+
|
|
1682
1716
|
function blur(ui, current, origin) {
|
|
1683
1717
|
const {blur: blur} = ui.__;
|
|
1684
1718
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -1693,10 +1727,12 @@ const EffectModule = {
|
|
|
1693
1727
|
innerShadow: innerShadow,
|
|
1694
1728
|
blur: blur,
|
|
1695
1729
|
backgroundBlur: backgroundBlur,
|
|
1696
|
-
|
|
1730
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
1731
|
+
getShadowTransform: getShadowTransform,
|
|
1697
1732
|
isTransformShadow(_shadow) {
|
|
1698
1733
|
return undefined;
|
|
1699
|
-
}
|
|
1734
|
+
},
|
|
1735
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
1700
1736
|
};
|
|
1701
1737
|
|
|
1702
1738
|
const {excludeRenderBounds: excludeRenderBounds} = core.LeafBoundsHelper;
|
|
@@ -1713,6 +1749,7 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1713
1749
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
1714
1750
|
maskCanvas = contentCanvas = null;
|
|
1715
1751
|
}
|
|
1752
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1716
1753
|
maskOpacity = child.__.opacity;
|
|
1717
1754
|
usedGrayscaleAlpha = false;
|
|
1718
1755
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -1730,7 +1767,6 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1730
1767
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
1731
1768
|
child.__render(maskCanvas, options);
|
|
1732
1769
|
}
|
|
1733
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1734
1770
|
continue;
|
|
1735
1771
|
}
|
|
1736
1772
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|