leafer-ui 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/README.md +97 -86
- 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 +281 -188
- 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 +290 -188
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.cjs
CHANGED
|
@@ -39,7 +39,7 @@ class LeaferCanvas extends core.LeaferCanvasBase {
|
|
|
39
39
|
}
|
|
40
40
|
if (core.Platform.syncDomFont && !this.parentView) {
|
|
41
41
|
style.display = "none";
|
|
42
|
-
document.body.appendChild(this.view);
|
|
42
|
+
if (document.body) document.body.appendChild(this.view);
|
|
43
43
|
}
|
|
44
44
|
this.__createContext();
|
|
45
45
|
if (!this.autoLayout) this.resize(config);
|
|
@@ -635,6 +635,7 @@ class Renderer {
|
|
|
635
635
|
usePartRender: true,
|
|
636
636
|
maxFPS: 120
|
|
637
637
|
};
|
|
638
|
+
this.frames = [];
|
|
638
639
|
this.target = target;
|
|
639
640
|
this.canvas = canvas;
|
|
640
641
|
if (userConfig) this.config = core.DataHelper.default(userConfig, this.config);
|
|
@@ -764,7 +765,7 @@ class Renderer {
|
|
|
764
765
|
};
|
|
765
766
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
766
767
|
if (core.Debug.showRepaint) core.Debug.drawRepaint(canvas, bounds);
|
|
767
|
-
this.target
|
|
768
|
+
core.Platform.render(this.target, canvas, options);
|
|
768
769
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
769
770
|
this.renderOptions = options;
|
|
770
771
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -787,12 +788,15 @@ class Renderer {
|
|
|
787
788
|
const target = this.target;
|
|
788
789
|
if (this.requestTime || !target) return;
|
|
789
790
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
790
|
-
|
|
791
|
+
this.requestTime = this.frameTime || Date.now();
|
|
791
792
|
const render = () => {
|
|
792
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
793
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
793
794
|
const {maxFPS: maxFPS} = this.config;
|
|
794
|
-
if (maxFPS && nowFPS > maxFPS
|
|
795
|
-
|
|
795
|
+
if (maxFPS && nowFPS > maxFPS) return core.Platform.requestRender(render);
|
|
796
|
+
const {frames: frames} = this;
|
|
797
|
+
if (frames.length > 30) frames.shift();
|
|
798
|
+
frames.push(nowFPS);
|
|
799
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
796
800
|
this.requestTime = 0;
|
|
797
801
|
this.checkRender();
|
|
798
802
|
};
|
|
@@ -1040,6 +1044,15 @@ Object.assign(core.Creator, {
|
|
|
1040
1044
|
|
|
1041
1045
|
core.Platform.layout = Layouter.fullLayout;
|
|
1042
1046
|
|
|
1047
|
+
core.Platform.render = function(target, canvas, options) {
|
|
1048
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
1049
|
+
topRendering: true
|
|
1050
|
+
});
|
|
1051
|
+
options.topList = new core.LeafList;
|
|
1052
|
+
target.__render(canvas, options);
|
|
1053
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1043
1056
|
const PointerEventHelper = {
|
|
1044
1057
|
convert(e, local) {
|
|
1045
1058
|
const base = core$1.InteractionHelper.getBase(e), {x: x, y: y} = local;
|
|
@@ -1561,24 +1574,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
1561
1574
|
}
|
|
1562
1575
|
}
|
|
1563
1576
|
|
|
1564
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
1577
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = core.BoundsHelper;
|
|
1578
|
+
|
|
1579
|
+
const tempBounds$1 = {};
|
|
1565
1580
|
|
|
1566
1581
|
function shape(ui, current, options) {
|
|
1567
1582
|
const canvas = current.getSameCanvas();
|
|
1568
|
-
const nowWorld = ui.__nowWorld,
|
|
1569
|
-
|
|
1583
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
1584
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
1585
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
1586
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
1587
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
1570
1588
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
1571
|
-
if (currentBounds.includes(
|
|
1589
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
1572
1590
|
worldCanvas = canvas;
|
|
1573
|
-
bounds = shapeBounds =
|
|
1591
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
1592
|
+
renderBounds = nowWorld;
|
|
1574
1593
|
} else {
|
|
1575
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
1576
1594
|
let worldClipBounds;
|
|
1577
1595
|
if (core.Platform.fullImageShadow) {
|
|
1578
|
-
worldClipBounds =
|
|
1596
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
1579
1597
|
} else {
|
|
1580
|
-
const spreadBounds =
|
|
1581
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
1598
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, core.FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
1599
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
1582
1600
|
}
|
|
1583
1601
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
1584
1602
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -1588,8 +1606,10 @@ function shape(ui, current, options) {
|
|
|
1588
1606
|
scaleX *= fitScaleX;
|
|
1589
1607
|
scaleY *= fitScaleY;
|
|
1590
1608
|
}
|
|
1591
|
-
shapeBounds = getOuterOf(
|
|
1609
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
1592
1610
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1611
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
1612
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
1593
1613
|
const userMatrix = options.matrix;
|
|
1594
1614
|
if (userMatrix) {
|
|
1595
1615
|
matrix = new core.Matrix(fitMatrix);
|
|
@@ -1608,6 +1628,7 @@ function shape(ui, current, options) {
|
|
|
1608
1628
|
matrix: matrix,
|
|
1609
1629
|
fitMatrix: fitMatrix,
|
|
1610
1630
|
bounds: bounds,
|
|
1631
|
+
renderBounds: renderBounds,
|
|
1611
1632
|
worldCanvas: worldCanvas,
|
|
1612
1633
|
shapeBounds: shapeBounds,
|
|
1613
1634
|
scaleX: scaleX,
|
|
@@ -1711,7 +1732,7 @@ const PaintModule = {
|
|
|
1711
1732
|
shape: shape
|
|
1712
1733
|
};
|
|
1713
1734
|
|
|
1714
|
-
let origin = {}, tempMatrix = core.getMatrixData();
|
|
1735
|
+
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
1715
1736
|
|
|
1716
1737
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1717
1738
|
|
|
@@ -1726,12 +1747,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
1726
1747
|
data.transform = transform;
|
|
1727
1748
|
}
|
|
1728
1749
|
|
|
1729
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
1750
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
1730
1751
|
const transform = get$3();
|
|
1731
1752
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1732
|
-
if (
|
|
1733
|
-
tempMatrix.a =
|
|
1734
|
-
multiplyParent(transform, tempMatrix);
|
|
1753
|
+
if (clipScaleX) {
|
|
1754
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
1755
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1735
1756
|
}
|
|
1736
1757
|
data.transform = transform;
|
|
1737
1758
|
}
|
|
@@ -1832,7 +1853,12 @@ function getPatternData(paint, box, image) {
|
|
|
1832
1853
|
|
|
1833
1854
|
case "normal":
|
|
1834
1855
|
case "clip":
|
|
1835
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
1856
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
1857
|
+
let clipScaleX, clipScaleY;
|
|
1858
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1859
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1860
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1861
|
+
}
|
|
1836
1862
|
break;
|
|
1837
1863
|
|
|
1838
1864
|
case "repeat":
|
|
@@ -1990,7 +2016,7 @@ function ignoreRender(ui, value) {
|
|
|
1990
2016
|
|
|
1991
2017
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1992
2018
|
|
|
1993
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
2019
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1994
2020
|
|
|
1995
2021
|
function createPattern(ui, paint, pixelRatio) {
|
|
1996
2022
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -2039,8 +2065,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
2039
2065
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
2040
2066
|
const canvasWidth = width + (xGap || 0);
|
|
2041
2067
|
const canvasHeight = height + (yGap || 0);
|
|
2042
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
2043
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
2068
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
2069
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
2044
2070
|
if (!imageMatrix) {
|
|
2045
2071
|
imageMatrix = get$1();
|
|
2046
2072
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -2099,17 +2125,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
2099
2125
|
if (allowDraw) {
|
|
2100
2126
|
if (data.repeat) {
|
|
2101
2127
|
allowDraw = false;
|
|
2102
|
-
} else {
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
height *= data.scaleY;
|
|
2110
|
-
}
|
|
2111
|
-
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
2128
|
+
} else if (!(paint.changeful || core.Platform.name === "miniapp" && core.ResizeEvent.isResizing(ui) || draw.Export.running)) {
|
|
2129
|
+
let {width: width, height: height} = data;
|
|
2130
|
+
width *= scaleX * pixelRatio;
|
|
2131
|
+
height *= scaleY * pixelRatio;
|
|
2132
|
+
if (data.scaleX) {
|
|
2133
|
+
width *= data.scaleX;
|
|
2134
|
+
height *= data.scaleY;
|
|
2112
2135
|
}
|
|
2136
|
+
allowDraw = width * height > core.Platform.image.maxCacheSize;
|
|
2113
2137
|
}
|
|
2114
2138
|
}
|
|
2115
2139
|
if (allowDraw) {
|
|
@@ -2289,20 +2313,20 @@ const PaintGradientModule = {
|
|
|
2289
2313
|
getTransform: getTransform
|
|
2290
2314
|
};
|
|
2291
2315
|
|
|
2292
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper;
|
|
2316
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
2293
2317
|
|
|
2294
|
-
const tempBounds = {};
|
|
2318
|
+
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
2295
2319
|
|
|
2296
2320
|
const offsetOutBounds$1 = {};
|
|
2297
2321
|
|
|
2298
2322
|
function shadow(ui, current, shape) {
|
|
2299
|
-
let copyBounds,
|
|
2300
|
-
const {__nowWorld: nowWorld
|
|
2323
|
+
let copyBounds, transform;
|
|
2324
|
+
const {__nowWorld: nowWorld} = ui;
|
|
2301
2325
|
const {shadow: shadow} = ui.__;
|
|
2302
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
2326
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
2303
2327
|
const other = current.getSameCanvas();
|
|
2304
2328
|
const end = shadow.length - 1;
|
|
2305
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
2329
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
2306
2330
|
shadow.forEach((item, index) => {
|
|
2307
2331
|
let otherScale = 1;
|
|
2308
2332
|
if (item.scaleFixed) {
|
|
@@ -2310,54 +2334,61 @@ function shadow(ui, current, shape) {
|
|
|
2310
2334
|
if (sx > 1) otherScale = 1 / sx;
|
|
2311
2335
|
}
|
|
2312
2336
|
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));
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2337
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
2338
|
+
if (transform) other.setTransform(transform);
|
|
2339
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
2340
|
+
if (transform) other.resetTransform();
|
|
2341
|
+
copyBounds = renderBounds;
|
|
2316
2342
|
if (item.box) {
|
|
2317
2343
|
other.restore();
|
|
2318
2344
|
other.save();
|
|
2319
2345
|
if (worldCanvas) {
|
|
2320
|
-
other.copyWorld(other,
|
|
2346
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
2321
2347
|
copyBounds = nowWorld;
|
|
2322
2348
|
}
|
|
2323
2349
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
2324
2350
|
}
|
|
2325
|
-
|
|
2351
|
+
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
2326
2352
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
2327
2353
|
});
|
|
2328
2354
|
other.recycle(copyBounds);
|
|
2329
2355
|
}
|
|
2330
2356
|
|
|
2331
|
-
function
|
|
2332
|
-
let
|
|
2333
|
-
shadow.forEach(item =>
|
|
2334
|
-
|
|
2357
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
2358
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
2359
|
+
shadow.forEach(item => {
|
|
2360
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
2361
|
+
top = max(top, spread + blur - y);
|
|
2362
|
+
right = max(right, spread + blur + x);
|
|
2363
|
+
bottom = max(bottom, spread + blur + y);
|
|
2364
|
+
left = max(left, spread + blur - x);
|
|
2365
|
+
});
|
|
2366
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
2370
|
+
if (shadow.spread) {
|
|
2371
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
2372
|
+
tempMatrix.set().scaleOfOuter({
|
|
2373
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
2374
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
2375
|
+
}, spreadScale);
|
|
2376
|
+
return tempMatrix;
|
|
2377
|
+
}
|
|
2378
|
+
return undefined;
|
|
2335
2379
|
}
|
|
2336
2380
|
|
|
2337
|
-
function drawWorldShadow(canvas, outBounds,
|
|
2338
|
-
const {
|
|
2381
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
2382
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
2383
|
+
let from, to;
|
|
2339
2384
|
if (core.Platform.fullImageShadow) {
|
|
2340
2385
|
copy(tempBounds, canvas.bounds);
|
|
2341
|
-
tempBounds.x
|
|
2342
|
-
|
|
2343
|
-
if (spreadScale) {
|
|
2344
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
2345
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
2346
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
2347
|
-
tempBounds.width *= spreadScale;
|
|
2348
|
-
tempBounds.height *= spreadScale;
|
|
2349
|
-
}
|
|
2350
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
2386
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
2387
|
+
from = canvas.bounds, to = tempBounds;
|
|
2351
2388
|
} else {
|
|
2352
|
-
|
|
2353
|
-
copy(tempBounds, outBounds);
|
|
2354
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
2355
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
2356
|
-
tempBounds.width *= spreadScale;
|
|
2357
|
-
tempBounds.height *= spreadScale;
|
|
2358
|
-
}
|
|
2359
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
2389
|
+
from = shapeBounds, to = outBounds;
|
|
2360
2390
|
}
|
|
2391
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
2361
2392
|
}
|
|
2362
2393
|
|
|
2363
2394
|
const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
@@ -2365,13 +2396,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = core.BoundsHelper;
|
|
|
2365
2396
|
const offsetOutBounds = {};
|
|
2366
2397
|
|
|
2367
2398
|
function innerShadow(ui, current, shape) {
|
|
2368
|
-
let copyBounds,
|
|
2369
|
-
const {__nowWorld: nowWorld
|
|
2399
|
+
let copyBounds, transform;
|
|
2400
|
+
const {__nowWorld: nowWorld} = ui;
|
|
2370
2401
|
const {innerShadow: innerShadow} = ui.__;
|
|
2371
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
2402
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
2372
2403
|
const other = current.getSameCanvas();
|
|
2373
2404
|
const end = innerShadow.length - 1;
|
|
2374
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
2405
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
2375
2406
|
innerShadow.forEach((item, index) => {
|
|
2376
2407
|
let otherScale = 1;
|
|
2377
2408
|
if (item.scaleFixed) {
|
|
@@ -2380,16 +2411,17 @@ function innerShadow(ui, current, shape) {
|
|
|
2380
2411
|
}
|
|
2381
2412
|
other.save();
|
|
2382
2413
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
2383
|
-
|
|
2384
|
-
|
|
2414
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
2415
|
+
if (transform) other.setTransform(transform);
|
|
2416
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
2385
2417
|
other.restore();
|
|
2386
2418
|
if (worldCanvas) {
|
|
2387
|
-
other.copyWorld(other,
|
|
2419
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
2388
2420
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
2389
2421
|
copyBounds = nowWorld;
|
|
2390
2422
|
} else {
|
|
2391
2423
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
2392
|
-
copyBounds =
|
|
2424
|
+
copyBounds = renderBounds;
|
|
2393
2425
|
}
|
|
2394
2426
|
other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), "source-in");
|
|
2395
2427
|
core.LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -2398,6 +2430,8 @@ function innerShadow(ui, current, shape) {
|
|
|
2398
2430
|
other.recycle(copyBounds);
|
|
2399
2431
|
}
|
|
2400
2432
|
|
|
2433
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
2434
|
+
|
|
2401
2435
|
function blur(ui, current, origin) {
|
|
2402
2436
|
const {blur: blur} = ui.__;
|
|
2403
2437
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -2412,10 +2446,12 @@ const EffectModule = {
|
|
|
2412
2446
|
innerShadow: innerShadow,
|
|
2413
2447
|
blur: blur,
|
|
2414
2448
|
backgroundBlur: backgroundBlur,
|
|
2415
|
-
|
|
2449
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
2450
|
+
getShadowTransform: getShadowTransform,
|
|
2416
2451
|
isTransformShadow(_shadow) {
|
|
2417
2452
|
return undefined;
|
|
2418
|
-
}
|
|
2453
|
+
},
|
|
2454
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
2419
2455
|
};
|
|
2420
2456
|
|
|
2421
2457
|
const {excludeRenderBounds: excludeRenderBounds} = core.LeafBoundsHelper;
|
|
@@ -2432,6 +2468,7 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
2432
2468
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
2433
2469
|
maskCanvas = contentCanvas = null;
|
|
2434
2470
|
}
|
|
2471
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
2435
2472
|
maskOpacity = child.__.opacity;
|
|
2436
2473
|
usedGrayscaleAlpha = false;
|
|
2437
2474
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -2449,7 +2486,6 @@ draw.Group.prototype.__renderMask = function(canvas, options) {
|
|
|
2449
2486
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
2450
2487
|
child.__render(maskCanvas, options);
|
|
2451
2488
|
}
|
|
2452
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
2453
2489
|
continue;
|
|
2454
2490
|
}
|
|
2455
2491
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|