@visactor/vchart 2.0.20 → 2.0.21
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 +345 -100
- package/build/index.js +345 -100
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/index.js +2 -1
- package/cjs/animation/utils.js +1 -2
- package/cjs/constant/correlation.js +1 -2
- package/cjs/constant/gradient.js +2 -1
- package/cjs/constant/marker.js +1 -1
- package/cjs/constant/polar.js +1 -1
- package/cjs/constant/scatter.js +1 -1
- package/cjs/constant/scroll-bar.js +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/data/initialize.js +1 -1
- package/cjs/data/register.js +1 -1
- package/cjs/env/env.js +1 -1
- package/cjs/env/index.js +1 -1
- package/cjs/typings/visual.d.ts +19 -1
- package/cjs/typings/visual.js.map +1 -1
- package/esm/animation/index.js +2 -1
- package/esm/animation/utils.js +1 -2
- package/esm/constant/correlation.js +1 -2
- package/esm/constant/gradient.js +2 -1
- package/esm/constant/marker.js +1 -1
- package/esm/constant/polar.js +1 -1
- package/esm/constant/scatter.js +1 -1
- package/esm/constant/scroll-bar.js +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/data/initialize.js +1 -1
- package/esm/data/register.js +1 -1
- package/esm/env/env.js +1 -1
- package/esm/env/index.js +1 -1
- package/esm/typings/visual.d.ts +19 -1
- package/esm/typings/visual.js.map +1 -1
- package/package.json +8 -8
package/build/index.js
CHANGED
|
@@ -11450,6 +11450,7 @@
|
|
|
11450
11450
|
backgroundScale: 1,
|
|
11451
11451
|
backgroundOffsetX: 0,
|
|
11452
11452
|
backgroundOffsetY: 0,
|
|
11453
|
+
backgroundPosition: "top-left",
|
|
11453
11454
|
blur: 0,
|
|
11454
11455
|
filter: "",
|
|
11455
11456
|
cursor: null,
|
|
@@ -11622,11 +11623,16 @@
|
|
|
11622
11623
|
const DefaultImageAttribute = Object.assign(Object.assign({
|
|
11623
11624
|
repeatX: "no-repeat",
|
|
11624
11625
|
repeatY: "no-repeat",
|
|
11626
|
+
imageMode: void 0,
|
|
11625
11627
|
image: "",
|
|
11626
11628
|
width: 0,
|
|
11627
11629
|
height: 0,
|
|
11628
11630
|
maxWidth: 500,
|
|
11629
|
-
maxHeight: 500
|
|
11631
|
+
maxHeight: 500,
|
|
11632
|
+
imagePosition: "top-left",
|
|
11633
|
+
imageScale: 1,
|
|
11634
|
+
imageOffsetX: 0,
|
|
11635
|
+
imageOffsetY: 0
|
|
11630
11636
|
}, DefaultAttribute), {
|
|
11631
11637
|
fill: !0,
|
|
11632
11638
|
cornerRadius: 0,
|
|
@@ -16677,7 +16683,8 @@
|
|
|
16677
16683
|
return isString$1(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
|
|
16678
16684
|
}
|
|
16679
16685
|
loadImage(image, background = !1) {
|
|
16680
|
-
if (
|
|
16686
|
+
if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
|
|
16687
|
+
if (!image) return;
|
|
16681
16688
|
const url = image;
|
|
16682
16689
|
this.resources || (this.resources = new Map());
|
|
16683
16690
|
const cache = {
|
|
@@ -16732,7 +16739,7 @@
|
|
|
16732
16739
|
}
|
|
16733
16740
|
}
|
|
16734
16741
|
function backgroundNotImage(image) {
|
|
16735
|
-
return !(!image.fill && !image.stroke);
|
|
16742
|
+
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));
|
|
16736
16743
|
}
|
|
16737
16744
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
|
|
16738
16745
|
|
|
@@ -18865,7 +18872,7 @@
|
|
|
18865
18872
|
return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
|
|
18866
18873
|
}
|
|
18867
18874
|
|
|
18868
|
-
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
18875
|
+
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
18869
18876
|
class Image extends Graphic {
|
|
18870
18877
|
constructor(params) {
|
|
18871
18878
|
super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
|
|
@@ -18970,6 +18977,7 @@
|
|
|
18970
18977
|
}
|
|
18971
18978
|
Image.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
18972
18979
|
image: 1,
|
|
18980
|
+
imageMode: 1,
|
|
18973
18981
|
repeatX: 1,
|
|
18974
18982
|
repeatY: 1
|
|
18975
18983
|
}, NOWORK_ANIMATE_ATTR);
|
|
@@ -20163,11 +20171,12 @@
|
|
|
20163
20171
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
20164
20172
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
20165
20173
|
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
20166
|
-
backgroundClip = graphicAttribute.backgroundClip
|
|
20174
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
20175
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
20167
20176
|
} = graphic.attribute;
|
|
20168
20177
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
20169
|
-
const res = graphic.resources.get(background);
|
|
20170
|
-
if ("success" !== res.state || !res.data) return;
|
|
20178
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
20179
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
20171
20180
|
if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
|
|
20172
20181
|
const groupAttribute = getTheme$1(graphic.parent).group,
|
|
20173
20182
|
{
|
|
@@ -20184,59 +20193,160 @@
|
|
|
20184
20193
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20185
20194
|
backgroundScale: backgroundScale,
|
|
20186
20195
|
backgroundOffsetX: backgroundOffsetX,
|
|
20187
|
-
backgroundOffsetY: backgroundOffsetY
|
|
20196
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
20197
|
+
backgroundPosition: backgroundPosition
|
|
20188
20198
|
}), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
|
|
20189
20199
|
} else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
20190
20200
|
}
|
|
20191
20201
|
doDrawImage(context, data, b, params) {
|
|
20192
|
-
|
|
20193
|
-
backgroundMode: backgroundMode,
|
|
20194
|
-
backgroundFit: backgroundFit,
|
|
20195
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20196
|
-
backgroundScale = 1,
|
|
20197
|
-
backgroundOffsetX = 0,
|
|
20198
|
-
backgroundOffsetY = 0
|
|
20199
|
-
} = params,
|
|
20200
|
-
targetW = b.width(),
|
|
20201
|
-
targetH = b.height();
|
|
20202
|
-
let w = targetW,
|
|
20203
|
-
h = targetH;
|
|
20204
|
-
if ("no-repeat" === backgroundMode) {
|
|
20205
|
-
if (backgroundFit) {
|
|
20206
|
-
if (backgroundKeepAspectRatio) {
|
|
20207
|
-
const maxScale = Math.max(targetW / data.width, targetH / data.height);
|
|
20208
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
|
|
20209
|
-
} else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
20210
|
-
} else {
|
|
20211
|
-
const resW = data.width * backgroundScale,
|
|
20212
|
-
resH = data.height * backgroundScale;
|
|
20213
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
|
|
20214
|
-
}
|
|
20215
|
-
} else {
|
|
20216
|
-
if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
|
|
20217
|
-
const resW = data.width,
|
|
20218
|
-
resH = data.height;
|
|
20219
|
-
if ("repeat-x" === backgroundMode) {
|
|
20220
|
-
w = resW * (targetH / resH), h = targetH;
|
|
20221
|
-
} else if ("repeat-y" === backgroundMode) {
|
|
20222
|
-
h = resH * (targetW / resW), w = targetW;
|
|
20223
|
-
}
|
|
20224
|
-
const dpr = context.dpr,
|
|
20225
|
-
canvas = canvasAllocate.allocate({
|
|
20226
|
-
width: w,
|
|
20227
|
-
height: h,
|
|
20228
|
-
dpr: dpr
|
|
20229
|
-
}),
|
|
20230
|
-
ctx = canvas.getContext("2d");
|
|
20231
|
-
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);
|
|
20232
|
-
}
|
|
20233
|
-
const dpr = context.dpr,
|
|
20234
|
-
pattern = context.createPattern(data, backgroundMode);
|
|
20235
|
-
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);
|
|
20236
|
-
}
|
|
20202
|
+
drawBackgroundImage(context, data, b, params);
|
|
20237
20203
|
}
|
|
20238
20204
|
}
|
|
20239
20205
|
const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
|
|
20206
|
+
const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
|
|
20207
|
+
function getBackgroundImage(background) {
|
|
20208
|
+
var _a;
|
|
20209
|
+
return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
20210
|
+
}
|
|
20211
|
+
function resolveBackgroundSizing({
|
|
20212
|
+
backgroundFit: backgroundFit,
|
|
20213
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
20214
|
+
}) {
|
|
20215
|
+
return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
|
|
20216
|
+
}
|
|
20217
|
+
const NO_REPEAT_SIZING_MAP = {
|
|
20218
|
+
"no-repeat-cover": "cover",
|
|
20219
|
+
"no-repeat-contain": "contain",
|
|
20220
|
+
"no-repeat-fill": "fill",
|
|
20221
|
+
"no-repeat-auto": "auto"
|
|
20222
|
+
};
|
|
20223
|
+
function resolveBackgroundDrawMode({
|
|
20224
|
+
backgroundMode: backgroundMode,
|
|
20225
|
+
backgroundFit: backgroundFit,
|
|
20226
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
20227
|
+
}) {
|
|
20228
|
+
const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
|
|
20229
|
+
return sizing ? {
|
|
20230
|
+
backgroundRepeatMode: "no-repeat",
|
|
20231
|
+
backgroundSizing: sizing
|
|
20232
|
+
} : {
|
|
20233
|
+
backgroundRepeatMode: backgroundMode,
|
|
20234
|
+
backgroundSizing: resolveBackgroundSizing({
|
|
20235
|
+
backgroundFit: backgroundFit,
|
|
20236
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
20237
|
+
})
|
|
20238
|
+
};
|
|
20239
|
+
}
|
|
20240
|
+
function isPercentageValue(value) {
|
|
20241
|
+
return /^-?\d+(\.\d+)?%$/.test(value);
|
|
20242
|
+
}
|
|
20243
|
+
function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
|
|
20244
|
+
if ("number" == typeof value && Number.isFinite(value)) return value;
|
|
20245
|
+
const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
|
|
20246
|
+
if (!normalizedValue || normalizedValue === startKeyword) return 0;
|
|
20247
|
+
if (normalizedValue === centerKeyword) return remainSpace / 2;
|
|
20248
|
+
if (normalizedValue === endKeyword) return remainSpace;
|
|
20249
|
+
if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
|
|
20250
|
+
const parsedValue = Number(normalizedValue);
|
|
20251
|
+
return Number.isFinite(parsedValue) ? parsedValue : 0;
|
|
20252
|
+
}
|
|
20253
|
+
function normalizeBackgroundPosition(position) {
|
|
20254
|
+
var _a, _b;
|
|
20255
|
+
if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
|
|
20256
|
+
const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
|
|
20257
|
+
if (0 === tokens.length) return ["left", "top"];
|
|
20258
|
+
if (1 === tokens.length) {
|
|
20259
|
+
const token = tokens[0];
|
|
20260
|
+
return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
|
|
20261
|
+
}
|
|
20262
|
+
let horizontal, vertical;
|
|
20263
|
+
const genericTokens = [];
|
|
20264
|
+
for (let i = 0; i < 2; i++) {
|
|
20265
|
+
const token = tokens[i];
|
|
20266
|
+
"left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
|
|
20267
|
+
}
|
|
20268
|
+
return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
|
|
20269
|
+
}
|
|
20270
|
+
function resolveBackgroundPosition(position, remainWidth, remainHeight) {
|
|
20271
|
+
const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
|
|
20272
|
+
return {
|
|
20273
|
+
x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
|
|
20274
|
+
y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
|
|
20275
|
+
};
|
|
20276
|
+
}
|
|
20277
|
+
function pickRenderableDimension(...values) {
|
|
20278
|
+
for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
|
|
20279
|
+
return null;
|
|
20280
|
+
}
|
|
20281
|
+
function resolveRenderableImageSize(data) {
|
|
20282
|
+
if (!data) return null;
|
|
20283
|
+
const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
|
|
20284
|
+
height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
|
|
20285
|
+
return null == width || null == height ? null : {
|
|
20286
|
+
width: width,
|
|
20287
|
+
height: height
|
|
20288
|
+
};
|
|
20289
|
+
}
|
|
20290
|
+
function drawBackgroundImage(context, data, b, params) {
|
|
20291
|
+
var _a, _b;
|
|
20292
|
+
const {
|
|
20293
|
+
backgroundMode: backgroundMode,
|
|
20294
|
+
backgroundFit: backgroundFit,
|
|
20295
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20296
|
+
backgroundScale = 1,
|
|
20297
|
+
backgroundOffsetX = 0,
|
|
20298
|
+
backgroundOffsetY = 0,
|
|
20299
|
+
backgroundPosition = "top-left"
|
|
20300
|
+
} = params,
|
|
20301
|
+
targetW = b.width(),
|
|
20302
|
+
targetH = b.height(),
|
|
20303
|
+
sourceSize = resolveRenderableImageSize(data),
|
|
20304
|
+
{
|
|
20305
|
+
backgroundRepeatMode: backgroundRepeatMode,
|
|
20306
|
+
backgroundSizing: resolvedBackgroundSizing
|
|
20307
|
+
} = resolveBackgroundDrawMode({
|
|
20308
|
+
backgroundMode: backgroundMode,
|
|
20309
|
+
backgroundFit: backgroundFit,
|
|
20310
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
20311
|
+
});
|
|
20312
|
+
let w = targetW,
|
|
20313
|
+
h = targetH;
|
|
20314
|
+
if (targetW <= 0 || targetH <= 0) return;
|
|
20315
|
+
if ("no-repeat" === backgroundRepeatMode) {
|
|
20316
|
+
let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
|
|
20317
|
+
drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
|
|
20318
|
+
if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
|
|
20319
|
+
const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
|
|
20320
|
+
drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
|
|
20321
|
+
}
|
|
20322
|
+
drawWidth *= backgroundScale, drawHeight *= backgroundScale;
|
|
20323
|
+
const {
|
|
20324
|
+
x: x,
|
|
20325
|
+
y: y
|
|
20326
|
+
} = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
|
|
20327
|
+
return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
|
|
20328
|
+
}
|
|
20329
|
+
if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
|
|
20330
|
+
const resW = sourceSize.width,
|
|
20331
|
+
resH = sourceSize.height;
|
|
20332
|
+
if ("repeat-x" === backgroundRepeatMode) {
|
|
20333
|
+
w = resW * (targetH / resH), h = targetH;
|
|
20334
|
+
} else if ("repeat-y" === backgroundRepeatMode) {
|
|
20335
|
+
h = resH * (targetW / resW), w = targetW;
|
|
20336
|
+
}
|
|
20337
|
+
const dpr = context.dpr,
|
|
20338
|
+
canvas = canvasAllocate.allocate({
|
|
20339
|
+
width: w,
|
|
20340
|
+
height: h,
|
|
20341
|
+
dpr: dpr
|
|
20342
|
+
}),
|
|
20343
|
+
ctx = canvas.getContext("2d");
|
|
20344
|
+
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);
|
|
20345
|
+
}
|
|
20346
|
+
const dpr = context.dpr,
|
|
20347
|
+
pattern = context.createPattern(data, backgroundRepeatMode);
|
|
20348
|
+
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);
|
|
20349
|
+
}
|
|
20240
20350
|
let DefaultBaseInteractiveRenderContribution = class {
|
|
20241
20351
|
constructor(subRenderContribitions) {
|
|
20242
20352
|
this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
@@ -20593,27 +20703,32 @@
|
|
|
20593
20703
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
20594
20704
|
const {
|
|
20595
20705
|
background: background,
|
|
20706
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
20707
|
+
opacity = graphicAttribute.opacity,
|
|
20596
20708
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
20597
20709
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
20598
20710
|
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
20599
20711
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
20600
20712
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
20601
|
-
backgroundOffsetY = graphicAttribute.backgroundOffsetY
|
|
20713
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
20714
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
20715
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
20602
20716
|
} = graphic.attribute;
|
|
20603
20717
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
20604
|
-
const res = graphic.resources.get(background);
|
|
20605
|
-
if ("success" !== res.state || !res.data) return;
|
|
20718
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
20719
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
20606
20720
|
context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
|
|
20607
20721
|
const b = graphic.AABBBounds;
|
|
20608
|
-
this.doDrawImage(context, res.data, b, {
|
|
20722
|
+
context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
|
|
20609
20723
|
backgroundMode: backgroundMode,
|
|
20610
20724
|
backgroundFit: backgroundFit,
|
|
20611
20725
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20612
20726
|
backgroundScale: backgroundScale,
|
|
20613
20727
|
backgroundOffsetX: backgroundOffsetX,
|
|
20614
|
-
backgroundOffsetY: backgroundOffsetY
|
|
20728
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
20729
|
+
backgroundPosition: backgroundPosition
|
|
20615
20730
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
20616
|
-
} else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
20731
|
+
} else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
20617
20732
|
}
|
|
20618
20733
|
}
|
|
20619
20734
|
const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
|
|
@@ -22095,9 +22210,17 @@
|
|
|
22095
22210
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
22096
22211
|
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
22097
22212
|
const {
|
|
22213
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
22214
|
+
opacity = graphicAttribute.opacity,
|
|
22098
22215
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
22099
22216
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
22100
|
-
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
|
|
22217
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
22218
|
+
backgroundScale = graphicAttribute.backgroundScale,
|
|
22219
|
+
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
22220
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
22221
|
+
backgroundPosition = graphicAttribute.backgroundPosition,
|
|
22222
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
22223
|
+
backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
|
|
22101
22224
|
} = graphic.attribute;
|
|
22102
22225
|
let matrix,
|
|
22103
22226
|
{
|
|
@@ -22109,18 +22232,18 @@
|
|
|
22109
22232
|
};
|
|
22110
22233
|
let b;
|
|
22111
22234
|
"richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
|
|
22112
|
-
const
|
|
22235
|
+
const backgroundConfig = isObject$2(background) && background.background ? background : null,
|
|
22113
22236
|
onlyTranslate = graphic.transMatrix.onlyTranslate();
|
|
22114
|
-
if (
|
|
22237
|
+
if (backgroundConfig) {
|
|
22115
22238
|
const _b = graphic.AABBBounds,
|
|
22116
|
-
x = (null !== (_a =
|
|
22117
|
-
y = (null !== (_d =
|
|
22118
|
-
w = null !== (_f =
|
|
22119
|
-
h = null !== (_g =
|
|
22120
|
-
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background =
|
|
22239
|
+
x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
|
|
22240
|
+
y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
|
|
22241
|
+
w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
|
|
22242
|
+
h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
|
|
22243
|
+
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
|
|
22121
22244
|
const w = b.width(),
|
|
22122
22245
|
h = b.height();
|
|
22123
|
-
b.set((null !== (_h =
|
|
22246
|
+
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);
|
|
22124
22247
|
}
|
|
22125
22248
|
} else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
|
|
22126
22249
|
angle: 0,
|
|
@@ -22133,20 +22256,18 @@
|
|
|
22133
22256
|
})).clone());
|
|
22134
22257
|
if (graphic.backgroundImg && graphic.resources) {
|
|
22135
22258
|
const res = graphic.resources.get(background);
|
|
22136
|
-
if ("success" !== res.state || !res.data) return void restore();
|
|
22137
|
-
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.
|
|
22259
|
+
if (!res || "success" !== res.state || !res.data) return void restore();
|
|
22260
|
+
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, {
|
|
22138
22261
|
backgroundMode: backgroundMode,
|
|
22139
22262
|
backgroundFit: backgroundFit,
|
|
22140
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
22263
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
22264
|
+
backgroundScale: backgroundScale,
|
|
22265
|
+
backgroundOffsetX: backgroundOffsetX,
|
|
22266
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
22267
|
+
backgroundPosition: backgroundPosition
|
|
22141
22268
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
22142
|
-
} else
|
|
22143
|
-
|
|
22144
|
-
backgroundCornerRadius: backgroundCornerRadius,
|
|
22145
|
-
backgroundOpacity = 1
|
|
22146
|
-
} = graphic.attribute;
|
|
22147
|
-
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();
|
|
22148
|
-
}
|
|
22149
|
-
shouldReCalBounds && boundsAllocate.free(b), restore();
|
|
22269
|
+
} 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();
|
|
22270
|
+
backgroundConfig && boundsAllocate.free(b), restore();
|
|
22150
22271
|
}
|
|
22151
22272
|
}
|
|
22152
22273
|
const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
|
|
@@ -22573,6 +22694,92 @@
|
|
|
22573
22694
|
};
|
|
22574
22695
|
};
|
|
22575
22696
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
22697
|
+
function resolveImageMode({
|
|
22698
|
+
repeatX = "no-repeat",
|
|
22699
|
+
repeatY = "no-repeat",
|
|
22700
|
+
imageMode: imageMode
|
|
22701
|
+
}) {
|
|
22702
|
+
const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
|
|
22703
|
+
return {
|
|
22704
|
+
repeatMode: repeatMode,
|
|
22705
|
+
sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
|
|
22706
|
+
};
|
|
22707
|
+
}
|
|
22708
|
+
const IMAGE_MODE_TO_BACKGROUND_MODE = {
|
|
22709
|
+
cover: "no-repeat-cover",
|
|
22710
|
+
contain: "no-repeat-contain",
|
|
22711
|
+
fill: "no-repeat-fill",
|
|
22712
|
+
auto: "no-repeat-auto"
|
|
22713
|
+
};
|
|
22714
|
+
function resolveBackgroundParamsByImageSizing(sizingMode) {
|
|
22715
|
+
return {
|
|
22716
|
+
backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
|
|
22717
|
+
backgroundFit: !1,
|
|
22718
|
+
backgroundKeepAspectRatio: !1
|
|
22719
|
+
};
|
|
22720
|
+
}
|
|
22721
|
+
function resolveImageRepeatMode(repeatX, repeatY) {
|
|
22722
|
+
let repeat = 0;
|
|
22723
|
+
return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
|
|
22724
|
+
}
|
|
22725
|
+
function shouldClipImageByLayout({
|
|
22726
|
+
repeatX = "no-repeat",
|
|
22727
|
+
repeatY = "no-repeat",
|
|
22728
|
+
imageMode: imageMode,
|
|
22729
|
+
imageScale = 1,
|
|
22730
|
+
imageOffsetX = 0,
|
|
22731
|
+
imageOffsetY = 0,
|
|
22732
|
+
imagePosition = "top-left"
|
|
22733
|
+
}) {
|
|
22734
|
+
const {
|
|
22735
|
+
repeatMode: repeatMode,
|
|
22736
|
+
sizingMode: sizingMode
|
|
22737
|
+
} = resolveImageMode({
|
|
22738
|
+
repeatX: repeatX,
|
|
22739
|
+
repeatY: repeatY,
|
|
22740
|
+
imageMode: imageMode
|
|
22741
|
+
});
|
|
22742
|
+
return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
|
|
22743
|
+
}
|
|
22744
|
+
function drawImageWithLayout(context, data, x, y, width, height, {
|
|
22745
|
+
repeatX = "no-repeat",
|
|
22746
|
+
repeatY = "no-repeat",
|
|
22747
|
+
imageMode: imageMode,
|
|
22748
|
+
imageScale = 1,
|
|
22749
|
+
imageOffsetX = 0,
|
|
22750
|
+
imageOffsetY = 0,
|
|
22751
|
+
imagePosition = "top-left"
|
|
22752
|
+
}) {
|
|
22753
|
+
const {
|
|
22754
|
+
repeatMode: repeatMode,
|
|
22755
|
+
sizingMode: sizingMode
|
|
22756
|
+
} = resolveImageMode({
|
|
22757
|
+
repeatX: repeatX,
|
|
22758
|
+
repeatY: repeatY,
|
|
22759
|
+
imageMode: imageMode
|
|
22760
|
+
}),
|
|
22761
|
+
imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
|
|
22762
|
+
backgroundMode: repeatMode,
|
|
22763
|
+
backgroundFit: !1,
|
|
22764
|
+
backgroundKeepAspectRatio: !1
|
|
22765
|
+
};
|
|
22766
|
+
drawBackgroundImage(context, data, {
|
|
22767
|
+
x1: x,
|
|
22768
|
+
y1: y,
|
|
22769
|
+
x2: x + width,
|
|
22770
|
+
y2: y + height,
|
|
22771
|
+
width: () => width,
|
|
22772
|
+
height: () => height
|
|
22773
|
+
}, {
|
|
22774
|
+
backgroundMode: imageBackgroundParams.backgroundMode,
|
|
22775
|
+
backgroundFit: imageBackgroundParams.backgroundFit,
|
|
22776
|
+
backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
|
|
22777
|
+
backgroundScale: imageScale,
|
|
22778
|
+
backgroundOffsetX: imageOffsetX,
|
|
22779
|
+
backgroundOffsetY: imageOffsetY,
|
|
22780
|
+
backgroundPosition: imagePosition
|
|
22781
|
+
});
|
|
22782
|
+
}
|
|
22576
22783
|
let DefaultCanvasImageRender = class extends BaseRender {
|
|
22577
22784
|
constructor(graphicRenderContributions) {
|
|
22578
22785
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -22587,6 +22794,11 @@
|
|
|
22587
22794
|
cornerRadius = imageAttribute.cornerRadius,
|
|
22588
22795
|
fillStrokeOrder = imageAttribute.fillStrokeOrder,
|
|
22589
22796
|
cornerType = imageAttribute.cornerType,
|
|
22797
|
+
imageMode = imageAttribute.imageMode,
|
|
22798
|
+
imageScale = imageAttribute.imageScale,
|
|
22799
|
+
imageOffsetX = imageAttribute.imageOffsetX,
|
|
22800
|
+
imageOffsetY = imageAttribute.imageOffsetY,
|
|
22801
|
+
imagePosition = imageAttribute.imagePosition,
|
|
22590
22802
|
image: url
|
|
22591
22803
|
} = image.attribute,
|
|
22592
22804
|
data = this.valid(image, imageAttribute, fillCb);
|
|
@@ -22603,22 +22815,33 @@
|
|
|
22603
22815
|
const width = image.width,
|
|
22604
22816
|
height = image.height;
|
|
22605
22817
|
context.beginPath();
|
|
22606
|
-
let
|
|
22607
|
-
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),
|
|
22818
|
+
let needCornerClip = !1;
|
|
22819
|
+
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);
|
|
22608
22820
|
const _runFill = () => {
|
|
22609
|
-
|
|
22610
|
-
|
|
22611
|
-
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
|
|
22616
|
-
|
|
22821
|
+
doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
|
|
22822
|
+
repeatX: repeatX,
|
|
22823
|
+
repeatY: repeatY,
|
|
22824
|
+
imageMode: imageMode,
|
|
22825
|
+
imageScale: imageScale,
|
|
22826
|
+
imageOffsetX: imageOffsetX,
|
|
22827
|
+
imageOffsetY: imageOffsetY,
|
|
22828
|
+
imagePosition: imagePosition
|
|
22829
|
+
})));
|
|
22617
22830
|
},
|
|
22618
22831
|
_runStroke = () => {
|
|
22619
22832
|
doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
|
|
22620
|
-
}
|
|
22621
|
-
|
|
22833
|
+
},
|
|
22834
|
+
needLayoutClip = shouldClipImageByLayout({
|
|
22835
|
+
repeatX: repeatX,
|
|
22836
|
+
repeatY: repeatY,
|
|
22837
|
+
imageMode: imageMode,
|
|
22838
|
+
imageScale: imageScale,
|
|
22839
|
+
imageOffsetX: imageOffsetX,
|
|
22840
|
+
imageOffsetY: imageOffsetY,
|
|
22841
|
+
imagePosition: imagePosition
|
|
22842
|
+
}),
|
|
22843
|
+
needClip = needCornerClip || needLayoutClip;
|
|
22844
|
+
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);
|
|
22622
22845
|
}
|
|
22623
22846
|
draw(image, renderService, drawContext) {
|
|
22624
22847
|
const {
|
|
@@ -23477,7 +23700,7 @@
|
|
|
23477
23700
|
return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
|
|
23478
23701
|
}
|
|
23479
23702
|
clearScreen(renderService, context, drawContext) {
|
|
23480
|
-
var _a, _b, _c;
|
|
23703
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
23481
23704
|
const {
|
|
23482
23705
|
clear: clear,
|
|
23483
23706
|
viewBox: viewBox
|
|
@@ -23487,9 +23710,20 @@
|
|
|
23487
23710
|
if (clear) {
|
|
23488
23711
|
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);
|
|
23489
23712
|
const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
|
|
23490
|
-
if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
|
|
23491
|
-
const res = stage.resources.get(clear);
|
|
23492
|
-
res && "success" === res.state && res.data
|
|
23713
|
+
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) {
|
|
23714
|
+
const res = stage.resources.get(getBackgroundImage(clear));
|
|
23715
|
+
if (res && "success" === res.state && res.data) {
|
|
23716
|
+
const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
|
|
23717
|
+
drawBackgroundImage(context, res.data, backgroundBounds, {
|
|
23718
|
+
backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
|
|
23719
|
+
backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
|
|
23720
|
+
backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
|
|
23721
|
+
backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
|
|
23722
|
+
backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
|
|
23723
|
+
backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
|
|
23724
|
+
backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
|
|
23725
|
+
}), boundsAllocate.free(backgroundBounds);
|
|
23726
|
+
}
|
|
23493
23727
|
} else context.fillStyle = createColor(context, clear, {
|
|
23494
23728
|
AABBBounds: {
|
|
23495
23729
|
x1: 0,
|
|
@@ -23987,7 +24221,7 @@
|
|
|
23987
24221
|
return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
|
|
23988
24222
|
}
|
|
23989
24223
|
set background(b) {
|
|
23990
|
-
this._background = b;
|
|
24224
|
+
this._background = b, this.syncBackgroundImage(b);
|
|
23991
24225
|
}
|
|
23992
24226
|
get defaultLayer() {
|
|
23993
24227
|
return this.at(0);
|
|
@@ -24001,6 +24235,18 @@
|
|
|
24001
24235
|
set ticker(ticker) {
|
|
24002
24236
|
ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
|
|
24003
24237
|
}
|
|
24238
|
+
syncBackgroundImage(background) {
|
|
24239
|
+
var _a;
|
|
24240
|
+
const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
24241
|
+
this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
|
|
24242
|
+
}
|
|
24243
|
+
isImageBackgroundSource(source) {
|
|
24244
|
+
if (!source) return !1;
|
|
24245
|
+
if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
|
|
24246
|
+
if (!isObject$2(source)) return !1;
|
|
24247
|
+
const gradientSource = source;
|
|
24248
|
+
return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
|
|
24249
|
+
}
|
|
24004
24250
|
constructor(params = {}) {
|
|
24005
24251
|
var _a, _b;
|
|
24006
24252
|
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
@@ -24039,9 +24285,7 @@
|
|
|
24039
24285
|
main: !0
|
|
24040
24286
|
})), 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 = {
|
|
24041
24287
|
tickRenderMode: "effect"
|
|
24042
|
-
}), this.optmize(params.optimize), params.background &&
|
|
24043
|
-
background: this._background
|
|
24044
|
-
}), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|
|
24288
|
+
}), 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());
|
|
24045
24289
|
}
|
|
24046
24290
|
initAnimate(params) {
|
|
24047
24291
|
var _a;
|
|
@@ -35199,6 +35443,7 @@
|
|
|
35199
35443
|
if (custom.prototype.constructor === custom) {
|
|
35200
35444
|
const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
|
|
35201
35445
|
if (descriptor && !descriptor.writable) return 1;
|
|
35446
|
+
if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
|
|
35202
35447
|
}
|
|
35203
35448
|
return 2;
|
|
35204
35449
|
}
|
|
@@ -61935,7 +62180,7 @@
|
|
|
61935
62180
|
});
|
|
61936
62181
|
};
|
|
61937
62182
|
|
|
61938
|
-
const version = "2.0.
|
|
62183
|
+
const version = "2.0.21";
|
|
61939
62184
|
|
|
61940
62185
|
const addVChartProperty = (data, op) => {
|
|
61941
62186
|
const context = op.beforeCall();
|