@leafer-draw/node 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/node.cjs +120 -88
- package/dist/node.esm.js +122 -90
- package/dist/node.esm.min.js +1 -1
- package/dist/node.esm.min.js.map +1 -1
- package/dist/node.min.cjs +1 -1
- package/dist/node.min.cjs.map +1 -1
- package/package.json +10 -10
package/dist/node.cjs
CHANGED
|
@@ -452,6 +452,7 @@ class Renderer {
|
|
|
452
452
|
usePartRender: true,
|
|
453
453
|
maxFPS: 120
|
|
454
454
|
};
|
|
455
|
+
this.frames = [];
|
|
455
456
|
this.target = target;
|
|
456
457
|
this.canvas = canvas;
|
|
457
458
|
if (userConfig) this.config = core.DataHelper.default(userConfig, this.config);
|
|
@@ -581,7 +582,7 @@ class Renderer {
|
|
|
581
582
|
};
|
|
582
583
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
583
584
|
if (core.Debug.showRepaint) core.Debug.drawRepaint(canvas, bounds);
|
|
584
|
-
this.target
|
|
585
|
+
core.Platform.render(this.target, canvas, options);
|
|
585
586
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
586
587
|
this.renderOptions = options;
|
|
587
588
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -604,12 +605,15 @@ class Renderer {
|
|
|
604
605
|
const target = this.target;
|
|
605
606
|
if (this.requestTime || !target) return;
|
|
606
607
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
607
|
-
|
|
608
|
+
this.requestTime = this.frameTime || Date.now();
|
|
608
609
|
const render = () => {
|
|
609
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
610
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
610
611
|
const {maxFPS: maxFPS} = this.config;
|
|
611
|
-
if (maxFPS && nowFPS > maxFPS
|
|
612
|
-
|
|
612
|
+
if (maxFPS && nowFPS > maxFPS) return core.Platform.requestRender(render);
|
|
613
|
+
const {frames: frames} = this;
|
|
614
|
+
if (frames.length > 30) frames.shift();
|
|
615
|
+
frames.push(nowFPS);
|
|
616
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
613
617
|
this.requestTime = 0;
|
|
614
618
|
this.checkRender();
|
|
615
619
|
};
|
|
@@ -674,6 +678,15 @@ Object.assign(core.Creator, {
|
|
|
674
678
|
|
|
675
679
|
core.Platform.layout = Layouter.fullLayout;
|
|
676
680
|
|
|
681
|
+
core.Platform.render = function(target, canvas, options) {
|
|
682
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
683
|
+
topRendering: true
|
|
684
|
+
});
|
|
685
|
+
options.topList = new core.LeafList;
|
|
686
|
+
target.__render(canvas, options);
|
|
687
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
688
|
+
};
|
|
689
|
+
|
|
677
690
|
function fillText(ui, canvas) {
|
|
678
691
|
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
679
692
|
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
@@ -867,24 +880,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
867
880
|
}
|
|
868
881
|
}
|
|
869
882
|
|
|
870
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
883
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
884
|
+
|
|
885
|
+
const tempBounds$1 = {};
|
|
871
886
|
|
|
872
887
|
function shape(ui, current, options) {
|
|
873
888
|
const canvas = current.getSameCanvas();
|
|
874
|
-
const nowWorld = ui.__nowWorld,
|
|
875
|
-
|
|
889
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
890
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
891
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
892
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
893
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
876
894
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
877
|
-
if (currentBounds.includes(
|
|
895
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
878
896
|
worldCanvas = canvas;
|
|
879
|
-
bounds = shapeBounds =
|
|
897
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
898
|
+
renderBounds = nowWorld;
|
|
880
899
|
} else {
|
|
881
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
882
900
|
let worldClipBounds;
|
|
883
901
|
if (core.Platform.fullImageShadow) {
|
|
884
|
-
worldClipBounds =
|
|
902
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
885
903
|
} else {
|
|
886
|
-
const spreadBounds =
|
|
887
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
904
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, core.FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
905
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
888
906
|
}
|
|
889
907
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
890
908
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -894,8 +912,10 @@ function shape(ui, current, options) {
|
|
|
894
912
|
scaleX *= fitScaleX;
|
|
895
913
|
scaleY *= fitScaleY;
|
|
896
914
|
}
|
|
897
|
-
shapeBounds = getOuterOf(
|
|
915
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
898
916
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
917
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
918
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
899
919
|
const userMatrix = options.matrix;
|
|
900
920
|
if (userMatrix) {
|
|
901
921
|
matrix = new core.Matrix(fitMatrix);
|
|
@@ -914,6 +934,7 @@ function shape(ui, current, options) {
|
|
|
914
934
|
matrix: matrix,
|
|
915
935
|
fitMatrix: fitMatrix,
|
|
916
936
|
bounds: bounds,
|
|
937
|
+
renderBounds: renderBounds,
|
|
917
938
|
worldCanvas: worldCanvas,
|
|
918
939
|
shapeBounds: shapeBounds,
|
|
919
940
|
scaleX: scaleX,
|
|
@@ -1017,7 +1038,7 @@ const PaintModule = {
|
|
|
1017
1038
|
shape: shape
|
|
1018
1039
|
};
|
|
1019
1040
|
|
|
1020
|
-
let origin = {}, tempMatrix = core.getMatrixData();
|
|
1041
|
+
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
1021
1042
|
|
|
1022
1043
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1023
1044
|
|
|
@@ -1032,12 +1053,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1032
1053
|
data.transform = transform;
|
|
1033
1054
|
}
|
|
1034
1055
|
|
|
1035
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
1056
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
1036
1057
|
const transform = get$3();
|
|
1037
1058
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1038
|
-
if (
|
|
1039
|
-
tempMatrix.a =
|
|
1040
|
-
multiplyParent(transform, tempMatrix);
|
|
1059
|
+
if (clipScaleX) {
|
|
1060
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
1061
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1041
1062
|
}
|
|
1042
1063
|
data.transform = transform;
|
|
1043
1064
|
}
|
|
@@ -1138,7 +1159,12 @@ function getPatternData(paint, box, image) {
|
|
|
1138
1159
|
|
|
1139
1160
|
case "normal":
|
|
1140
1161
|
case "clip":
|
|
1141
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
1162
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
1163
|
+
let clipScaleX, clipScaleY;
|
|
1164
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1165
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1166
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1167
|
+
}
|
|
1142
1168
|
break;
|
|
1143
1169
|
|
|
1144
1170
|
case "repeat":
|
|
@@ -1296,7 +1322,7 @@ function ignoreRender(ui, value) {
|
|
|
1296
1322
|
|
|
1297
1323
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1298
1324
|
|
|
1299
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
1325
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1300
1326
|
|
|
1301
1327
|
function createPattern(ui, paint, pixelRatio) {
|
|
1302
1328
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1345,8 +1371,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1345
1371
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
1346
1372
|
const canvasWidth = width + (xGap || 0);
|
|
1347
1373
|
const canvasHeight = height + (yGap || 0);
|
|
1348
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
1349
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
1374
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
1375
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
1350
1376
|
if (!imageMatrix) {
|
|
1351
1377
|
imageMatrix = get$1();
|
|
1352
1378
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -1372,17 +1398,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1372
1398
|
if (allowDraw) {
|
|
1373
1399
|
if (data.repeat) {
|
|
1374
1400
|
allowDraw = false;
|
|
1375
|
-
} else {
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
height *= data.scaleY;
|
|
1383
|
-
}
|
|
1384
|
-
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1401
|
+
} else if (!(paint.changeful || core.Platform.name === "miniapp" && core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
|
|
1402
|
+
let {width: width, height: height} = data;
|
|
1403
|
+
width *= scaleX * pixelRatio;
|
|
1404
|
+
height *= scaleY * pixelRatio;
|
|
1405
|
+
if (data.scaleX) {
|
|
1406
|
+
width *= data.scaleX;
|
|
1407
|
+
height *= data.scaleY;
|
|
1385
1408
|
}
|
|
1409
|
+
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
1386
1410
|
}
|
|
1387
1411
|
}
|
|
1388
1412
|
if (allowDraw) {
|
|
@@ -1562,20 +1586,20 @@ const PaintGradientModule = {
|
|
|
1562
1586
|
getTransform: getTransform
|
|
1563
1587
|
};
|
|
1564
1588
|
|
|
1565
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper;
|
|
1589
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
1566
1590
|
|
|
1567
|
-
const tempBounds = {};
|
|
1591
|
+
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
1568
1592
|
|
|
1569
1593
|
const offsetOutBounds$1 = {};
|
|
1570
1594
|
|
|
1571
1595
|
function shadow(ui, current, shape) {
|
|
1572
|
-
let copyBounds,
|
|
1573
|
-
const {__nowWorld: nowWorld
|
|
1596
|
+
let copyBounds, transform;
|
|
1597
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1574
1598
|
const {shadow: shadow} = ui.__;
|
|
1575
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1599
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1576
1600
|
const other = current.getSameCanvas();
|
|
1577
1601
|
const end = shadow.length - 1;
|
|
1578
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
1602
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
1579
1603
|
shadow.forEach((item, index) => {
|
|
1580
1604
|
let otherScale = 1;
|
|
1581
1605
|
if (item.scaleFixed) {
|
|
@@ -1583,54 +1607,61 @@ function shadow(ui, current, shape) {
|
|
|
1583
1607
|
if (sx > 1) otherScale = 1 / sx;
|
|
1584
1608
|
}
|
|
1585
1609
|
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));
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1610
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
1611
|
+
if (transform) other.setTransform(transform);
|
|
1612
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
1613
|
+
if (transform) other.resetTransform();
|
|
1614
|
+
copyBounds = renderBounds;
|
|
1589
1615
|
if (item.box) {
|
|
1590
1616
|
other.restore();
|
|
1591
1617
|
other.save();
|
|
1592
1618
|
if (worldCanvas) {
|
|
1593
|
-
other.copyWorld(other,
|
|
1619
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1594
1620
|
copyBounds = nowWorld;
|
|
1595
1621
|
}
|
|
1596
1622
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
1597
1623
|
}
|
|
1598
|
-
|
|
1624
|
+
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
1599
1625
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
1600
1626
|
});
|
|
1601
1627
|
other.recycle(copyBounds);
|
|
1602
1628
|
}
|
|
1603
1629
|
|
|
1604
|
-
function
|
|
1605
|
-
let
|
|
1606
|
-
shadow.forEach(item =>
|
|
1607
|
-
|
|
1630
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
1631
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
1632
|
+
shadow.forEach(item => {
|
|
1633
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
1634
|
+
top = max(top, spread + blur - y);
|
|
1635
|
+
right = max(right, spread + blur + x);
|
|
1636
|
+
bottom = max(bottom, spread + blur + y);
|
|
1637
|
+
left = max(left, spread + blur - x);
|
|
1638
|
+
});
|
|
1639
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
1643
|
+
if (shadow.spread) {
|
|
1644
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
1645
|
+
tempMatrix.set().scaleOfOuter({
|
|
1646
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
1647
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
1648
|
+
}, spreadScale);
|
|
1649
|
+
return tempMatrix;
|
|
1650
|
+
}
|
|
1651
|
+
return undefined;
|
|
1608
1652
|
}
|
|
1609
1653
|
|
|
1610
|
-
function drawWorldShadow(canvas, outBounds,
|
|
1611
|
-
const {
|
|
1654
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
1655
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
1656
|
+
let from, to;
|
|
1612
1657
|
if (core.Platform.fullImageShadow) {
|
|
1613
1658
|
copy(tempBounds, canvas.bounds);
|
|
1614
|
-
tempBounds.x
|
|
1615
|
-
|
|
1616
|
-
if (spreadScale) {
|
|
1617
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
1618
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
1619
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
1620
|
-
tempBounds.width *= spreadScale;
|
|
1621
|
-
tempBounds.height *= spreadScale;
|
|
1622
|
-
}
|
|
1623
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
1659
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
1660
|
+
from = canvas.bounds, to = tempBounds;
|
|
1624
1661
|
} else {
|
|
1625
|
-
|
|
1626
|
-
copy(tempBounds, outBounds);
|
|
1627
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
1628
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
1629
|
-
tempBounds.width *= spreadScale;
|
|
1630
|
-
tempBounds.height *= spreadScale;
|
|
1631
|
-
}
|
|
1632
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
1662
|
+
from = shapeBounds, to = outBounds;
|
|
1633
1663
|
}
|
|
1664
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
1634
1665
|
}
|
|
1635
1666
|
|
|
1636
1667
|
const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
@@ -1638,13 +1669,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
|
1638
1669
|
const offsetOutBounds = {};
|
|
1639
1670
|
|
|
1640
1671
|
function innerShadow(ui, current, shape) {
|
|
1641
|
-
let copyBounds,
|
|
1642
|
-
const {__nowWorld: nowWorld
|
|
1672
|
+
let copyBounds, transform;
|
|
1673
|
+
const {__nowWorld: nowWorld} = ui;
|
|
1643
1674
|
const {innerShadow: innerShadow} = ui.__;
|
|
1644
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1675
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
1645
1676
|
const other = current.getSameCanvas();
|
|
1646
1677
|
const end = innerShadow.length - 1;
|
|
1647
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
1678
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
1648
1679
|
innerShadow.forEach((item, index) => {
|
|
1649
1680
|
let otherScale = 1;
|
|
1650
1681
|
if (item.scaleFixed) {
|
|
@@ -1653,16 +1684,17 @@ function innerShadow(ui, current, shape) {
|
|
|
1653
1684
|
}
|
|
1654
1685
|
other.save();
|
|
1655
1686
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
1656
|
-
|
|
1657
|
-
|
|
1687
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
1688
|
+
if (transform) other.setTransform(transform);
|
|
1689
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
1658
1690
|
other.restore();
|
|
1659
1691
|
if (worldCanvas) {
|
|
1660
|
-
other.copyWorld(other,
|
|
1692
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
1661
1693
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
1662
1694
|
copyBounds = nowWorld;
|
|
1663
1695
|
} else {
|
|
1664
1696
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
1665
|
-
copyBounds =
|
|
1697
|
+
copyBounds = renderBounds;
|
|
1666
1698
|
}
|
|
1667
1699
|
other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), "source-in");
|
|
1668
1700
|
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -1671,6 +1703,8 @@ function innerShadow(ui, current, shape) {
|
|
|
1671
1703
|
other.recycle(copyBounds);
|
|
1672
1704
|
}
|
|
1673
1705
|
|
|
1706
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
1707
|
+
|
|
1674
1708
|
function blur(ui, current, origin) {
|
|
1675
1709
|
const {blur: blur} = ui.__;
|
|
1676
1710
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -1685,10 +1719,12 @@ const EffectModule = {
|
|
|
1685
1719
|
innerShadow: innerShadow,
|
|
1686
1720
|
blur: blur,
|
|
1687
1721
|
backgroundBlur: backgroundBlur,
|
|
1688
|
-
|
|
1722
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
1723
|
+
getShadowTransform: getShadowTransform,
|
|
1689
1724
|
isTransformShadow(_shadow) {
|
|
1690
1725
|
return undefined;
|
|
1691
|
-
}
|
|
1726
|
+
},
|
|
1727
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
1692
1728
|
};
|
|
1693
1729
|
|
|
1694
1730
|
const {excludeRenderBounds: excludeRenderBounds} = core.LeafBoundsHelper;
|
|
@@ -1705,6 +1741,7 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1705
1741
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
1706
1742
|
maskCanvas = contentCanvas = null;
|
|
1707
1743
|
}
|
|
1744
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1708
1745
|
maskOpacity = child.__.opacity;
|
|
1709
1746
|
usedGrayscaleAlpha = false;
|
|
1710
1747
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -1722,7 +1759,6 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
1722
1759
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
1723
1760
|
child.__render(maskCanvas, options);
|
|
1724
1761
|
}
|
|
1725
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
1726
1762
|
continue;
|
|
1727
1763
|
}
|
|
1728
1764
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|
|
@@ -2420,14 +2456,10 @@ const ExportModule = {
|
|
|
2420
2456
|
renderOptions.bounds = canvas.bounds;
|
|
2421
2457
|
}
|
|
2422
2458
|
canvas.save();
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
leaf.fill = oldFill;
|
|
2428
|
-
} else {
|
|
2429
|
-
leaf.__render(canvas, renderOptions);
|
|
2430
|
-
}
|
|
2459
|
+
const igroneFill = isFrame && !draw.isUndefined(fill), oldFill = leaf.get("fill");
|
|
2460
|
+
if (igroneFill) leaf.fill = "";
|
|
2461
|
+
draw.Platform.render(leaf, canvas, renderOptions);
|
|
2462
|
+
if (igroneFill) leaf.fill = oldFill;
|
|
2431
2463
|
canvas.restore();
|
|
2432
2464
|
if (sliceLeaf) sliceLeaf.__updateWorldOpacity();
|
|
2433
2465
|
if (trim) {
|