@visactor/vchart 2.0.22 → 2.0.23-alpha.0
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 +97 -34
- package/build/index.js +97 -34
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/util.js +1 -2
- package/cjs/component/util.js +2 -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/esm/chart/util.js +1 -2
- package/esm/component/util.js +2 -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/package.json +9 -9
package/build/index.es.js
CHANGED
|
@@ -16065,6 +16065,7 @@ const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "ancho
|
|
|
16065
16065
|
const tempConstantXYKey = ["x", "y"],
|
|
16066
16066
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
16067
16067
|
tempConstantAngleKey = ["angle"],
|
|
16068
|
+
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
16068
16069
|
point = new Point();
|
|
16069
16070
|
const NOWORK_ANIMATE_ATTR = {
|
|
16070
16071
|
strokeSeg: 1,
|
|
@@ -16121,7 +16122,7 @@ class Graphic extends Node {
|
|
|
16121
16122
|
}
|
|
16122
16123
|
constructor(params = {}) {
|
|
16123
16124
|
var _a;
|
|
16124
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background
|
|
16125
|
+
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
16125
16126
|
}
|
|
16126
16127
|
getGraphicService() {
|
|
16127
16128
|
var _a, _b;
|
|
@@ -16310,7 +16311,7 @@ class Graphic extends Node {
|
|
|
16310
16311
|
});
|
|
16311
16312
|
}
|
|
16312
16313
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
16313
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background
|
|
16314
|
+
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
|
|
16314
16315
|
}
|
|
16315
16316
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
16316
16317
|
const keys = Object.keys(params);
|
|
@@ -16325,7 +16326,7 @@ class Graphic extends Node {
|
|
|
16325
16326
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
16326
16327
|
[key]: value
|
|
16327
16328
|
}, this.attribute, key, context);
|
|
16328
|
-
params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
16329
|
+
params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
16329
16330
|
}
|
|
16330
16331
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
16331
16332
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -16344,7 +16345,7 @@ class Graphic extends Node {
|
|
|
16344
16345
|
const context = {
|
|
16345
16346
|
type: AttributeUpdateType.INIT
|
|
16346
16347
|
};
|
|
16347
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background
|
|
16348
|
+
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
|
|
16348
16349
|
}
|
|
16349
16350
|
translate(x, y) {
|
|
16350
16351
|
var _a, _b;
|
|
@@ -16735,6 +16736,9 @@ class Graphic extends Node {
|
|
|
16735
16736
|
function backgroundNotImage(image) {
|
|
16736
16737
|
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
16738
|
}
|
|
16739
|
+
function isExternalTexture(texture) {
|
|
16740
|
+
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
|
|
16741
|
+
}
|
|
16738
16742
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
|
|
16739
16743
|
|
|
16740
16744
|
var GroupUpdateAABBBoundsMode;
|
|
@@ -20386,6 +20390,7 @@ class DefaultBaseClipRenderAfterContribution {
|
|
|
20386
20390
|
}
|
|
20387
20391
|
const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
|
|
20388
20392
|
|
|
20393
|
+
const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
|
|
20389
20394
|
function formatRatio(ratio) {
|
|
20390
20395
|
return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
|
|
20391
20396
|
}
|
|
@@ -20499,38 +20504,43 @@ class DefaultBaseTextureRenderContribution {
|
|
|
20499
20504
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
20500
20505
|
}
|
|
20501
20506
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
20502
|
-
var _a;
|
|
20507
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20503
20508
|
const {
|
|
20504
20509
|
textureRatio = graphicAttribute.textureRatio,
|
|
20505
20510
|
textureOptions = null
|
|
20506
20511
|
} = graphic.attribute;
|
|
20507
|
-
let pattern =
|
|
20508
|
-
|
|
20509
|
-
|
|
20510
|
-
|
|
20511
|
-
|
|
20512
|
-
|
|
20513
|
-
|
|
20514
|
-
|
|
20515
|
-
|
|
20516
|
-
|
|
20517
|
-
|
|
20518
|
-
|
|
20519
|
-
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
|
|
20523
|
-
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
|
|
20527
|
-
|
|
20528
|
-
|
|
20529
|
-
|
|
20530
|
-
|
|
20531
|
-
|
|
20512
|
+
let pattern = null;
|
|
20513
|
+
const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
|
|
20514
|
+
patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
|
|
20515
|
+
if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
|
|
20516
|
+
if ("string" == typeof texture) switch (texture) {
|
|
20517
|
+
case "circle":
|
|
20518
|
+
pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
|
|
20519
|
+
break;
|
|
20520
|
+
case "diamond":
|
|
20521
|
+
pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
|
|
20522
|
+
break;
|
|
20523
|
+
case "rect":
|
|
20524
|
+
pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
|
|
20525
|
+
break;
|
|
20526
|
+
case "vertical-line":
|
|
20527
|
+
pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
20528
|
+
break;
|
|
20529
|
+
case "horizontal-line":
|
|
20530
|
+
pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
20531
|
+
break;
|
|
20532
|
+
case "bias-lr":
|
|
20533
|
+
pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
|
|
20534
|
+
break;
|
|
20535
|
+
case "bias-rl":
|
|
20536
|
+
pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
|
|
20537
|
+
break;
|
|
20538
|
+
case "grid":
|
|
20539
|
+
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
20540
|
+
}
|
|
20541
|
+
pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
|
|
20532
20542
|
}
|
|
20533
|
-
if (textureOptions && textureOptions.dynamicTexture) {
|
|
20543
|
+
if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
|
|
20534
20544
|
const {
|
|
20535
20545
|
gridConfig = {},
|
|
20536
20546
|
useNewCanvas: useNewCanvas
|
|
@@ -20575,10 +20585,24 @@ class DefaultBaseTextureRenderContribution {
|
|
|
20575
20585
|
for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
|
|
20576
20586
|
const _x = x + cellSize / 2 + j * cellSize,
|
|
20577
20587
|
_y = y + cellSize / 2 + i * cellSize;
|
|
20578
|
-
null === (
|
|
20588
|
+
null === (_b = textureOptions.beforeDynamicTexture) || void 0 === _b || _b.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());
|
|
20579
20589
|
}
|
|
20580
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();
|
|
20581
|
-
} else if (pattern)
|
|
20591
|
+
} else if (pattern) {
|
|
20592
|
+
if (pattern.setTransform) {
|
|
20593
|
+
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
20594
|
+
alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
|
|
20595
|
+
alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
|
|
20596
|
+
let translateX = 0,
|
|
20597
|
+
translateY = 0;
|
|
20598
|
+
if (alignToGraphic) {
|
|
20599
|
+
const m = context.currentMatrix;
|
|
20600
|
+
translateX = (null !== (_e = null == m ? void 0 : m.e) && void 0 !== _e ? _e : 0) + x + alignOffsetX, translateY = (null !== (_f = null == m ? void 0 : m.f) && void 0 !== _f ? _f : 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) {
|
|
20582
20606
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
20583
20607
|
const b = graphic.AABBBounds;
|
|
20584
20608
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -20586,6 +20610,45 @@ class DefaultBaseTextureRenderContribution {
|
|
|
20586
20610
|
}), x + b.x1 - x, y + b.y1 - y), context.restore();
|
|
20587
20611
|
}
|
|
20588
20612
|
}
|
|
20613
|
+
getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
|
|
20614
|
+
return "string" != typeof texture ? texturePadding > 0 || textureRadius > 0 ? null : texture : "wave" === texture ? null : builtinProceduralTextureTypes.has(texture) ? `builtin:${texture}|size:${textureSize}|padding:${texturePadding}|color:${textureColor}|dpr:${dpr}` : `resource:${texture}|padding:${texturePadding}|radius:${textureRadius}|dpr:${dpr}`;
|
|
20615
|
+
}
|
|
20616
|
+
createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
|
|
20617
|
+
var _a;
|
|
20618
|
+
const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
|
|
20619
|
+
data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
|
|
20620
|
+
if (!data) return null;
|
|
20621
|
+
if (texturePadding > 0 || textureRadius > 0) {
|
|
20622
|
+
const w = data.naturalWidth || data.width,
|
|
20623
|
+
h = data.naturalHeight || data.height;
|
|
20624
|
+
if (w > 0 && h > 0) {
|
|
20625
|
+
const tileW = w + 2 * texturePadding,
|
|
20626
|
+
tileH = h + 2 * texturePadding,
|
|
20627
|
+
canvas = canvasAllocate.allocate({
|
|
20628
|
+
width: tileW,
|
|
20629
|
+
height: tileH,
|
|
20630
|
+
dpr: context.dpr
|
|
20631
|
+
}),
|
|
20632
|
+
ctx = canvas.getContext("2d");
|
|
20633
|
+
if (ctx) {
|
|
20634
|
+
if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
|
|
20635
|
+
const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
|
|
20636
|
+
x0 = texturePadding,
|
|
20637
|
+
y0 = texturePadding,
|
|
20638
|
+
x1 = x0 + w,
|
|
20639
|
+
y1 = y0 + h;
|
|
20640
|
+
ctx.beginPath(), ctx.moveTo(x0 + r, y0), ctx.lineTo(x1 - r, y0), ctx.quadraticCurveTo(x1, y0, x1, y0 + r), ctx.lineTo(x1, y1 - r), ctx.quadraticCurveTo(x1, y1, x1 - r, y1), ctx.lineTo(x0 + r, y1), ctx.quadraticCurveTo(x0, y1, x0, y1 - r), ctx.lineTo(x0, y0 + r), ctx.quadraticCurveTo(x0, y0, x0 + r, y0), ctx.closePath(), ctx.clip();
|
|
20641
|
+
}
|
|
20642
|
+
ctx.drawImage(data, texturePadding, texturePadding, w, h);
|
|
20643
|
+
const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
|
|
20644
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), canvasAllocate.free(canvas), pattern;
|
|
20645
|
+
}
|
|
20646
|
+
canvasAllocate.free(canvas);
|
|
20647
|
+
}
|
|
20648
|
+
}
|
|
20649
|
+
const pattern = context.createPattern(data, "repeat");
|
|
20650
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
|
|
20651
|
+
}
|
|
20589
20652
|
}
|
|
20590
20653
|
const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
|
|
20591
20654
|
|
|
@@ -62176,7 +62239,7 @@ const lookup = (data, opt) => {
|
|
|
62176
62239
|
});
|
|
62177
62240
|
};
|
|
62178
62241
|
|
|
62179
|
-
const version = "2.0.
|
|
62242
|
+
const version = "2.0.21";
|
|
62180
62243
|
|
|
62181
62244
|
const addVChartProperty = (data, op) => {
|
|
62182
62245
|
const context = op.beforeCall();
|
package/build/index.js
CHANGED
|
@@ -16071,6 +16071,7 @@
|
|
|
16071
16071
|
const tempConstantXYKey = ["x", "y"],
|
|
16072
16072
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
16073
16073
|
tempConstantAngleKey = ["angle"],
|
|
16074
|
+
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
16074
16075
|
point = new Point();
|
|
16075
16076
|
const NOWORK_ANIMATE_ATTR = {
|
|
16076
16077
|
strokeSeg: 1,
|
|
@@ -16127,7 +16128,7 @@
|
|
|
16127
16128
|
}
|
|
16128
16129
|
constructor(params = {}) {
|
|
16129
16130
|
var _a;
|
|
16130
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background
|
|
16131
|
+
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
16131
16132
|
}
|
|
16132
16133
|
getGraphicService() {
|
|
16133
16134
|
var _a, _b;
|
|
@@ -16316,7 +16317,7 @@
|
|
|
16316
16317
|
});
|
|
16317
16318
|
}
|
|
16318
16319
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
16319
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background
|
|
16320
|
+
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
|
|
16320
16321
|
}
|
|
16321
16322
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
16322
16323
|
const keys = Object.keys(params);
|
|
@@ -16331,7 +16332,7 @@
|
|
|
16331
16332
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
16332
16333
|
[key]: value
|
|
16333
16334
|
}, this.attribute, key, context);
|
|
16334
|
-
params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
16335
|
+
params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
16335
16336
|
}
|
|
16336
16337
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
16337
16338
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -16350,7 +16351,7 @@
|
|
|
16350
16351
|
const context = {
|
|
16351
16352
|
type: AttributeUpdateType.INIT
|
|
16352
16353
|
};
|
|
16353
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background
|
|
16354
|
+
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
|
|
16354
16355
|
}
|
|
16355
16356
|
translate(x, y) {
|
|
16356
16357
|
var _a, _b;
|
|
@@ -16741,6 +16742,9 @@
|
|
|
16741
16742
|
function backgroundNotImage(image) {
|
|
16742
16743
|
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));
|
|
16743
16744
|
}
|
|
16745
|
+
function isExternalTexture(texture) {
|
|
16746
|
+
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
|
|
16747
|
+
}
|
|
16744
16748
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
|
|
16745
16749
|
|
|
16746
16750
|
var GroupUpdateAABBBoundsMode;
|
|
@@ -20392,6 +20396,7 @@
|
|
|
20392
20396
|
}
|
|
20393
20397
|
const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
|
|
20394
20398
|
|
|
20399
|
+
const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
|
|
20395
20400
|
function formatRatio(ratio) {
|
|
20396
20401
|
return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
|
|
20397
20402
|
}
|
|
@@ -20505,38 +20510,43 @@
|
|
|
20505
20510
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
20506
20511
|
}
|
|
20507
20512
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
20508
|
-
var _a;
|
|
20513
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20509
20514
|
const {
|
|
20510
20515
|
textureRatio = graphicAttribute.textureRatio,
|
|
20511
20516
|
textureOptions = null
|
|
20512
20517
|
} = graphic.attribute;
|
|
20513
|
-
let pattern =
|
|
20514
|
-
|
|
20515
|
-
|
|
20516
|
-
|
|
20517
|
-
|
|
20518
|
-
|
|
20519
|
-
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
|
|
20523
|
-
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
|
|
20527
|
-
|
|
20528
|
-
|
|
20529
|
-
|
|
20530
|
-
|
|
20531
|
-
|
|
20532
|
-
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
20518
|
+
let pattern = null;
|
|
20519
|
+
const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
|
|
20520
|
+
patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
|
|
20521
|
+
if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
|
|
20522
|
+
if ("string" == typeof texture) switch (texture) {
|
|
20523
|
+
case "circle":
|
|
20524
|
+
pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
|
|
20525
|
+
break;
|
|
20526
|
+
case "diamond":
|
|
20527
|
+
pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
|
|
20528
|
+
break;
|
|
20529
|
+
case "rect":
|
|
20530
|
+
pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
|
|
20531
|
+
break;
|
|
20532
|
+
case "vertical-line":
|
|
20533
|
+
pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
20534
|
+
break;
|
|
20535
|
+
case "horizontal-line":
|
|
20536
|
+
pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
20537
|
+
break;
|
|
20538
|
+
case "bias-lr":
|
|
20539
|
+
pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
|
|
20540
|
+
break;
|
|
20541
|
+
case "bias-rl":
|
|
20542
|
+
pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
|
|
20543
|
+
break;
|
|
20544
|
+
case "grid":
|
|
20545
|
+
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
20546
|
+
}
|
|
20547
|
+
pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
|
|
20538
20548
|
}
|
|
20539
|
-
if (textureOptions && textureOptions.dynamicTexture) {
|
|
20549
|
+
if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
|
|
20540
20550
|
const {
|
|
20541
20551
|
gridConfig = {},
|
|
20542
20552
|
useNewCanvas: useNewCanvas
|
|
@@ -20581,10 +20591,24 @@
|
|
|
20581
20591
|
for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
|
|
20582
20592
|
const _x = x + cellSize / 2 + j * cellSize,
|
|
20583
20593
|
_y = y + cellSize / 2 + i * cellSize;
|
|
20584
|
-
null === (
|
|
20594
|
+
null === (_b = textureOptions.beforeDynamicTexture) || void 0 === _b || _b.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());
|
|
20585
20595
|
}
|
|
20586
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();
|
|
20587
|
-
} else if (pattern)
|
|
20597
|
+
} else if (pattern) {
|
|
20598
|
+
if (pattern.setTransform) {
|
|
20599
|
+
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
20600
|
+
alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
|
|
20601
|
+
alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
|
|
20602
|
+
let translateX = 0,
|
|
20603
|
+
translateY = 0;
|
|
20604
|
+
if (alignToGraphic) {
|
|
20605
|
+
const m = context.currentMatrix;
|
|
20606
|
+
translateX = (null !== (_e = null == m ? void 0 : m.e) && void 0 !== _e ? _e : 0) + x + alignOffsetX, translateY = (null !== (_f = null == m ? void 0 : m.f) && void 0 !== _f ? _f : 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) {
|
|
20588
20612
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
20589
20613
|
const b = graphic.AABBBounds;
|
|
20590
20614
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -20592,6 +20616,45 @@
|
|
|
20592
20616
|
}), x + b.x1 - x, y + b.y1 - y), context.restore();
|
|
20593
20617
|
}
|
|
20594
20618
|
}
|
|
20619
|
+
getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
|
|
20620
|
+
return "string" != typeof texture ? texturePadding > 0 || textureRadius > 0 ? null : texture : "wave" === texture ? null : builtinProceduralTextureTypes.has(texture) ? `builtin:${texture}|size:${textureSize}|padding:${texturePadding}|color:${textureColor}|dpr:${dpr}` : `resource:${texture}|padding:${texturePadding}|radius:${textureRadius}|dpr:${dpr}`;
|
|
20621
|
+
}
|
|
20622
|
+
createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
|
|
20623
|
+
var _a;
|
|
20624
|
+
const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
|
|
20625
|
+
data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
|
|
20626
|
+
if (!data) return null;
|
|
20627
|
+
if (texturePadding > 0 || textureRadius > 0) {
|
|
20628
|
+
const w = data.naturalWidth || data.width,
|
|
20629
|
+
h = data.naturalHeight || data.height;
|
|
20630
|
+
if (w > 0 && h > 0) {
|
|
20631
|
+
const tileW = w + 2 * texturePadding,
|
|
20632
|
+
tileH = h + 2 * texturePadding,
|
|
20633
|
+
canvas = canvasAllocate.allocate({
|
|
20634
|
+
width: tileW,
|
|
20635
|
+
height: tileH,
|
|
20636
|
+
dpr: context.dpr
|
|
20637
|
+
}),
|
|
20638
|
+
ctx = canvas.getContext("2d");
|
|
20639
|
+
if (ctx) {
|
|
20640
|
+
if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
|
|
20641
|
+
const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
|
|
20642
|
+
x0 = texturePadding,
|
|
20643
|
+
y0 = texturePadding,
|
|
20644
|
+
x1 = x0 + w,
|
|
20645
|
+
y1 = y0 + h;
|
|
20646
|
+
ctx.beginPath(), ctx.moveTo(x0 + r, y0), ctx.lineTo(x1 - r, y0), ctx.quadraticCurveTo(x1, y0, x1, y0 + r), ctx.lineTo(x1, y1 - r), ctx.quadraticCurveTo(x1, y1, x1 - r, y1), ctx.lineTo(x0 + r, y1), ctx.quadraticCurveTo(x0, y1, x0, y1 - r), ctx.lineTo(x0, y0 + r), ctx.quadraticCurveTo(x0, y0, x0 + r, y0), ctx.closePath(), ctx.clip();
|
|
20647
|
+
}
|
|
20648
|
+
ctx.drawImage(data, texturePadding, texturePadding, w, h);
|
|
20649
|
+
const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
|
|
20650
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), canvasAllocate.free(canvas), pattern;
|
|
20651
|
+
}
|
|
20652
|
+
canvasAllocate.free(canvas);
|
|
20653
|
+
}
|
|
20654
|
+
}
|
|
20655
|
+
const pattern = context.createPattern(data, "repeat");
|
|
20656
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
|
|
20657
|
+
}
|
|
20595
20658
|
}
|
|
20596
20659
|
const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
|
|
20597
20660
|
|
|
@@ -62182,7 +62245,7 @@
|
|
|
62182
62245
|
});
|
|
62183
62246
|
};
|
|
62184
62247
|
|
|
62185
|
-
const version = "2.0.
|
|
62248
|
+
const version = "2.0.21";
|
|
62186
62249
|
|
|
62187
62250
|
const addVChartProperty = (data, op) => {
|
|
62188
62251
|
const context = op.beforeCall();
|