@visactor/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/es5/index.js +1 -1
- package/build/index.es.js +363 -102
- package/build/index.js +363 -102
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/callback-disappear.js +2 -1
- package/cjs/animation/index.js +1 -2
- package/cjs/core/index.js +1 -1
- package/cjs/core/instance-manager.js +1 -1
- package/cjs/data/initialize.js +1 -1
- package/cjs/data/register.js +1 -1
- package/esm/animation/callback-disappear.js +2 -1
- package/esm/animation/index.js +1 -2
- package/esm/core/index.js +1 -1
- package/esm/core/instance-manager.js +1 -1
- package/esm/data/initialize.js +1 -1
- package/esm/data/register.js +1 -1
- package/package.json +8 -8
package/build/index.js
CHANGED
|
@@ -11436,7 +11436,9 @@
|
|
|
11436
11436
|
background: null,
|
|
11437
11437
|
autoAnimateTexture: !1,
|
|
11438
11438
|
textureRatio: 1,
|
|
11439
|
-
textureOptions:
|
|
11439
|
+
textureOptions: {
|
|
11440
|
+
alignToGraphic: !0
|
|
11441
|
+
},
|
|
11440
11442
|
backgroundOpacity: 1,
|
|
11441
11443
|
backgroundCornerRadius: 0,
|
|
11442
11444
|
texture: null,
|
|
@@ -11450,6 +11452,7 @@
|
|
|
11450
11452
|
backgroundScale: 1,
|
|
11451
11453
|
backgroundOffsetX: 0,
|
|
11452
11454
|
backgroundOffsetY: 0,
|
|
11455
|
+
backgroundPosition: "top-left",
|
|
11453
11456
|
blur: 0,
|
|
11454
11457
|
filter: "",
|
|
11455
11458
|
cursor: null,
|
|
@@ -11622,11 +11625,16 @@
|
|
|
11622
11625
|
const DefaultImageAttribute = Object.assign(Object.assign({
|
|
11623
11626
|
repeatX: "no-repeat",
|
|
11624
11627
|
repeatY: "no-repeat",
|
|
11628
|
+
imageMode: void 0,
|
|
11625
11629
|
image: "",
|
|
11626
11630
|
width: 0,
|
|
11627
11631
|
height: 0,
|
|
11628
11632
|
maxWidth: 500,
|
|
11629
|
-
maxHeight: 500
|
|
11633
|
+
maxHeight: 500,
|
|
11634
|
+
imagePosition: "top-left",
|
|
11635
|
+
imageScale: 1,
|
|
11636
|
+
imageOffsetX: 0,
|
|
11637
|
+
imageOffsetY: 0
|
|
11630
11638
|
}, DefaultAttribute), {
|
|
11631
11639
|
fill: !0,
|
|
11632
11640
|
cornerRadius: 0,
|
|
@@ -16678,7 +16686,8 @@
|
|
|
16678
16686
|
return isString$1(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
|
|
16679
16687
|
}
|
|
16680
16688
|
loadImage(image, background = !1) {
|
|
16681
|
-
if (
|
|
16689
|
+
if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
|
|
16690
|
+
if (!image) return;
|
|
16682
16691
|
const url = image;
|
|
16683
16692
|
this.resources || (this.resources = new Map());
|
|
16684
16693
|
const cache = {
|
|
@@ -16733,7 +16742,7 @@
|
|
|
16733
16742
|
}
|
|
16734
16743
|
}
|
|
16735
16744
|
function backgroundNotImage(image) {
|
|
16736
|
-
return !(!image.fill && !image.stroke);
|
|
16745
|
+
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));
|
|
16737
16746
|
}
|
|
16738
16747
|
function isExternalTexture(texture) {
|
|
16739
16748
|
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
|
|
@@ -18869,7 +18878,7 @@
|
|
|
18869
18878
|
return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
|
|
18870
18879
|
}
|
|
18871
18880
|
|
|
18872
|
-
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
18881
|
+
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
18873
18882
|
class Image extends Graphic {
|
|
18874
18883
|
constructor(params) {
|
|
18875
18884
|
super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
|
|
@@ -18974,6 +18983,7 @@
|
|
|
18974
18983
|
}
|
|
18975
18984
|
Image.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
18976
18985
|
image: 1,
|
|
18986
|
+
imageMode: 1,
|
|
18977
18987
|
repeatX: 1,
|
|
18978
18988
|
repeatY: 1
|
|
18979
18989
|
}, NOWORK_ANIMATE_ATTR);
|
|
@@ -20167,11 +20177,12 @@
|
|
|
20167
20177
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
20168
20178
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
20169
20179
|
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
20170
|
-
backgroundClip = graphicAttribute.backgroundClip
|
|
20180
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
20181
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
20171
20182
|
} = graphic.attribute;
|
|
20172
20183
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
20173
|
-
const res = graphic.resources.get(background);
|
|
20174
|
-
if ("success" !== res.state || !res.data) return;
|
|
20184
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
20185
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
20175
20186
|
if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
|
|
20176
20187
|
const groupAttribute = getTheme$1(graphic.parent).group,
|
|
20177
20188
|
{
|
|
@@ -20188,59 +20199,160 @@
|
|
|
20188
20199
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20189
20200
|
backgroundScale: backgroundScale,
|
|
20190
20201
|
backgroundOffsetX: backgroundOffsetX,
|
|
20191
|
-
backgroundOffsetY: backgroundOffsetY
|
|
20202
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
20203
|
+
backgroundPosition: backgroundPosition
|
|
20192
20204
|
}), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
|
|
20193
20205
|
} else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
20194
20206
|
}
|
|
20195
20207
|
doDrawImage(context, data, b, params) {
|
|
20196
|
-
|
|
20197
|
-
backgroundMode: backgroundMode,
|
|
20198
|
-
backgroundFit: backgroundFit,
|
|
20199
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20200
|
-
backgroundScale = 1,
|
|
20201
|
-
backgroundOffsetX = 0,
|
|
20202
|
-
backgroundOffsetY = 0
|
|
20203
|
-
} = params,
|
|
20204
|
-
targetW = b.width(),
|
|
20205
|
-
targetH = b.height();
|
|
20206
|
-
let w = targetW,
|
|
20207
|
-
h = targetH;
|
|
20208
|
-
if ("no-repeat" === backgroundMode) {
|
|
20209
|
-
if (backgroundFit) {
|
|
20210
|
-
if (backgroundKeepAspectRatio) {
|
|
20211
|
-
const maxScale = Math.max(targetW / data.width, targetH / data.height);
|
|
20212
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
|
|
20213
|
-
} else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
20214
|
-
} else {
|
|
20215
|
-
const resW = data.width * backgroundScale,
|
|
20216
|
-
resH = data.height * backgroundScale;
|
|
20217
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
|
|
20218
|
-
}
|
|
20219
|
-
} else {
|
|
20220
|
-
if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
|
|
20221
|
-
const resW = data.width,
|
|
20222
|
-
resH = data.height;
|
|
20223
|
-
if ("repeat-x" === backgroundMode) {
|
|
20224
|
-
w = resW * (targetH / resH), h = targetH;
|
|
20225
|
-
} else if ("repeat-y" === backgroundMode) {
|
|
20226
|
-
h = resH * (targetW / resW), w = targetW;
|
|
20227
|
-
}
|
|
20228
|
-
const dpr = context.dpr,
|
|
20229
|
-
canvas = canvasAllocate.allocate({
|
|
20230
|
-
width: w,
|
|
20231
|
-
height: h,
|
|
20232
|
-
dpr: dpr
|
|
20233
|
-
}),
|
|
20234
|
-
ctx = canvas.getContext("2d");
|
|
20235
|
-
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);
|
|
20236
|
-
}
|
|
20237
|
-
const dpr = context.dpr,
|
|
20238
|
-
pattern = context.createPattern(data, backgroundMode);
|
|
20239
|
-
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);
|
|
20240
|
-
}
|
|
20208
|
+
drawBackgroundImage(context, data, b, params);
|
|
20241
20209
|
}
|
|
20242
20210
|
}
|
|
20243
20211
|
const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
|
|
20212
|
+
const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
|
|
20213
|
+
function getBackgroundImage(background) {
|
|
20214
|
+
var _a;
|
|
20215
|
+
return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
20216
|
+
}
|
|
20217
|
+
function resolveBackgroundSizing({
|
|
20218
|
+
backgroundFit: backgroundFit,
|
|
20219
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
20220
|
+
}) {
|
|
20221
|
+
return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
|
|
20222
|
+
}
|
|
20223
|
+
const NO_REPEAT_SIZING_MAP = {
|
|
20224
|
+
"no-repeat-cover": "cover",
|
|
20225
|
+
"no-repeat-contain": "contain",
|
|
20226
|
+
"no-repeat-fill": "fill",
|
|
20227
|
+
"no-repeat-auto": "auto"
|
|
20228
|
+
};
|
|
20229
|
+
function resolveBackgroundDrawMode({
|
|
20230
|
+
backgroundMode: backgroundMode,
|
|
20231
|
+
backgroundFit: backgroundFit,
|
|
20232
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
20233
|
+
}) {
|
|
20234
|
+
const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
|
|
20235
|
+
return sizing ? {
|
|
20236
|
+
backgroundRepeatMode: "no-repeat",
|
|
20237
|
+
backgroundSizing: sizing
|
|
20238
|
+
} : {
|
|
20239
|
+
backgroundRepeatMode: backgroundMode,
|
|
20240
|
+
backgroundSizing: resolveBackgroundSizing({
|
|
20241
|
+
backgroundFit: backgroundFit,
|
|
20242
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
20243
|
+
})
|
|
20244
|
+
};
|
|
20245
|
+
}
|
|
20246
|
+
function isPercentageValue(value) {
|
|
20247
|
+
return /^-?\d+(\.\d+)?%$/.test(value);
|
|
20248
|
+
}
|
|
20249
|
+
function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
|
|
20250
|
+
if ("number" == typeof value && Number.isFinite(value)) return value;
|
|
20251
|
+
const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
|
|
20252
|
+
if (!normalizedValue || normalizedValue === startKeyword) return 0;
|
|
20253
|
+
if (normalizedValue === centerKeyword) return remainSpace / 2;
|
|
20254
|
+
if (normalizedValue === endKeyword) return remainSpace;
|
|
20255
|
+
if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
|
|
20256
|
+
const parsedValue = Number(normalizedValue);
|
|
20257
|
+
return Number.isFinite(parsedValue) ? parsedValue : 0;
|
|
20258
|
+
}
|
|
20259
|
+
function normalizeBackgroundPosition(position) {
|
|
20260
|
+
var _a, _b;
|
|
20261
|
+
if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
|
|
20262
|
+
const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
|
|
20263
|
+
if (0 === tokens.length) return ["left", "top"];
|
|
20264
|
+
if (1 === tokens.length) {
|
|
20265
|
+
const token = tokens[0];
|
|
20266
|
+
return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
|
|
20267
|
+
}
|
|
20268
|
+
let horizontal, vertical;
|
|
20269
|
+
const genericTokens = [];
|
|
20270
|
+
for (let i = 0; i < 2; i++) {
|
|
20271
|
+
const token = tokens[i];
|
|
20272
|
+
"left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
|
|
20273
|
+
}
|
|
20274
|
+
return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
|
|
20275
|
+
}
|
|
20276
|
+
function resolveBackgroundPosition(position, remainWidth, remainHeight) {
|
|
20277
|
+
const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
|
|
20278
|
+
return {
|
|
20279
|
+
x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
|
|
20280
|
+
y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
|
|
20281
|
+
};
|
|
20282
|
+
}
|
|
20283
|
+
function pickRenderableDimension(...values) {
|
|
20284
|
+
for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
|
|
20285
|
+
return null;
|
|
20286
|
+
}
|
|
20287
|
+
function resolveRenderableImageSize(data) {
|
|
20288
|
+
if (!data) return null;
|
|
20289
|
+
const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
|
|
20290
|
+
height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
|
|
20291
|
+
return null == width || null == height ? null : {
|
|
20292
|
+
width: width,
|
|
20293
|
+
height: height
|
|
20294
|
+
};
|
|
20295
|
+
}
|
|
20296
|
+
function drawBackgroundImage(context, data, b, params) {
|
|
20297
|
+
var _a, _b;
|
|
20298
|
+
const {
|
|
20299
|
+
backgroundMode: backgroundMode,
|
|
20300
|
+
backgroundFit: backgroundFit,
|
|
20301
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20302
|
+
backgroundScale = 1,
|
|
20303
|
+
backgroundOffsetX = 0,
|
|
20304
|
+
backgroundOffsetY = 0,
|
|
20305
|
+
backgroundPosition = "top-left"
|
|
20306
|
+
} = params,
|
|
20307
|
+
targetW = b.width(),
|
|
20308
|
+
targetH = b.height(),
|
|
20309
|
+
sourceSize = resolveRenderableImageSize(data),
|
|
20310
|
+
{
|
|
20311
|
+
backgroundRepeatMode: backgroundRepeatMode,
|
|
20312
|
+
backgroundSizing: resolvedBackgroundSizing
|
|
20313
|
+
} = resolveBackgroundDrawMode({
|
|
20314
|
+
backgroundMode: backgroundMode,
|
|
20315
|
+
backgroundFit: backgroundFit,
|
|
20316
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
20317
|
+
});
|
|
20318
|
+
let w = targetW,
|
|
20319
|
+
h = targetH;
|
|
20320
|
+
if (targetW <= 0 || targetH <= 0) return;
|
|
20321
|
+
if ("no-repeat" === backgroundRepeatMode) {
|
|
20322
|
+
let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
|
|
20323
|
+
drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
|
|
20324
|
+
if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
|
|
20325
|
+
const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
|
|
20326
|
+
drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
|
|
20327
|
+
}
|
|
20328
|
+
drawWidth *= backgroundScale, drawHeight *= backgroundScale;
|
|
20329
|
+
const {
|
|
20330
|
+
x: x,
|
|
20331
|
+
y: y
|
|
20332
|
+
} = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
|
|
20333
|
+
return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
|
|
20334
|
+
}
|
|
20335
|
+
if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
|
|
20336
|
+
const resW = sourceSize.width,
|
|
20337
|
+
resH = sourceSize.height;
|
|
20338
|
+
if ("repeat-x" === backgroundRepeatMode) {
|
|
20339
|
+
w = resW * (targetH / resH), h = targetH;
|
|
20340
|
+
} else if ("repeat-y" === backgroundRepeatMode) {
|
|
20341
|
+
h = resH * (targetW / resW), w = targetW;
|
|
20342
|
+
}
|
|
20343
|
+
const dpr = context.dpr,
|
|
20344
|
+
canvas = canvasAllocate.allocate({
|
|
20345
|
+
width: w,
|
|
20346
|
+
height: h,
|
|
20347
|
+
dpr: dpr
|
|
20348
|
+
}),
|
|
20349
|
+
ctx = canvas.getContext("2d");
|
|
20350
|
+
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);
|
|
20351
|
+
}
|
|
20352
|
+
const dpr = context.dpr,
|
|
20353
|
+
pattern = context.createPattern(data, backgroundRepeatMode);
|
|
20354
|
+
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);
|
|
20355
|
+
}
|
|
20244
20356
|
let DefaultBaseInteractiveRenderContribution = class {
|
|
20245
20357
|
constructor(subRenderContribitions) {
|
|
20246
20358
|
this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
@@ -20399,7 +20511,7 @@
|
|
|
20399
20511
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
20400
20512
|
}
|
|
20401
20513
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
20402
|
-
var _a;
|
|
20514
|
+
var _a, _b, _c, _d, _e;
|
|
20403
20515
|
const {
|
|
20404
20516
|
textureRatio = graphicAttribute.textureRatio,
|
|
20405
20517
|
textureOptions = null
|
|
@@ -20482,7 +20594,21 @@
|
|
|
20482
20594
|
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());
|
|
20483
20595
|
}
|
|
20484
20596
|
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();
|
|
20485
|
-
} else if (pattern)
|
|
20597
|
+
} else if (pattern) {
|
|
20598
|
+
if (pattern.setTransform) {
|
|
20599
|
+
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
20600
|
+
alignOffsetX = null !== (_b = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _b ? _b : 0,
|
|
20601
|
+
alignOffsetY = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _c ? _c : 0;
|
|
20602
|
+
let translateX = 0,
|
|
20603
|
+
translateY = 0;
|
|
20604
|
+
if (alignToGraphic) {
|
|
20605
|
+
const m = context.currentMatrix;
|
|
20606
|
+
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;
|
|
20607
|
+
} else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
|
|
20608
|
+
pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
|
|
20609
|
+
}
|
|
20610
|
+
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
|
|
20611
|
+
} else if ("wave" === texture) {
|
|
20486
20612
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
20487
20613
|
const b = graphic.AABBBounds;
|
|
20488
20614
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -20612,27 +20738,32 @@
|
|
|
20612
20738
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
20613
20739
|
const {
|
|
20614
20740
|
background: background,
|
|
20741
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
20742
|
+
opacity = graphicAttribute.opacity,
|
|
20615
20743
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
20616
20744
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
20617
20745
|
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
20618
20746
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
20619
20747
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
20620
|
-
backgroundOffsetY = graphicAttribute.backgroundOffsetY
|
|
20748
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
20749
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
20750
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
20621
20751
|
} = graphic.attribute;
|
|
20622
20752
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
20623
|
-
const res = graphic.resources.get(background);
|
|
20624
|
-
if ("success" !== res.state || !res.data) return;
|
|
20753
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
20754
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
20625
20755
|
context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
|
|
20626
20756
|
const b = graphic.AABBBounds;
|
|
20627
|
-
this.doDrawImage(context, res.data, b, {
|
|
20757
|
+
context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
|
|
20628
20758
|
backgroundMode: backgroundMode,
|
|
20629
20759
|
backgroundFit: backgroundFit,
|
|
20630
20760
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20631
20761
|
backgroundScale: backgroundScale,
|
|
20632
20762
|
backgroundOffsetX: backgroundOffsetX,
|
|
20633
|
-
backgroundOffsetY: backgroundOffsetY
|
|
20763
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
20764
|
+
backgroundPosition: backgroundPosition
|
|
20634
20765
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
20635
|
-
} else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
20766
|
+
} else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
20636
20767
|
}
|
|
20637
20768
|
}
|
|
20638
20769
|
const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
|
|
@@ -22114,9 +22245,17 @@
|
|
|
22114
22245
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
22115
22246
|
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
22116
22247
|
const {
|
|
22248
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
22249
|
+
opacity = graphicAttribute.opacity,
|
|
22117
22250
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
22118
22251
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
22119
|
-
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
|
|
22252
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
22253
|
+
backgroundScale = graphicAttribute.backgroundScale,
|
|
22254
|
+
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
22255
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
22256
|
+
backgroundPosition = graphicAttribute.backgroundPosition,
|
|
22257
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
22258
|
+
backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
|
|
22120
22259
|
} = graphic.attribute;
|
|
22121
22260
|
let matrix,
|
|
22122
22261
|
{
|
|
@@ -22128,18 +22267,18 @@
|
|
|
22128
22267
|
};
|
|
22129
22268
|
let b;
|
|
22130
22269
|
"richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
|
|
22131
|
-
const
|
|
22270
|
+
const backgroundConfig = isObject$2(background) && background.background ? background : null,
|
|
22132
22271
|
onlyTranslate = graphic.transMatrix.onlyTranslate();
|
|
22133
|
-
if (
|
|
22272
|
+
if (backgroundConfig) {
|
|
22134
22273
|
const _b = graphic.AABBBounds,
|
|
22135
|
-
x = (null !== (_a =
|
|
22136
|
-
y = (null !== (_d =
|
|
22137
|
-
w = null !== (_f =
|
|
22138
|
-
h = null !== (_g =
|
|
22139
|
-
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background =
|
|
22274
|
+
x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
|
|
22275
|
+
y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
|
|
22276
|
+
w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
|
|
22277
|
+
h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
|
|
22278
|
+
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
|
|
22140
22279
|
const w = b.width(),
|
|
22141
22280
|
h = b.height();
|
|
22142
|
-
b.set((null !== (_h =
|
|
22281
|
+
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);
|
|
22143
22282
|
}
|
|
22144
22283
|
} else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
|
|
22145
22284
|
angle: 0,
|
|
@@ -22152,20 +22291,18 @@
|
|
|
22152
22291
|
})).clone());
|
|
22153
22292
|
if (graphic.backgroundImg && graphic.resources) {
|
|
22154
22293
|
const res = graphic.resources.get(background);
|
|
22155
|
-
if ("success" !== res.state || !res.data) return void restore();
|
|
22156
|
-
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.
|
|
22294
|
+
if (!res || "success" !== res.state || !res.data) return void restore();
|
|
22295
|
+
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, {
|
|
22157
22296
|
backgroundMode: backgroundMode,
|
|
22158
22297
|
backgroundFit: backgroundFit,
|
|
22159
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
22298
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
22299
|
+
backgroundScale: backgroundScale,
|
|
22300
|
+
backgroundOffsetX: backgroundOffsetX,
|
|
22301
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
22302
|
+
backgroundPosition: backgroundPosition
|
|
22160
22303
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
22161
|
-
} else
|
|
22162
|
-
|
|
22163
|
-
backgroundCornerRadius: backgroundCornerRadius,
|
|
22164
|
-
backgroundOpacity = 1
|
|
22165
|
-
} = graphic.attribute;
|
|
22166
|
-
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();
|
|
22167
|
-
}
|
|
22168
|
-
shouldReCalBounds && boundsAllocate.free(b), restore();
|
|
22304
|
+
} 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();
|
|
22305
|
+
backgroundConfig && boundsAllocate.free(b), restore();
|
|
22169
22306
|
}
|
|
22170
22307
|
}
|
|
22171
22308
|
const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
|
|
@@ -22592,6 +22729,92 @@
|
|
|
22592
22729
|
};
|
|
22593
22730
|
};
|
|
22594
22731
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
22732
|
+
function resolveImageMode({
|
|
22733
|
+
repeatX = "no-repeat",
|
|
22734
|
+
repeatY = "no-repeat",
|
|
22735
|
+
imageMode: imageMode
|
|
22736
|
+
}) {
|
|
22737
|
+
const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
|
|
22738
|
+
return {
|
|
22739
|
+
repeatMode: repeatMode,
|
|
22740
|
+
sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
|
|
22741
|
+
};
|
|
22742
|
+
}
|
|
22743
|
+
const IMAGE_MODE_TO_BACKGROUND_MODE = {
|
|
22744
|
+
cover: "no-repeat-cover",
|
|
22745
|
+
contain: "no-repeat-contain",
|
|
22746
|
+
fill: "no-repeat-fill",
|
|
22747
|
+
auto: "no-repeat-auto"
|
|
22748
|
+
};
|
|
22749
|
+
function resolveBackgroundParamsByImageSizing(sizingMode) {
|
|
22750
|
+
return {
|
|
22751
|
+
backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
|
|
22752
|
+
backgroundFit: !1,
|
|
22753
|
+
backgroundKeepAspectRatio: !1
|
|
22754
|
+
};
|
|
22755
|
+
}
|
|
22756
|
+
function resolveImageRepeatMode(repeatX, repeatY) {
|
|
22757
|
+
let repeat = 0;
|
|
22758
|
+
return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
|
|
22759
|
+
}
|
|
22760
|
+
function shouldClipImageByLayout({
|
|
22761
|
+
repeatX = "no-repeat",
|
|
22762
|
+
repeatY = "no-repeat",
|
|
22763
|
+
imageMode: imageMode,
|
|
22764
|
+
imageScale = 1,
|
|
22765
|
+
imageOffsetX = 0,
|
|
22766
|
+
imageOffsetY = 0,
|
|
22767
|
+
imagePosition = "top-left"
|
|
22768
|
+
}) {
|
|
22769
|
+
const {
|
|
22770
|
+
repeatMode: repeatMode,
|
|
22771
|
+
sizingMode: sizingMode
|
|
22772
|
+
} = resolveImageMode({
|
|
22773
|
+
repeatX: repeatX,
|
|
22774
|
+
repeatY: repeatY,
|
|
22775
|
+
imageMode: imageMode
|
|
22776
|
+
});
|
|
22777
|
+
return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
|
|
22778
|
+
}
|
|
22779
|
+
function drawImageWithLayout(context, data, x, y, width, height, {
|
|
22780
|
+
repeatX = "no-repeat",
|
|
22781
|
+
repeatY = "no-repeat",
|
|
22782
|
+
imageMode: imageMode,
|
|
22783
|
+
imageScale = 1,
|
|
22784
|
+
imageOffsetX = 0,
|
|
22785
|
+
imageOffsetY = 0,
|
|
22786
|
+
imagePosition = "top-left"
|
|
22787
|
+
}) {
|
|
22788
|
+
const {
|
|
22789
|
+
repeatMode: repeatMode,
|
|
22790
|
+
sizingMode: sizingMode
|
|
22791
|
+
} = resolveImageMode({
|
|
22792
|
+
repeatX: repeatX,
|
|
22793
|
+
repeatY: repeatY,
|
|
22794
|
+
imageMode: imageMode
|
|
22795
|
+
}),
|
|
22796
|
+
imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
|
|
22797
|
+
backgroundMode: repeatMode,
|
|
22798
|
+
backgroundFit: !1,
|
|
22799
|
+
backgroundKeepAspectRatio: !1
|
|
22800
|
+
};
|
|
22801
|
+
drawBackgroundImage(context, data, {
|
|
22802
|
+
x1: x,
|
|
22803
|
+
y1: y,
|
|
22804
|
+
x2: x + width,
|
|
22805
|
+
y2: y + height,
|
|
22806
|
+
width: () => width,
|
|
22807
|
+
height: () => height
|
|
22808
|
+
}, {
|
|
22809
|
+
backgroundMode: imageBackgroundParams.backgroundMode,
|
|
22810
|
+
backgroundFit: imageBackgroundParams.backgroundFit,
|
|
22811
|
+
backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
|
|
22812
|
+
backgroundScale: imageScale,
|
|
22813
|
+
backgroundOffsetX: imageOffsetX,
|
|
22814
|
+
backgroundOffsetY: imageOffsetY,
|
|
22815
|
+
backgroundPosition: imagePosition
|
|
22816
|
+
});
|
|
22817
|
+
}
|
|
22595
22818
|
let DefaultCanvasImageRender = class extends BaseRender {
|
|
22596
22819
|
constructor(graphicRenderContributions) {
|
|
22597
22820
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -22606,6 +22829,11 @@
|
|
|
22606
22829
|
cornerRadius = imageAttribute.cornerRadius,
|
|
22607
22830
|
fillStrokeOrder = imageAttribute.fillStrokeOrder,
|
|
22608
22831
|
cornerType = imageAttribute.cornerType,
|
|
22832
|
+
imageMode = imageAttribute.imageMode,
|
|
22833
|
+
imageScale = imageAttribute.imageScale,
|
|
22834
|
+
imageOffsetX = imageAttribute.imageOffsetX,
|
|
22835
|
+
imageOffsetY = imageAttribute.imageOffsetY,
|
|
22836
|
+
imagePosition = imageAttribute.imagePosition,
|
|
22609
22837
|
image: url
|
|
22610
22838
|
} = image.attribute,
|
|
22611
22839
|
data = this.valid(image, imageAttribute, fillCb);
|
|
@@ -22622,22 +22850,33 @@
|
|
|
22622
22850
|
const width = image.width,
|
|
22623
22851
|
height = image.height;
|
|
22624
22852
|
context.beginPath();
|
|
22625
|
-
let
|
|
22626
|
-
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),
|
|
22853
|
+
let needCornerClip = !1;
|
|
22854
|
+
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);
|
|
22627
22855
|
const _runFill = () => {
|
|
22628
|
-
|
|
22629
|
-
|
|
22630
|
-
|
|
22631
|
-
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22856
|
+
doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
|
|
22857
|
+
repeatX: repeatX,
|
|
22858
|
+
repeatY: repeatY,
|
|
22859
|
+
imageMode: imageMode,
|
|
22860
|
+
imageScale: imageScale,
|
|
22861
|
+
imageOffsetX: imageOffsetX,
|
|
22862
|
+
imageOffsetY: imageOffsetY,
|
|
22863
|
+
imagePosition: imagePosition
|
|
22864
|
+
})));
|
|
22636
22865
|
},
|
|
22637
22866
|
_runStroke = () => {
|
|
22638
22867
|
doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
|
|
22639
|
-
}
|
|
22640
|
-
|
|
22868
|
+
},
|
|
22869
|
+
needLayoutClip = shouldClipImageByLayout({
|
|
22870
|
+
repeatX: repeatX,
|
|
22871
|
+
repeatY: repeatY,
|
|
22872
|
+
imageMode: imageMode,
|
|
22873
|
+
imageScale: imageScale,
|
|
22874
|
+
imageOffsetX: imageOffsetX,
|
|
22875
|
+
imageOffsetY: imageOffsetY,
|
|
22876
|
+
imagePosition: imagePosition
|
|
22877
|
+
}),
|
|
22878
|
+
needClip = needCornerClip || needLayoutClip;
|
|
22879
|
+
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);
|
|
22641
22880
|
}
|
|
22642
22881
|
draw(image, renderService, drawContext) {
|
|
22643
22882
|
const {
|
|
@@ -23496,7 +23735,7 @@
|
|
|
23496
23735
|
return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
|
|
23497
23736
|
}
|
|
23498
23737
|
clearScreen(renderService, context, drawContext) {
|
|
23499
|
-
var _a, _b, _c;
|
|
23738
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
23500
23739
|
const {
|
|
23501
23740
|
clear: clear,
|
|
23502
23741
|
viewBox: viewBox
|
|
@@ -23506,9 +23745,20 @@
|
|
|
23506
23745
|
if (clear) {
|
|
23507
23746
|
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);
|
|
23508
23747
|
const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
|
|
23509
|
-
if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
|
|
23510
|
-
const res = stage.resources.get(clear);
|
|
23511
|
-
res && "success" === res.state && res.data
|
|
23748
|
+
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) {
|
|
23749
|
+
const res = stage.resources.get(getBackgroundImage(clear));
|
|
23750
|
+
if (res && "success" === res.state && res.data) {
|
|
23751
|
+
const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
|
|
23752
|
+
drawBackgroundImage(context, res.data, backgroundBounds, {
|
|
23753
|
+
backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
|
|
23754
|
+
backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
|
|
23755
|
+
backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
|
|
23756
|
+
backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
|
|
23757
|
+
backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
|
|
23758
|
+
backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
|
|
23759
|
+
backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
|
|
23760
|
+
}), boundsAllocate.free(backgroundBounds);
|
|
23761
|
+
}
|
|
23512
23762
|
} else context.fillStyle = createColor(context, clear, {
|
|
23513
23763
|
AABBBounds: {
|
|
23514
23764
|
x1: 0,
|
|
@@ -24006,7 +24256,7 @@
|
|
|
24006
24256
|
return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
|
|
24007
24257
|
}
|
|
24008
24258
|
set background(b) {
|
|
24009
|
-
this._background = b;
|
|
24259
|
+
this._background = b, this.syncBackgroundImage(b);
|
|
24010
24260
|
}
|
|
24011
24261
|
get defaultLayer() {
|
|
24012
24262
|
return this.at(0);
|
|
@@ -24020,6 +24270,18 @@
|
|
|
24020
24270
|
set ticker(ticker) {
|
|
24021
24271
|
ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
|
|
24022
24272
|
}
|
|
24273
|
+
syncBackgroundImage(background) {
|
|
24274
|
+
var _a;
|
|
24275
|
+
const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
24276
|
+
this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
|
|
24277
|
+
}
|
|
24278
|
+
isImageBackgroundSource(source) {
|
|
24279
|
+
if (!source) return !1;
|
|
24280
|
+
if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
|
|
24281
|
+
if (!isObject$2(source)) return !1;
|
|
24282
|
+
const gradientSource = source;
|
|
24283
|
+
return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
|
|
24284
|
+
}
|
|
24023
24285
|
constructor(params = {}) {
|
|
24024
24286
|
var _a, _b;
|
|
24025
24287
|
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
@@ -24058,9 +24320,7 @@
|
|
|
24058
24320
|
main: !0
|
|
24059
24321
|
})), 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 = {
|
|
24060
24322
|
tickRenderMode: "effect"
|
|
24061
|
-
}), this.optmize(params.optimize), params.background &&
|
|
24062
|
-
background: this._background
|
|
24063
|
-
}), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|
|
24323
|
+
}), 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());
|
|
24064
24324
|
}
|
|
24065
24325
|
initAnimate(params) {
|
|
24066
24326
|
var _a;
|
|
@@ -35218,6 +35478,7 @@
|
|
|
35218
35478
|
if (custom.prototype.constructor === custom) {
|
|
35219
35479
|
const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
|
|
35220
35480
|
if (descriptor && !descriptor.writable) return 1;
|
|
35481
|
+
if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
|
|
35221
35482
|
}
|
|
35222
35483
|
return 2;
|
|
35223
35484
|
}
|