@visactor/vtable-sheet 1.22.13-alpha.1 → 1.22.13-alpha.11
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/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/styles/formula-bar.js +1 -2
- package/cjs/styles/sheet-tab.js +2 -1
- package/dist/vtable-sheet.js +569 -196
- package/dist/vtable-sheet.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/styles/formula-bar.js +1 -2
- package/es/styles/sheet-tab.js +2 -1
- package/package.json +6 -6
package/dist/vtable-sheet.js
CHANGED
|
@@ -3667,28 +3667,59 @@
|
|
|
3667
3667
|
}
|
|
3668
3668
|
addEventListener(type, listener, options) {
|
|
3669
3669
|
if (!listener) return;
|
|
3670
|
+
const capture = this._resolveCapture(options),
|
|
3671
|
+
once = this._resolveOnce(options),
|
|
3672
|
+
listenerTypeMap = this._getOrCreateListenerTypeMap(type),
|
|
3673
|
+
wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
|
|
3674
|
+
if (wrappedMap.has(capture)) return;
|
|
3670
3675
|
const wrappedListener = event => {
|
|
3671
3676
|
const transformedEvent = this._eventListenerTransformer(event);
|
|
3672
|
-
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
|
|
3677
|
+
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
|
|
3673
3678
|
};
|
|
3674
|
-
|
|
3679
|
+
wrappedMap.set(capture, {
|
|
3680
|
+
wrappedListener: wrappedListener,
|
|
3681
|
+
options: options
|
|
3682
|
+
}), this._nativeAddEventListener(type, wrappedListener, options);
|
|
3675
3683
|
}
|
|
3676
3684
|
removeEventListener(type, listener, options) {
|
|
3677
|
-
var _a;
|
|
3685
|
+
var _a, _b;
|
|
3678
3686
|
if (!listener) return;
|
|
3679
|
-
const
|
|
3680
|
-
|
|
3687
|
+
const capture = this._resolveCapture(options),
|
|
3688
|
+
wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
|
|
3689
|
+
wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
|
|
3681
3690
|
}
|
|
3682
3691
|
dispatchEvent(event) {
|
|
3683
3692
|
return this._nativeDispatchEvent(event);
|
|
3684
3693
|
}
|
|
3685
3694
|
clearAllEventListeners() {
|
|
3686
|
-
this._listenerMap.forEach((
|
|
3687
|
-
|
|
3688
|
-
|
|
3695
|
+
this._listenerMap.forEach((listenerMap, type) => {
|
|
3696
|
+
listenerMap.forEach(wrappedMap => {
|
|
3697
|
+
wrappedMap.forEach((wrappedRecord, capture) => {
|
|
3698
|
+
this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
|
|
3699
|
+
});
|
|
3689
3700
|
});
|
|
3690
3701
|
}), this._listenerMap.clear();
|
|
3691
3702
|
}
|
|
3703
|
+
_resolveCapture(options) {
|
|
3704
|
+
return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
|
|
3705
|
+
}
|
|
3706
|
+
_resolveOnce(options) {
|
|
3707
|
+
return "object" == typeof options && !!(null == options ? void 0 : options.once);
|
|
3708
|
+
}
|
|
3709
|
+
_getOrCreateListenerTypeMap(type) {
|
|
3710
|
+
let listenerTypeMap = this._listenerMap.get(type);
|
|
3711
|
+
return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
|
|
3712
|
+
}
|
|
3713
|
+
_getOrCreateWrappedMap(listenerTypeMap, listener) {
|
|
3714
|
+
let wrappedMap = listenerTypeMap.get(listener);
|
|
3715
|
+
return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
|
|
3716
|
+
}
|
|
3717
|
+
_deleteListenerRecord(type, listener, capture) {
|
|
3718
|
+
const listenerTypeMap = this._listenerMap.get(type);
|
|
3719
|
+
if (!listenerTypeMap) return;
|
|
3720
|
+
const wrappedMap = listenerTypeMap.get(listener);
|
|
3721
|
+
wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
|
|
3722
|
+
}
|
|
3692
3723
|
_nativeAddEventListener(type, listener, options) {
|
|
3693
3724
|
throw new Error("_nativeAddEventListener must be implemented by derived classes");
|
|
3694
3725
|
}
|
|
@@ -7584,6 +7615,7 @@
|
|
|
7584
7615
|
backgroundScale: 1,
|
|
7585
7616
|
backgroundOffsetX: 0,
|
|
7586
7617
|
backgroundOffsetY: 0,
|
|
7618
|
+
backgroundPosition: "top-left",
|
|
7587
7619
|
blur: 0,
|
|
7588
7620
|
filter: "",
|
|
7589
7621
|
cursor: null,
|
|
@@ -7756,11 +7788,16 @@
|
|
|
7756
7788
|
const DefaultImageAttribute = Object.assign(Object.assign({
|
|
7757
7789
|
repeatX: "no-repeat",
|
|
7758
7790
|
repeatY: "no-repeat",
|
|
7791
|
+
imageMode: void 0,
|
|
7759
7792
|
image: "",
|
|
7760
7793
|
width: 0,
|
|
7761
7794
|
height: 0,
|
|
7762
7795
|
maxWidth: 500,
|
|
7763
|
-
maxHeight: 500
|
|
7796
|
+
maxHeight: 500,
|
|
7797
|
+
imagePosition: "top-left",
|
|
7798
|
+
imageScale: 1,
|
|
7799
|
+
imageOffsetX: 0,
|
|
7800
|
+
imageOffsetY: 0
|
|
7764
7801
|
}, DefaultAttribute), {
|
|
7765
7802
|
fill: !0,
|
|
7766
7803
|
cornerRadius: 0,
|
|
@@ -10202,7 +10239,9 @@
|
|
|
10202
10239
|
var _a;
|
|
10203
10240
|
if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
|
|
10204
10241
|
const constructor = event.constructor;
|
|
10205
|
-
this.eventPool.has(constructor) || this.eventPool.
|
|
10242
|
+
this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
|
|
10243
|
+
e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
|
|
10244
|
+
}), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
|
|
10206
10245
|
}
|
|
10207
10246
|
notifyListeners(e, type) {
|
|
10208
10247
|
const listeners = e.currentTarget._events[type];
|
|
@@ -12159,6 +12198,7 @@
|
|
|
12159
12198
|
const tempConstantXYKey = ["x", "y"],
|
|
12160
12199
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
12161
12200
|
tempConstantAngleKey = ["angle"],
|
|
12201
|
+
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
12162
12202
|
point = new Point();
|
|
12163
12203
|
const NOWORK_ANIMATE_ATTR = {
|
|
12164
12204
|
strokeSeg: 1,
|
|
@@ -12215,7 +12255,7 @@
|
|
|
12215
12255
|
}
|
|
12216
12256
|
constructor(params = {}) {
|
|
12217
12257
|
var _a;
|
|
12218
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background
|
|
12258
|
+
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);
|
|
12219
12259
|
}
|
|
12220
12260
|
getGraphicService() {
|
|
12221
12261
|
var _a, _b;
|
|
@@ -12404,7 +12444,7 @@
|
|
|
12404
12444
|
});
|
|
12405
12445
|
}
|
|
12406
12446
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
12407
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background
|
|
12447
|
+
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));
|
|
12408
12448
|
}
|
|
12409
12449
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
12410
12450
|
const keys = Object.keys(params);
|
|
@@ -12419,7 +12459,7 @@
|
|
|
12419
12459
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
12420
12460
|
[key]: value
|
|
12421
12461
|
}, this.attribute, key, context);
|
|
12422
|
-
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);
|
|
12462
|
+
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);
|
|
12423
12463
|
}
|
|
12424
12464
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
12425
12465
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -12438,7 +12478,7 @@
|
|
|
12438
12478
|
const context = {
|
|
12439
12479
|
type: AttributeUpdateType.INIT
|
|
12440
12480
|
};
|
|
12441
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background
|
|
12481
|
+
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);
|
|
12442
12482
|
}
|
|
12443
12483
|
translate(x, y) {
|
|
12444
12484
|
var _a, _b;
|
|
@@ -12771,7 +12811,8 @@
|
|
|
12771
12811
|
return isString$2(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
|
|
12772
12812
|
}
|
|
12773
12813
|
loadImage(image, background = !1) {
|
|
12774
|
-
if (
|
|
12814
|
+
if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
|
|
12815
|
+
if (!image) return;
|
|
12775
12816
|
const url = image;
|
|
12776
12817
|
this.resources || (this.resources = new Map());
|
|
12777
12818
|
const cache = {
|
|
@@ -12806,7 +12847,7 @@
|
|
|
12806
12847
|
});
|
|
12807
12848
|
}
|
|
12808
12849
|
release() {
|
|
12809
|
-
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
|
|
12850
|
+
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
|
|
12810
12851
|
}
|
|
12811
12852
|
_emitCustomEvent(type, context) {
|
|
12812
12853
|
var _a, _b;
|
|
@@ -12826,7 +12867,10 @@
|
|
|
12826
12867
|
}
|
|
12827
12868
|
}
|
|
12828
12869
|
function backgroundNotImage(image) {
|
|
12829
|
-
return !(!image.fill && !image.stroke);
|
|
12870
|
+
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));
|
|
12871
|
+
}
|
|
12872
|
+
function isExternalTexture(texture) {
|
|
12873
|
+
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$a(texture));
|
|
12830
12874
|
}
|
|
12831
12875
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget$3);
|
|
12832
12876
|
|
|
@@ -14920,7 +14964,7 @@
|
|
|
14920
14964
|
return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
|
|
14921
14965
|
}
|
|
14922
14966
|
|
|
14923
|
-
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
14967
|
+
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
14924
14968
|
let Image$2 = class Image extends Graphic {
|
|
14925
14969
|
constructor(params) {
|
|
14926
14970
|
super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
|
|
@@ -15025,6 +15069,7 @@
|
|
|
15025
15069
|
};
|
|
15026
15070
|
Image$2.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
15027
15071
|
image: 1,
|
|
15072
|
+
imageMode: 1,
|
|
15028
15073
|
repeatX: 1,
|
|
15029
15074
|
repeatY: 1
|
|
15030
15075
|
}, NOWORK_ANIMATE_ATTR);
|
|
@@ -16001,11 +16046,12 @@
|
|
|
16001
16046
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
16002
16047
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
16003
16048
|
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
16004
|
-
backgroundClip = graphicAttribute.backgroundClip
|
|
16049
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
16050
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
16005
16051
|
} = graphic.attribute;
|
|
16006
16052
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
16007
|
-
const res = graphic.resources.get(background);
|
|
16008
|
-
if ("success" !== res.state || !res.data) return;
|
|
16053
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
16054
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
16009
16055
|
if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
|
|
16010
16056
|
const groupAttribute = getTheme(graphic.parent).group,
|
|
16011
16057
|
{
|
|
@@ -16022,59 +16068,160 @@
|
|
|
16022
16068
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
16023
16069
|
backgroundScale: backgroundScale,
|
|
16024
16070
|
backgroundOffsetX: backgroundOffsetX,
|
|
16025
|
-
backgroundOffsetY: backgroundOffsetY
|
|
16071
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
16072
|
+
backgroundPosition: backgroundPosition
|
|
16026
16073
|
}), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
|
|
16027
16074
|
} else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
16028
16075
|
}
|
|
16029
16076
|
doDrawImage(context, data, b, params) {
|
|
16030
|
-
|
|
16031
|
-
backgroundMode: backgroundMode,
|
|
16032
|
-
backgroundFit: backgroundFit,
|
|
16033
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
16034
|
-
backgroundScale = 1,
|
|
16035
|
-
backgroundOffsetX = 0,
|
|
16036
|
-
backgroundOffsetY = 0
|
|
16037
|
-
} = params,
|
|
16038
|
-
targetW = b.width(),
|
|
16039
|
-
targetH = b.height();
|
|
16040
|
-
let w = targetW,
|
|
16041
|
-
h = targetH;
|
|
16042
|
-
if ("no-repeat" === backgroundMode) {
|
|
16043
|
-
if (backgroundFit) {
|
|
16044
|
-
if (backgroundKeepAspectRatio) {
|
|
16045
|
-
const maxScale = Math.max(targetW / data.width, targetH / data.height);
|
|
16046
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
|
|
16047
|
-
} else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
16048
|
-
} else {
|
|
16049
|
-
const resW = data.width * backgroundScale,
|
|
16050
|
-
resH = data.height * backgroundScale;
|
|
16051
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
|
|
16052
|
-
}
|
|
16053
|
-
} else {
|
|
16054
|
-
if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
|
|
16055
|
-
const resW = data.width,
|
|
16056
|
-
resH = data.height;
|
|
16057
|
-
if ("repeat-x" === backgroundMode) {
|
|
16058
|
-
w = resW * (targetH / resH), h = targetH;
|
|
16059
|
-
} else if ("repeat-y" === backgroundMode) {
|
|
16060
|
-
h = resH * (targetW / resW), w = targetW;
|
|
16061
|
-
}
|
|
16062
|
-
const dpr = context.dpr,
|
|
16063
|
-
canvas = canvasAllocate.allocate({
|
|
16064
|
-
width: w,
|
|
16065
|
-
height: h,
|
|
16066
|
-
dpr: dpr
|
|
16067
|
-
}),
|
|
16068
|
-
ctx = canvas.getContext("2d");
|
|
16069
|
-
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);
|
|
16070
|
-
}
|
|
16071
|
-
const dpr = context.dpr,
|
|
16072
|
-
pattern = context.createPattern(data, backgroundMode);
|
|
16073
|
-
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);
|
|
16074
|
-
}
|
|
16077
|
+
drawBackgroundImage(context, data, b, params);
|
|
16075
16078
|
}
|
|
16076
16079
|
}
|
|
16077
16080
|
const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
|
|
16081
|
+
const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
|
|
16082
|
+
function getBackgroundImage(background) {
|
|
16083
|
+
var _a;
|
|
16084
|
+
return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
16085
|
+
}
|
|
16086
|
+
function resolveBackgroundSizing({
|
|
16087
|
+
backgroundFit: backgroundFit,
|
|
16088
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
16089
|
+
}) {
|
|
16090
|
+
return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
|
|
16091
|
+
}
|
|
16092
|
+
const NO_REPEAT_SIZING_MAP = {
|
|
16093
|
+
"no-repeat-cover": "cover",
|
|
16094
|
+
"no-repeat-contain": "contain",
|
|
16095
|
+
"no-repeat-fill": "fill",
|
|
16096
|
+
"no-repeat-auto": "auto"
|
|
16097
|
+
};
|
|
16098
|
+
function resolveBackgroundDrawMode({
|
|
16099
|
+
backgroundMode: backgroundMode,
|
|
16100
|
+
backgroundFit: backgroundFit,
|
|
16101
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
16102
|
+
}) {
|
|
16103
|
+
const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
|
|
16104
|
+
return sizing ? {
|
|
16105
|
+
backgroundRepeatMode: "no-repeat",
|
|
16106
|
+
backgroundSizing: sizing
|
|
16107
|
+
} : {
|
|
16108
|
+
backgroundRepeatMode: backgroundMode,
|
|
16109
|
+
backgroundSizing: resolveBackgroundSizing({
|
|
16110
|
+
backgroundFit: backgroundFit,
|
|
16111
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
16112
|
+
})
|
|
16113
|
+
};
|
|
16114
|
+
}
|
|
16115
|
+
function isPercentageValue(value) {
|
|
16116
|
+
return /^-?\d+(\.\d+)?%$/.test(value);
|
|
16117
|
+
}
|
|
16118
|
+
function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
|
|
16119
|
+
if ("number" == typeof value && Number.isFinite(value)) return value;
|
|
16120
|
+
const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
|
|
16121
|
+
if (!normalizedValue || normalizedValue === startKeyword) return 0;
|
|
16122
|
+
if (normalizedValue === centerKeyword) return remainSpace / 2;
|
|
16123
|
+
if (normalizedValue === endKeyword) return remainSpace;
|
|
16124
|
+
if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
|
|
16125
|
+
const parsedValue = Number(normalizedValue);
|
|
16126
|
+
return Number.isFinite(parsedValue) ? parsedValue : 0;
|
|
16127
|
+
}
|
|
16128
|
+
function normalizeBackgroundPosition(position) {
|
|
16129
|
+
var _a, _b;
|
|
16130
|
+
if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
|
|
16131
|
+
const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
|
|
16132
|
+
if (0 === tokens.length) return ["left", "top"];
|
|
16133
|
+
if (1 === tokens.length) {
|
|
16134
|
+
const token = tokens[0];
|
|
16135
|
+
return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
|
|
16136
|
+
}
|
|
16137
|
+
let horizontal, vertical;
|
|
16138
|
+
const genericTokens = [];
|
|
16139
|
+
for (let i = 0; i < 2; i++) {
|
|
16140
|
+
const token = tokens[i];
|
|
16141
|
+
"left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
|
|
16142
|
+
}
|
|
16143
|
+
return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
|
|
16144
|
+
}
|
|
16145
|
+
function resolveBackgroundPosition(position, remainWidth, remainHeight) {
|
|
16146
|
+
const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
|
|
16147
|
+
return {
|
|
16148
|
+
x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
|
|
16149
|
+
y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
|
|
16150
|
+
};
|
|
16151
|
+
}
|
|
16152
|
+
function pickRenderableDimension(...values) {
|
|
16153
|
+
for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
|
|
16154
|
+
return null;
|
|
16155
|
+
}
|
|
16156
|
+
function resolveRenderableImageSize(data) {
|
|
16157
|
+
if (!data) return null;
|
|
16158
|
+
const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
|
|
16159
|
+
height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
|
|
16160
|
+
return null == width || null == height ? null : {
|
|
16161
|
+
width: width,
|
|
16162
|
+
height: height
|
|
16163
|
+
};
|
|
16164
|
+
}
|
|
16165
|
+
function drawBackgroundImage(context, data, b, params) {
|
|
16166
|
+
var _a, _b;
|
|
16167
|
+
const {
|
|
16168
|
+
backgroundMode: backgroundMode,
|
|
16169
|
+
backgroundFit: backgroundFit,
|
|
16170
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
16171
|
+
backgroundScale = 1,
|
|
16172
|
+
backgroundOffsetX = 0,
|
|
16173
|
+
backgroundOffsetY = 0,
|
|
16174
|
+
backgroundPosition = "top-left"
|
|
16175
|
+
} = params,
|
|
16176
|
+
targetW = b.width(),
|
|
16177
|
+
targetH = b.height(),
|
|
16178
|
+
sourceSize = resolveRenderableImageSize(data),
|
|
16179
|
+
{
|
|
16180
|
+
backgroundRepeatMode: backgroundRepeatMode,
|
|
16181
|
+
backgroundSizing: resolvedBackgroundSizing
|
|
16182
|
+
} = resolveBackgroundDrawMode({
|
|
16183
|
+
backgroundMode: backgroundMode,
|
|
16184
|
+
backgroundFit: backgroundFit,
|
|
16185
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
16186
|
+
});
|
|
16187
|
+
let w = targetW,
|
|
16188
|
+
h = targetH;
|
|
16189
|
+
if (targetW <= 0 || targetH <= 0) return;
|
|
16190
|
+
if ("no-repeat" === backgroundRepeatMode) {
|
|
16191
|
+
let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
|
|
16192
|
+
drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
|
|
16193
|
+
if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
|
|
16194
|
+
const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
|
|
16195
|
+
drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
|
|
16196
|
+
}
|
|
16197
|
+
drawWidth *= backgroundScale, drawHeight *= backgroundScale;
|
|
16198
|
+
const {
|
|
16199
|
+
x: x,
|
|
16200
|
+
y: y
|
|
16201
|
+
} = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
|
|
16202
|
+
return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
|
|
16203
|
+
}
|
|
16204
|
+
if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
|
|
16205
|
+
const resW = sourceSize.width,
|
|
16206
|
+
resH = sourceSize.height;
|
|
16207
|
+
if ("repeat-x" === backgroundRepeatMode) {
|
|
16208
|
+
w = resW * (targetH / resH), h = targetH;
|
|
16209
|
+
} else if ("repeat-y" === backgroundRepeatMode) {
|
|
16210
|
+
h = resH * (targetW / resW), w = targetW;
|
|
16211
|
+
}
|
|
16212
|
+
const dpr = context.dpr,
|
|
16213
|
+
canvas = canvasAllocate.allocate({
|
|
16214
|
+
width: w,
|
|
16215
|
+
height: h,
|
|
16216
|
+
dpr: dpr
|
|
16217
|
+
}),
|
|
16218
|
+
ctx = canvas.getContext("2d");
|
|
16219
|
+
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);
|
|
16220
|
+
}
|
|
16221
|
+
const dpr = context.dpr,
|
|
16222
|
+
pattern = context.createPattern(data, backgroundRepeatMode);
|
|
16223
|
+
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);
|
|
16224
|
+
}
|
|
16078
16225
|
let DefaultBaseInteractiveRenderContribution = class {
|
|
16079
16226
|
constructor(subRenderContribitions) {
|
|
16080
16227
|
this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
@@ -16120,6 +16267,7 @@
|
|
|
16120
16267
|
}
|
|
16121
16268
|
const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
|
|
16122
16269
|
|
|
16270
|
+
const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
|
|
16123
16271
|
function formatRatio(ratio) {
|
|
16124
16272
|
return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
|
|
16125
16273
|
}
|
|
@@ -16233,38 +16381,43 @@
|
|
|
16233
16381
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
16234
16382
|
}
|
|
16235
16383
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
16236
|
-
var _a;
|
|
16384
|
+
var _a, _b, _c, _d, _e, _f;
|
|
16237
16385
|
const {
|
|
16238
16386
|
textureRatio = graphicAttribute.textureRatio,
|
|
16239
16387
|
textureOptions = null
|
|
16240
16388
|
} = graphic.attribute;
|
|
16241
|
-
let pattern =
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16263
|
-
|
|
16264
|
-
|
|
16265
|
-
|
|
16389
|
+
let pattern = null;
|
|
16390
|
+
const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
|
|
16391
|
+
patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
|
|
16392
|
+
if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
|
|
16393
|
+
if ("string" == typeof texture) switch (texture) {
|
|
16394
|
+
case "circle":
|
|
16395
|
+
pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
|
|
16396
|
+
break;
|
|
16397
|
+
case "diamond":
|
|
16398
|
+
pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
|
|
16399
|
+
break;
|
|
16400
|
+
case "rect":
|
|
16401
|
+
pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
|
|
16402
|
+
break;
|
|
16403
|
+
case "vertical-line":
|
|
16404
|
+
pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
16405
|
+
break;
|
|
16406
|
+
case "horizontal-line":
|
|
16407
|
+
pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
16408
|
+
break;
|
|
16409
|
+
case "bias-lr":
|
|
16410
|
+
pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
|
|
16411
|
+
break;
|
|
16412
|
+
case "bias-rl":
|
|
16413
|
+
pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
|
|
16414
|
+
break;
|
|
16415
|
+
case "grid":
|
|
16416
|
+
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
16417
|
+
}
|
|
16418
|
+
pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
|
|
16266
16419
|
}
|
|
16267
|
-
if (textureOptions && textureOptions.dynamicTexture) {
|
|
16420
|
+
if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
|
|
16268
16421
|
const {
|
|
16269
16422
|
gridConfig = {},
|
|
16270
16423
|
useNewCanvas: useNewCanvas
|
|
@@ -16309,10 +16462,24 @@
|
|
|
16309
16462
|
for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
|
|
16310
16463
|
const _x = x + cellSize / 2 + j * cellSize,
|
|
16311
16464
|
_y = y + cellSize / 2 + i * cellSize;
|
|
16312
|
-
null === (
|
|
16465
|
+
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());
|
|
16313
16466
|
}
|
|
16314
16467
|
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();
|
|
16315
|
-
} else if (pattern)
|
|
16468
|
+
} else if (pattern) {
|
|
16469
|
+
if (pattern.setTransform) {
|
|
16470
|
+
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
16471
|
+
alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
|
|
16472
|
+
alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
|
|
16473
|
+
let translateX = 0,
|
|
16474
|
+
translateY = 0;
|
|
16475
|
+
if (alignToGraphic) {
|
|
16476
|
+
const m = context.currentMatrix;
|
|
16477
|
+
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;
|
|
16478
|
+
} else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
|
|
16479
|
+
pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
|
|
16480
|
+
}
|
|
16481
|
+
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
|
|
16482
|
+
} else if ("wave" === texture) {
|
|
16316
16483
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
16317
16484
|
const b = graphic.AABBBounds;
|
|
16318
16485
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -16320,6 +16487,45 @@
|
|
|
16320
16487
|
}), x + b.x1 - x, y + b.y1 - y), context.restore();
|
|
16321
16488
|
}
|
|
16322
16489
|
}
|
|
16490
|
+
getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
|
|
16491
|
+
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}`;
|
|
16492
|
+
}
|
|
16493
|
+
createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
|
|
16494
|
+
var _a;
|
|
16495
|
+
const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
|
|
16496
|
+
data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
|
|
16497
|
+
if (!data) return null;
|
|
16498
|
+
if (texturePadding > 0 || textureRadius > 0) {
|
|
16499
|
+
const w = data.naturalWidth || data.width,
|
|
16500
|
+
h = data.naturalHeight || data.height;
|
|
16501
|
+
if (w > 0 && h > 0) {
|
|
16502
|
+
const tileW = w + 2 * texturePadding,
|
|
16503
|
+
tileH = h + 2 * texturePadding,
|
|
16504
|
+
canvas = canvasAllocate.allocate({
|
|
16505
|
+
width: tileW,
|
|
16506
|
+
height: tileH,
|
|
16507
|
+
dpr: context.dpr
|
|
16508
|
+
}),
|
|
16509
|
+
ctx = canvas.getContext("2d");
|
|
16510
|
+
if (ctx) {
|
|
16511
|
+
if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
|
|
16512
|
+
const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
|
|
16513
|
+
x0 = texturePadding,
|
|
16514
|
+
y0 = texturePadding,
|
|
16515
|
+
x1 = x0 + w,
|
|
16516
|
+
y1 = y0 + h;
|
|
16517
|
+
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();
|
|
16518
|
+
}
|
|
16519
|
+
ctx.drawImage(data, texturePadding, texturePadding, w, h);
|
|
16520
|
+
const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
|
|
16521
|
+
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;
|
|
16522
|
+
}
|
|
16523
|
+
canvasAllocate.free(canvas);
|
|
16524
|
+
}
|
|
16525
|
+
}
|
|
16526
|
+
const pattern = context.createPattern(data, "repeat");
|
|
16527
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
|
|
16528
|
+
}
|
|
16323
16529
|
}
|
|
16324
16530
|
const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
|
|
16325
16531
|
|
|
@@ -16431,27 +16637,32 @@
|
|
|
16431
16637
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
16432
16638
|
const {
|
|
16433
16639
|
background: background,
|
|
16640
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
16641
|
+
opacity = graphicAttribute.opacity,
|
|
16434
16642
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
16435
16643
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
16436
16644
|
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
16437
16645
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
16438
16646
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
16439
|
-
backgroundOffsetY = graphicAttribute.backgroundOffsetY
|
|
16647
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
16648
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
16649
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
16440
16650
|
} = graphic.attribute;
|
|
16441
16651
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
16442
|
-
const res = graphic.resources.get(background);
|
|
16443
|
-
if ("success" !== res.state || !res.data) return;
|
|
16652
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
16653
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
16444
16654
|
context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
|
|
16445
16655
|
const b = graphic.AABBBounds;
|
|
16446
|
-
this.doDrawImage(context, res.data, b, {
|
|
16656
|
+
context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
|
|
16447
16657
|
backgroundMode: backgroundMode,
|
|
16448
16658
|
backgroundFit: backgroundFit,
|
|
16449
16659
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
16450
16660
|
backgroundScale: backgroundScale,
|
|
16451
16661
|
backgroundOffsetX: backgroundOffsetX,
|
|
16452
|
-
backgroundOffsetY: backgroundOffsetY
|
|
16662
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
16663
|
+
backgroundPosition: backgroundPosition
|
|
16453
16664
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
16454
|
-
} else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
16665
|
+
} else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
16455
16666
|
}
|
|
16456
16667
|
}
|
|
16457
16668
|
const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
|
|
@@ -17933,9 +18144,17 @@
|
|
|
17933
18144
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
17934
18145
|
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
17935
18146
|
const {
|
|
18147
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
18148
|
+
opacity = graphicAttribute.opacity,
|
|
17936
18149
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
17937
18150
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
17938
|
-
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
|
|
18151
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
18152
|
+
backgroundScale = graphicAttribute.backgroundScale,
|
|
18153
|
+
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
18154
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
18155
|
+
backgroundPosition = graphicAttribute.backgroundPosition,
|
|
18156
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
18157
|
+
backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
|
|
17939
18158
|
} = graphic.attribute;
|
|
17940
18159
|
let matrix,
|
|
17941
18160
|
{
|
|
@@ -17947,18 +18166,18 @@
|
|
|
17947
18166
|
};
|
|
17948
18167
|
let b;
|
|
17949
18168
|
"richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
|
|
17950
|
-
const
|
|
18169
|
+
const backgroundConfig = isObject$a(background) && background.background ? background : null,
|
|
17951
18170
|
onlyTranslate = graphic.transMatrix.onlyTranslate();
|
|
17952
|
-
if (
|
|
18171
|
+
if (backgroundConfig) {
|
|
17953
18172
|
const _b = graphic.AABBBounds,
|
|
17954
|
-
x = (null !== (_a =
|
|
17955
|
-
y = (null !== (_d =
|
|
17956
|
-
w = null !== (_f =
|
|
17957
|
-
h = null !== (_g =
|
|
17958
|
-
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background =
|
|
18173
|
+
x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
|
|
18174
|
+
y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
|
|
18175
|
+
w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
|
|
18176
|
+
h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
|
|
18177
|
+
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
|
|
17959
18178
|
const w = b.width(),
|
|
17960
18179
|
h = b.height();
|
|
17961
|
-
b.set((null !== (_h =
|
|
18180
|
+
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);
|
|
17962
18181
|
}
|
|
17963
18182
|
} else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
|
|
17964
18183
|
angle: 0,
|
|
@@ -17971,19 +18190,18 @@
|
|
|
17971
18190
|
})).clone());
|
|
17972
18191
|
if (graphic.backgroundImg && graphic.resources) {
|
|
17973
18192
|
const res = graphic.resources.get(background);
|
|
17974
|
-
if ("success" !== res.state || !res.data) return void restore();
|
|
17975
|
-
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.
|
|
18193
|
+
if (!res || "success" !== res.state || !res.data) return void restore();
|
|
18194
|
+
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, {
|
|
17976
18195
|
backgroundMode: backgroundMode,
|
|
17977
18196
|
backgroundFit: backgroundFit,
|
|
17978
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
18197
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
18198
|
+
backgroundScale: backgroundScale,
|
|
18199
|
+
backgroundOffsetX: backgroundOffsetX,
|
|
18200
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
18201
|
+
backgroundPosition: backgroundPosition
|
|
17979
18202
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
17980
|
-
} else
|
|
17981
|
-
|
|
17982
|
-
backgroundCornerRadius: backgroundCornerRadius
|
|
17983
|
-
} = graphic.attribute;
|
|
17984
|
-
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), 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();
|
|
17985
|
-
}
|
|
17986
|
-
shouldReCalBounds && boundsAllocate.free(b), restore();
|
|
18203
|
+
} 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();
|
|
18204
|
+
backgroundConfig && boundsAllocate.free(b), restore();
|
|
17987
18205
|
}
|
|
17988
18206
|
}
|
|
17989
18207
|
const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
|
|
@@ -18410,6 +18628,92 @@
|
|
|
18410
18628
|
};
|
|
18411
18629
|
};
|
|
18412
18630
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
18631
|
+
function resolveImageMode({
|
|
18632
|
+
repeatX = "no-repeat",
|
|
18633
|
+
repeatY = "no-repeat",
|
|
18634
|
+
imageMode: imageMode
|
|
18635
|
+
}) {
|
|
18636
|
+
const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
|
|
18637
|
+
return {
|
|
18638
|
+
repeatMode: repeatMode,
|
|
18639
|
+
sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
|
|
18640
|
+
};
|
|
18641
|
+
}
|
|
18642
|
+
const IMAGE_MODE_TO_BACKGROUND_MODE = {
|
|
18643
|
+
cover: "no-repeat-cover",
|
|
18644
|
+
contain: "no-repeat-contain",
|
|
18645
|
+
fill: "no-repeat-fill",
|
|
18646
|
+
auto: "no-repeat-auto"
|
|
18647
|
+
};
|
|
18648
|
+
function resolveBackgroundParamsByImageSizing(sizingMode) {
|
|
18649
|
+
return {
|
|
18650
|
+
backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
|
|
18651
|
+
backgroundFit: !1,
|
|
18652
|
+
backgroundKeepAspectRatio: !1
|
|
18653
|
+
};
|
|
18654
|
+
}
|
|
18655
|
+
function resolveImageRepeatMode(repeatX, repeatY) {
|
|
18656
|
+
let repeat = 0;
|
|
18657
|
+
return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
|
|
18658
|
+
}
|
|
18659
|
+
function shouldClipImageByLayout({
|
|
18660
|
+
repeatX = "no-repeat",
|
|
18661
|
+
repeatY = "no-repeat",
|
|
18662
|
+
imageMode: imageMode,
|
|
18663
|
+
imageScale = 1,
|
|
18664
|
+
imageOffsetX = 0,
|
|
18665
|
+
imageOffsetY = 0,
|
|
18666
|
+
imagePosition = "top-left"
|
|
18667
|
+
}) {
|
|
18668
|
+
const {
|
|
18669
|
+
repeatMode: repeatMode,
|
|
18670
|
+
sizingMode: sizingMode
|
|
18671
|
+
} = resolveImageMode({
|
|
18672
|
+
repeatX: repeatX,
|
|
18673
|
+
repeatY: repeatY,
|
|
18674
|
+
imageMode: imageMode
|
|
18675
|
+
});
|
|
18676
|
+
return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
|
|
18677
|
+
}
|
|
18678
|
+
function drawImageWithLayout(context, data, x, y, width, height, {
|
|
18679
|
+
repeatX = "no-repeat",
|
|
18680
|
+
repeatY = "no-repeat",
|
|
18681
|
+
imageMode: imageMode,
|
|
18682
|
+
imageScale = 1,
|
|
18683
|
+
imageOffsetX = 0,
|
|
18684
|
+
imageOffsetY = 0,
|
|
18685
|
+
imagePosition = "top-left"
|
|
18686
|
+
}) {
|
|
18687
|
+
const {
|
|
18688
|
+
repeatMode: repeatMode,
|
|
18689
|
+
sizingMode: sizingMode
|
|
18690
|
+
} = resolveImageMode({
|
|
18691
|
+
repeatX: repeatX,
|
|
18692
|
+
repeatY: repeatY,
|
|
18693
|
+
imageMode: imageMode
|
|
18694
|
+
}),
|
|
18695
|
+
imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
|
|
18696
|
+
backgroundMode: repeatMode,
|
|
18697
|
+
backgroundFit: !1,
|
|
18698
|
+
backgroundKeepAspectRatio: !1
|
|
18699
|
+
};
|
|
18700
|
+
drawBackgroundImage(context, data, {
|
|
18701
|
+
x1: x,
|
|
18702
|
+
y1: y,
|
|
18703
|
+
x2: x + width,
|
|
18704
|
+
y2: y + height,
|
|
18705
|
+
width: () => width,
|
|
18706
|
+
height: () => height
|
|
18707
|
+
}, {
|
|
18708
|
+
backgroundMode: imageBackgroundParams.backgroundMode,
|
|
18709
|
+
backgroundFit: imageBackgroundParams.backgroundFit,
|
|
18710
|
+
backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
|
|
18711
|
+
backgroundScale: imageScale,
|
|
18712
|
+
backgroundOffsetX: imageOffsetX,
|
|
18713
|
+
backgroundOffsetY: imageOffsetY,
|
|
18714
|
+
backgroundPosition: imagePosition
|
|
18715
|
+
});
|
|
18716
|
+
}
|
|
18413
18717
|
let DefaultCanvasImageRender = class extends BaseRender {
|
|
18414
18718
|
constructor(graphicRenderContributions) {
|
|
18415
18719
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -18424,6 +18728,11 @@
|
|
|
18424
18728
|
cornerRadius = imageAttribute.cornerRadius,
|
|
18425
18729
|
fillStrokeOrder = imageAttribute.fillStrokeOrder,
|
|
18426
18730
|
cornerType = imageAttribute.cornerType,
|
|
18731
|
+
imageMode = imageAttribute.imageMode,
|
|
18732
|
+
imageScale = imageAttribute.imageScale,
|
|
18733
|
+
imageOffsetX = imageAttribute.imageOffsetX,
|
|
18734
|
+
imageOffsetY = imageAttribute.imageOffsetY,
|
|
18735
|
+
imagePosition = imageAttribute.imagePosition,
|
|
18427
18736
|
image: url
|
|
18428
18737
|
} = image.attribute,
|
|
18429
18738
|
data = this.valid(image, imageAttribute, fillCb);
|
|
@@ -18440,22 +18749,33 @@
|
|
|
18440
18749
|
const width = image.width,
|
|
18441
18750
|
height = image.height;
|
|
18442
18751
|
context.beginPath();
|
|
18443
|
-
let
|
|
18444
|
-
0 === cornerRadius || isArray$8(cornerRadius) && cornerRadius.every(num => 0 === num) ? context.rect(x, y, width, height) : (createRectPath(context, x, y, width, height, cornerRadius, "bevel" !== cornerType),
|
|
18752
|
+
let needCornerClip = !1;
|
|
18753
|
+
0 === cornerRadius || isArray$8(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);
|
|
18445
18754
|
const _runFill = () => {
|
|
18446
|
-
|
|
18447
|
-
|
|
18448
|
-
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
|
|
18453
|
-
|
|
18755
|
+
doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
|
|
18756
|
+
repeatX: repeatX,
|
|
18757
|
+
repeatY: repeatY,
|
|
18758
|
+
imageMode: imageMode,
|
|
18759
|
+
imageScale: imageScale,
|
|
18760
|
+
imageOffsetX: imageOffsetX,
|
|
18761
|
+
imageOffsetY: imageOffsetY,
|
|
18762
|
+
imagePosition: imagePosition
|
|
18763
|
+
})));
|
|
18454
18764
|
},
|
|
18455
18765
|
_runStroke = () => {
|
|
18456
18766
|
doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
|
|
18457
|
-
}
|
|
18458
|
-
|
|
18767
|
+
},
|
|
18768
|
+
needLayoutClip = shouldClipImageByLayout({
|
|
18769
|
+
repeatX: repeatX,
|
|
18770
|
+
repeatY: repeatY,
|
|
18771
|
+
imageMode: imageMode,
|
|
18772
|
+
imageScale: imageScale,
|
|
18773
|
+
imageOffsetX: imageOffsetX,
|
|
18774
|
+
imageOffsetY: imageOffsetY,
|
|
18775
|
+
imagePosition: imagePosition
|
|
18776
|
+
}),
|
|
18777
|
+
needClip = needCornerClip || needLayoutClip;
|
|
18778
|
+
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);
|
|
18459
18779
|
}
|
|
18460
18780
|
draw(image, renderService, drawContext) {
|
|
18461
18781
|
const {
|
|
@@ -19309,7 +19629,7 @@
|
|
|
19309
19629
|
return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
|
|
19310
19630
|
}
|
|
19311
19631
|
clearScreen(renderService, context, drawContext) {
|
|
19312
|
-
var _a, _b, _c;
|
|
19632
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
19313
19633
|
const {
|
|
19314
19634
|
clear: clear,
|
|
19315
19635
|
viewBox: viewBox
|
|
@@ -19319,9 +19639,20 @@
|
|
|
19319
19639
|
if (clear) {
|
|
19320
19640
|
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);
|
|
19321
19641
|
const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
|
|
19322
|
-
if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
|
|
19323
|
-
const res = stage.resources.get(clear);
|
|
19324
|
-
res && "success" === res.state && res.data
|
|
19642
|
+
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) {
|
|
19643
|
+
const res = stage.resources.get(getBackgroundImage(clear));
|
|
19644
|
+
if (res && "success" === res.state && res.data) {
|
|
19645
|
+
const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
|
|
19646
|
+
drawBackgroundImage(context, res.data, backgroundBounds, {
|
|
19647
|
+
backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
|
|
19648
|
+
backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
|
|
19649
|
+
backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
|
|
19650
|
+
backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
|
|
19651
|
+
backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
|
|
19652
|
+
backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
|
|
19653
|
+
backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
|
|
19654
|
+
}), boundsAllocate.free(backgroundBounds);
|
|
19655
|
+
}
|
|
19325
19656
|
} else context.fillStyle = createColor(context, clear, {
|
|
19326
19657
|
AABBBounds: {
|
|
19327
19658
|
x1: 0,
|
|
@@ -19824,7 +20155,7 @@
|
|
|
19824
20155
|
return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
|
|
19825
20156
|
}
|
|
19826
20157
|
set background(b) {
|
|
19827
|
-
this._background = b;
|
|
20158
|
+
this._background = b, this.syncBackgroundImage(b);
|
|
19828
20159
|
}
|
|
19829
20160
|
get defaultLayer() {
|
|
19830
20161
|
return this.at(0);
|
|
@@ -19838,6 +20169,18 @@
|
|
|
19838
20169
|
set ticker(ticker) {
|
|
19839
20170
|
ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
|
|
19840
20171
|
}
|
|
20172
|
+
syncBackgroundImage(background) {
|
|
20173
|
+
var _a;
|
|
20174
|
+
const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
20175
|
+
this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
|
|
20176
|
+
}
|
|
20177
|
+
isImageBackgroundSource(source) {
|
|
20178
|
+
if (!source) return !1;
|
|
20179
|
+
if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
|
|
20180
|
+
if (!isObject$a(source)) return !1;
|
|
20181
|
+
const gradientSource = source;
|
|
20182
|
+
return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
|
|
20183
|
+
}
|
|
19841
20184
|
constructor(params = {}) {
|
|
19842
20185
|
var _a, _b;
|
|
19843
20186
|
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
@@ -19876,9 +20219,7 @@
|
|
|
19876
20219
|
main: !0
|
|
19877
20220
|
})), 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 = {
|
|
19878
20221
|
tickRenderMode: "effect"
|
|
19879
|
-
}), this.optmize(params.optimize), params.background &&
|
|
19880
|
-
background: this._background
|
|
19881
|
-
}), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|
|
20222
|
+
}), 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());
|
|
19882
20223
|
}
|
|
19883
20224
|
initAnimate(params) {
|
|
19884
20225
|
var _a;
|
|
@@ -20213,12 +20554,12 @@
|
|
|
20213
20554
|
throw new Error("暂不支持");
|
|
20214
20555
|
}
|
|
20215
20556
|
release() {
|
|
20216
|
-
var _a, _b;
|
|
20557
|
+
var _a, _b, _d;
|
|
20217
20558
|
super.release(), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(layer => {
|
|
20218
20559
|
layer.release();
|
|
20219
20560
|
}), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
|
|
20220
20561
|
item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
|
|
20221
|
-
}), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.renderService.renderTreeRoots = [];
|
|
20562
|
+
}), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.params.ticker || null === (_d = this._ticker) || void 0 === _d || _d.release(), this.renderService.renderTreeRoots = [];
|
|
20222
20563
|
}
|
|
20223
20564
|
setStage(stage) {}
|
|
20224
20565
|
dirty(b, matrix) {
|
|
@@ -24444,7 +24785,7 @@
|
|
|
24444
24785
|
this._sliderRenderBounds = null, this._sliderLimitRange = null;
|
|
24445
24786
|
}
|
|
24446
24787
|
release(all) {
|
|
24447
|
-
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).
|
|
24788
|
+
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
|
|
24448
24789
|
passive: !1
|
|
24449
24790
|
}), this._clearDragEvents();
|
|
24450
24791
|
}
|
|
@@ -26027,17 +26368,21 @@
|
|
|
26027
26368
|
} = this.attribute.label;
|
|
26028
26369
|
textStyle = isFunction$4(textStyle) ? merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer)) : textStyle;
|
|
26029
26370
|
const labelAlign = this.getLabelAlign(vector, inside, textStyle.angle);
|
|
26030
|
-
|
|
26371
|
+
textStyle = merge(labelAlign, textStyle), isFunction$4(textStyle.text) && (textStyle.text = textStyle.text({
|
|
26031
26372
|
label: tickDatum.label,
|
|
26032
26373
|
value: tickDatum.rawValue,
|
|
26033
26374
|
index: tickDatum.index,
|
|
26034
26375
|
layer: layer
|
|
26035
|
-
}))
|
|
26376
|
+
}));
|
|
26377
|
+
let reactStyle = textStyle.react;
|
|
26378
|
+
return isFunction$4(reactStyle) && (reactStyle = reactStyle(tickDatum, index, tickData, layer)), Object.assign(Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
|
|
26036
26379
|
text: null != text ? text : textContent,
|
|
26037
26380
|
_originText: tickDatum.label,
|
|
26038
26381
|
lineHeight: null == textStyle ? void 0 : textStyle.fontSize,
|
|
26039
26382
|
type: type
|
|
26040
|
-
}), textStyle)
|
|
26383
|
+
}), textStyle), {
|
|
26384
|
+
react: reactStyle
|
|
26385
|
+
});
|
|
26041
26386
|
}
|
|
26042
26387
|
getLabelPosition(point, vector, text, style) {
|
|
26043
26388
|
return point;
|
|
@@ -27066,6 +27411,8 @@
|
|
|
27066
27411
|
this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
|
|
27067
27412
|
timeline.tick(delta);
|
|
27068
27413
|
}), this.emit("tick", delta));
|
|
27414
|
+
}, this._handleGraphTick = () => {
|
|
27415
|
+
this.initHandler(!1);
|
|
27069
27416
|
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
|
|
27070
27417
|
}
|
|
27071
27418
|
bindStage(stage) {
|
|
@@ -27075,9 +27422,7 @@
|
|
|
27075
27422
|
this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
|
|
27076
27423
|
}
|
|
27077
27424
|
init() {
|
|
27078
|
-
this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker",
|
|
27079
|
-
this.initHandler(!1);
|
|
27080
|
-
}), application.global.env && this.initHandler(!1);
|
|
27425
|
+
this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", this._handleGraphTick), application.global.env && this.initHandler(!1);
|
|
27081
27426
|
}
|
|
27082
27427
|
addTimeline(timeline) {
|
|
27083
27428
|
this.timelines.push(timeline);
|
|
@@ -27150,7 +27495,7 @@
|
|
|
27150
27495
|
}
|
|
27151
27496
|
release() {
|
|
27152
27497
|
var _a;
|
|
27153
|
-
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
|
|
27498
|
+
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1, application.global.hooks.onSetEnv.unTap("graph-ticker", this._handleGraphTick);
|
|
27154
27499
|
}
|
|
27155
27500
|
checkSkip(delta) {
|
|
27156
27501
|
var _a, _b, _c;
|
|
@@ -27264,6 +27609,7 @@
|
|
|
27264
27609
|
if (custom.prototype.constructor === custom) {
|
|
27265
27610
|
const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
|
|
27266
27611
|
if (descriptor && !descriptor.writable) return 1;
|
|
27612
|
+
if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
|
|
27267
27613
|
}
|
|
27268
27614
|
return 2;
|
|
27269
27615
|
}
|
|
@@ -27410,7 +27756,7 @@
|
|
|
27410
27756
|
let parsedFromProps = null,
|
|
27411
27757
|
props = params.to,
|
|
27412
27758
|
from = params.from;
|
|
27413
|
-
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
27759
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
27414
27760
|
let totalDelay = 0;
|
|
27415
27761
|
oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
|
|
27416
27762
|
const delayAfterValue = isFunction$4(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
|
|
@@ -27473,7 +27819,7 @@
|
|
|
27473
27819
|
let parsedFromProps = null,
|
|
27474
27820
|
props = effect.to,
|
|
27475
27821
|
from = effect.from;
|
|
27476
|
-
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
|
|
27822
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel);
|
|
27477
27823
|
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
27478
27824
|
customType = effect.custom ? effect.customType : getCustomType(custom);
|
|
27479
27825
|
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
@@ -27492,22 +27838,31 @@
|
|
|
27492
27838
|
animate.play(customAnimate);
|
|
27493
27839
|
}
|
|
27494
27840
|
createPropsFromChannel(channel, graphic) {
|
|
27841
|
+
var _a;
|
|
27495
27842
|
const props = {};
|
|
27496
27843
|
let from = null;
|
|
27497
|
-
|
|
27498
|
-
|
|
27499
|
-
|
|
27500
|
-
|
|
27501
|
-
}
|
|
27844
|
+
if (!channel) return {
|
|
27845
|
+
from: from,
|
|
27846
|
+
props: props,
|
|
27847
|
+
attrOutChannel: null
|
|
27848
|
+
};
|
|
27849
|
+
const attrOutChannel = {};
|
|
27850
|
+
let hasAttrs = !1;
|
|
27851
|
+
const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
|
|
27852
|
+
if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
|
|
27853
|
+
to: diffAttrs[key]
|
|
27854
|
+
}), res), {})), Object.keys(channel).forEach(key => {
|
|
27502
27855
|
var _a, _b, _c, _d;
|
|
27503
27856
|
const config = channel[key];
|
|
27504
27857
|
void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : props[key] = config.to), void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : from[key] = config.from);
|
|
27505
|
-
}), {
|
|
27506
|
-
|
|
27507
|
-
props
|
|
27508
|
-
}
|
|
27858
|
+
}), diffAttrs) for (const key in diffAttrs) {
|
|
27859
|
+
const value = diffAttrs[key];
|
|
27860
|
+
void 0 !== value && (props.hasOwnProperty(key) || (attrOutChannel[key] = value, hasAttrs = !0));
|
|
27861
|
+
}
|
|
27862
|
+
return {
|
|
27509
27863
|
from: from,
|
|
27510
|
-
props: props
|
|
27864
|
+
props: props,
|
|
27865
|
+
attrOutChannel: hasAttrs ? attrOutChannel : null
|
|
27511
27866
|
};
|
|
27512
27867
|
}
|
|
27513
27868
|
resolveValue(value, graphic, defaultValue) {
|
|
@@ -35414,7 +35769,31 @@
|
|
|
35414
35769
|
return graphicCreator.symbol(style);
|
|
35415
35770
|
}
|
|
35416
35771
|
_renderHandlerText(value, position) {
|
|
35417
|
-
|
|
35772
|
+
return graphicCreator.text(this._getHandlerTextAttributes(value, position));
|
|
35773
|
+
}
|
|
35774
|
+
_getHandlerPosition(isStart) {
|
|
35775
|
+
return this.attribute.range && isStart ? "start" : "end";
|
|
35776
|
+
}
|
|
35777
|
+
_getHandlerTextStyle(value, position) {
|
|
35778
|
+
const {
|
|
35779
|
+
align: align,
|
|
35780
|
+
handlerSize = 14,
|
|
35781
|
+
handlerText = {},
|
|
35782
|
+
railHeight: railHeight,
|
|
35783
|
+
railWidth: railWidth,
|
|
35784
|
+
slidable: slidable
|
|
35785
|
+
} = this.attribute;
|
|
35786
|
+
return isFunction$4(handlerText.style) ? handlerText.style(value, position, {
|
|
35787
|
+
layout: this.attribute.layout,
|
|
35788
|
+
align: align,
|
|
35789
|
+
railWidth: railWidth,
|
|
35790
|
+
railHeight: railHeight,
|
|
35791
|
+
handlerSize: handlerSize,
|
|
35792
|
+
slidable: slidable
|
|
35793
|
+
}) : handlerText.style;
|
|
35794
|
+
}
|
|
35795
|
+
_getHandlerTextAttributes(value, position) {
|
|
35796
|
+
var _a, _b;
|
|
35418
35797
|
const {
|
|
35419
35798
|
align: align,
|
|
35420
35799
|
handlerSize = 14,
|
|
@@ -35426,13 +35805,13 @@
|
|
|
35426
35805
|
isHorizontal = this._isHorizontal,
|
|
35427
35806
|
pos = this.calculatePosByValue(value, position),
|
|
35428
35807
|
textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
|
|
35808
|
+
handlerTextStyle = this._getHandlerTextStyle(value, position),
|
|
35429
35809
|
textStyle = {
|
|
35430
35810
|
text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
|
|
35431
|
-
lineHeight: null
|
|
35811
|
+
lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
|
|
35432
35812
|
cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
|
|
35433
35813
|
};
|
|
35434
|
-
isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos);
|
|
35435
|
-
return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
|
|
35814
|
+
return isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos), Object.assign(Object.assign({}, textStyle), handlerTextStyle);
|
|
35436
35815
|
}
|
|
35437
35816
|
_renderTooltip() {
|
|
35438
35817
|
var _a;
|
|
@@ -35560,31 +35939,19 @@
|
|
|
35560
35939
|
}
|
|
35561
35940
|
}
|
|
35562
35941
|
_updateHandler(handler, position, value) {
|
|
35563
|
-
var _a;
|
|
35564
35942
|
const isHorizontal = this._isHorizontal;
|
|
35565
35943
|
handler.setAttribute(isHorizontal ? "x" : "y", position);
|
|
35566
35944
|
const updateHandlerText = handler.name === SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
|
|
35567
35945
|
if (updateHandlerText) {
|
|
35568
|
-
const
|
|
35569
|
-
|
|
35570
|
-
} = this.attribute;
|
|
35571
|
-
updateHandlerText.setAttributes({
|
|
35572
|
-
text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
|
|
35573
|
-
[isHorizontal ? "x" : "y"]: position
|
|
35574
|
-
});
|
|
35946
|
+
const handlerPosition = this._getHandlerPosition(handler.name === SLIDER_ELEMENT_NAME.startHandler);
|
|
35947
|
+
updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
|
|
35575
35948
|
}
|
|
35576
35949
|
handler.name === SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
|
|
35577
35950
|
}
|
|
35578
35951
|
_updateHandlerText(handlerText, position, value) {
|
|
35579
|
-
var _a;
|
|
35580
35952
|
const isHorizontal = this._isHorizontal,
|
|
35581
|
-
|
|
35582
|
-
|
|
35583
|
-
} = this.attribute;
|
|
35584
|
-
handlerText.setAttributes({
|
|
35585
|
-
[isHorizontal ? "x" : "y"]: position,
|
|
35586
|
-
text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
|
|
35587
|
-
});
|
|
35953
|
+
handlerPosition = this._getHandlerPosition(handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText);
|
|
35954
|
+
handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
|
|
35588
35955
|
const updateHandler = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
|
|
35589
35956
|
updateHandler && updateHandler.setAttributes({
|
|
35590
35957
|
[isHorizontal ? "x" : "y"]: position
|
|
@@ -35620,7 +35987,7 @@
|
|
|
35620
35987
|
};
|
|
35621
35988
|
}
|
|
35622
35989
|
release(all) {
|
|
35623
|
-
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).
|
|
35990
|
+
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
|
|
35624
35991
|
passive: !1
|
|
35625
35992
|
}), this._clearAllDragEvents();
|
|
35626
35993
|
}
|
|
@@ -60209,11 +60576,11 @@
|
|
|
60209
60576
|
onUpdate(end, ratio, out) {
|
|
60210
60577
|
if (this.from.x !== this.to.x) {
|
|
60211
60578
|
const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
|
|
60212
|
-
this.params.table.scrollLeft = x;
|
|
60579
|
+
this.params.table.scrollLeft = x, 1 === ratio && -1 !== this.to.targetCol && this.params.table.scrollToCol(this.to.targetCol, !1);
|
|
60213
60580
|
}
|
|
60214
60581
|
if (this.from.y !== this.to.y) {
|
|
60215
60582
|
const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
|
|
60216
|
-
this.params.table.scrollTop = y;
|
|
60583
|
+
this.params.table.scrollTop = y, 1 === ratio && -1 !== this.to.targetRow && this.params.table.scrollToRow(this.to.targetRow, !1);
|
|
60217
60584
|
}
|
|
60218
60585
|
}
|
|
60219
60586
|
}
|
|
@@ -60245,7 +60612,9 @@
|
|
|
60245
60612
|
colDecimal && (left += colDecimal * cellRect.width), rowDecimal && (top += rowDecimal * cellRect.height);
|
|
60246
60613
|
const to = {
|
|
60247
60614
|
x: isNumber$2(col) ? left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
|
|
60248
|
-
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop
|
|
60615
|
+
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop,
|
|
60616
|
+
targetCol: null != col ? col : -1,
|
|
60617
|
+
targetRow: null != row ? row : -1
|
|
60249
60618
|
},
|
|
60250
60619
|
duration = isBoolean$2(animationOption) ? animationOption ? 3e3 : 0 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3,
|
|
60251
60620
|
easing = isBoolean$2(animationOption) ? animationOption ? "linear" : "" : null !== (_b = null == animationOption ? void 0 : animationOption.easing) && void 0 !== _b ? _b : "linear";
|
|
@@ -60332,7 +60701,7 @@
|
|
|
60332
60701
|
}
|
|
60333
60702
|
constructor(container, options = {}) {
|
|
60334
60703
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
60335
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.22.13-alpha.
|
|
60704
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.22.13-alpha.11", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
60336
60705
|
this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
60337
60706
|
options: options,
|
|
60338
60707
|
container: container
|
|
@@ -61261,17 +61630,18 @@
|
|
|
61261
61630
|
this.release();
|
|
61262
61631
|
}
|
|
61263
61632
|
release() {
|
|
61264
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
61633
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
61634
|
+
null === (_c = null === (_b = null === (_a = this.scenegraph) || void 0 === _a ? void 0 : _a.component) || void 0 === _b ? void 0 : _b.vScrollBar) || void 0 === _c || _c.release(), null === (_f = null === (_e = null === (_d = this.scenegraph) || void 0 === _d ? void 0 : _d.component) || void 0 === _e ? void 0 : _e.hScrollBar) || void 0 === _f || _f.release(), this.animationManager.clear(), this.animationManager.ticker.release(), null === (_j = null === (_h = null === (_g = this.scenegraph) || void 0 === _g ? void 0 : _g.stage) || void 0 === _h ? void 0 : _h.ticker) || void 0 === _j || _j.release();
|
|
61265
61635
|
const internalProps = this.internalProps;
|
|
61266
61636
|
if (this.isReleased) return;
|
|
61267
|
-
null === (
|
|
61637
|
+
null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k), null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m), null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(), null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q), this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s), null === (_u = internalProps.legends) || void 0 === _u || _u.forEach(legend => {
|
|
61268
61638
|
null == legend || legend.release();
|
|
61269
|
-
}), null === (
|
|
61639
|
+
}), null === (_v = internalProps.title) || void 0 === _v || _v.release(), internalProps.title = null, null === (_w = internalProps.emptyTip) || void 0 === _w || _w.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
|
|
61270
61640
|
var _a;
|
|
61271
61641
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
61272
61642
|
}), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
61273
|
-
const parentElement = null === (
|
|
61274
|
-
parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), null === (
|
|
61643
|
+
const parentElement = null === (_x = internalProps.element) || void 0 === _x ? void 0 : _x.parentElement;
|
|
61644
|
+
parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), null === (_0 = null === (_z = null === (_y = this.editorManager) || void 0 === _y ? void 0 : _y.editingEditor) || void 0 === _z ? void 0 : _z.onEnd) || void 0 === _0 || _0.call(_z), this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_1 = this.reactCustomLayout) || void 0 === _1 || _1.clearCache(), clearChartRenderQueue();
|
|
61275
61645
|
}
|
|
61276
61646
|
fireListeners(type, event) {
|
|
61277
61647
|
return super.fireListeners(type, event);
|
|
@@ -62440,6 +62810,7 @@
|
|
|
62440
62810
|
});
|
|
62441
62811
|
}
|
|
62442
62812
|
scrollToCell(cellAddr, animationOption) {
|
|
62813
|
+
var _a;
|
|
62443
62814
|
if (animationOption) return void this.animationManager.scrollTo(cellAddr, animationOption);
|
|
62444
62815
|
const drawRange = this.getDrawRange();
|
|
62445
62816
|
if (isValid$2(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
|
|
@@ -62449,8 +62820,10 @@
|
|
|
62449
62820
|
}
|
|
62450
62821
|
if (isValid$2(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
|
|
62451
62822
|
const frozenHeight = this.getFrozenRowsHeight(),
|
|
62452
|
-
|
|
62453
|
-
|
|
62823
|
+
rowInt = Math.floor(cellAddr.row),
|
|
62824
|
+
rowFloat = cellAddr.row - rowInt;
|
|
62825
|
+
let top = this.internalProps._rowHeightsMap.getSumInRange(0, rowInt - 1);
|
|
62826
|
+
rowFloat > 0 && (top += (null !== (_a = this.internalProps._rowHeightsMap.get(rowInt)) && void 0 !== _a ? _a : this.getRowHeight(rowInt)) * rowFloat), this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
|
|
62454
62827
|
}
|
|
62455
62828
|
this.render();
|
|
62456
62829
|
}
|
|
@@ -91428,7 +91801,7 @@
|
|
|
91428
91801
|
importStyle();
|
|
91429
91802
|
}
|
|
91430
91803
|
|
|
91431
|
-
const version = "1.22.13-alpha.
|
|
91804
|
+
const version = "1.22.13-alpha.11";
|
|
91432
91805
|
importStyles();
|
|
91433
91806
|
|
|
91434
91807
|
exports.TYPES = index;
|