@visactor/react-vchart 2.0.22-alpha.0 → 2.0.22-alpha.1
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/build/index.js +363 -102
- package/build/index.min.js +3 -3
- package/package.json +5 -5
package/build/index.js
CHANGED
|
@@ -9936,7 +9936,9 @@
|
|
|
9936
9936
|
background: null,
|
|
9937
9937
|
autoAnimateTexture: !1,
|
|
9938
9938
|
textureRatio: 1,
|
|
9939
|
-
textureOptions:
|
|
9939
|
+
textureOptions: {
|
|
9940
|
+
alignToGraphic: !0
|
|
9941
|
+
},
|
|
9940
9942
|
backgroundOpacity: 1,
|
|
9941
9943
|
backgroundCornerRadius: 0,
|
|
9942
9944
|
texture: null,
|
|
@@ -9950,6 +9952,7 @@
|
|
|
9950
9952
|
backgroundScale: 1,
|
|
9951
9953
|
backgroundOffsetX: 0,
|
|
9952
9954
|
backgroundOffsetY: 0,
|
|
9955
|
+
backgroundPosition: "top-left",
|
|
9953
9956
|
blur: 0,
|
|
9954
9957
|
filter: "",
|
|
9955
9958
|
cursor: null,
|
|
@@ -10122,11 +10125,16 @@
|
|
|
10122
10125
|
const DefaultImageAttribute = Object.assign(Object.assign({
|
|
10123
10126
|
repeatX: "no-repeat",
|
|
10124
10127
|
repeatY: "no-repeat",
|
|
10128
|
+
imageMode: void 0,
|
|
10125
10129
|
image: "",
|
|
10126
10130
|
width: 0,
|
|
10127
10131
|
height: 0,
|
|
10128
10132
|
maxWidth: 500,
|
|
10129
|
-
maxHeight: 500
|
|
10133
|
+
maxHeight: 500,
|
|
10134
|
+
imagePosition: "top-left",
|
|
10135
|
+
imageScale: 1,
|
|
10136
|
+
imageOffsetX: 0,
|
|
10137
|
+
imageOffsetY: 0
|
|
10130
10138
|
}, DefaultAttribute), {
|
|
10131
10139
|
fill: !0,
|
|
10132
10140
|
cornerRadius: 0,
|
|
@@ -15178,7 +15186,8 @@
|
|
|
15178
15186
|
return isString$1(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
|
|
15179
15187
|
}
|
|
15180
15188
|
loadImage(image, background = !1) {
|
|
15181
|
-
if (
|
|
15189
|
+
if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
|
|
15190
|
+
if (!image) return;
|
|
15182
15191
|
const url = image;
|
|
15183
15192
|
this.resources || (this.resources = new Map());
|
|
15184
15193
|
const cache = {
|
|
@@ -15233,7 +15242,7 @@
|
|
|
15233
15242
|
}
|
|
15234
15243
|
}
|
|
15235
15244
|
function backgroundNotImage(image) {
|
|
15236
|
-
return !(!image.fill && !image.stroke);
|
|
15245
|
+
return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
|
|
15237
15246
|
}
|
|
15238
15247
|
function isExternalTexture(texture) {
|
|
15239
15248
|
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
|
|
@@ -17369,7 +17378,7 @@
|
|
|
17369
17378
|
return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
|
|
17370
17379
|
}
|
|
17371
17380
|
|
|
17372
|
-
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
17381
|
+
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
17373
17382
|
class Image extends Graphic {
|
|
17374
17383
|
constructor(params) {
|
|
17375
17384
|
super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
|
|
@@ -17474,6 +17483,7 @@
|
|
|
17474
17483
|
}
|
|
17475
17484
|
Image.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
17476
17485
|
image: 1,
|
|
17486
|
+
imageMode: 1,
|
|
17477
17487
|
repeatX: 1,
|
|
17478
17488
|
repeatY: 1
|
|
17479
17489
|
}, NOWORK_ANIMATE_ATTR);
|
|
@@ -18667,11 +18677,12 @@
|
|
|
18667
18677
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
18668
18678
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
18669
18679
|
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
18670
|
-
backgroundClip = graphicAttribute.backgroundClip
|
|
18680
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
18681
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
18671
18682
|
} = graphic.attribute;
|
|
18672
18683
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
18673
|
-
const res = graphic.resources.get(background);
|
|
18674
|
-
if ("success" !== res.state || !res.data) return;
|
|
18684
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
18685
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
18675
18686
|
if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
|
|
18676
18687
|
const groupAttribute = getTheme$1(graphic.parent).group,
|
|
18677
18688
|
{
|
|
@@ -18688,59 +18699,160 @@
|
|
|
18688
18699
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
18689
18700
|
backgroundScale: backgroundScale,
|
|
18690
18701
|
backgroundOffsetX: backgroundOffsetX,
|
|
18691
|
-
backgroundOffsetY: backgroundOffsetY
|
|
18702
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
18703
|
+
backgroundPosition: backgroundPosition
|
|
18692
18704
|
}), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
|
|
18693
18705
|
} else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
18694
18706
|
}
|
|
18695
18707
|
doDrawImage(context, data, b, params) {
|
|
18696
|
-
|
|
18697
|
-
backgroundMode: backgroundMode,
|
|
18698
|
-
backgroundFit: backgroundFit,
|
|
18699
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
18700
|
-
backgroundScale = 1,
|
|
18701
|
-
backgroundOffsetX = 0,
|
|
18702
|
-
backgroundOffsetY = 0
|
|
18703
|
-
} = params,
|
|
18704
|
-
targetW = b.width(),
|
|
18705
|
-
targetH = b.height();
|
|
18706
|
-
let w = targetW,
|
|
18707
|
-
h = targetH;
|
|
18708
|
-
if ("no-repeat" === backgroundMode) {
|
|
18709
|
-
if (backgroundFit) {
|
|
18710
|
-
if (backgroundKeepAspectRatio) {
|
|
18711
|
-
const maxScale = Math.max(targetW / data.width, targetH / data.height);
|
|
18712
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
|
|
18713
|
-
} else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
18714
|
-
} else {
|
|
18715
|
-
const resW = data.width * backgroundScale,
|
|
18716
|
-
resH = data.height * backgroundScale;
|
|
18717
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
|
|
18718
|
-
}
|
|
18719
|
-
} else {
|
|
18720
|
-
if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
|
|
18721
|
-
const resW = data.width,
|
|
18722
|
-
resH = data.height;
|
|
18723
|
-
if ("repeat-x" === backgroundMode) {
|
|
18724
|
-
w = resW * (targetH / resH), h = targetH;
|
|
18725
|
-
} else if ("repeat-y" === backgroundMode) {
|
|
18726
|
-
h = resH * (targetW / resW), w = targetW;
|
|
18727
|
-
}
|
|
18728
|
-
const dpr = context.dpr,
|
|
18729
|
-
canvas = canvasAllocate.allocate({
|
|
18730
|
-
width: w,
|
|
18731
|
-
height: h,
|
|
18732
|
-
dpr: dpr
|
|
18733
|
-
}),
|
|
18734
|
-
ctx = canvas.getContext("2d");
|
|
18735
|
-
ctx && (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, w, h), ctx.drawImage(data, 0, 0, w, h), data = canvas.nativeCanvas), canvasAllocate.free(canvas);
|
|
18736
|
-
}
|
|
18737
|
-
const dpr = context.dpr,
|
|
18738
|
-
pattern = context.createPattern(data, backgroundMode);
|
|
18739
|
-
pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0])), context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, targetW, targetH), context.translate(-b.x1, -b.y1);
|
|
18740
|
-
}
|
|
18708
|
+
drawBackgroundImage(context, data, b, params);
|
|
18741
18709
|
}
|
|
18742
18710
|
}
|
|
18743
18711
|
const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
|
|
18712
|
+
const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
|
|
18713
|
+
function getBackgroundImage(background) {
|
|
18714
|
+
var _a;
|
|
18715
|
+
return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
18716
|
+
}
|
|
18717
|
+
function resolveBackgroundSizing({
|
|
18718
|
+
backgroundFit: backgroundFit,
|
|
18719
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
18720
|
+
}) {
|
|
18721
|
+
return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
|
|
18722
|
+
}
|
|
18723
|
+
const NO_REPEAT_SIZING_MAP = {
|
|
18724
|
+
"no-repeat-cover": "cover",
|
|
18725
|
+
"no-repeat-contain": "contain",
|
|
18726
|
+
"no-repeat-fill": "fill",
|
|
18727
|
+
"no-repeat-auto": "auto"
|
|
18728
|
+
};
|
|
18729
|
+
function resolveBackgroundDrawMode({
|
|
18730
|
+
backgroundMode: backgroundMode,
|
|
18731
|
+
backgroundFit: backgroundFit,
|
|
18732
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
18733
|
+
}) {
|
|
18734
|
+
const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
|
|
18735
|
+
return sizing ? {
|
|
18736
|
+
backgroundRepeatMode: "no-repeat",
|
|
18737
|
+
backgroundSizing: sizing
|
|
18738
|
+
} : {
|
|
18739
|
+
backgroundRepeatMode: backgroundMode,
|
|
18740
|
+
backgroundSizing: resolveBackgroundSizing({
|
|
18741
|
+
backgroundFit: backgroundFit,
|
|
18742
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
18743
|
+
})
|
|
18744
|
+
};
|
|
18745
|
+
}
|
|
18746
|
+
function isPercentageValue(value) {
|
|
18747
|
+
return /^-?\d+(\.\d+)?%$/.test(value);
|
|
18748
|
+
}
|
|
18749
|
+
function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
|
|
18750
|
+
if ("number" == typeof value && Number.isFinite(value)) return value;
|
|
18751
|
+
const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
|
|
18752
|
+
if (!normalizedValue || normalizedValue === startKeyword) return 0;
|
|
18753
|
+
if (normalizedValue === centerKeyword) return remainSpace / 2;
|
|
18754
|
+
if (normalizedValue === endKeyword) return remainSpace;
|
|
18755
|
+
if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
|
|
18756
|
+
const parsedValue = Number(normalizedValue);
|
|
18757
|
+
return Number.isFinite(parsedValue) ? parsedValue : 0;
|
|
18758
|
+
}
|
|
18759
|
+
function normalizeBackgroundPosition(position) {
|
|
18760
|
+
var _a, _b;
|
|
18761
|
+
if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
|
|
18762
|
+
const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
|
|
18763
|
+
if (0 === tokens.length) return ["left", "top"];
|
|
18764
|
+
if (1 === tokens.length) {
|
|
18765
|
+
const token = tokens[0];
|
|
18766
|
+
return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
|
|
18767
|
+
}
|
|
18768
|
+
let horizontal, vertical;
|
|
18769
|
+
const genericTokens = [];
|
|
18770
|
+
for (let i = 0; i < 2; i++) {
|
|
18771
|
+
const token = tokens[i];
|
|
18772
|
+
"left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
|
|
18773
|
+
}
|
|
18774
|
+
return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
|
|
18775
|
+
}
|
|
18776
|
+
function resolveBackgroundPosition(position, remainWidth, remainHeight) {
|
|
18777
|
+
const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
|
|
18778
|
+
return {
|
|
18779
|
+
x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
|
|
18780
|
+
y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
|
|
18781
|
+
};
|
|
18782
|
+
}
|
|
18783
|
+
function pickRenderableDimension(...values) {
|
|
18784
|
+
for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
|
|
18785
|
+
return null;
|
|
18786
|
+
}
|
|
18787
|
+
function resolveRenderableImageSize(data) {
|
|
18788
|
+
if (!data) return null;
|
|
18789
|
+
const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
|
|
18790
|
+
height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
|
|
18791
|
+
return null == width || null == height ? null : {
|
|
18792
|
+
width: width,
|
|
18793
|
+
height: height
|
|
18794
|
+
};
|
|
18795
|
+
}
|
|
18796
|
+
function drawBackgroundImage(context, data, b, params) {
|
|
18797
|
+
var _a, _b;
|
|
18798
|
+
const {
|
|
18799
|
+
backgroundMode: backgroundMode,
|
|
18800
|
+
backgroundFit: backgroundFit,
|
|
18801
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
18802
|
+
backgroundScale = 1,
|
|
18803
|
+
backgroundOffsetX = 0,
|
|
18804
|
+
backgroundOffsetY = 0,
|
|
18805
|
+
backgroundPosition = "top-left"
|
|
18806
|
+
} = params,
|
|
18807
|
+
targetW = b.width(),
|
|
18808
|
+
targetH = b.height(),
|
|
18809
|
+
sourceSize = resolveRenderableImageSize(data),
|
|
18810
|
+
{
|
|
18811
|
+
backgroundRepeatMode: backgroundRepeatMode,
|
|
18812
|
+
backgroundSizing: resolvedBackgroundSizing
|
|
18813
|
+
} = resolveBackgroundDrawMode({
|
|
18814
|
+
backgroundMode: backgroundMode,
|
|
18815
|
+
backgroundFit: backgroundFit,
|
|
18816
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
18817
|
+
});
|
|
18818
|
+
let w = targetW,
|
|
18819
|
+
h = targetH;
|
|
18820
|
+
if (targetW <= 0 || targetH <= 0) return;
|
|
18821
|
+
if ("no-repeat" === backgroundRepeatMode) {
|
|
18822
|
+
let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
|
|
18823
|
+
drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
|
|
18824
|
+
if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
|
|
18825
|
+
const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
|
|
18826
|
+
drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
|
|
18827
|
+
}
|
|
18828
|
+
drawWidth *= backgroundScale, drawHeight *= backgroundScale;
|
|
18829
|
+
const {
|
|
18830
|
+
x: x,
|
|
18831
|
+
y: y
|
|
18832
|
+
} = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
|
|
18833
|
+
return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
|
|
18834
|
+
}
|
|
18835
|
+
if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
|
|
18836
|
+
const resW = sourceSize.width,
|
|
18837
|
+
resH = sourceSize.height;
|
|
18838
|
+
if ("repeat-x" === backgroundRepeatMode) {
|
|
18839
|
+
w = resW * (targetH / resH), h = targetH;
|
|
18840
|
+
} else if ("repeat-y" === backgroundRepeatMode) {
|
|
18841
|
+
h = resH * (targetW / resW), w = targetW;
|
|
18842
|
+
}
|
|
18843
|
+
const dpr = context.dpr,
|
|
18844
|
+
canvas = canvasAllocate.allocate({
|
|
18845
|
+
width: w,
|
|
18846
|
+
height: h,
|
|
18847
|
+
dpr: dpr
|
|
18848
|
+
}),
|
|
18849
|
+
ctx = canvas.getContext("2d");
|
|
18850
|
+
ctx && (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, w, h), ctx.drawImage(data, 0, 0, w, h), data = canvas.nativeCanvas), canvasAllocate.free(canvas);
|
|
18851
|
+
}
|
|
18852
|
+
const dpr = context.dpr,
|
|
18853
|
+
pattern = context.createPattern(data, backgroundRepeatMode);
|
|
18854
|
+
pattern.setTransform && pattern.setTransform(new DOMMatrix([1 / dpr, 0, 0, 1 / dpr, 0, 0])), context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, targetW, targetH), context.translate(-b.x1, -b.y1);
|
|
18855
|
+
}
|
|
18744
18856
|
let DefaultBaseInteractiveRenderContribution = class {
|
|
18745
18857
|
constructor(subRenderContribitions) {
|
|
18746
18858
|
this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
@@ -18899,7 +19011,7 @@
|
|
|
18899
19011
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
18900
19012
|
}
|
|
18901
19013
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
18902
|
-
var _a;
|
|
19014
|
+
var _a, _b, _c, _d, _e;
|
|
18903
19015
|
const {
|
|
18904
19016
|
textureRatio = graphicAttribute.textureRatio,
|
|
18905
19017
|
textureOptions = null
|
|
@@ -18982,7 +19094,21 @@
|
|
|
18982
19094
|
null === (_a = textureOptions.beforeDynamicTexture) || void 0 === _a || _a.call(textureOptions, context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height()), context.beginPath(), !1 === parsedPath.draw(context, Math.min(sizeW - gutterColumn, sizeH - gutterRow), _x, _y, 0) && context.closePath(), context.fillStyle = textureColor, textureOptions.dynamicTexture(context, i, j, gridRows, gridColumns, textureRatio, graphic, b.width(), b.height());
|
|
18983
19095
|
}
|
|
18984
19096
|
useNewCanvas && (originalContext.globalAlpha = 1, originalContext.drawImage(newCanvas.nativeCanvas, 0, 0, newCanvas.nativeCanvas.width, newCanvas.nativeCanvas.height, b.x1, b.y1, b.width() * originalContext.dpr, b.height() * originalContext.dpr)), originalContext.restore();
|
|
18985
|
-
} else if (pattern)
|
|
19097
|
+
} else if (pattern) {
|
|
19098
|
+
if (pattern.setTransform) {
|
|
19099
|
+
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
19100
|
+
alignOffsetX = null !== (_b = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _b ? _b : 0,
|
|
19101
|
+
alignOffsetY = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _c ? _c : 0;
|
|
19102
|
+
let translateX = 0,
|
|
19103
|
+
translateY = 0;
|
|
19104
|
+
if (alignToGraphic) {
|
|
19105
|
+
const m = context.currentMatrix;
|
|
19106
|
+
translateX = (null !== (_d = null == m ? void 0 : m.e) && void 0 !== _d ? _d : 0) + x + alignOffsetX, translateY = (null !== (_e = null == m ? void 0 : m.f) && void 0 !== _e ? _e : 0) + y + alignOffsetY;
|
|
19107
|
+
} else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
|
|
19108
|
+
pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
|
|
19109
|
+
}
|
|
19110
|
+
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
|
|
19111
|
+
} else if ("wave" === texture) {
|
|
18986
19112
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
18987
19113
|
const b = graphic.AABBBounds;
|
|
18988
19114
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -19112,27 +19238,32 @@
|
|
|
19112
19238
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
19113
19239
|
const {
|
|
19114
19240
|
background: background,
|
|
19241
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
19242
|
+
opacity = graphicAttribute.opacity,
|
|
19115
19243
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
19116
19244
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
19117
19245
|
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
19118
19246
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
19119
19247
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
19120
|
-
backgroundOffsetY = graphicAttribute.backgroundOffsetY
|
|
19248
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
19249
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
19250
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
19121
19251
|
} = graphic.attribute;
|
|
19122
19252
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
19123
|
-
const res = graphic.resources.get(background);
|
|
19124
|
-
if ("success" !== res.state || !res.data) return;
|
|
19253
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
19254
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
19125
19255
|
context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
|
|
19126
19256
|
const b = graphic.AABBBounds;
|
|
19127
|
-
this.doDrawImage(context, res.data, b, {
|
|
19257
|
+
context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
|
|
19128
19258
|
backgroundMode: backgroundMode,
|
|
19129
19259
|
backgroundFit: backgroundFit,
|
|
19130
19260
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
19131
19261
|
backgroundScale: backgroundScale,
|
|
19132
19262
|
backgroundOffsetX: backgroundOffsetX,
|
|
19133
|
-
backgroundOffsetY: backgroundOffsetY
|
|
19263
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
19264
|
+
backgroundPosition: backgroundPosition
|
|
19134
19265
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
19135
|
-
} else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
19266
|
+
} else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
19136
19267
|
}
|
|
19137
19268
|
}
|
|
19138
19269
|
const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
|
|
@@ -20614,9 +20745,17 @@
|
|
|
20614
20745
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
20615
20746
|
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
20616
20747
|
const {
|
|
20748
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
20749
|
+
opacity = graphicAttribute.opacity,
|
|
20617
20750
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
20618
20751
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
20619
|
-
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
|
|
20752
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
20753
|
+
backgroundScale = graphicAttribute.backgroundScale,
|
|
20754
|
+
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
20755
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
20756
|
+
backgroundPosition = graphicAttribute.backgroundPosition,
|
|
20757
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
20758
|
+
backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
|
|
20620
20759
|
} = graphic.attribute;
|
|
20621
20760
|
let matrix,
|
|
20622
20761
|
{
|
|
@@ -20628,18 +20767,18 @@
|
|
|
20628
20767
|
};
|
|
20629
20768
|
let b;
|
|
20630
20769
|
"richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
|
|
20631
|
-
const
|
|
20770
|
+
const backgroundConfig = isObject$2(background) && background.background ? background : null,
|
|
20632
20771
|
onlyTranslate = graphic.transMatrix.onlyTranslate();
|
|
20633
|
-
if (
|
|
20772
|
+
if (backgroundConfig) {
|
|
20634
20773
|
const _b = graphic.AABBBounds,
|
|
20635
|
-
x = (null !== (_a =
|
|
20636
|
-
y = (null !== (_d =
|
|
20637
|
-
w = null !== (_f =
|
|
20638
|
-
h = null !== (_g =
|
|
20639
|
-
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background =
|
|
20774
|
+
x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
|
|
20775
|
+
y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
|
|
20776
|
+
w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
|
|
20777
|
+
h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
|
|
20778
|
+
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
|
|
20640
20779
|
const w = b.width(),
|
|
20641
20780
|
h = b.height();
|
|
20642
|
-
b.set((null !== (_h =
|
|
20781
|
+
b.set((null !== (_h = backgroundConfig.x) && void 0 !== _h ? _h : 0) + (null !== (_j = backgroundConfig.dx) && void 0 !== _j ? _j : 0), (null !== (_k = backgroundConfig.y) && void 0 !== _k ? _k : 0) + (null !== (_l = backgroundConfig.dy) && void 0 !== _l ? _l : 0), w, h);
|
|
20643
20782
|
}
|
|
20644
20783
|
} else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
|
|
20645
20784
|
angle: 0,
|
|
@@ -20652,20 +20791,18 @@
|
|
|
20652
20791
|
})).clone());
|
|
20653
20792
|
if (graphic.backgroundImg && graphic.resources) {
|
|
20654
20793
|
const res = graphic.resources.get(background);
|
|
20655
|
-
if ("success" !== res.state || !res.data) return void restore();
|
|
20656
|
-
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.
|
|
20794
|
+
if (!res || "success" !== res.state || !res.data) return void restore();
|
|
20795
|
+
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.globalAlpha = backgroundOpacity * opacity, backgroundClip && (context.beginPath(), backgroundCornerRadius ? createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0) : context.rect(b.x1, b.y1, b.width(), b.height()), context.clip()), this.doDrawImage(context, res.data, b, {
|
|
20657
20796
|
backgroundMode: backgroundMode,
|
|
20658
20797
|
backgroundFit: backgroundFit,
|
|
20659
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
20798
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20799
|
+
backgroundScale: backgroundScale,
|
|
20800
|
+
backgroundOffsetX: backgroundOffsetX,
|
|
20801
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
20802
|
+
backgroundPosition: backgroundPosition
|
|
20660
20803
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
20661
|
-
} else
|
|
20662
|
-
|
|
20663
|
-
backgroundCornerRadius: backgroundCornerRadius,
|
|
20664
|
-
backgroundOpacity = 1
|
|
20665
|
-
} = graphic.attribute;
|
|
20666
|
-
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity, context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
|
|
20667
|
-
}
|
|
20668
|
-
shouldReCalBounds && boundsAllocate.free(b), restore();
|
|
20804
|
+
} else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
|
|
20805
|
+
backgroundConfig && boundsAllocate.free(b), restore();
|
|
20669
20806
|
}
|
|
20670
20807
|
}
|
|
20671
20808
|
const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
|
|
@@ -21092,6 +21229,92 @@
|
|
|
21092
21229
|
};
|
|
21093
21230
|
};
|
|
21094
21231
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
21232
|
+
function resolveImageMode({
|
|
21233
|
+
repeatX = "no-repeat",
|
|
21234
|
+
repeatY = "no-repeat",
|
|
21235
|
+
imageMode: imageMode
|
|
21236
|
+
}) {
|
|
21237
|
+
const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
|
|
21238
|
+
return {
|
|
21239
|
+
repeatMode: repeatMode,
|
|
21240
|
+
sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
|
|
21241
|
+
};
|
|
21242
|
+
}
|
|
21243
|
+
const IMAGE_MODE_TO_BACKGROUND_MODE = {
|
|
21244
|
+
cover: "no-repeat-cover",
|
|
21245
|
+
contain: "no-repeat-contain",
|
|
21246
|
+
fill: "no-repeat-fill",
|
|
21247
|
+
auto: "no-repeat-auto"
|
|
21248
|
+
};
|
|
21249
|
+
function resolveBackgroundParamsByImageSizing(sizingMode) {
|
|
21250
|
+
return {
|
|
21251
|
+
backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
|
|
21252
|
+
backgroundFit: !1,
|
|
21253
|
+
backgroundKeepAspectRatio: !1
|
|
21254
|
+
};
|
|
21255
|
+
}
|
|
21256
|
+
function resolveImageRepeatMode(repeatX, repeatY) {
|
|
21257
|
+
let repeat = 0;
|
|
21258
|
+
return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
|
|
21259
|
+
}
|
|
21260
|
+
function shouldClipImageByLayout({
|
|
21261
|
+
repeatX = "no-repeat",
|
|
21262
|
+
repeatY = "no-repeat",
|
|
21263
|
+
imageMode: imageMode,
|
|
21264
|
+
imageScale = 1,
|
|
21265
|
+
imageOffsetX = 0,
|
|
21266
|
+
imageOffsetY = 0,
|
|
21267
|
+
imagePosition = "top-left"
|
|
21268
|
+
}) {
|
|
21269
|
+
const {
|
|
21270
|
+
repeatMode: repeatMode,
|
|
21271
|
+
sizingMode: sizingMode
|
|
21272
|
+
} = resolveImageMode({
|
|
21273
|
+
repeatX: repeatX,
|
|
21274
|
+
repeatY: repeatY,
|
|
21275
|
+
imageMode: imageMode
|
|
21276
|
+
});
|
|
21277
|
+
return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
|
|
21278
|
+
}
|
|
21279
|
+
function drawImageWithLayout(context, data, x, y, width, height, {
|
|
21280
|
+
repeatX = "no-repeat",
|
|
21281
|
+
repeatY = "no-repeat",
|
|
21282
|
+
imageMode: imageMode,
|
|
21283
|
+
imageScale = 1,
|
|
21284
|
+
imageOffsetX = 0,
|
|
21285
|
+
imageOffsetY = 0,
|
|
21286
|
+
imagePosition = "top-left"
|
|
21287
|
+
}) {
|
|
21288
|
+
const {
|
|
21289
|
+
repeatMode: repeatMode,
|
|
21290
|
+
sizingMode: sizingMode
|
|
21291
|
+
} = resolveImageMode({
|
|
21292
|
+
repeatX: repeatX,
|
|
21293
|
+
repeatY: repeatY,
|
|
21294
|
+
imageMode: imageMode
|
|
21295
|
+
}),
|
|
21296
|
+
imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
|
|
21297
|
+
backgroundMode: repeatMode,
|
|
21298
|
+
backgroundFit: !1,
|
|
21299
|
+
backgroundKeepAspectRatio: !1
|
|
21300
|
+
};
|
|
21301
|
+
drawBackgroundImage(context, data, {
|
|
21302
|
+
x1: x,
|
|
21303
|
+
y1: y,
|
|
21304
|
+
x2: x + width,
|
|
21305
|
+
y2: y + height,
|
|
21306
|
+
width: () => width,
|
|
21307
|
+
height: () => height
|
|
21308
|
+
}, {
|
|
21309
|
+
backgroundMode: imageBackgroundParams.backgroundMode,
|
|
21310
|
+
backgroundFit: imageBackgroundParams.backgroundFit,
|
|
21311
|
+
backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
|
|
21312
|
+
backgroundScale: imageScale,
|
|
21313
|
+
backgroundOffsetX: imageOffsetX,
|
|
21314
|
+
backgroundOffsetY: imageOffsetY,
|
|
21315
|
+
backgroundPosition: imagePosition
|
|
21316
|
+
});
|
|
21317
|
+
}
|
|
21095
21318
|
let DefaultCanvasImageRender = class extends BaseRender {
|
|
21096
21319
|
constructor(graphicRenderContributions) {
|
|
21097
21320
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -21106,6 +21329,11 @@
|
|
|
21106
21329
|
cornerRadius = imageAttribute.cornerRadius,
|
|
21107
21330
|
fillStrokeOrder = imageAttribute.fillStrokeOrder,
|
|
21108
21331
|
cornerType = imageAttribute.cornerType,
|
|
21332
|
+
imageMode = imageAttribute.imageMode,
|
|
21333
|
+
imageScale = imageAttribute.imageScale,
|
|
21334
|
+
imageOffsetX = imageAttribute.imageOffsetX,
|
|
21335
|
+
imageOffsetY = imageAttribute.imageOffsetY,
|
|
21336
|
+
imagePosition = imageAttribute.imagePosition,
|
|
21109
21337
|
image: url
|
|
21110
21338
|
} = image.attribute,
|
|
21111
21339
|
data = this.valid(image, imageAttribute, fillCb);
|
|
@@ -21122,22 +21350,33 @@
|
|
|
21122
21350
|
const width = image.width,
|
|
21123
21351
|
height = image.height;
|
|
21124
21352
|
context.beginPath();
|
|
21125
|
-
let
|
|
21126
|
-
0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? context.rect(x, y, width, height) : (createRectPath(context, x, y, width, height, cornerRadius, "bevel" !== cornerType),
|
|
21353
|
+
let needCornerClip = !1;
|
|
21354
|
+
0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? context.rect(x, y, width, height) : (createRectPath(context, x, y, width, height, cornerRadius, "bevel" !== cornerType), needCornerClip = !0), context.setShadowBlendStyle && context.setShadowBlendStyle(image, image.attribute, imageAttribute);
|
|
21127
21355
|
const _runFill = () => {
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
|
|
21131
|
-
|
|
21132
|
-
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
|
|
21356
|
+
doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
|
|
21357
|
+
repeatX: repeatX,
|
|
21358
|
+
repeatY: repeatY,
|
|
21359
|
+
imageMode: imageMode,
|
|
21360
|
+
imageScale: imageScale,
|
|
21361
|
+
imageOffsetX: imageOffsetX,
|
|
21362
|
+
imageOffsetY: imageOffsetY,
|
|
21363
|
+
imagePosition: imagePosition
|
|
21364
|
+
})));
|
|
21136
21365
|
},
|
|
21137
21366
|
_runStroke = () => {
|
|
21138
21367
|
doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
|
|
21139
|
-
}
|
|
21140
|
-
|
|
21368
|
+
},
|
|
21369
|
+
needLayoutClip = shouldClipImageByLayout({
|
|
21370
|
+
repeatX: repeatX,
|
|
21371
|
+
repeatY: repeatY,
|
|
21372
|
+
imageMode: imageMode,
|
|
21373
|
+
imageScale: imageScale,
|
|
21374
|
+
imageOffsetX: imageOffsetX,
|
|
21375
|
+
imageOffsetY: imageOffsetY,
|
|
21376
|
+
imagePosition: imagePosition
|
|
21377
|
+
}),
|
|
21378
|
+
needClip = needCornerClip || needLayoutClip;
|
|
21379
|
+
fillStrokeOrder ? (_runStroke(), needClip && (context.save(), context.clip()), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), _runFill(), needClip && context.restore()) : (needClip && (context.save(), context.clip()), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), _runFill(), needClip && context.restore(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
|
|
21141
21380
|
}
|
|
21142
21381
|
draw(image, renderService, drawContext) {
|
|
21143
21382
|
const {
|
|
@@ -21996,7 +22235,7 @@
|
|
|
21996
22235
|
return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
|
|
21997
22236
|
}
|
|
21998
22237
|
clearScreen(renderService, context, drawContext) {
|
|
21999
|
-
var _a, _b, _c;
|
|
22238
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
22000
22239
|
const {
|
|
22001
22240
|
clear: clear,
|
|
22002
22241
|
viewBox: viewBox
|
|
@@ -22006,9 +22245,20 @@
|
|
|
22006
22245
|
if (clear) {
|
|
22007
22246
|
context.clearRect(0, 0, width, height), (null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage) && renderService.drawParams.stage.hooks.afterClearRect.call(renderService.drawParams);
|
|
22008
22247
|
const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
|
|
22009
|
-
if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
|
|
22010
|
-
const res = stage.resources.get(clear);
|
|
22011
|
-
res && "success" === res.state && res.data
|
|
22248
|
+
if (stage && (context.globalAlpha = (null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1) * (null !== (_d = stage.attribute.backgroundOpacity) && void 0 !== _d ? _d : 1)), stage && stage.backgroundImg && stage.resources) {
|
|
22249
|
+
const res = stage.resources.get(getBackgroundImage(clear));
|
|
22250
|
+
if (res && "success" === res.state && res.data) {
|
|
22251
|
+
const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
|
|
22252
|
+
drawBackgroundImage(context, res.data, backgroundBounds, {
|
|
22253
|
+
backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
|
|
22254
|
+
backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
|
|
22255
|
+
backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
|
|
22256
|
+
backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
|
|
22257
|
+
backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
|
|
22258
|
+
backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
|
|
22259
|
+
backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
|
|
22260
|
+
}), boundsAllocate.free(backgroundBounds);
|
|
22261
|
+
}
|
|
22012
22262
|
} else context.fillStyle = createColor(context, clear, {
|
|
22013
22263
|
AABBBounds: {
|
|
22014
22264
|
x1: 0,
|
|
@@ -22506,7 +22756,7 @@
|
|
|
22506
22756
|
return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
|
|
22507
22757
|
}
|
|
22508
22758
|
set background(b) {
|
|
22509
|
-
this._background = b;
|
|
22759
|
+
this._background = b, this.syncBackgroundImage(b);
|
|
22510
22760
|
}
|
|
22511
22761
|
get defaultLayer() {
|
|
22512
22762
|
return this.at(0);
|
|
@@ -22520,6 +22770,18 @@
|
|
|
22520
22770
|
set ticker(ticker) {
|
|
22521
22771
|
ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
|
|
22522
22772
|
}
|
|
22773
|
+
syncBackgroundImage(background) {
|
|
22774
|
+
var _a;
|
|
22775
|
+
const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
22776
|
+
this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
|
|
22777
|
+
}
|
|
22778
|
+
isImageBackgroundSource(source) {
|
|
22779
|
+
if (!source) return !1;
|
|
22780
|
+
if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
|
|
22781
|
+
if (!isObject$2(source)) return !1;
|
|
22782
|
+
const gradientSource = source;
|
|
22783
|
+
return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
|
|
22784
|
+
}
|
|
22523
22785
|
constructor(params = {}) {
|
|
22524
22786
|
var _a, _b;
|
|
22525
22787
|
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
@@ -22558,9 +22820,7 @@
|
|
|
22558
22820
|
main: !0
|
|
22559
22821
|
})), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), params.beforeRender && this._beforeRenderList.push(params.beforeRender), params.afterRender && this._afterRenderList.push(params.afterRender), this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect), this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
|
|
22560
22822
|
tickRenderMode: "effect"
|
|
22561
|
-
}), this.optmize(params.optimize), params.background &&
|
|
22562
|
-
background: this._background
|
|
22563
|
-
}), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|
|
22823
|
+
}), this.optmize(params.optimize), params.background && this.syncBackgroundImage(this._background), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|
|
22564
22824
|
}
|
|
22565
22825
|
initAnimate(params) {
|
|
22566
22826
|
var _a;
|
|
@@ -31234,6 +31494,7 @@
|
|
|
31234
31494
|
if (custom.prototype.constructor === custom) {
|
|
31235
31495
|
const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
|
|
31236
31496
|
if (descriptor && !descriptor.writable) return 1;
|
|
31497
|
+
if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
|
|
31237
31498
|
}
|
|
31238
31499
|
return 2;
|
|
31239
31500
|
}
|