@visactor/vtable-calendar 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/dist/vtable-calendar.js +568 -195
- package/dist/vtable-calendar.min.js +1 -1
- package/package.json +4 -4
package/dist/vtable-calendar.js
CHANGED
|
@@ -627,28 +627,59 @@
|
|
|
627
627
|
}
|
|
628
628
|
addEventListener(type, listener, options) {
|
|
629
629
|
if (!listener) return;
|
|
630
|
+
const capture = this._resolveCapture(options),
|
|
631
|
+
once = this._resolveOnce(options),
|
|
632
|
+
listenerTypeMap = this._getOrCreateListenerTypeMap(type),
|
|
633
|
+
wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
|
|
634
|
+
if (wrappedMap.has(capture)) return;
|
|
630
635
|
const wrappedListener = event => {
|
|
631
636
|
const transformedEvent = this._eventListenerTransformer(event);
|
|
632
|
-
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
|
|
637
|
+
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
|
|
633
638
|
};
|
|
634
|
-
|
|
639
|
+
wrappedMap.set(capture, {
|
|
640
|
+
wrappedListener: wrappedListener,
|
|
641
|
+
options: options
|
|
642
|
+
}), this._nativeAddEventListener(type, wrappedListener, options);
|
|
635
643
|
}
|
|
636
644
|
removeEventListener(type, listener, options) {
|
|
637
|
-
var _a;
|
|
645
|
+
var _a, _b;
|
|
638
646
|
if (!listener) return;
|
|
639
|
-
const
|
|
640
|
-
|
|
647
|
+
const capture = this._resolveCapture(options),
|
|
648
|
+
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);
|
|
649
|
+
wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
|
|
641
650
|
}
|
|
642
651
|
dispatchEvent(event) {
|
|
643
652
|
return this._nativeDispatchEvent(event);
|
|
644
653
|
}
|
|
645
654
|
clearAllEventListeners() {
|
|
646
|
-
this._listenerMap.forEach((
|
|
647
|
-
|
|
648
|
-
|
|
655
|
+
this._listenerMap.forEach((listenerMap, type) => {
|
|
656
|
+
listenerMap.forEach(wrappedMap => {
|
|
657
|
+
wrappedMap.forEach((wrappedRecord, capture) => {
|
|
658
|
+
this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
|
|
659
|
+
});
|
|
649
660
|
});
|
|
650
661
|
}), this._listenerMap.clear();
|
|
651
662
|
}
|
|
663
|
+
_resolveCapture(options) {
|
|
664
|
+
return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
|
|
665
|
+
}
|
|
666
|
+
_resolveOnce(options) {
|
|
667
|
+
return "object" == typeof options && !!(null == options ? void 0 : options.once);
|
|
668
|
+
}
|
|
669
|
+
_getOrCreateListenerTypeMap(type) {
|
|
670
|
+
let listenerTypeMap = this._listenerMap.get(type);
|
|
671
|
+
return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
|
|
672
|
+
}
|
|
673
|
+
_getOrCreateWrappedMap(listenerTypeMap, listener) {
|
|
674
|
+
let wrappedMap = listenerTypeMap.get(listener);
|
|
675
|
+
return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
|
|
676
|
+
}
|
|
677
|
+
_deleteListenerRecord(type, listener, capture) {
|
|
678
|
+
const listenerTypeMap = this._listenerMap.get(type);
|
|
679
|
+
if (!listenerTypeMap) return;
|
|
680
|
+
const wrappedMap = listenerTypeMap.get(listener);
|
|
681
|
+
wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
|
|
682
|
+
}
|
|
652
683
|
_nativeAddEventListener(type, listener, options) {
|
|
653
684
|
throw new Error("_nativeAddEventListener must be implemented by derived classes");
|
|
654
685
|
}
|
|
@@ -4544,6 +4575,7 @@
|
|
|
4544
4575
|
backgroundScale: 1,
|
|
4545
4576
|
backgroundOffsetX: 0,
|
|
4546
4577
|
backgroundOffsetY: 0,
|
|
4578
|
+
backgroundPosition: "top-left",
|
|
4547
4579
|
blur: 0,
|
|
4548
4580
|
filter: "",
|
|
4549
4581
|
cursor: null,
|
|
@@ -4716,11 +4748,16 @@
|
|
|
4716
4748
|
const DefaultImageAttribute = Object.assign(Object.assign({
|
|
4717
4749
|
repeatX: "no-repeat",
|
|
4718
4750
|
repeatY: "no-repeat",
|
|
4751
|
+
imageMode: void 0,
|
|
4719
4752
|
image: "",
|
|
4720
4753
|
width: 0,
|
|
4721
4754
|
height: 0,
|
|
4722
4755
|
maxWidth: 500,
|
|
4723
|
-
maxHeight: 500
|
|
4756
|
+
maxHeight: 500,
|
|
4757
|
+
imagePosition: "top-left",
|
|
4758
|
+
imageScale: 1,
|
|
4759
|
+
imageOffsetX: 0,
|
|
4760
|
+
imageOffsetY: 0
|
|
4724
4761
|
}, DefaultAttribute), {
|
|
4725
4762
|
fill: !0,
|
|
4726
4763
|
cornerRadius: 0,
|
|
@@ -7162,7 +7199,9 @@
|
|
|
7162
7199
|
var _a;
|
|
7163
7200
|
if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
|
|
7164
7201
|
const constructor = event.constructor;
|
|
7165
|
-
this.eventPool.has(constructor) || this.eventPool.
|
|
7202
|
+
this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
|
|
7203
|
+
e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
|
|
7204
|
+
}), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
|
|
7166
7205
|
}
|
|
7167
7206
|
notifyListeners(e, type) {
|
|
7168
7207
|
const listeners = e.currentTarget._events[type];
|
|
@@ -9119,6 +9158,7 @@
|
|
|
9119
9158
|
const tempConstantXYKey = ["x", "y"],
|
|
9120
9159
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
9121
9160
|
tempConstantAngleKey = ["angle"],
|
|
9161
|
+
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
9122
9162
|
point = new Point();
|
|
9123
9163
|
const NOWORK_ANIMATE_ATTR = {
|
|
9124
9164
|
strokeSeg: 1,
|
|
@@ -9175,7 +9215,7 @@
|
|
|
9175
9215
|
}
|
|
9176
9216
|
constructor(params = {}) {
|
|
9177
9217
|
var _a;
|
|
9178
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background
|
|
9218
|
+
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);
|
|
9179
9219
|
}
|
|
9180
9220
|
getGraphicService() {
|
|
9181
9221
|
var _a, _b;
|
|
@@ -9364,7 +9404,7 @@
|
|
|
9364
9404
|
});
|
|
9365
9405
|
}
|
|
9366
9406
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
9367
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background
|
|
9407
|
+
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));
|
|
9368
9408
|
}
|
|
9369
9409
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
9370
9410
|
const keys = Object.keys(params);
|
|
@@ -9379,7 +9419,7 @@
|
|
|
9379
9419
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
9380
9420
|
[key]: value
|
|
9381
9421
|
}, this.attribute, key, context);
|
|
9382
|
-
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);
|
|
9422
|
+
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);
|
|
9383
9423
|
}
|
|
9384
9424
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
9385
9425
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -9398,7 +9438,7 @@
|
|
|
9398
9438
|
const context = {
|
|
9399
9439
|
type: AttributeUpdateType.INIT
|
|
9400
9440
|
};
|
|
9401
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background
|
|
9441
|
+
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);
|
|
9402
9442
|
}
|
|
9403
9443
|
translate(x, y) {
|
|
9404
9444
|
var _a, _b;
|
|
@@ -9731,7 +9771,8 @@
|
|
|
9731
9771
|
return isString$2(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
|
|
9732
9772
|
}
|
|
9733
9773
|
loadImage(image, background = !1) {
|
|
9734
|
-
if (
|
|
9774
|
+
if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
|
|
9775
|
+
if (!image) return;
|
|
9735
9776
|
const url = image;
|
|
9736
9777
|
this.resources || (this.resources = new Map());
|
|
9737
9778
|
const cache = {
|
|
@@ -9766,7 +9807,7 @@
|
|
|
9766
9807
|
});
|
|
9767
9808
|
}
|
|
9768
9809
|
release() {
|
|
9769
|
-
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
|
|
9810
|
+
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
|
|
9770
9811
|
}
|
|
9771
9812
|
_emitCustomEvent(type, context) {
|
|
9772
9813
|
var _a, _b;
|
|
@@ -9786,7 +9827,10 @@
|
|
|
9786
9827
|
}
|
|
9787
9828
|
}
|
|
9788
9829
|
function backgroundNotImage(image) {
|
|
9789
|
-
return !(!image.fill && !image.stroke);
|
|
9830
|
+
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));
|
|
9831
|
+
}
|
|
9832
|
+
function isExternalTexture(texture) {
|
|
9833
|
+
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$7(texture));
|
|
9790
9834
|
}
|
|
9791
9835
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget$2);
|
|
9792
9836
|
|
|
@@ -11880,7 +11924,7 @@
|
|
|
11880
11924
|
return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
|
|
11881
11925
|
}
|
|
11882
11926
|
|
|
11883
|
-
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
11927
|
+
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
11884
11928
|
let Image$1 = class Image extends Graphic {
|
|
11885
11929
|
constructor(params) {
|
|
11886
11930
|
super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
|
|
@@ -11985,6 +12029,7 @@
|
|
|
11985
12029
|
};
|
|
11986
12030
|
Image$1.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
11987
12031
|
image: 1,
|
|
12032
|
+
imageMode: 1,
|
|
11988
12033
|
repeatX: 1,
|
|
11989
12034
|
repeatY: 1
|
|
11990
12035
|
}, NOWORK_ANIMATE_ATTR);
|
|
@@ -12961,11 +13006,12 @@
|
|
|
12961
13006
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
12962
13007
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
12963
13008
|
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
12964
|
-
backgroundClip = graphicAttribute.backgroundClip
|
|
13009
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
13010
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
12965
13011
|
} = graphic.attribute;
|
|
12966
13012
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
12967
|
-
const res = graphic.resources.get(background);
|
|
12968
|
-
if ("success" !== res.state || !res.data) return;
|
|
13013
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
13014
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
12969
13015
|
if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
|
|
12970
13016
|
const groupAttribute = getTheme(graphic.parent).group,
|
|
12971
13017
|
{
|
|
@@ -12982,59 +13028,160 @@
|
|
|
12982
13028
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
12983
13029
|
backgroundScale: backgroundScale,
|
|
12984
13030
|
backgroundOffsetX: backgroundOffsetX,
|
|
12985
|
-
backgroundOffsetY: backgroundOffsetY
|
|
13031
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
13032
|
+
backgroundPosition: backgroundPosition
|
|
12986
13033
|
}), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
|
|
12987
13034
|
} else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
12988
13035
|
}
|
|
12989
13036
|
doDrawImage(context, data, b, params) {
|
|
12990
|
-
|
|
12991
|
-
backgroundMode: backgroundMode,
|
|
12992
|
-
backgroundFit: backgroundFit,
|
|
12993
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
12994
|
-
backgroundScale = 1,
|
|
12995
|
-
backgroundOffsetX = 0,
|
|
12996
|
-
backgroundOffsetY = 0
|
|
12997
|
-
} = params,
|
|
12998
|
-
targetW = b.width(),
|
|
12999
|
-
targetH = b.height();
|
|
13000
|
-
let w = targetW,
|
|
13001
|
-
h = targetH;
|
|
13002
|
-
if ("no-repeat" === backgroundMode) {
|
|
13003
|
-
if (backgroundFit) {
|
|
13004
|
-
if (backgroundKeepAspectRatio) {
|
|
13005
|
-
const maxScale = Math.max(targetW / data.width, targetH / data.height);
|
|
13006
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
|
|
13007
|
-
} else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
13008
|
-
} else {
|
|
13009
|
-
const resW = data.width * backgroundScale,
|
|
13010
|
-
resH = data.height * backgroundScale;
|
|
13011
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
|
|
13012
|
-
}
|
|
13013
|
-
} else {
|
|
13014
|
-
if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
|
|
13015
|
-
const resW = data.width,
|
|
13016
|
-
resH = data.height;
|
|
13017
|
-
if ("repeat-x" === backgroundMode) {
|
|
13018
|
-
w = resW * (targetH / resH), h = targetH;
|
|
13019
|
-
} else if ("repeat-y" === backgroundMode) {
|
|
13020
|
-
h = resH * (targetW / resW), w = targetW;
|
|
13021
|
-
}
|
|
13022
|
-
const dpr = context.dpr,
|
|
13023
|
-
canvas = canvasAllocate.allocate({
|
|
13024
|
-
width: w,
|
|
13025
|
-
height: h,
|
|
13026
|
-
dpr: dpr
|
|
13027
|
-
}),
|
|
13028
|
-
ctx = canvas.getContext("2d");
|
|
13029
|
-
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);
|
|
13030
|
-
}
|
|
13031
|
-
const dpr = context.dpr,
|
|
13032
|
-
pattern = context.createPattern(data, backgroundMode);
|
|
13033
|
-
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);
|
|
13034
|
-
}
|
|
13037
|
+
drawBackgroundImage(context, data, b, params);
|
|
13035
13038
|
}
|
|
13036
13039
|
}
|
|
13037
13040
|
const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
|
|
13041
|
+
const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
|
|
13042
|
+
function getBackgroundImage(background) {
|
|
13043
|
+
var _a;
|
|
13044
|
+
return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
13045
|
+
}
|
|
13046
|
+
function resolveBackgroundSizing({
|
|
13047
|
+
backgroundFit: backgroundFit,
|
|
13048
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
13049
|
+
}) {
|
|
13050
|
+
return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
|
|
13051
|
+
}
|
|
13052
|
+
const NO_REPEAT_SIZING_MAP = {
|
|
13053
|
+
"no-repeat-cover": "cover",
|
|
13054
|
+
"no-repeat-contain": "contain",
|
|
13055
|
+
"no-repeat-fill": "fill",
|
|
13056
|
+
"no-repeat-auto": "auto"
|
|
13057
|
+
};
|
|
13058
|
+
function resolveBackgroundDrawMode({
|
|
13059
|
+
backgroundMode: backgroundMode,
|
|
13060
|
+
backgroundFit: backgroundFit,
|
|
13061
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
13062
|
+
}) {
|
|
13063
|
+
const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
|
|
13064
|
+
return sizing ? {
|
|
13065
|
+
backgroundRepeatMode: "no-repeat",
|
|
13066
|
+
backgroundSizing: sizing
|
|
13067
|
+
} : {
|
|
13068
|
+
backgroundRepeatMode: backgroundMode,
|
|
13069
|
+
backgroundSizing: resolveBackgroundSizing({
|
|
13070
|
+
backgroundFit: backgroundFit,
|
|
13071
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
13072
|
+
})
|
|
13073
|
+
};
|
|
13074
|
+
}
|
|
13075
|
+
function isPercentageValue(value) {
|
|
13076
|
+
return /^-?\d+(\.\d+)?%$/.test(value);
|
|
13077
|
+
}
|
|
13078
|
+
function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
|
|
13079
|
+
if ("number" == typeof value && Number.isFinite(value)) return value;
|
|
13080
|
+
const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
|
|
13081
|
+
if (!normalizedValue || normalizedValue === startKeyword) return 0;
|
|
13082
|
+
if (normalizedValue === centerKeyword) return remainSpace / 2;
|
|
13083
|
+
if (normalizedValue === endKeyword) return remainSpace;
|
|
13084
|
+
if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
|
|
13085
|
+
const parsedValue = Number(normalizedValue);
|
|
13086
|
+
return Number.isFinite(parsedValue) ? parsedValue : 0;
|
|
13087
|
+
}
|
|
13088
|
+
function normalizeBackgroundPosition(position) {
|
|
13089
|
+
var _a, _b;
|
|
13090
|
+
if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
|
|
13091
|
+
const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
|
|
13092
|
+
if (0 === tokens.length) return ["left", "top"];
|
|
13093
|
+
if (1 === tokens.length) {
|
|
13094
|
+
const token = tokens[0];
|
|
13095
|
+
return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
|
|
13096
|
+
}
|
|
13097
|
+
let horizontal, vertical;
|
|
13098
|
+
const genericTokens = [];
|
|
13099
|
+
for (let i = 0; i < 2; i++) {
|
|
13100
|
+
const token = tokens[i];
|
|
13101
|
+
"left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
|
|
13102
|
+
}
|
|
13103
|
+
return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
|
|
13104
|
+
}
|
|
13105
|
+
function resolveBackgroundPosition(position, remainWidth, remainHeight) {
|
|
13106
|
+
const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
|
|
13107
|
+
return {
|
|
13108
|
+
x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
|
|
13109
|
+
y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
|
|
13110
|
+
};
|
|
13111
|
+
}
|
|
13112
|
+
function pickRenderableDimension(...values) {
|
|
13113
|
+
for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
|
|
13114
|
+
return null;
|
|
13115
|
+
}
|
|
13116
|
+
function resolveRenderableImageSize(data) {
|
|
13117
|
+
if (!data) return null;
|
|
13118
|
+
const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
|
|
13119
|
+
height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
|
|
13120
|
+
return null == width || null == height ? null : {
|
|
13121
|
+
width: width,
|
|
13122
|
+
height: height
|
|
13123
|
+
};
|
|
13124
|
+
}
|
|
13125
|
+
function drawBackgroundImage(context, data, b, params) {
|
|
13126
|
+
var _a, _b;
|
|
13127
|
+
const {
|
|
13128
|
+
backgroundMode: backgroundMode,
|
|
13129
|
+
backgroundFit: backgroundFit,
|
|
13130
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
13131
|
+
backgroundScale = 1,
|
|
13132
|
+
backgroundOffsetX = 0,
|
|
13133
|
+
backgroundOffsetY = 0,
|
|
13134
|
+
backgroundPosition = "top-left"
|
|
13135
|
+
} = params,
|
|
13136
|
+
targetW = b.width(),
|
|
13137
|
+
targetH = b.height(),
|
|
13138
|
+
sourceSize = resolveRenderableImageSize(data),
|
|
13139
|
+
{
|
|
13140
|
+
backgroundRepeatMode: backgroundRepeatMode,
|
|
13141
|
+
backgroundSizing: resolvedBackgroundSizing
|
|
13142
|
+
} = resolveBackgroundDrawMode({
|
|
13143
|
+
backgroundMode: backgroundMode,
|
|
13144
|
+
backgroundFit: backgroundFit,
|
|
13145
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
13146
|
+
});
|
|
13147
|
+
let w = targetW,
|
|
13148
|
+
h = targetH;
|
|
13149
|
+
if (targetW <= 0 || targetH <= 0) return;
|
|
13150
|
+
if ("no-repeat" === backgroundRepeatMode) {
|
|
13151
|
+
let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
|
|
13152
|
+
drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
|
|
13153
|
+
if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
|
|
13154
|
+
const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
|
|
13155
|
+
drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
|
|
13156
|
+
}
|
|
13157
|
+
drawWidth *= backgroundScale, drawHeight *= backgroundScale;
|
|
13158
|
+
const {
|
|
13159
|
+
x: x,
|
|
13160
|
+
y: y
|
|
13161
|
+
} = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
|
|
13162
|
+
return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
|
|
13163
|
+
}
|
|
13164
|
+
if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
|
|
13165
|
+
const resW = sourceSize.width,
|
|
13166
|
+
resH = sourceSize.height;
|
|
13167
|
+
if ("repeat-x" === backgroundRepeatMode) {
|
|
13168
|
+
w = resW * (targetH / resH), h = targetH;
|
|
13169
|
+
} else if ("repeat-y" === backgroundRepeatMode) {
|
|
13170
|
+
h = resH * (targetW / resW), w = targetW;
|
|
13171
|
+
}
|
|
13172
|
+
const dpr = context.dpr,
|
|
13173
|
+
canvas = canvasAllocate.allocate({
|
|
13174
|
+
width: w,
|
|
13175
|
+
height: h,
|
|
13176
|
+
dpr: dpr
|
|
13177
|
+
}),
|
|
13178
|
+
ctx = canvas.getContext("2d");
|
|
13179
|
+
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);
|
|
13180
|
+
}
|
|
13181
|
+
const dpr = context.dpr,
|
|
13182
|
+
pattern = context.createPattern(data, backgroundRepeatMode);
|
|
13183
|
+
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);
|
|
13184
|
+
}
|
|
13038
13185
|
let DefaultBaseInteractiveRenderContribution = class {
|
|
13039
13186
|
constructor(subRenderContribitions) {
|
|
13040
13187
|
this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
@@ -13080,6 +13227,7 @@
|
|
|
13080
13227
|
}
|
|
13081
13228
|
const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
|
|
13082
13229
|
|
|
13230
|
+
const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
|
|
13083
13231
|
function formatRatio(ratio) {
|
|
13084
13232
|
return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
|
|
13085
13233
|
}
|
|
@@ -13193,38 +13341,43 @@
|
|
|
13193
13341
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
13194
13342
|
}
|
|
13195
13343
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
13196
|
-
var _a;
|
|
13344
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13197
13345
|
const {
|
|
13198
13346
|
textureRatio = graphicAttribute.textureRatio,
|
|
13199
13347
|
textureOptions = null
|
|
13200
13348
|
} = graphic.attribute;
|
|
13201
|
-
let pattern =
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13349
|
+
let pattern = null;
|
|
13350
|
+
const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
|
|
13351
|
+
patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
|
|
13352
|
+
if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
|
|
13353
|
+
if ("string" == typeof texture) switch (texture) {
|
|
13354
|
+
case "circle":
|
|
13355
|
+
pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
|
|
13356
|
+
break;
|
|
13357
|
+
case "diamond":
|
|
13358
|
+
pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
|
|
13359
|
+
break;
|
|
13360
|
+
case "rect":
|
|
13361
|
+
pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
|
|
13362
|
+
break;
|
|
13363
|
+
case "vertical-line":
|
|
13364
|
+
pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
13365
|
+
break;
|
|
13366
|
+
case "horizontal-line":
|
|
13367
|
+
pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
13368
|
+
break;
|
|
13369
|
+
case "bias-lr":
|
|
13370
|
+
pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
|
|
13371
|
+
break;
|
|
13372
|
+
case "bias-rl":
|
|
13373
|
+
pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
|
|
13374
|
+
break;
|
|
13375
|
+
case "grid":
|
|
13376
|
+
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
13377
|
+
}
|
|
13378
|
+
pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
|
|
13226
13379
|
}
|
|
13227
|
-
if (textureOptions && textureOptions.dynamicTexture) {
|
|
13380
|
+
if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
|
|
13228
13381
|
const {
|
|
13229
13382
|
gridConfig = {},
|
|
13230
13383
|
useNewCanvas: useNewCanvas
|
|
@@ -13269,10 +13422,24 @@
|
|
|
13269
13422
|
for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
|
|
13270
13423
|
const _x = x + cellSize / 2 + j * cellSize,
|
|
13271
13424
|
_y = y + cellSize / 2 + i * cellSize;
|
|
13272
|
-
null === (
|
|
13425
|
+
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());
|
|
13273
13426
|
}
|
|
13274
13427
|
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();
|
|
13275
|
-
} else if (pattern)
|
|
13428
|
+
} else if (pattern) {
|
|
13429
|
+
if (pattern.setTransform) {
|
|
13430
|
+
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
13431
|
+
alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
|
|
13432
|
+
alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
|
|
13433
|
+
let translateX = 0,
|
|
13434
|
+
translateY = 0;
|
|
13435
|
+
if (alignToGraphic) {
|
|
13436
|
+
const m = context.currentMatrix;
|
|
13437
|
+
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;
|
|
13438
|
+
} else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
|
|
13439
|
+
pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
|
|
13440
|
+
}
|
|
13441
|
+
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
|
|
13442
|
+
} else if ("wave" === texture) {
|
|
13276
13443
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
13277
13444
|
const b = graphic.AABBBounds;
|
|
13278
13445
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -13280,6 +13447,45 @@
|
|
|
13280
13447
|
}), x + b.x1 - x, y + b.y1 - y), context.restore();
|
|
13281
13448
|
}
|
|
13282
13449
|
}
|
|
13450
|
+
getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
|
|
13451
|
+
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}`;
|
|
13452
|
+
}
|
|
13453
|
+
createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
|
|
13454
|
+
var _a;
|
|
13455
|
+
const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
|
|
13456
|
+
data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
|
|
13457
|
+
if (!data) return null;
|
|
13458
|
+
if (texturePadding > 0 || textureRadius > 0) {
|
|
13459
|
+
const w = data.naturalWidth || data.width,
|
|
13460
|
+
h = data.naturalHeight || data.height;
|
|
13461
|
+
if (w > 0 && h > 0) {
|
|
13462
|
+
const tileW = w + 2 * texturePadding,
|
|
13463
|
+
tileH = h + 2 * texturePadding,
|
|
13464
|
+
canvas = canvasAllocate.allocate({
|
|
13465
|
+
width: tileW,
|
|
13466
|
+
height: tileH,
|
|
13467
|
+
dpr: context.dpr
|
|
13468
|
+
}),
|
|
13469
|
+
ctx = canvas.getContext("2d");
|
|
13470
|
+
if (ctx) {
|
|
13471
|
+
if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
|
|
13472
|
+
const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
|
|
13473
|
+
x0 = texturePadding,
|
|
13474
|
+
y0 = texturePadding,
|
|
13475
|
+
x1 = x0 + w,
|
|
13476
|
+
y1 = y0 + h;
|
|
13477
|
+
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();
|
|
13478
|
+
}
|
|
13479
|
+
ctx.drawImage(data, texturePadding, texturePadding, w, h);
|
|
13480
|
+
const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
|
|
13481
|
+
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;
|
|
13482
|
+
}
|
|
13483
|
+
canvasAllocate.free(canvas);
|
|
13484
|
+
}
|
|
13485
|
+
}
|
|
13486
|
+
const pattern = context.createPattern(data, "repeat");
|
|
13487
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
|
|
13488
|
+
}
|
|
13283
13489
|
}
|
|
13284
13490
|
const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
|
|
13285
13491
|
|
|
@@ -13391,27 +13597,32 @@
|
|
|
13391
13597
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
13392
13598
|
const {
|
|
13393
13599
|
background: background,
|
|
13600
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
13601
|
+
opacity = graphicAttribute.opacity,
|
|
13394
13602
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
13395
13603
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
13396
13604
|
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
13397
13605
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
13398
13606
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
13399
|
-
backgroundOffsetY = graphicAttribute.backgroundOffsetY
|
|
13607
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
13608
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
13609
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
13400
13610
|
} = graphic.attribute;
|
|
13401
13611
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
13402
|
-
const res = graphic.resources.get(background);
|
|
13403
|
-
if ("success" !== res.state || !res.data) return;
|
|
13612
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
13613
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
13404
13614
|
context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
|
|
13405
13615
|
const b = graphic.AABBBounds;
|
|
13406
|
-
this.doDrawImage(context, res.data, b, {
|
|
13616
|
+
context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
|
|
13407
13617
|
backgroundMode: backgroundMode,
|
|
13408
13618
|
backgroundFit: backgroundFit,
|
|
13409
13619
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
13410
13620
|
backgroundScale: backgroundScale,
|
|
13411
13621
|
backgroundOffsetX: backgroundOffsetX,
|
|
13412
|
-
backgroundOffsetY: backgroundOffsetY
|
|
13622
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
13623
|
+
backgroundPosition: backgroundPosition
|
|
13413
13624
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
13414
|
-
} else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
13625
|
+
} else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
13415
13626
|
}
|
|
13416
13627
|
}
|
|
13417
13628
|
const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
|
|
@@ -14893,9 +15104,17 @@
|
|
|
14893
15104
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
14894
15105
|
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
14895
15106
|
const {
|
|
15107
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
15108
|
+
opacity = graphicAttribute.opacity,
|
|
14896
15109
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
14897
15110
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
14898
|
-
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
|
|
15111
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
15112
|
+
backgroundScale = graphicAttribute.backgroundScale,
|
|
15113
|
+
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
15114
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
15115
|
+
backgroundPosition = graphicAttribute.backgroundPosition,
|
|
15116
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
15117
|
+
backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
|
|
14899
15118
|
} = graphic.attribute;
|
|
14900
15119
|
let matrix,
|
|
14901
15120
|
{
|
|
@@ -14907,18 +15126,18 @@
|
|
|
14907
15126
|
};
|
|
14908
15127
|
let b;
|
|
14909
15128
|
"richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
|
|
14910
|
-
const
|
|
15129
|
+
const backgroundConfig = isObject$7(background) && background.background ? background : null,
|
|
14911
15130
|
onlyTranslate = graphic.transMatrix.onlyTranslate();
|
|
14912
|
-
if (
|
|
15131
|
+
if (backgroundConfig) {
|
|
14913
15132
|
const _b = graphic.AABBBounds,
|
|
14914
|
-
x = (null !== (_a =
|
|
14915
|
-
y = (null !== (_d =
|
|
14916
|
-
w = null !== (_f =
|
|
14917
|
-
h = null !== (_g =
|
|
14918
|
-
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background =
|
|
15133
|
+
x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
|
|
15134
|
+
y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
|
|
15135
|
+
w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
|
|
15136
|
+
h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
|
|
15137
|
+
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
|
|
14919
15138
|
const w = b.width(),
|
|
14920
15139
|
h = b.height();
|
|
14921
|
-
b.set((null !== (_h =
|
|
15140
|
+
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);
|
|
14922
15141
|
}
|
|
14923
15142
|
} else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
|
|
14924
15143
|
angle: 0,
|
|
@@ -14931,19 +15150,18 @@
|
|
|
14931
15150
|
})).clone());
|
|
14932
15151
|
if (graphic.backgroundImg && graphic.resources) {
|
|
14933
15152
|
const res = graphic.resources.get(background);
|
|
14934
|
-
if ("success" !== res.state || !res.data) return void restore();
|
|
14935
|
-
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.
|
|
15153
|
+
if (!res || "success" !== res.state || !res.data) return void restore();
|
|
15154
|
+
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, {
|
|
14936
15155
|
backgroundMode: backgroundMode,
|
|
14937
15156
|
backgroundFit: backgroundFit,
|
|
14938
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
15157
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
15158
|
+
backgroundScale: backgroundScale,
|
|
15159
|
+
backgroundOffsetX: backgroundOffsetX,
|
|
15160
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
15161
|
+
backgroundPosition: backgroundPosition
|
|
14939
15162
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
14940
|
-
} else
|
|
14941
|
-
|
|
14942
|
-
backgroundCornerRadius: backgroundCornerRadius
|
|
14943
|
-
} = graphic.attribute;
|
|
14944
|
-
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();
|
|
14945
|
-
}
|
|
14946
|
-
shouldReCalBounds && boundsAllocate.free(b), restore();
|
|
15163
|
+
} 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();
|
|
15164
|
+
backgroundConfig && boundsAllocate.free(b), restore();
|
|
14947
15165
|
}
|
|
14948
15166
|
}
|
|
14949
15167
|
const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
|
|
@@ -15370,6 +15588,92 @@
|
|
|
15370
15588
|
};
|
|
15371
15589
|
};
|
|
15372
15590
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
15591
|
+
function resolveImageMode({
|
|
15592
|
+
repeatX = "no-repeat",
|
|
15593
|
+
repeatY = "no-repeat",
|
|
15594
|
+
imageMode: imageMode
|
|
15595
|
+
}) {
|
|
15596
|
+
const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
|
|
15597
|
+
return {
|
|
15598
|
+
repeatMode: repeatMode,
|
|
15599
|
+
sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
|
|
15600
|
+
};
|
|
15601
|
+
}
|
|
15602
|
+
const IMAGE_MODE_TO_BACKGROUND_MODE = {
|
|
15603
|
+
cover: "no-repeat-cover",
|
|
15604
|
+
contain: "no-repeat-contain",
|
|
15605
|
+
fill: "no-repeat-fill",
|
|
15606
|
+
auto: "no-repeat-auto"
|
|
15607
|
+
};
|
|
15608
|
+
function resolveBackgroundParamsByImageSizing(sizingMode) {
|
|
15609
|
+
return {
|
|
15610
|
+
backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
|
|
15611
|
+
backgroundFit: !1,
|
|
15612
|
+
backgroundKeepAspectRatio: !1
|
|
15613
|
+
};
|
|
15614
|
+
}
|
|
15615
|
+
function resolveImageRepeatMode(repeatX, repeatY) {
|
|
15616
|
+
let repeat = 0;
|
|
15617
|
+
return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
|
|
15618
|
+
}
|
|
15619
|
+
function shouldClipImageByLayout({
|
|
15620
|
+
repeatX = "no-repeat",
|
|
15621
|
+
repeatY = "no-repeat",
|
|
15622
|
+
imageMode: imageMode,
|
|
15623
|
+
imageScale = 1,
|
|
15624
|
+
imageOffsetX = 0,
|
|
15625
|
+
imageOffsetY = 0,
|
|
15626
|
+
imagePosition = "top-left"
|
|
15627
|
+
}) {
|
|
15628
|
+
const {
|
|
15629
|
+
repeatMode: repeatMode,
|
|
15630
|
+
sizingMode: sizingMode
|
|
15631
|
+
} = resolveImageMode({
|
|
15632
|
+
repeatX: repeatX,
|
|
15633
|
+
repeatY: repeatY,
|
|
15634
|
+
imageMode: imageMode
|
|
15635
|
+
});
|
|
15636
|
+
return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
|
|
15637
|
+
}
|
|
15638
|
+
function drawImageWithLayout(context, data, x, y, width, height, {
|
|
15639
|
+
repeatX = "no-repeat",
|
|
15640
|
+
repeatY = "no-repeat",
|
|
15641
|
+
imageMode: imageMode,
|
|
15642
|
+
imageScale = 1,
|
|
15643
|
+
imageOffsetX = 0,
|
|
15644
|
+
imageOffsetY = 0,
|
|
15645
|
+
imagePosition = "top-left"
|
|
15646
|
+
}) {
|
|
15647
|
+
const {
|
|
15648
|
+
repeatMode: repeatMode,
|
|
15649
|
+
sizingMode: sizingMode
|
|
15650
|
+
} = resolveImageMode({
|
|
15651
|
+
repeatX: repeatX,
|
|
15652
|
+
repeatY: repeatY,
|
|
15653
|
+
imageMode: imageMode
|
|
15654
|
+
}),
|
|
15655
|
+
imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
|
|
15656
|
+
backgroundMode: repeatMode,
|
|
15657
|
+
backgroundFit: !1,
|
|
15658
|
+
backgroundKeepAspectRatio: !1
|
|
15659
|
+
};
|
|
15660
|
+
drawBackgroundImage(context, data, {
|
|
15661
|
+
x1: x,
|
|
15662
|
+
y1: y,
|
|
15663
|
+
x2: x + width,
|
|
15664
|
+
y2: y + height,
|
|
15665
|
+
width: () => width,
|
|
15666
|
+
height: () => height
|
|
15667
|
+
}, {
|
|
15668
|
+
backgroundMode: imageBackgroundParams.backgroundMode,
|
|
15669
|
+
backgroundFit: imageBackgroundParams.backgroundFit,
|
|
15670
|
+
backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
|
|
15671
|
+
backgroundScale: imageScale,
|
|
15672
|
+
backgroundOffsetX: imageOffsetX,
|
|
15673
|
+
backgroundOffsetY: imageOffsetY,
|
|
15674
|
+
backgroundPosition: imagePosition
|
|
15675
|
+
});
|
|
15676
|
+
}
|
|
15373
15677
|
let DefaultCanvasImageRender = class extends BaseRender {
|
|
15374
15678
|
constructor(graphicRenderContributions) {
|
|
15375
15679
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -15384,6 +15688,11 @@
|
|
|
15384
15688
|
cornerRadius = imageAttribute.cornerRadius,
|
|
15385
15689
|
fillStrokeOrder = imageAttribute.fillStrokeOrder,
|
|
15386
15690
|
cornerType = imageAttribute.cornerType,
|
|
15691
|
+
imageMode = imageAttribute.imageMode,
|
|
15692
|
+
imageScale = imageAttribute.imageScale,
|
|
15693
|
+
imageOffsetX = imageAttribute.imageOffsetX,
|
|
15694
|
+
imageOffsetY = imageAttribute.imageOffsetY,
|
|
15695
|
+
imagePosition = imageAttribute.imagePosition,
|
|
15387
15696
|
image: url
|
|
15388
15697
|
} = image.attribute,
|
|
15389
15698
|
data = this.valid(image, imageAttribute, fillCb);
|
|
@@ -15400,22 +15709,33 @@
|
|
|
15400
15709
|
const width = image.width,
|
|
15401
15710
|
height = image.height;
|
|
15402
15711
|
context.beginPath();
|
|
15403
|
-
let
|
|
15404
|
-
0 === cornerRadius || isArray$5(cornerRadius) && cornerRadius.every(num => 0 === num) ? context.rect(x, y, width, height) : (createRectPath(context, x, y, width, height, cornerRadius, "bevel" !== cornerType),
|
|
15712
|
+
let needCornerClip = !1;
|
|
15713
|
+
0 === cornerRadius || isArray$5(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);
|
|
15405
15714
|
const _runFill = () => {
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15715
|
+
doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
|
|
15716
|
+
repeatX: repeatX,
|
|
15717
|
+
repeatY: repeatY,
|
|
15718
|
+
imageMode: imageMode,
|
|
15719
|
+
imageScale: imageScale,
|
|
15720
|
+
imageOffsetX: imageOffsetX,
|
|
15721
|
+
imageOffsetY: imageOffsetY,
|
|
15722
|
+
imagePosition: imagePosition
|
|
15723
|
+
})));
|
|
15414
15724
|
},
|
|
15415
15725
|
_runStroke = () => {
|
|
15416
15726
|
doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
|
|
15417
|
-
}
|
|
15418
|
-
|
|
15727
|
+
},
|
|
15728
|
+
needLayoutClip = shouldClipImageByLayout({
|
|
15729
|
+
repeatX: repeatX,
|
|
15730
|
+
repeatY: repeatY,
|
|
15731
|
+
imageMode: imageMode,
|
|
15732
|
+
imageScale: imageScale,
|
|
15733
|
+
imageOffsetX: imageOffsetX,
|
|
15734
|
+
imageOffsetY: imageOffsetY,
|
|
15735
|
+
imagePosition: imagePosition
|
|
15736
|
+
}),
|
|
15737
|
+
needClip = needCornerClip || needLayoutClip;
|
|
15738
|
+
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);
|
|
15419
15739
|
}
|
|
15420
15740
|
draw(image, renderService, drawContext) {
|
|
15421
15741
|
const {
|
|
@@ -16269,7 +16589,7 @@
|
|
|
16269
16589
|
return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
|
|
16270
16590
|
}
|
|
16271
16591
|
clearScreen(renderService, context, drawContext) {
|
|
16272
|
-
var _a, _b, _c;
|
|
16592
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
16273
16593
|
const {
|
|
16274
16594
|
clear: clear,
|
|
16275
16595
|
viewBox: viewBox
|
|
@@ -16279,9 +16599,20 @@
|
|
|
16279
16599
|
if (clear) {
|
|
16280
16600
|
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);
|
|
16281
16601
|
const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
|
|
16282
|
-
if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
|
|
16283
|
-
const res = stage.resources.get(clear);
|
|
16284
|
-
res && "success" === res.state && res.data
|
|
16602
|
+
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) {
|
|
16603
|
+
const res = stage.resources.get(getBackgroundImage(clear));
|
|
16604
|
+
if (res && "success" === res.state && res.data) {
|
|
16605
|
+
const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
|
|
16606
|
+
drawBackgroundImage(context, res.data, backgroundBounds, {
|
|
16607
|
+
backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
|
|
16608
|
+
backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
|
|
16609
|
+
backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
|
|
16610
|
+
backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
|
|
16611
|
+
backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
|
|
16612
|
+
backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
|
|
16613
|
+
backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
|
|
16614
|
+
}), boundsAllocate.free(backgroundBounds);
|
|
16615
|
+
}
|
|
16285
16616
|
} else context.fillStyle = createColor(context, clear, {
|
|
16286
16617
|
AABBBounds: {
|
|
16287
16618
|
x1: 0,
|
|
@@ -16784,7 +17115,7 @@
|
|
|
16784
17115
|
return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
|
|
16785
17116
|
}
|
|
16786
17117
|
set background(b) {
|
|
16787
|
-
this._background = b;
|
|
17118
|
+
this._background = b, this.syncBackgroundImage(b);
|
|
16788
17119
|
}
|
|
16789
17120
|
get defaultLayer() {
|
|
16790
17121
|
return this.at(0);
|
|
@@ -16798,6 +17129,18 @@
|
|
|
16798
17129
|
set ticker(ticker) {
|
|
16799
17130
|
ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
|
|
16800
17131
|
}
|
|
17132
|
+
syncBackgroundImage(background) {
|
|
17133
|
+
var _a;
|
|
17134
|
+
const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
17135
|
+
this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
|
|
17136
|
+
}
|
|
17137
|
+
isImageBackgroundSource(source) {
|
|
17138
|
+
if (!source) return !1;
|
|
17139
|
+
if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
|
|
17140
|
+
if (!isObject$7(source)) return !1;
|
|
17141
|
+
const gradientSource = source;
|
|
17142
|
+
return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
|
|
17143
|
+
}
|
|
16801
17144
|
constructor(params = {}) {
|
|
16802
17145
|
var _a, _b;
|
|
16803
17146
|
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
@@ -16836,9 +17179,7 @@
|
|
|
16836
17179
|
main: !0
|
|
16837
17180
|
})), 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 = {
|
|
16838
17181
|
tickRenderMode: "effect"
|
|
16839
|
-
}), this.optmize(params.optimize), params.background &&
|
|
16840
|
-
background: this._background
|
|
16841
|
-
}), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|
|
17182
|
+
}), 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());
|
|
16842
17183
|
}
|
|
16843
17184
|
initAnimate(params) {
|
|
16844
17185
|
var _a;
|
|
@@ -17173,12 +17514,12 @@
|
|
|
17173
17514
|
throw new Error("暂不支持");
|
|
17174
17515
|
}
|
|
17175
17516
|
release() {
|
|
17176
|
-
var _a, _b;
|
|
17517
|
+
var _a, _b, _d;
|
|
17177
17518
|
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 => {
|
|
17178
17519
|
layer.release();
|
|
17179
17520
|
}), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
|
|
17180
17521
|
item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
|
|
17181
|
-
}), 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 = [];
|
|
17522
|
+
}), 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 = [];
|
|
17182
17523
|
}
|
|
17183
17524
|
setStage(stage) {}
|
|
17184
17525
|
dirty(b, matrix) {
|
|
@@ -21404,7 +21745,7 @@
|
|
|
21404
21745
|
this._sliderRenderBounds = null, this._sliderLimitRange = null;
|
|
21405
21746
|
}
|
|
21406
21747
|
release(all) {
|
|
21407
|
-
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).
|
|
21748
|
+
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
|
|
21408
21749
|
passive: !1
|
|
21409
21750
|
}), this._clearDragEvents();
|
|
21410
21751
|
}
|
|
@@ -22987,17 +23328,21 @@
|
|
|
22987
23328
|
} = this.attribute.label;
|
|
22988
23329
|
textStyle = isFunction$3(textStyle) ? merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer)) : textStyle;
|
|
22989
23330
|
const labelAlign = this.getLabelAlign(vector, inside, textStyle.angle);
|
|
22990
|
-
|
|
23331
|
+
textStyle = merge(labelAlign, textStyle), isFunction$3(textStyle.text) && (textStyle.text = textStyle.text({
|
|
22991
23332
|
label: tickDatum.label,
|
|
22992
23333
|
value: tickDatum.rawValue,
|
|
22993
23334
|
index: tickDatum.index,
|
|
22994
23335
|
layer: layer
|
|
22995
|
-
}))
|
|
23336
|
+
}));
|
|
23337
|
+
let reactStyle = textStyle.react;
|
|
23338
|
+
return isFunction$3(reactStyle) && (reactStyle = reactStyle(tickDatum, index, tickData, layer)), Object.assign(Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
|
|
22996
23339
|
text: null != text ? text : textContent,
|
|
22997
23340
|
_originText: tickDatum.label,
|
|
22998
23341
|
lineHeight: null == textStyle ? void 0 : textStyle.fontSize,
|
|
22999
23342
|
type: type
|
|
23000
|
-
}), textStyle)
|
|
23343
|
+
}), textStyle), {
|
|
23344
|
+
react: reactStyle
|
|
23345
|
+
});
|
|
23001
23346
|
}
|
|
23002
23347
|
getLabelPosition(point, vector, text, style) {
|
|
23003
23348
|
return point;
|
|
@@ -24026,6 +24371,8 @@
|
|
|
24026
24371
|
this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
|
|
24027
24372
|
timeline.tick(delta);
|
|
24028
24373
|
}), this.emit("tick", delta));
|
|
24374
|
+
}, this._handleGraphTick = () => {
|
|
24375
|
+
this.initHandler(!1);
|
|
24029
24376
|
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
|
|
24030
24377
|
}
|
|
24031
24378
|
bindStage(stage) {
|
|
@@ -24035,9 +24382,7 @@
|
|
|
24035
24382
|
this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
|
|
24036
24383
|
}
|
|
24037
24384
|
init() {
|
|
24038
|
-
this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker",
|
|
24039
|
-
this.initHandler(!1);
|
|
24040
|
-
}), application.global.env && this.initHandler(!1);
|
|
24385
|
+
this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", this._handleGraphTick), application.global.env && this.initHandler(!1);
|
|
24041
24386
|
}
|
|
24042
24387
|
addTimeline(timeline) {
|
|
24043
24388
|
this.timelines.push(timeline);
|
|
@@ -24110,7 +24455,7 @@
|
|
|
24110
24455
|
}
|
|
24111
24456
|
release() {
|
|
24112
24457
|
var _a;
|
|
24113
|
-
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
|
|
24458
|
+
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);
|
|
24114
24459
|
}
|
|
24115
24460
|
checkSkip(delta) {
|
|
24116
24461
|
var _a, _b, _c;
|
|
@@ -24224,6 +24569,7 @@
|
|
|
24224
24569
|
if (custom.prototype.constructor === custom) {
|
|
24225
24570
|
const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
|
|
24226
24571
|
if (descriptor && !descriptor.writable) return 1;
|
|
24572
|
+
if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
|
|
24227
24573
|
}
|
|
24228
24574
|
return 2;
|
|
24229
24575
|
}
|
|
@@ -24370,7 +24716,7 @@
|
|
|
24370
24716
|
let parsedFromProps = null,
|
|
24371
24717
|
props = params.to,
|
|
24372
24718
|
from = params.from;
|
|
24373
|
-
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);
|
|
24719
|
+
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);
|
|
24374
24720
|
let totalDelay = 0;
|
|
24375
24721
|
oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
|
|
24376
24722
|
const delayAfterValue = isFunction$3(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
|
|
@@ -24433,7 +24779,7 @@
|
|
|
24433
24779
|
let parsedFromProps = null,
|
|
24434
24780
|
props = effect.to,
|
|
24435
24781
|
from = effect.from;
|
|
24436
|
-
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
|
|
24782
|
+
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);
|
|
24437
24783
|
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
24438
24784
|
customType = effect.custom ? effect.customType : getCustomType(custom);
|
|
24439
24785
|
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
@@ -24452,22 +24798,31 @@
|
|
|
24452
24798
|
animate.play(customAnimate);
|
|
24453
24799
|
}
|
|
24454
24800
|
createPropsFromChannel(channel, graphic) {
|
|
24801
|
+
var _a;
|
|
24455
24802
|
const props = {};
|
|
24456
24803
|
let from = null;
|
|
24457
|
-
|
|
24458
|
-
|
|
24459
|
-
|
|
24460
|
-
|
|
24461
|
-
}
|
|
24804
|
+
if (!channel) return {
|
|
24805
|
+
from: from,
|
|
24806
|
+
props: props,
|
|
24807
|
+
attrOutChannel: null
|
|
24808
|
+
};
|
|
24809
|
+
const attrOutChannel = {};
|
|
24810
|
+
let hasAttrs = !1;
|
|
24811
|
+
const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
|
|
24812
|
+
if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
|
|
24813
|
+
to: diffAttrs[key]
|
|
24814
|
+
}), res), {})), Object.keys(channel).forEach(key => {
|
|
24462
24815
|
var _a, _b, _c, _d;
|
|
24463
24816
|
const config = channel[key];
|
|
24464
24817
|
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);
|
|
24465
|
-
}), {
|
|
24466
|
-
|
|
24467
|
-
props
|
|
24468
|
-
}
|
|
24818
|
+
}), diffAttrs) for (const key in diffAttrs) {
|
|
24819
|
+
const value = diffAttrs[key];
|
|
24820
|
+
void 0 !== value && (props.hasOwnProperty(key) || (attrOutChannel[key] = value, hasAttrs = !0));
|
|
24821
|
+
}
|
|
24822
|
+
return {
|
|
24469
24823
|
from: from,
|
|
24470
|
-
props: props
|
|
24824
|
+
props: props,
|
|
24825
|
+
attrOutChannel: hasAttrs ? attrOutChannel : null
|
|
24471
24826
|
};
|
|
24472
24827
|
}
|
|
24473
24828
|
resolveValue(value, graphic, defaultValue) {
|
|
@@ -32374,7 +32729,31 @@
|
|
|
32374
32729
|
return graphicCreator.symbol(style);
|
|
32375
32730
|
}
|
|
32376
32731
|
_renderHandlerText(value, position) {
|
|
32377
|
-
|
|
32732
|
+
return graphicCreator.text(this._getHandlerTextAttributes(value, position));
|
|
32733
|
+
}
|
|
32734
|
+
_getHandlerPosition(isStart) {
|
|
32735
|
+
return this.attribute.range && isStart ? "start" : "end";
|
|
32736
|
+
}
|
|
32737
|
+
_getHandlerTextStyle(value, position) {
|
|
32738
|
+
const {
|
|
32739
|
+
align: align,
|
|
32740
|
+
handlerSize = 14,
|
|
32741
|
+
handlerText = {},
|
|
32742
|
+
railHeight: railHeight,
|
|
32743
|
+
railWidth: railWidth,
|
|
32744
|
+
slidable: slidable
|
|
32745
|
+
} = this.attribute;
|
|
32746
|
+
return isFunction$3(handlerText.style) ? handlerText.style(value, position, {
|
|
32747
|
+
layout: this.attribute.layout,
|
|
32748
|
+
align: align,
|
|
32749
|
+
railWidth: railWidth,
|
|
32750
|
+
railHeight: railHeight,
|
|
32751
|
+
handlerSize: handlerSize,
|
|
32752
|
+
slidable: slidable
|
|
32753
|
+
}) : handlerText.style;
|
|
32754
|
+
}
|
|
32755
|
+
_getHandlerTextAttributes(value, position) {
|
|
32756
|
+
var _a, _b;
|
|
32378
32757
|
const {
|
|
32379
32758
|
align: align,
|
|
32380
32759
|
handlerSize = 14,
|
|
@@ -32386,13 +32765,13 @@
|
|
|
32386
32765
|
isHorizontal = this._isHorizontal,
|
|
32387
32766
|
pos = this.calculatePosByValue(value, position),
|
|
32388
32767
|
textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
|
|
32768
|
+
handlerTextStyle = this._getHandlerTextStyle(value, position),
|
|
32389
32769
|
textStyle = {
|
|
32390
32770
|
text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
|
|
32391
|
-
lineHeight: null
|
|
32771
|
+
lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
|
|
32392
32772
|
cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
|
|
32393
32773
|
};
|
|
32394
|
-
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);
|
|
32395
|
-
return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
|
|
32774
|
+
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);
|
|
32396
32775
|
}
|
|
32397
32776
|
_renderTooltip() {
|
|
32398
32777
|
var _a;
|
|
@@ -32520,31 +32899,19 @@
|
|
|
32520
32899
|
}
|
|
32521
32900
|
}
|
|
32522
32901
|
_updateHandler(handler, position, value) {
|
|
32523
|
-
var _a;
|
|
32524
32902
|
const isHorizontal = this._isHorizontal;
|
|
32525
32903
|
handler.setAttribute(isHorizontal ? "x" : "y", position);
|
|
32526
32904
|
const updateHandlerText = handler.name === SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
|
|
32527
32905
|
if (updateHandlerText) {
|
|
32528
|
-
const
|
|
32529
|
-
|
|
32530
|
-
} = this.attribute;
|
|
32531
|
-
updateHandlerText.setAttributes({
|
|
32532
|
-
text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
|
|
32533
|
-
[isHorizontal ? "x" : "y"]: position
|
|
32534
|
-
});
|
|
32906
|
+
const handlerPosition = this._getHandlerPosition(handler.name === SLIDER_ELEMENT_NAME.startHandler);
|
|
32907
|
+
updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
|
|
32535
32908
|
}
|
|
32536
32909
|
handler.name === SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
|
|
32537
32910
|
}
|
|
32538
32911
|
_updateHandlerText(handlerText, position, value) {
|
|
32539
|
-
var _a;
|
|
32540
32912
|
const isHorizontal = this._isHorizontal,
|
|
32541
|
-
|
|
32542
|
-
|
|
32543
|
-
} = this.attribute;
|
|
32544
|
-
handlerText.setAttributes({
|
|
32545
|
-
[isHorizontal ? "x" : "y"]: position,
|
|
32546
|
-
text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
|
|
32547
|
-
});
|
|
32913
|
+
handlerPosition = this._getHandlerPosition(handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText);
|
|
32914
|
+
handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
|
|
32548
32915
|
const updateHandler = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
|
|
32549
32916
|
updateHandler && updateHandler.setAttributes({
|
|
32550
32917
|
[isHorizontal ? "x" : "y"]: position
|
|
@@ -32580,7 +32947,7 @@
|
|
|
32580
32947
|
};
|
|
32581
32948
|
}
|
|
32582
32949
|
release(all) {
|
|
32583
|
-
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).
|
|
32950
|
+
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
|
|
32584
32951
|
passive: !1
|
|
32585
32952
|
}), this._clearAllDragEvents();
|
|
32586
32953
|
}
|
|
@@ -56238,11 +56605,11 @@
|
|
|
56238
56605
|
onUpdate(end, ratio, out) {
|
|
56239
56606
|
if (this.from.x !== this.to.x) {
|
|
56240
56607
|
const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
|
|
56241
|
-
this.params.table.scrollLeft = x;
|
|
56608
|
+
this.params.table.scrollLeft = x, 1 === ratio && -1 !== this.to.targetCol && this.params.table.scrollToCol(this.to.targetCol, !1);
|
|
56242
56609
|
}
|
|
56243
56610
|
if (this.from.y !== this.to.y) {
|
|
56244
56611
|
const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
|
|
56245
|
-
this.params.table.scrollTop = y;
|
|
56612
|
+
this.params.table.scrollTop = y, 1 === ratio && -1 !== this.to.targetRow && this.params.table.scrollToRow(this.to.targetRow, !1);
|
|
56246
56613
|
}
|
|
56247
56614
|
}
|
|
56248
56615
|
}
|
|
@@ -56274,7 +56641,9 @@
|
|
|
56274
56641
|
colDecimal && (left += colDecimal * cellRect.width), rowDecimal && (top += rowDecimal * cellRect.height);
|
|
56275
56642
|
const to = {
|
|
56276
56643
|
x: isNumber$2(col) ? left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
|
|
56277
|
-
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop
|
|
56644
|
+
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop,
|
|
56645
|
+
targetCol: null != col ? col : -1,
|
|
56646
|
+
targetRow: null != row ? row : -1
|
|
56278
56647
|
},
|
|
56279
56648
|
duration = isBoolean$2(animationOption) ? animationOption ? 3e3 : 0 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3,
|
|
56280
56649
|
easing = isBoolean$2(animationOption) ? animationOption ? "linear" : "" : null !== (_b = null == animationOption ? void 0 : animationOption.easing) && void 0 !== _b ? _b : "linear";
|
|
@@ -56361,7 +56730,7 @@
|
|
|
56361
56730
|
}
|
|
56362
56731
|
constructor(container, options = {}) {
|
|
56363
56732
|
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;
|
|
56364
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.22.13-alpha.
|
|
56733
|
+
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.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");
|
|
56365
56734
|
this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
56366
56735
|
options: options,
|
|
56367
56736
|
container: container
|
|
@@ -57290,17 +57659,18 @@
|
|
|
57290
57659
|
this.release();
|
|
57291
57660
|
}
|
|
57292
57661
|
release() {
|
|
57293
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
57662
|
+
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;
|
|
57663
|
+
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();
|
|
57294
57664
|
const internalProps = this.internalProps;
|
|
57295
57665
|
if (this.isReleased) return;
|
|
57296
|
-
null === (
|
|
57666
|
+
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 => {
|
|
57297
57667
|
null == legend || legend.release();
|
|
57298
|
-
}), null === (
|
|
57668
|
+
}), 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 => {
|
|
57299
57669
|
var _a;
|
|
57300
57670
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
57301
57671
|
}), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
57302
|
-
const parentElement = null === (
|
|
57303
|
-
parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), null === (
|
|
57672
|
+
const parentElement = null === (_x = internalProps.element) || void 0 === _x ? void 0 : _x.parentElement;
|
|
57673
|
+
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();
|
|
57304
57674
|
}
|
|
57305
57675
|
fireListeners(type, event) {
|
|
57306
57676
|
return super.fireListeners(type, event);
|
|
@@ -58469,6 +58839,7 @@
|
|
|
58469
58839
|
});
|
|
58470
58840
|
}
|
|
58471
58841
|
scrollToCell(cellAddr, animationOption) {
|
|
58842
|
+
var _a;
|
|
58472
58843
|
if (animationOption) return void this.animationManager.scrollTo(cellAddr, animationOption);
|
|
58473
58844
|
const drawRange = this.getDrawRange();
|
|
58474
58845
|
if (isValid$1(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
|
|
@@ -58478,8 +58849,10 @@
|
|
|
58478
58849
|
}
|
|
58479
58850
|
if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
|
|
58480
58851
|
const frozenHeight = this.getFrozenRowsHeight(),
|
|
58481
|
-
|
|
58482
|
-
|
|
58852
|
+
rowInt = Math.floor(cellAddr.row),
|
|
58853
|
+
rowFloat = cellAddr.row - rowInt;
|
|
58854
|
+
let top = this.internalProps._rowHeightsMap.getSumInRange(0, rowInt - 1);
|
|
58855
|
+
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);
|
|
58483
58856
|
}
|
|
58484
58857
|
this.render();
|
|
58485
58858
|
}
|