@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.es.js
CHANGED
|
@@ -11430,7 +11430,9 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
|
11430
11430
|
background: null,
|
|
11431
11431
|
autoAnimateTexture: !1,
|
|
11432
11432
|
textureRatio: 1,
|
|
11433
|
-
textureOptions:
|
|
11433
|
+
textureOptions: {
|
|
11434
|
+
alignToGraphic: !0
|
|
11435
|
+
},
|
|
11434
11436
|
backgroundOpacity: 1,
|
|
11435
11437
|
backgroundCornerRadius: 0,
|
|
11436
11438
|
texture: null,
|
|
@@ -11444,6 +11446,7 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
|
11444
11446
|
backgroundScale: 1,
|
|
11445
11447
|
backgroundOffsetX: 0,
|
|
11446
11448
|
backgroundOffsetY: 0,
|
|
11449
|
+
backgroundPosition: "top-left",
|
|
11447
11450
|
blur: 0,
|
|
11448
11451
|
filter: "",
|
|
11449
11452
|
cursor: null,
|
|
@@ -11616,11 +11619,16 @@ const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, D
|
|
|
11616
11619
|
const DefaultImageAttribute = Object.assign(Object.assign({
|
|
11617
11620
|
repeatX: "no-repeat",
|
|
11618
11621
|
repeatY: "no-repeat",
|
|
11622
|
+
imageMode: void 0,
|
|
11619
11623
|
image: "",
|
|
11620
11624
|
width: 0,
|
|
11621
11625
|
height: 0,
|
|
11622
11626
|
maxWidth: 500,
|
|
11623
|
-
maxHeight: 500
|
|
11627
|
+
maxHeight: 500,
|
|
11628
|
+
imagePosition: "top-left",
|
|
11629
|
+
imageScale: 1,
|
|
11630
|
+
imageOffsetX: 0,
|
|
11631
|
+
imageOffsetY: 0
|
|
11624
11632
|
}, DefaultAttribute), {
|
|
11625
11633
|
fill: !0,
|
|
11626
11634
|
cornerRadius: 0,
|
|
@@ -16672,7 +16680,8 @@ class Graphic extends Node {
|
|
|
16672
16680
|
return isString$1(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
|
|
16673
16681
|
}
|
|
16674
16682
|
loadImage(image, background = !1) {
|
|
16675
|
-
if (
|
|
16683
|
+
if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
|
|
16684
|
+
if (!image) return;
|
|
16676
16685
|
const url = image;
|
|
16677
16686
|
this.resources || (this.resources = new Map());
|
|
16678
16687
|
const cache = {
|
|
@@ -16727,7 +16736,7 @@ class Graphic extends Node {
|
|
|
16727
16736
|
}
|
|
16728
16737
|
}
|
|
16729
16738
|
function backgroundNotImage(image) {
|
|
16730
|
-
return !(!image.fill && !image.stroke);
|
|
16739
|
+
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));
|
|
16731
16740
|
}
|
|
16732
16741
|
function isExternalTexture(texture) {
|
|
16733
16742
|
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
|
|
@@ -18863,7 +18872,7 @@ function seperateParagraph(paragraph, index) {
|
|
|
18863
18872
|
return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
|
|
18864
18873
|
}
|
|
18865
18874
|
|
|
18866
|
-
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];
|
|
18867
18876
|
class Image extends Graphic {
|
|
18868
18877
|
constructor(params) {
|
|
18869
18878
|
super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
|
|
@@ -18968,6 +18977,7 @@ class Image extends Graphic {
|
|
|
18968
18977
|
}
|
|
18969
18978
|
Image.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
18970
18979
|
image: 1,
|
|
18980
|
+
imageMode: 1,
|
|
18971
18981
|
repeatX: 1,
|
|
18972
18982
|
repeatY: 1
|
|
18973
18983
|
}, NOWORK_ANIMATE_ATTR);
|
|
@@ -20161,11 +20171,12 @@ class DefaultBaseBackgroundRenderContribution {
|
|
|
20161
20171
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
20162
20172
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
20163
20173
|
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
20164
|
-
backgroundClip = graphicAttribute.backgroundClip
|
|
20174
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
20175
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
20165
20176
|
} = graphic.attribute;
|
|
20166
20177
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
20167
|
-
const res = graphic.resources.get(background);
|
|
20168
|
-
if ("success" !== res.state || !res.data) return;
|
|
20178
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
20179
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
20169
20180
|
if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
|
|
20170
20181
|
const groupAttribute = getTheme$1(graphic.parent).group,
|
|
20171
20182
|
{
|
|
@@ -20182,59 +20193,160 @@ class DefaultBaseBackgroundRenderContribution {
|
|
|
20182
20193
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20183
20194
|
backgroundScale: backgroundScale,
|
|
20184
20195
|
backgroundOffsetX: backgroundOffsetX,
|
|
20185
|
-
backgroundOffsetY: backgroundOffsetY
|
|
20196
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
20197
|
+
backgroundPosition: backgroundPosition
|
|
20186
20198
|
}), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
|
|
20187
20199
|
} else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
20188
20200
|
}
|
|
20189
20201
|
doDrawImage(context, data, b, params) {
|
|
20190
|
-
|
|
20191
|
-
backgroundMode: backgroundMode,
|
|
20192
|
-
backgroundFit: backgroundFit,
|
|
20193
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20194
|
-
backgroundScale = 1,
|
|
20195
|
-
backgroundOffsetX = 0,
|
|
20196
|
-
backgroundOffsetY = 0
|
|
20197
|
-
} = params,
|
|
20198
|
-
targetW = b.width(),
|
|
20199
|
-
targetH = b.height();
|
|
20200
|
-
let w = targetW,
|
|
20201
|
-
h = targetH;
|
|
20202
|
-
if ("no-repeat" === backgroundMode) {
|
|
20203
|
-
if (backgroundFit) {
|
|
20204
|
-
if (backgroundKeepAspectRatio) {
|
|
20205
|
-
const maxScale = Math.max(targetW / data.width, targetH / data.height);
|
|
20206
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
|
|
20207
|
-
} else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
20208
|
-
} else {
|
|
20209
|
-
const resW = data.width * backgroundScale,
|
|
20210
|
-
resH = data.height * backgroundScale;
|
|
20211
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
|
|
20212
|
-
}
|
|
20213
|
-
} else {
|
|
20214
|
-
if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
|
|
20215
|
-
const resW = data.width,
|
|
20216
|
-
resH = data.height;
|
|
20217
|
-
if ("repeat-x" === backgroundMode) {
|
|
20218
|
-
w = resW * (targetH / resH), h = targetH;
|
|
20219
|
-
} else if ("repeat-y" === backgroundMode) {
|
|
20220
|
-
h = resH * (targetW / resW), w = targetW;
|
|
20221
|
-
}
|
|
20222
|
-
const dpr = context.dpr,
|
|
20223
|
-
canvas = canvasAllocate.allocate({
|
|
20224
|
-
width: w,
|
|
20225
|
-
height: h,
|
|
20226
|
-
dpr: dpr
|
|
20227
|
-
}),
|
|
20228
|
-
ctx = canvas.getContext("2d");
|
|
20229
|
-
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);
|
|
20230
|
-
}
|
|
20231
|
-
const dpr = context.dpr,
|
|
20232
|
-
pattern = context.createPattern(data, backgroundMode);
|
|
20233
|
-
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);
|
|
20234
|
-
}
|
|
20202
|
+
drawBackgroundImage(context, data, b, params);
|
|
20235
20203
|
}
|
|
20236
20204
|
}
|
|
20237
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
|
+
}
|
|
20238
20350
|
let DefaultBaseInteractiveRenderContribution = class {
|
|
20239
20351
|
constructor(subRenderContribitions) {
|
|
20240
20352
|
this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
@@ -20393,7 +20505,7 @@ class DefaultBaseTextureRenderContribution {
|
|
|
20393
20505
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
20394
20506
|
}
|
|
20395
20507
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
20396
|
-
var _a;
|
|
20508
|
+
var _a, _b, _c, _d, _e;
|
|
20397
20509
|
const {
|
|
20398
20510
|
textureRatio = graphicAttribute.textureRatio,
|
|
20399
20511
|
textureOptions = null
|
|
@@ -20476,7 +20588,21 @@ class DefaultBaseTextureRenderContribution {
|
|
|
20476
20588
|
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());
|
|
20477
20589
|
}
|
|
20478
20590
|
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();
|
|
20479
|
-
} else if (pattern)
|
|
20591
|
+
} else if (pattern) {
|
|
20592
|
+
if (pattern.setTransform) {
|
|
20593
|
+
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
20594
|
+
alignOffsetX = null !== (_b = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _b ? _b : 0,
|
|
20595
|
+
alignOffsetY = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _c ? _c : 0;
|
|
20596
|
+
let translateX = 0,
|
|
20597
|
+
translateY = 0;
|
|
20598
|
+
if (alignToGraphic) {
|
|
20599
|
+
const m = context.currentMatrix;
|
|
20600
|
+
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;
|
|
20601
|
+
} else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
|
|
20602
|
+
pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
|
|
20603
|
+
}
|
|
20604
|
+
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
|
|
20605
|
+
} else if ("wave" === texture) {
|
|
20480
20606
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
20481
20607
|
const b = graphic.AABBBounds;
|
|
20482
20608
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -20606,27 +20732,32 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
|
|
|
20606
20732
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
20607
20733
|
const {
|
|
20608
20734
|
background: background,
|
|
20735
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
20736
|
+
opacity = graphicAttribute.opacity,
|
|
20609
20737
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
20610
20738
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
20611
20739
|
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
20612
20740
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
20613
20741
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
20614
|
-
backgroundOffsetY = graphicAttribute.backgroundOffsetY
|
|
20742
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
20743
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
20744
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
20615
20745
|
} = graphic.attribute;
|
|
20616
20746
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
20617
|
-
const res = graphic.resources.get(background);
|
|
20618
|
-
if ("success" !== res.state || !res.data) return;
|
|
20747
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
20748
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
20619
20749
|
context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
|
|
20620
20750
|
const b = graphic.AABBBounds;
|
|
20621
|
-
this.doDrawImage(context, res.data, b, {
|
|
20751
|
+
context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
|
|
20622
20752
|
backgroundMode: backgroundMode,
|
|
20623
20753
|
backgroundFit: backgroundFit,
|
|
20624
20754
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
20625
20755
|
backgroundScale: backgroundScale,
|
|
20626
20756
|
backgroundOffsetX: backgroundOffsetX,
|
|
20627
|
-
backgroundOffsetY: backgroundOffsetY
|
|
20757
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
20758
|
+
backgroundPosition: backgroundPosition
|
|
20628
20759
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
20629
|
-
} else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
20760
|
+
} else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
20630
20761
|
}
|
|
20631
20762
|
}
|
|
20632
20763
|
const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
|
|
@@ -22108,9 +22239,17 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
|
|
|
22108
22239
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
22109
22240
|
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
22110
22241
|
const {
|
|
22242
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
22243
|
+
opacity = graphicAttribute.opacity,
|
|
22111
22244
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
22112
22245
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
22113
|
-
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
|
|
22246
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
22247
|
+
backgroundScale = graphicAttribute.backgroundScale,
|
|
22248
|
+
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
22249
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
22250
|
+
backgroundPosition = graphicAttribute.backgroundPosition,
|
|
22251
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
22252
|
+
backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
|
|
22114
22253
|
} = graphic.attribute;
|
|
22115
22254
|
let matrix,
|
|
22116
22255
|
{
|
|
@@ -22122,18 +22261,18 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
|
|
|
22122
22261
|
};
|
|
22123
22262
|
let b;
|
|
22124
22263
|
"richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
|
|
22125
|
-
const
|
|
22264
|
+
const backgroundConfig = isObject$2(background) && background.background ? background : null,
|
|
22126
22265
|
onlyTranslate = graphic.transMatrix.onlyTranslate();
|
|
22127
|
-
if (
|
|
22266
|
+
if (backgroundConfig) {
|
|
22128
22267
|
const _b = graphic.AABBBounds,
|
|
22129
|
-
x = (null !== (_a =
|
|
22130
|
-
y = (null !== (_d =
|
|
22131
|
-
w = null !== (_f =
|
|
22132
|
-
h = null !== (_g =
|
|
22133
|
-
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background =
|
|
22268
|
+
x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
|
|
22269
|
+
y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
|
|
22270
|
+
w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
|
|
22271
|
+
h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
|
|
22272
|
+
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
|
|
22134
22273
|
const w = b.width(),
|
|
22135
22274
|
h = b.height();
|
|
22136
|
-
b.set((null !== (_h =
|
|
22275
|
+
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);
|
|
22137
22276
|
}
|
|
22138
22277
|
} else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
|
|
22139
22278
|
angle: 0,
|
|
@@ -22146,20 +22285,18 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
|
|
|
22146
22285
|
})).clone());
|
|
22147
22286
|
if (graphic.backgroundImg && graphic.resources) {
|
|
22148
22287
|
const res = graphic.resources.get(background);
|
|
22149
|
-
if ("success" !== res.state || !res.data) return void restore();
|
|
22150
|
-
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.
|
|
22288
|
+
if (!res || "success" !== res.state || !res.data) return void restore();
|
|
22289
|
+
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, {
|
|
22151
22290
|
backgroundMode: backgroundMode,
|
|
22152
22291
|
backgroundFit: backgroundFit,
|
|
22153
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
22292
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
22293
|
+
backgroundScale: backgroundScale,
|
|
22294
|
+
backgroundOffsetX: backgroundOffsetX,
|
|
22295
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
22296
|
+
backgroundPosition: backgroundPosition
|
|
22154
22297
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
22155
|
-
} else
|
|
22156
|
-
|
|
22157
|
-
backgroundCornerRadius: backgroundCornerRadius,
|
|
22158
|
-
backgroundOpacity = 1
|
|
22159
|
-
} = graphic.attribute;
|
|
22160
|
-
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();
|
|
22161
|
-
}
|
|
22162
|
-
shouldReCalBounds && boundsAllocate.free(b), restore();
|
|
22298
|
+
} 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();
|
|
22299
|
+
backgroundConfig && boundsAllocate.free(b), restore();
|
|
22163
22300
|
}
|
|
22164
22301
|
}
|
|
22165
22302
|
const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
|
|
@@ -22586,6 +22723,92 @@ var __decorate$1h = undefined && undefined.__decorate || function (decorators, t
|
|
|
22586
22723
|
};
|
|
22587
22724
|
};
|
|
22588
22725
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
22726
|
+
function resolveImageMode({
|
|
22727
|
+
repeatX = "no-repeat",
|
|
22728
|
+
repeatY = "no-repeat",
|
|
22729
|
+
imageMode: imageMode
|
|
22730
|
+
}) {
|
|
22731
|
+
const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
|
|
22732
|
+
return {
|
|
22733
|
+
repeatMode: repeatMode,
|
|
22734
|
+
sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
|
|
22735
|
+
};
|
|
22736
|
+
}
|
|
22737
|
+
const IMAGE_MODE_TO_BACKGROUND_MODE = {
|
|
22738
|
+
cover: "no-repeat-cover",
|
|
22739
|
+
contain: "no-repeat-contain",
|
|
22740
|
+
fill: "no-repeat-fill",
|
|
22741
|
+
auto: "no-repeat-auto"
|
|
22742
|
+
};
|
|
22743
|
+
function resolveBackgroundParamsByImageSizing(sizingMode) {
|
|
22744
|
+
return {
|
|
22745
|
+
backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
|
|
22746
|
+
backgroundFit: !1,
|
|
22747
|
+
backgroundKeepAspectRatio: !1
|
|
22748
|
+
};
|
|
22749
|
+
}
|
|
22750
|
+
function resolveImageRepeatMode(repeatX, repeatY) {
|
|
22751
|
+
let repeat = 0;
|
|
22752
|
+
return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
|
|
22753
|
+
}
|
|
22754
|
+
function shouldClipImageByLayout({
|
|
22755
|
+
repeatX = "no-repeat",
|
|
22756
|
+
repeatY = "no-repeat",
|
|
22757
|
+
imageMode: imageMode,
|
|
22758
|
+
imageScale = 1,
|
|
22759
|
+
imageOffsetX = 0,
|
|
22760
|
+
imageOffsetY = 0,
|
|
22761
|
+
imagePosition = "top-left"
|
|
22762
|
+
}) {
|
|
22763
|
+
const {
|
|
22764
|
+
repeatMode: repeatMode,
|
|
22765
|
+
sizingMode: sizingMode
|
|
22766
|
+
} = resolveImageMode({
|
|
22767
|
+
repeatX: repeatX,
|
|
22768
|
+
repeatY: repeatY,
|
|
22769
|
+
imageMode: imageMode
|
|
22770
|
+
});
|
|
22771
|
+
return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
|
|
22772
|
+
}
|
|
22773
|
+
function drawImageWithLayout(context, data, x, y, width, height, {
|
|
22774
|
+
repeatX = "no-repeat",
|
|
22775
|
+
repeatY = "no-repeat",
|
|
22776
|
+
imageMode: imageMode,
|
|
22777
|
+
imageScale = 1,
|
|
22778
|
+
imageOffsetX = 0,
|
|
22779
|
+
imageOffsetY = 0,
|
|
22780
|
+
imagePosition = "top-left"
|
|
22781
|
+
}) {
|
|
22782
|
+
const {
|
|
22783
|
+
repeatMode: repeatMode,
|
|
22784
|
+
sizingMode: sizingMode
|
|
22785
|
+
} = resolveImageMode({
|
|
22786
|
+
repeatX: repeatX,
|
|
22787
|
+
repeatY: repeatY,
|
|
22788
|
+
imageMode: imageMode
|
|
22789
|
+
}),
|
|
22790
|
+
imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
|
|
22791
|
+
backgroundMode: repeatMode,
|
|
22792
|
+
backgroundFit: !1,
|
|
22793
|
+
backgroundKeepAspectRatio: !1
|
|
22794
|
+
};
|
|
22795
|
+
drawBackgroundImage(context, data, {
|
|
22796
|
+
x1: x,
|
|
22797
|
+
y1: y,
|
|
22798
|
+
x2: x + width,
|
|
22799
|
+
y2: y + height,
|
|
22800
|
+
width: () => width,
|
|
22801
|
+
height: () => height
|
|
22802
|
+
}, {
|
|
22803
|
+
backgroundMode: imageBackgroundParams.backgroundMode,
|
|
22804
|
+
backgroundFit: imageBackgroundParams.backgroundFit,
|
|
22805
|
+
backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
|
|
22806
|
+
backgroundScale: imageScale,
|
|
22807
|
+
backgroundOffsetX: imageOffsetX,
|
|
22808
|
+
backgroundOffsetY: imageOffsetY,
|
|
22809
|
+
backgroundPosition: imagePosition
|
|
22810
|
+
});
|
|
22811
|
+
}
|
|
22589
22812
|
let DefaultCanvasImageRender = class extends BaseRender {
|
|
22590
22813
|
constructor(graphicRenderContributions) {
|
|
22591
22814
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -22600,6 +22823,11 @@ let DefaultCanvasImageRender = class extends BaseRender {
|
|
|
22600
22823
|
cornerRadius = imageAttribute.cornerRadius,
|
|
22601
22824
|
fillStrokeOrder = imageAttribute.fillStrokeOrder,
|
|
22602
22825
|
cornerType = imageAttribute.cornerType,
|
|
22826
|
+
imageMode = imageAttribute.imageMode,
|
|
22827
|
+
imageScale = imageAttribute.imageScale,
|
|
22828
|
+
imageOffsetX = imageAttribute.imageOffsetX,
|
|
22829
|
+
imageOffsetY = imageAttribute.imageOffsetY,
|
|
22830
|
+
imagePosition = imageAttribute.imagePosition,
|
|
22603
22831
|
image: url
|
|
22604
22832
|
} = image.attribute,
|
|
22605
22833
|
data = this.valid(image, imageAttribute, fillCb);
|
|
@@ -22616,22 +22844,33 @@ let DefaultCanvasImageRender = class extends BaseRender {
|
|
|
22616
22844
|
const width = image.width,
|
|
22617
22845
|
height = image.height;
|
|
22618
22846
|
context.beginPath();
|
|
22619
|
-
let
|
|
22620
|
-
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),
|
|
22847
|
+
let needCornerClip = !1;
|
|
22848
|
+
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);
|
|
22621
22849
|
const _runFill = () => {
|
|
22622
|
-
|
|
22623
|
-
|
|
22624
|
-
|
|
22625
|
-
|
|
22626
|
-
|
|
22627
|
-
|
|
22628
|
-
|
|
22629
|
-
|
|
22850
|
+
doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
|
|
22851
|
+
repeatX: repeatX,
|
|
22852
|
+
repeatY: repeatY,
|
|
22853
|
+
imageMode: imageMode,
|
|
22854
|
+
imageScale: imageScale,
|
|
22855
|
+
imageOffsetX: imageOffsetX,
|
|
22856
|
+
imageOffsetY: imageOffsetY,
|
|
22857
|
+
imagePosition: imagePosition
|
|
22858
|
+
})));
|
|
22630
22859
|
},
|
|
22631
22860
|
_runStroke = () => {
|
|
22632
22861
|
doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
|
|
22633
|
-
}
|
|
22634
|
-
|
|
22862
|
+
},
|
|
22863
|
+
needLayoutClip = shouldClipImageByLayout({
|
|
22864
|
+
repeatX: repeatX,
|
|
22865
|
+
repeatY: repeatY,
|
|
22866
|
+
imageMode: imageMode,
|
|
22867
|
+
imageScale: imageScale,
|
|
22868
|
+
imageOffsetX: imageOffsetX,
|
|
22869
|
+
imageOffsetY: imageOffsetY,
|
|
22870
|
+
imagePosition: imagePosition
|
|
22871
|
+
}),
|
|
22872
|
+
needClip = needCornerClip || needLayoutClip;
|
|
22873
|
+
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);
|
|
22635
22874
|
}
|
|
22636
22875
|
draw(image, renderService, drawContext) {
|
|
22637
22876
|
const {
|
|
@@ -23490,7 +23729,7 @@ let DefaultDrawContribution = class {
|
|
|
23490
23729
|
return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
|
|
23491
23730
|
}
|
|
23492
23731
|
clearScreen(renderService, context, drawContext) {
|
|
23493
|
-
var _a, _b, _c;
|
|
23732
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
23494
23733
|
const {
|
|
23495
23734
|
clear: clear,
|
|
23496
23735
|
viewBox: viewBox
|
|
@@ -23500,9 +23739,20 @@ let DefaultDrawContribution = class {
|
|
|
23500
23739
|
if (clear) {
|
|
23501
23740
|
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);
|
|
23502
23741
|
const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
|
|
23503
|
-
if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
|
|
23504
|
-
const res = stage.resources.get(clear);
|
|
23505
|
-
res && "success" === res.state && res.data
|
|
23742
|
+
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) {
|
|
23743
|
+
const res = stage.resources.get(getBackgroundImage(clear));
|
|
23744
|
+
if (res && "success" === res.state && res.data) {
|
|
23745
|
+
const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
|
|
23746
|
+
drawBackgroundImage(context, res.data, backgroundBounds, {
|
|
23747
|
+
backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
|
|
23748
|
+
backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
|
|
23749
|
+
backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
|
|
23750
|
+
backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
|
|
23751
|
+
backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
|
|
23752
|
+
backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
|
|
23753
|
+
backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
|
|
23754
|
+
}), boundsAllocate.free(backgroundBounds);
|
|
23755
|
+
}
|
|
23506
23756
|
} else context.fillStyle = createColor(context, clear, {
|
|
23507
23757
|
AABBBounds: {
|
|
23508
23758
|
x1: 0,
|
|
@@ -24000,7 +24250,7 @@ class Stage extends Group$1 {
|
|
|
24000
24250
|
return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
|
|
24001
24251
|
}
|
|
24002
24252
|
set background(b) {
|
|
24003
|
-
this._background = b;
|
|
24253
|
+
this._background = b, this.syncBackgroundImage(b);
|
|
24004
24254
|
}
|
|
24005
24255
|
get defaultLayer() {
|
|
24006
24256
|
return this.at(0);
|
|
@@ -24014,6 +24264,18 @@ class Stage extends Group$1 {
|
|
|
24014
24264
|
set ticker(ticker) {
|
|
24015
24265
|
ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
|
|
24016
24266
|
}
|
|
24267
|
+
syncBackgroundImage(background) {
|
|
24268
|
+
var _a;
|
|
24269
|
+
const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
24270
|
+
this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
|
|
24271
|
+
}
|
|
24272
|
+
isImageBackgroundSource(source) {
|
|
24273
|
+
if (!source) return !1;
|
|
24274
|
+
if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
|
|
24275
|
+
if (!isObject$2(source)) return !1;
|
|
24276
|
+
const gradientSource = source;
|
|
24277
|
+
return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
|
|
24278
|
+
}
|
|
24017
24279
|
constructor(params = {}) {
|
|
24018
24280
|
var _a, _b;
|
|
24019
24281
|
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
@@ -24052,9 +24314,7 @@ class Stage extends Group$1 {
|
|
|
24052
24314
|
main: !0
|
|
24053
24315
|
})), 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 = {
|
|
24054
24316
|
tickRenderMode: "effect"
|
|
24055
|
-
}), this.optmize(params.optimize), params.background &&
|
|
24056
|
-
background: this._background
|
|
24057
|
-
}), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|
|
24317
|
+
}), 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());
|
|
24058
24318
|
}
|
|
24059
24319
|
initAnimate(params) {
|
|
24060
24320
|
var _a;
|
|
@@ -35212,6 +35472,7 @@ function getCustomType(custom) {
|
|
|
35212
35472
|
if (custom.prototype.constructor === custom) {
|
|
35213
35473
|
const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
|
|
35214
35474
|
if (descriptor && !descriptor.writable) return 1;
|
|
35475
|
+
if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
|
|
35215
35476
|
}
|
|
35216
35477
|
return 2;
|
|
35217
35478
|
}
|