@visactor/vtable-gantt 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/dist/vtable-gantt.js +624 -221
- package/dist/vtable-gantt.min.js +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +5 -5
package/dist/vtable-gantt.js
CHANGED
|
@@ -685,28 +685,59 @@
|
|
|
685
685
|
}
|
|
686
686
|
addEventListener(type, listener, options) {
|
|
687
687
|
if (!listener) return;
|
|
688
|
+
const capture = this._resolveCapture(options),
|
|
689
|
+
once = this._resolveOnce(options),
|
|
690
|
+
listenerTypeMap = this._getOrCreateListenerTypeMap(type),
|
|
691
|
+
wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
|
|
692
|
+
if (wrappedMap.has(capture)) return;
|
|
688
693
|
const wrappedListener = event => {
|
|
689
694
|
const transformedEvent = this._eventListenerTransformer(event);
|
|
690
|
-
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
|
|
695
|
+
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
|
|
691
696
|
};
|
|
692
|
-
|
|
697
|
+
wrappedMap.set(capture, {
|
|
698
|
+
wrappedListener: wrappedListener,
|
|
699
|
+
options: options
|
|
700
|
+
}), this._nativeAddEventListener(type, wrappedListener, options);
|
|
693
701
|
}
|
|
694
702
|
removeEventListener(type, listener, options) {
|
|
695
|
-
var _a;
|
|
703
|
+
var _a, _b;
|
|
696
704
|
if (!listener) return;
|
|
697
|
-
const
|
|
698
|
-
|
|
705
|
+
const capture = this._resolveCapture(options),
|
|
706
|
+
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);
|
|
707
|
+
wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
|
|
699
708
|
}
|
|
700
709
|
dispatchEvent(event) {
|
|
701
710
|
return this._nativeDispatchEvent(event);
|
|
702
711
|
}
|
|
703
712
|
clearAllEventListeners() {
|
|
704
|
-
this._listenerMap.forEach((
|
|
705
|
-
|
|
706
|
-
|
|
713
|
+
this._listenerMap.forEach((listenerMap, type) => {
|
|
714
|
+
listenerMap.forEach(wrappedMap => {
|
|
715
|
+
wrappedMap.forEach((wrappedRecord, capture) => {
|
|
716
|
+
this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
|
|
717
|
+
});
|
|
707
718
|
});
|
|
708
719
|
}), this._listenerMap.clear();
|
|
709
720
|
}
|
|
721
|
+
_resolveCapture(options) {
|
|
722
|
+
return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
|
|
723
|
+
}
|
|
724
|
+
_resolveOnce(options) {
|
|
725
|
+
return "object" == typeof options && !!(null == options ? void 0 : options.once);
|
|
726
|
+
}
|
|
727
|
+
_getOrCreateListenerTypeMap(type) {
|
|
728
|
+
let listenerTypeMap = this._listenerMap.get(type);
|
|
729
|
+
return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
|
|
730
|
+
}
|
|
731
|
+
_getOrCreateWrappedMap(listenerTypeMap, listener) {
|
|
732
|
+
let wrappedMap = listenerTypeMap.get(listener);
|
|
733
|
+
return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
|
|
734
|
+
}
|
|
735
|
+
_deleteListenerRecord(type, listener, capture) {
|
|
736
|
+
const listenerTypeMap = this._listenerMap.get(type);
|
|
737
|
+
if (!listenerTypeMap) return;
|
|
738
|
+
const wrappedMap = listenerTypeMap.get(listener);
|
|
739
|
+
wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
|
|
740
|
+
}
|
|
710
741
|
_nativeAddEventListener(type, listener, options) {
|
|
711
742
|
throw new Error("_nativeAddEventListener must be implemented by derived classes");
|
|
712
743
|
}
|
|
@@ -4602,6 +4633,7 @@
|
|
|
4602
4633
|
backgroundScale: 1,
|
|
4603
4634
|
backgroundOffsetX: 0,
|
|
4604
4635
|
backgroundOffsetY: 0,
|
|
4636
|
+
backgroundPosition: "top-left",
|
|
4605
4637
|
blur: 0,
|
|
4606
4638
|
filter: "",
|
|
4607
4639
|
cursor: null,
|
|
@@ -4774,11 +4806,16 @@
|
|
|
4774
4806
|
const DefaultImageAttribute = Object.assign(Object.assign({
|
|
4775
4807
|
repeatX: "no-repeat",
|
|
4776
4808
|
repeatY: "no-repeat",
|
|
4809
|
+
imageMode: void 0,
|
|
4777
4810
|
image: "",
|
|
4778
4811
|
width: 0,
|
|
4779
4812
|
height: 0,
|
|
4780
4813
|
maxWidth: 500,
|
|
4781
|
-
maxHeight: 500
|
|
4814
|
+
maxHeight: 500,
|
|
4815
|
+
imagePosition: "top-left",
|
|
4816
|
+
imageScale: 1,
|
|
4817
|
+
imageOffsetX: 0,
|
|
4818
|
+
imageOffsetY: 0
|
|
4782
4819
|
}, DefaultAttribute), {
|
|
4783
4820
|
fill: !0,
|
|
4784
4821
|
cornerRadius: 0,
|
|
@@ -7220,7 +7257,9 @@
|
|
|
7220
7257
|
var _a;
|
|
7221
7258
|
if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
|
|
7222
7259
|
const constructor = event.constructor;
|
|
7223
|
-
this.eventPool.has(constructor) || this.eventPool.
|
|
7260
|
+
this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
|
|
7261
|
+
e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
|
|
7262
|
+
}), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
|
|
7224
7263
|
}
|
|
7225
7264
|
notifyListeners(e, type) {
|
|
7226
7265
|
const listeners = e.currentTarget._events[type];
|
|
@@ -9177,6 +9216,7 @@
|
|
|
9177
9216
|
const tempConstantXYKey = ["x", "y"],
|
|
9178
9217
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
9179
9218
|
tempConstantAngleKey = ["angle"],
|
|
9219
|
+
builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
|
|
9180
9220
|
point = new Point();
|
|
9181
9221
|
const NOWORK_ANIMATE_ATTR = {
|
|
9182
9222
|
strokeSeg: 1,
|
|
@@ -9233,7 +9273,7 @@
|
|
|
9233
9273
|
}
|
|
9234
9274
|
constructor(params = {}) {
|
|
9235
9275
|
var _a;
|
|
9236
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background
|
|
9276
|
+
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);
|
|
9237
9277
|
}
|
|
9238
9278
|
getGraphicService() {
|
|
9239
9279
|
var _a, _b;
|
|
@@ -9422,7 +9462,7 @@
|
|
|
9422
9462
|
});
|
|
9423
9463
|
}
|
|
9424
9464
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
9425
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background
|
|
9465
|
+
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));
|
|
9426
9466
|
}
|
|
9427
9467
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
9428
9468
|
const keys = Object.keys(params);
|
|
@@ -9437,7 +9477,7 @@
|
|
|
9437
9477
|
const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
|
|
9438
9478
|
[key]: value
|
|
9439
9479
|
}, this.attribute, key, context);
|
|
9440
|
-
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);
|
|
9480
|
+
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);
|
|
9441
9481
|
}
|
|
9442
9482
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
9443
9483
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -9456,7 +9496,7 @@
|
|
|
9456
9496
|
const context = {
|
|
9457
9497
|
type: AttributeUpdateType.INIT
|
|
9458
9498
|
};
|
|
9459
|
-
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, params.background
|
|
9499
|
+
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);
|
|
9460
9500
|
}
|
|
9461
9501
|
translate(x, y) {
|
|
9462
9502
|
var _a, _b;
|
|
@@ -9789,7 +9829,8 @@
|
|
|
9789
9829
|
return isString$2(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
|
|
9790
9830
|
}
|
|
9791
9831
|
loadImage(image, background = !1) {
|
|
9792
|
-
if (
|
|
9832
|
+
if (background && (null == image ? void 0 : image.background) && (image = image.background), background && (!image || backgroundNotImage(image))) return void (this.backgroundImg = !1);
|
|
9833
|
+
if (!image) return;
|
|
9793
9834
|
const url = image;
|
|
9794
9835
|
this.resources || (this.resources = new Map());
|
|
9795
9836
|
const cache = {
|
|
@@ -9824,7 +9865,7 @@
|
|
|
9824
9865
|
});
|
|
9825
9866
|
}
|
|
9826
9867
|
release() {
|
|
9827
|
-
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
|
|
9868
|
+
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
|
|
9828
9869
|
}
|
|
9829
9870
|
_emitCustomEvent(type, context) {
|
|
9830
9871
|
var _a, _b;
|
|
@@ -9844,7 +9885,10 @@
|
|
|
9844
9885
|
}
|
|
9845
9886
|
}
|
|
9846
9887
|
function backgroundNotImage(image) {
|
|
9847
|
-
return !(!image.fill && !image.stroke);
|
|
9888
|
+
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));
|
|
9889
|
+
}
|
|
9890
|
+
function isExternalTexture(texture) {
|
|
9891
|
+
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$8(texture));
|
|
9848
9892
|
}
|
|
9849
9893
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget$3);
|
|
9850
9894
|
|
|
@@ -11938,7 +11982,7 @@
|
|
|
11938
11982
|
return [new Paragraph(text1, paragraph.newLine, paragraph.character, paragraph.ascentDescentMode), new Paragraph(text2, !0, paragraph.character, paragraph.ascentDescentMode)];
|
|
11939
11983
|
}
|
|
11940
11984
|
|
|
11941
|
-
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
11985
|
+
const IMAGE_UPDATE_TAG_KEY = ["width", "height", "image", "imageMode", "imagePosition", "imageScale", "imageOffsetX", "imageOffsetY", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
11942
11986
|
let Image$2 = class Image extends Graphic {
|
|
11943
11987
|
constructor(params) {
|
|
11944
11988
|
super(params), this.type = "image", this.numberType = IMAGE_NUMBER_TYPE, this.loadImage(this.attribute.image);
|
|
@@ -12043,6 +12087,7 @@
|
|
|
12043
12087
|
};
|
|
12044
12088
|
Image$2.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
12045
12089
|
image: 1,
|
|
12090
|
+
imageMode: 1,
|
|
12046
12091
|
repeatX: 1,
|
|
12047
12092
|
repeatY: 1
|
|
12048
12093
|
}, NOWORK_ANIMATE_ATTR);
|
|
@@ -13117,11 +13162,12 @@
|
|
|
13117
13162
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
13118
13163
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
13119
13164
|
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
13120
|
-
backgroundClip = graphicAttribute.backgroundClip
|
|
13165
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
13166
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
13121
13167
|
} = graphic.attribute;
|
|
13122
13168
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
13123
|
-
const res = graphic.resources.get(background);
|
|
13124
|
-
if ("success" !== res.state || !res.data) return;
|
|
13169
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
13170
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
13125
13171
|
if (context.save(), graphic.parent && !graphic.transMatrix.onlyTranslate()) {
|
|
13126
13172
|
const groupAttribute = getTheme(graphic.parent).group,
|
|
13127
13173
|
{
|
|
@@ -13138,59 +13184,160 @@
|
|
|
13138
13184
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
13139
13185
|
backgroundScale: backgroundScale,
|
|
13140
13186
|
backgroundOffsetX: backgroundOffsetX,
|
|
13141
|
-
backgroundOffsetY: backgroundOffsetY
|
|
13187
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
13188
|
+
backgroundPosition: backgroundPosition
|
|
13142
13189
|
}), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
|
|
13143
13190
|
} else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
13144
13191
|
}
|
|
13145
13192
|
doDrawImage(context, data, b, params) {
|
|
13146
|
-
|
|
13147
|
-
backgroundMode: backgroundMode,
|
|
13148
|
-
backgroundFit: backgroundFit,
|
|
13149
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
13150
|
-
backgroundScale = 1,
|
|
13151
|
-
backgroundOffsetX = 0,
|
|
13152
|
-
backgroundOffsetY = 0
|
|
13153
|
-
} = params,
|
|
13154
|
-
targetW = b.width(),
|
|
13155
|
-
targetH = b.height();
|
|
13156
|
-
let w = targetW,
|
|
13157
|
-
h = targetH;
|
|
13158
|
-
if ("no-repeat" === backgroundMode) {
|
|
13159
|
-
if (backgroundFit) {
|
|
13160
|
-
if (backgroundKeepAspectRatio) {
|
|
13161
|
-
const maxScale = Math.max(targetW / data.width, targetH / data.height);
|
|
13162
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, data.width * maxScale * backgroundScale, data.height * maxScale * backgroundScale);
|
|
13163
|
-
} else context.drawImage(data, b.x1, b.y1, b.width(), b.height());
|
|
13164
|
-
} else {
|
|
13165
|
-
const resW = data.width * backgroundScale,
|
|
13166
|
-
resH = data.height * backgroundScale;
|
|
13167
|
-
context.drawImage(data, b.x1 + backgroundOffsetX, b.y1 + backgroundOffsetY, resW, resH);
|
|
13168
|
-
}
|
|
13169
|
-
} else {
|
|
13170
|
-
if (backgroundFit && "repeat" !== backgroundMode && (data.width || data.height)) {
|
|
13171
|
-
const resW = data.width,
|
|
13172
|
-
resH = data.height;
|
|
13173
|
-
if ("repeat-x" === backgroundMode) {
|
|
13174
|
-
w = resW * (targetH / resH), h = targetH;
|
|
13175
|
-
} else if ("repeat-y" === backgroundMode) {
|
|
13176
|
-
h = resH * (targetW / resW), w = targetW;
|
|
13177
|
-
}
|
|
13178
|
-
const dpr = context.dpr,
|
|
13179
|
-
canvas = canvasAllocate.allocate({
|
|
13180
|
-
width: w,
|
|
13181
|
-
height: h,
|
|
13182
|
-
dpr: dpr
|
|
13183
|
-
}),
|
|
13184
|
-
ctx = canvas.getContext("2d");
|
|
13185
|
-
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);
|
|
13186
|
-
}
|
|
13187
|
-
const dpr = context.dpr,
|
|
13188
|
-
pattern = context.createPattern(data, backgroundMode);
|
|
13189
|
-
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);
|
|
13190
|
-
}
|
|
13193
|
+
drawBackgroundImage(context, data, b, params);
|
|
13191
13194
|
}
|
|
13192
13195
|
}
|
|
13193
13196
|
const defaultBaseBackgroundRenderContribution = new DefaultBaseBackgroundRenderContribution();
|
|
13197
|
+
const verticalPositionKeywords = new Set(["top", "center", "bottom"]);
|
|
13198
|
+
function getBackgroundImage(background) {
|
|
13199
|
+
var _a;
|
|
13200
|
+
return null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
13201
|
+
}
|
|
13202
|
+
function resolveBackgroundSizing({
|
|
13203
|
+
backgroundFit: backgroundFit,
|
|
13204
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
13205
|
+
}) {
|
|
13206
|
+
return backgroundFit ? backgroundKeepAspectRatio ? "cover" : "fill" : "auto";
|
|
13207
|
+
}
|
|
13208
|
+
const NO_REPEAT_SIZING_MAP = {
|
|
13209
|
+
"no-repeat-cover": "cover",
|
|
13210
|
+
"no-repeat-contain": "contain",
|
|
13211
|
+
"no-repeat-fill": "fill",
|
|
13212
|
+
"no-repeat-auto": "auto"
|
|
13213
|
+
};
|
|
13214
|
+
function resolveBackgroundDrawMode({
|
|
13215
|
+
backgroundMode: backgroundMode,
|
|
13216
|
+
backgroundFit: backgroundFit,
|
|
13217
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
13218
|
+
}) {
|
|
13219
|
+
const sizing = NO_REPEAT_SIZING_MAP[backgroundMode];
|
|
13220
|
+
return sizing ? {
|
|
13221
|
+
backgroundRepeatMode: "no-repeat",
|
|
13222
|
+
backgroundSizing: sizing
|
|
13223
|
+
} : {
|
|
13224
|
+
backgroundRepeatMode: backgroundMode,
|
|
13225
|
+
backgroundSizing: resolveBackgroundSizing({
|
|
13226
|
+
backgroundFit: backgroundFit,
|
|
13227
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
13228
|
+
})
|
|
13229
|
+
};
|
|
13230
|
+
}
|
|
13231
|
+
function isPercentageValue(value) {
|
|
13232
|
+
return /^-?\d+(\.\d+)?%$/.test(value);
|
|
13233
|
+
}
|
|
13234
|
+
function parsePositionToken(value, remainSpace, startKeyword, centerKeyword, endKeyword) {
|
|
13235
|
+
if ("number" == typeof value && Number.isFinite(value)) return value;
|
|
13236
|
+
const normalizedValue = `${null != value ? value : ""}`.trim().toLowerCase();
|
|
13237
|
+
if (!normalizedValue || normalizedValue === startKeyword) return 0;
|
|
13238
|
+
if (normalizedValue === centerKeyword) return remainSpace / 2;
|
|
13239
|
+
if (normalizedValue === endKeyword) return remainSpace;
|
|
13240
|
+
if (isPercentageValue(normalizedValue)) return remainSpace * parseFloat(normalizedValue) / 100;
|
|
13241
|
+
const parsedValue = Number(normalizedValue);
|
|
13242
|
+
return Number.isFinite(parsedValue) ? parsedValue : 0;
|
|
13243
|
+
}
|
|
13244
|
+
function normalizeBackgroundPosition(position) {
|
|
13245
|
+
var _a, _b;
|
|
13246
|
+
if (Array.isArray(position)) return [null !== (_a = position[0]) && void 0 !== _a ? _a : "left", null !== (_b = position[1]) && void 0 !== _b ? _b : "top"];
|
|
13247
|
+
const tokens = `${null != position ? position : "top-left"}`.trim().toLowerCase().replace(/-/g, " ").split(/\s+/).filter(Boolean);
|
|
13248
|
+
if (0 === tokens.length) return ["left", "top"];
|
|
13249
|
+
if (1 === tokens.length) {
|
|
13250
|
+
const token = tokens[0];
|
|
13251
|
+
return "center" === token ? ["center", "center"] : verticalPositionKeywords.has(token) ? ["center", token] : [token, "center"];
|
|
13252
|
+
}
|
|
13253
|
+
let horizontal, vertical;
|
|
13254
|
+
const genericTokens = [];
|
|
13255
|
+
for (let i = 0; i < 2; i++) {
|
|
13256
|
+
const token = tokens[i];
|
|
13257
|
+
"left" !== token && "right" !== token ? "top" !== token && "bottom" !== token ? genericTokens.push(token) : vertical = token : horizontal = token;
|
|
13258
|
+
}
|
|
13259
|
+
return null == horizontal && genericTokens.length && (horizontal = genericTokens.shift()), null == vertical && genericTokens.length && (vertical = genericTokens.shift()), [null != horizontal ? horizontal : "left", null != vertical ? vertical : "top"];
|
|
13260
|
+
}
|
|
13261
|
+
function resolveBackgroundPosition(position, remainWidth, remainHeight) {
|
|
13262
|
+
const [horizontalPosition, verticalPosition] = normalizeBackgroundPosition(position);
|
|
13263
|
+
return {
|
|
13264
|
+
x: parsePositionToken(horizontalPosition, remainWidth, "left", "center", "right"),
|
|
13265
|
+
y: parsePositionToken(verticalPosition, remainHeight, "top", "center", "bottom")
|
|
13266
|
+
};
|
|
13267
|
+
}
|
|
13268
|
+
function pickRenderableDimension(...values) {
|
|
13269
|
+
for (const value of values) if ("number" == typeof value && Number.isFinite(value) && value > 0) return value;
|
|
13270
|
+
return null;
|
|
13271
|
+
}
|
|
13272
|
+
function resolveRenderableImageSize(data) {
|
|
13273
|
+
if (!data) return null;
|
|
13274
|
+
const width = pickRenderableDimension(data.naturalWidth, data.videoWidth, data.width),
|
|
13275
|
+
height = pickRenderableDimension(data.naturalHeight, data.videoHeight, data.height);
|
|
13276
|
+
return null == width || null == height ? null : {
|
|
13277
|
+
width: width,
|
|
13278
|
+
height: height
|
|
13279
|
+
};
|
|
13280
|
+
}
|
|
13281
|
+
function drawBackgroundImage(context, data, b, params) {
|
|
13282
|
+
var _a, _b;
|
|
13283
|
+
const {
|
|
13284
|
+
backgroundMode: backgroundMode,
|
|
13285
|
+
backgroundFit: backgroundFit,
|
|
13286
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
13287
|
+
backgroundScale = 1,
|
|
13288
|
+
backgroundOffsetX = 0,
|
|
13289
|
+
backgroundOffsetY = 0,
|
|
13290
|
+
backgroundPosition = "top-left"
|
|
13291
|
+
} = params,
|
|
13292
|
+
targetW = b.width(),
|
|
13293
|
+
targetH = b.height(),
|
|
13294
|
+
sourceSize = resolveRenderableImageSize(data),
|
|
13295
|
+
{
|
|
13296
|
+
backgroundRepeatMode: backgroundRepeatMode,
|
|
13297
|
+
backgroundSizing: resolvedBackgroundSizing
|
|
13298
|
+
} = resolveBackgroundDrawMode({
|
|
13299
|
+
backgroundMode: backgroundMode,
|
|
13300
|
+
backgroundFit: backgroundFit,
|
|
13301
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
13302
|
+
});
|
|
13303
|
+
let w = targetW,
|
|
13304
|
+
h = targetH;
|
|
13305
|
+
if (targetW <= 0 || targetH <= 0) return;
|
|
13306
|
+
if ("no-repeat" === backgroundRepeatMode) {
|
|
13307
|
+
let drawWidth = null !== (_a = null == sourceSize ? void 0 : sourceSize.width) && void 0 !== _a ? _a : targetW,
|
|
13308
|
+
drawHeight = null !== (_b = null == sourceSize ? void 0 : sourceSize.height) && void 0 !== _b ? _b : targetH;
|
|
13309
|
+
if ("cover" !== resolvedBackgroundSizing && "contain" !== resolvedBackgroundSizing || !sourceSize) "fill" === resolvedBackgroundSizing && (drawWidth = targetW, drawHeight = targetH);else {
|
|
13310
|
+
const scale = "cover" === resolvedBackgroundSizing ? Math.max(targetW / sourceSize.width, targetH / sourceSize.height) : Math.min(targetW / sourceSize.width, targetH / sourceSize.height);
|
|
13311
|
+
drawWidth = sourceSize.width * scale, drawHeight = sourceSize.height * scale;
|
|
13312
|
+
}
|
|
13313
|
+
drawWidth *= backgroundScale, drawHeight *= backgroundScale;
|
|
13314
|
+
const {
|
|
13315
|
+
x: x,
|
|
13316
|
+
y: y
|
|
13317
|
+
} = resolveBackgroundPosition(backgroundPosition, targetW - drawWidth, targetH - drawHeight);
|
|
13318
|
+
return void context.drawImage(data, b.x1 + x + backgroundOffsetX, b.y1 + y + backgroundOffsetY, drawWidth, drawHeight);
|
|
13319
|
+
}
|
|
13320
|
+
if (backgroundFit && "repeat" !== backgroundRepeatMode && sourceSize) {
|
|
13321
|
+
const resW = sourceSize.width,
|
|
13322
|
+
resH = sourceSize.height;
|
|
13323
|
+
if ("repeat-x" === backgroundRepeatMode) {
|
|
13324
|
+
w = resW * (targetH / resH), h = targetH;
|
|
13325
|
+
} else if ("repeat-y" === backgroundRepeatMode) {
|
|
13326
|
+
h = resH * (targetW / resW), w = targetW;
|
|
13327
|
+
}
|
|
13328
|
+
const dpr = context.dpr,
|
|
13329
|
+
canvas = canvasAllocate.allocate({
|
|
13330
|
+
width: w,
|
|
13331
|
+
height: h,
|
|
13332
|
+
dpr: dpr
|
|
13333
|
+
}),
|
|
13334
|
+
ctx = canvas.getContext("2d");
|
|
13335
|
+
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);
|
|
13336
|
+
}
|
|
13337
|
+
const dpr = context.dpr,
|
|
13338
|
+
pattern = context.createPattern(data, backgroundRepeatMode);
|
|
13339
|
+
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);
|
|
13340
|
+
}
|
|
13194
13341
|
let DefaultBaseInteractiveRenderContribution = class {
|
|
13195
13342
|
constructor(subRenderContribitions) {
|
|
13196
13343
|
this.subRenderContribitions = subRenderContribitions, this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
@@ -13236,6 +13383,7 @@
|
|
|
13236
13383
|
}
|
|
13237
13384
|
const defaultBaseClipRenderAfterContribution = new DefaultBaseClipRenderAfterContribution();
|
|
13238
13385
|
|
|
13386
|
+
const builtinProceduralTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid"]);
|
|
13239
13387
|
function formatRatio(ratio) {
|
|
13240
13388
|
return ratio <= .5 ? 4 * ratio - 1 : -4 * ratio + 3;
|
|
13241
13389
|
}
|
|
@@ -13349,38 +13497,43 @@
|
|
|
13349
13497
|
texture && this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
13350
13498
|
}
|
|
13351
13499
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
13352
|
-
var _a;
|
|
13500
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13353
13501
|
const {
|
|
13354
13502
|
textureRatio = graphicAttribute.textureRatio,
|
|
13355
13503
|
textureOptions = null
|
|
13356
13504
|
} = graphic.attribute;
|
|
13357
|
-
let pattern =
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13505
|
+
let pattern = null;
|
|
13506
|
+
const textureRadius = null !== (_a = null == textureOptions ? void 0 : textureOptions.radius) && void 0 !== _a ? _a : 0,
|
|
13507
|
+
patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr, textureRadius);
|
|
13508
|
+
if (null !== patternKey && (pattern = this.textureMap.get(patternKey)), !pattern) {
|
|
13509
|
+
if ("string" == typeof texture) switch (texture) {
|
|
13510
|
+
case "circle":
|
|
13511
|
+
pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
|
|
13512
|
+
break;
|
|
13513
|
+
case "diamond":
|
|
13514
|
+
pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
|
|
13515
|
+
break;
|
|
13516
|
+
case "rect":
|
|
13517
|
+
pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
|
|
13518
|
+
break;
|
|
13519
|
+
case "vertical-line":
|
|
13520
|
+
pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
13521
|
+
break;
|
|
13522
|
+
case "horizontal-line":
|
|
13523
|
+
pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
13524
|
+
break;
|
|
13525
|
+
case "bias-lr":
|
|
13526
|
+
pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
|
|
13527
|
+
break;
|
|
13528
|
+
case "bias-rl":
|
|
13529
|
+
pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
|
|
13530
|
+
break;
|
|
13531
|
+
case "grid":
|
|
13532
|
+
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
13533
|
+
}
|
|
13534
|
+
pattern || (pattern = this.createResourcePattern(texture, graphic, context, texturePadding, textureRadius)), pattern && null !== patternKey && this.textureMap.set(patternKey, pattern);
|
|
13382
13535
|
}
|
|
13383
|
-
if (textureOptions && textureOptions.dynamicTexture) {
|
|
13536
|
+
if ("string" == typeof texture && textureOptions && textureOptions.dynamicTexture) {
|
|
13384
13537
|
const {
|
|
13385
13538
|
gridConfig = {},
|
|
13386
13539
|
useNewCanvas: useNewCanvas
|
|
@@ -13425,10 +13578,24 @@
|
|
|
13425
13578
|
for (let i = 0; i < gridRows; i++) for (let j = 0; j < gridColumns; j++) {
|
|
13426
13579
|
const _x = x + cellSize / 2 + j * cellSize,
|
|
13427
13580
|
_y = y + cellSize / 2 + i * cellSize;
|
|
13428
|
-
null === (
|
|
13581
|
+
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());
|
|
13429
13582
|
}
|
|
13430
13583
|
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();
|
|
13431
|
-
} else if (pattern)
|
|
13584
|
+
} else if (pattern) {
|
|
13585
|
+
if (pattern.setTransform) {
|
|
13586
|
+
const alignToGraphic = !!(null == textureOptions ? void 0 : textureOptions.alignToGraphic),
|
|
13587
|
+
alignOffsetX = null !== (_c = null == textureOptions ? void 0 : textureOptions.alignOffsetX) && void 0 !== _c ? _c : 0,
|
|
13588
|
+
alignOffsetY = null !== (_d = null == textureOptions ? void 0 : textureOptions.alignOffsetY) && void 0 !== _d ? _d : 0;
|
|
13589
|
+
let translateX = 0,
|
|
13590
|
+
translateY = 0;
|
|
13591
|
+
if (alignToGraphic) {
|
|
13592
|
+
const m = context.currentMatrix;
|
|
13593
|
+
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;
|
|
13594
|
+
} else (alignOffsetX || alignOffsetY) && (translateX = alignOffsetX, translateY = alignOffsetY);
|
|
13595
|
+
pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
|
|
13596
|
+
}
|
|
13597
|
+
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = pattern, context.fill(), context.highPerformanceRestore();
|
|
13598
|
+
} else if ("wave" === texture) {
|
|
13432
13599
|
context.save(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.clip();
|
|
13433
13600
|
const b = graphic.AABBBounds;
|
|
13434
13601
|
drawWave(context, textureRatio, b.width(), b.height(), Object.assign(Object.assign({}, textureOptions || {}), {
|
|
@@ -13436,6 +13603,45 @@
|
|
|
13436
13603
|
}), x + b.x1 - x, y + b.y1 - y), context.restore();
|
|
13437
13604
|
}
|
|
13438
13605
|
}
|
|
13606
|
+
getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr, textureRadius) {
|
|
13607
|
+
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}`;
|
|
13608
|
+
}
|
|
13609
|
+
createResourcePattern(texture, graphic, context, texturePadding, textureRadius) {
|
|
13610
|
+
var _a;
|
|
13611
|
+
const resource = null === (_a = graphic.resources) || void 0 === _a ? void 0 : _a.get(texture),
|
|
13612
|
+
data = "success" === (null == resource ? void 0 : resource.state) ? resource.data : "object" == typeof texture ? texture : null;
|
|
13613
|
+
if (!data) return null;
|
|
13614
|
+
if (texturePadding > 0 || textureRadius > 0) {
|
|
13615
|
+
const w = data.naturalWidth || data.width,
|
|
13616
|
+
h = data.naturalHeight || data.height;
|
|
13617
|
+
if (w > 0 && h > 0) {
|
|
13618
|
+
const tileW = w + 2 * texturePadding,
|
|
13619
|
+
tileH = h + 2 * texturePadding,
|
|
13620
|
+
canvas = canvasAllocate.allocate({
|
|
13621
|
+
width: tileW,
|
|
13622
|
+
height: tileH,
|
|
13623
|
+
dpr: context.dpr
|
|
13624
|
+
}),
|
|
13625
|
+
ctx = canvas.getContext("2d");
|
|
13626
|
+
if (ctx) {
|
|
13627
|
+
if (ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransformForCurrent(!0), ctx.clearRect(0, 0, tileW, tileH), textureRadius > 0) {
|
|
13628
|
+
const r = Math.max(0, Math.min(textureRadius, Math.min(w, h) / 2)),
|
|
13629
|
+
x0 = texturePadding,
|
|
13630
|
+
y0 = texturePadding,
|
|
13631
|
+
x1 = x0 + w,
|
|
13632
|
+
y1 = y0 + h;
|
|
13633
|
+
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();
|
|
13634
|
+
}
|
|
13635
|
+
ctx.drawImage(data, texturePadding, texturePadding, w, h);
|
|
13636
|
+
const pattern = context.createPattern(canvas.nativeCanvas, "repeat");
|
|
13637
|
+
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;
|
|
13638
|
+
}
|
|
13639
|
+
canvasAllocate.free(canvas);
|
|
13640
|
+
}
|
|
13641
|
+
}
|
|
13642
|
+
const pattern = context.createPattern(data, "repeat");
|
|
13643
|
+
return (null == pattern ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0])), pattern;
|
|
13644
|
+
}
|
|
13439
13645
|
}
|
|
13440
13646
|
const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
|
|
13441
13647
|
|
|
@@ -13547,27 +13753,32 @@
|
|
|
13547
13753
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
13548
13754
|
const {
|
|
13549
13755
|
background: background,
|
|
13756
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
13757
|
+
opacity = graphicAttribute.opacity,
|
|
13550
13758
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
13551
13759
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
13552
13760
|
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
13553
13761
|
backgroundScale = graphicAttribute.backgroundScale,
|
|
13554
13762
|
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
13555
|
-
backgroundOffsetY = graphicAttribute.backgroundOffsetY
|
|
13763
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
13764
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
13765
|
+
backgroundPosition = graphicAttribute.backgroundPosition
|
|
13556
13766
|
} = graphic.attribute;
|
|
13557
13767
|
if (background) if (graphic.backgroundImg && graphic.resources) {
|
|
13558
|
-
const res = graphic.resources.get(background);
|
|
13559
|
-
if ("success" !== res.state || !res.data) return;
|
|
13768
|
+
const res = graphic.resources.get(getBackgroundImage(background));
|
|
13769
|
+
if (!res || "success" !== res.state || !res.data) return;
|
|
13560
13770
|
context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
|
|
13561
13771
|
const b = graphic.AABBBounds;
|
|
13562
|
-
this.doDrawImage(context, res.data, b, {
|
|
13772
|
+
context.globalAlpha = backgroundOpacity * opacity, backgroundClip && context.clip(), this.doDrawImage(context, res.data, b, {
|
|
13563
13773
|
backgroundMode: backgroundMode,
|
|
13564
13774
|
backgroundFit: backgroundFit,
|
|
13565
13775
|
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
13566
13776
|
backgroundScale: backgroundScale,
|
|
13567
13777
|
backgroundOffsetX: backgroundOffsetX,
|
|
13568
|
-
backgroundOffsetY: backgroundOffsetY
|
|
13778
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
13779
|
+
backgroundPosition: backgroundPosition
|
|
13569
13780
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
13570
|
-
} else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
13781
|
+
} else context.highPerformanceSave(), context.globalAlpha = backgroundOpacity * opacity, context.fillStyle = background, context.fill(), context.highPerformanceRestore();
|
|
13571
13782
|
}
|
|
13572
13783
|
}
|
|
13573
13784
|
const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
|
|
@@ -15049,9 +15260,17 @@
|
|
|
15049
15260
|
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
15050
15261
|
var _a, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
15051
15262
|
const {
|
|
15263
|
+
backgroundOpacity = graphicAttribute.backgroundOpacity,
|
|
15264
|
+
opacity = graphicAttribute.opacity,
|
|
15052
15265
|
backgroundMode = graphicAttribute.backgroundMode,
|
|
15053
15266
|
backgroundFit = graphicAttribute.backgroundFit,
|
|
15054
|
-
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio
|
|
15267
|
+
backgroundKeepAspectRatio = graphicAttribute.backgroundKeepAspectRatio,
|
|
15268
|
+
backgroundScale = graphicAttribute.backgroundScale,
|
|
15269
|
+
backgroundOffsetX = graphicAttribute.backgroundOffsetX,
|
|
15270
|
+
backgroundOffsetY = graphicAttribute.backgroundOffsetY,
|
|
15271
|
+
backgroundPosition = graphicAttribute.backgroundPosition,
|
|
15272
|
+
backgroundClip = graphicAttribute.backgroundClip,
|
|
15273
|
+
backgroundCornerRadius = graphicAttribute.backgroundCornerRadius
|
|
15055
15274
|
} = graphic.attribute;
|
|
15056
15275
|
let matrix,
|
|
15057
15276
|
{
|
|
@@ -15063,18 +15282,18 @@
|
|
|
15063
15282
|
};
|
|
15064
15283
|
let b;
|
|
15065
15284
|
"richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
|
|
15066
|
-
const
|
|
15285
|
+
const backgroundConfig = isObject$8(background) && background.background ? background : null,
|
|
15067
15286
|
onlyTranslate = graphic.transMatrix.onlyTranslate();
|
|
15068
|
-
if (
|
|
15287
|
+
if (backgroundConfig) {
|
|
15069
15288
|
const _b = graphic.AABBBounds,
|
|
15070
|
-
x = (null !== (_a =
|
|
15071
|
-
y = (null !== (_d =
|
|
15072
|
-
w = null !== (_f =
|
|
15073
|
-
h = null !== (_g =
|
|
15074
|
-
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background =
|
|
15289
|
+
x = (null !== (_a = backgroundConfig.x) && void 0 !== _a ? _a : _b.x1) + (null !== (_c = backgroundConfig.dx) && void 0 !== _c ? _c : 0),
|
|
15290
|
+
y = (null !== (_d = backgroundConfig.y) && void 0 !== _d ? _d : _b.y1) + (null !== (_e = backgroundConfig.dy) && void 0 !== _e ? _e : 0),
|
|
15291
|
+
w = null !== (_f = backgroundConfig.width) && void 0 !== _f ? _f : _b.width(),
|
|
15292
|
+
h = null !== (_g = backgroundConfig.height) && void 0 !== _g ? _g : _b.height();
|
|
15293
|
+
if (b = boundsAllocate.allocate(x, y, x + w, y + h), background = backgroundConfig.background, !onlyTranslate) {
|
|
15075
15294
|
const w = b.width(),
|
|
15076
15295
|
h = b.height();
|
|
15077
|
-
b.set((null !== (_h =
|
|
15296
|
+
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);
|
|
15078
15297
|
}
|
|
15079
15298
|
} else b = graphic.AABBBounds, onlyTranslate || (b = getTextBounds(Object.assign(Object.assign({}, graphic.attribute), {
|
|
15080
15299
|
angle: 0,
|
|
@@ -15087,19 +15306,18 @@
|
|
|
15087
15306
|
})).clone());
|
|
15088
15307
|
if (graphic.backgroundImg && graphic.resources) {
|
|
15089
15308
|
const res = graphic.resources.get(background);
|
|
15090
|
-
if ("success" !== res.state || !res.data) return void restore();
|
|
15091
|
-
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.
|
|
15309
|
+
if (!res || "success" !== res.state || !res.data) return void restore();
|
|
15310
|
+
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, {
|
|
15092
15311
|
backgroundMode: backgroundMode,
|
|
15093
15312
|
backgroundFit: backgroundFit,
|
|
15094
|
-
backgroundKeepAspectRatio: backgroundKeepAspectRatio
|
|
15313
|
+
backgroundKeepAspectRatio: backgroundKeepAspectRatio,
|
|
15314
|
+
backgroundScale: backgroundScale,
|
|
15315
|
+
backgroundOffsetX: backgroundOffsetX,
|
|
15316
|
+
backgroundOffsetY: backgroundOffsetY,
|
|
15317
|
+
backgroundPosition: backgroundPosition
|
|
15095
15318
|
}), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
15096
|
-
} else
|
|
15097
|
-
|
|
15098
|
-
backgroundCornerRadius: backgroundCornerRadius
|
|
15099
|
-
} = graphic.attribute;
|
|
15100
|
-
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();
|
|
15101
|
-
}
|
|
15102
|
-
shouldReCalBounds && boundsAllocate.free(b), restore();
|
|
15319
|
+
} 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();
|
|
15320
|
+
backgroundConfig && boundsAllocate.free(b), restore();
|
|
15103
15321
|
}
|
|
15104
15322
|
}
|
|
15105
15323
|
const defaultTextBackgroundRenderContribution = new DefaultTextBackgroundRenderContribution();
|
|
@@ -15526,6 +15744,92 @@
|
|
|
15526
15744
|
};
|
|
15527
15745
|
};
|
|
15528
15746
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
15747
|
+
function resolveImageMode({
|
|
15748
|
+
repeatX = "no-repeat",
|
|
15749
|
+
repeatY = "no-repeat",
|
|
15750
|
+
imageMode: imageMode
|
|
15751
|
+
}) {
|
|
15752
|
+
const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
|
|
15753
|
+
return {
|
|
15754
|
+
repeatMode: repeatMode,
|
|
15755
|
+
sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
|
|
15756
|
+
};
|
|
15757
|
+
}
|
|
15758
|
+
const IMAGE_MODE_TO_BACKGROUND_MODE = {
|
|
15759
|
+
cover: "no-repeat-cover",
|
|
15760
|
+
contain: "no-repeat-contain",
|
|
15761
|
+
fill: "no-repeat-fill",
|
|
15762
|
+
auto: "no-repeat-auto"
|
|
15763
|
+
};
|
|
15764
|
+
function resolveBackgroundParamsByImageSizing(sizingMode) {
|
|
15765
|
+
return {
|
|
15766
|
+
backgroundMode: IMAGE_MODE_TO_BACKGROUND_MODE[sizingMode],
|
|
15767
|
+
backgroundFit: !1,
|
|
15768
|
+
backgroundKeepAspectRatio: !1
|
|
15769
|
+
};
|
|
15770
|
+
}
|
|
15771
|
+
function resolveImageRepeatMode(repeatX, repeatY) {
|
|
15772
|
+
let repeat = 0;
|
|
15773
|
+
return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
|
|
15774
|
+
}
|
|
15775
|
+
function shouldClipImageByLayout({
|
|
15776
|
+
repeatX = "no-repeat",
|
|
15777
|
+
repeatY = "no-repeat",
|
|
15778
|
+
imageMode: imageMode,
|
|
15779
|
+
imageScale = 1,
|
|
15780
|
+
imageOffsetX = 0,
|
|
15781
|
+
imageOffsetY = 0,
|
|
15782
|
+
imagePosition = "top-left"
|
|
15783
|
+
}) {
|
|
15784
|
+
const {
|
|
15785
|
+
repeatMode: repeatMode,
|
|
15786
|
+
sizingMode: sizingMode
|
|
15787
|
+
} = resolveImageMode({
|
|
15788
|
+
repeatX: repeatX,
|
|
15789
|
+
repeatY: repeatY,
|
|
15790
|
+
imageMode: imageMode
|
|
15791
|
+
});
|
|
15792
|
+
return "no-repeat" === repeatMode && ("cover" === sizingMode || "auto" === sizingMode || 1 !== imageScale || 0 !== imageOffsetX || 0 !== imageOffsetY);
|
|
15793
|
+
}
|
|
15794
|
+
function drawImageWithLayout(context, data, x, y, width, height, {
|
|
15795
|
+
repeatX = "no-repeat",
|
|
15796
|
+
repeatY = "no-repeat",
|
|
15797
|
+
imageMode: imageMode,
|
|
15798
|
+
imageScale = 1,
|
|
15799
|
+
imageOffsetX = 0,
|
|
15800
|
+
imageOffsetY = 0,
|
|
15801
|
+
imagePosition = "top-left"
|
|
15802
|
+
}) {
|
|
15803
|
+
const {
|
|
15804
|
+
repeatMode: repeatMode,
|
|
15805
|
+
sizingMode: sizingMode
|
|
15806
|
+
} = resolveImageMode({
|
|
15807
|
+
repeatX: repeatX,
|
|
15808
|
+
repeatY: repeatY,
|
|
15809
|
+
imageMode: imageMode
|
|
15810
|
+
}),
|
|
15811
|
+
imageBackgroundParams = "no-repeat" === repeatMode ? resolveBackgroundParamsByImageSizing(sizingMode) : {
|
|
15812
|
+
backgroundMode: repeatMode,
|
|
15813
|
+
backgroundFit: !1,
|
|
15814
|
+
backgroundKeepAspectRatio: !1
|
|
15815
|
+
};
|
|
15816
|
+
drawBackgroundImage(context, data, {
|
|
15817
|
+
x1: x,
|
|
15818
|
+
y1: y,
|
|
15819
|
+
x2: x + width,
|
|
15820
|
+
y2: y + height,
|
|
15821
|
+
width: () => width,
|
|
15822
|
+
height: () => height
|
|
15823
|
+
}, {
|
|
15824
|
+
backgroundMode: imageBackgroundParams.backgroundMode,
|
|
15825
|
+
backgroundFit: imageBackgroundParams.backgroundFit,
|
|
15826
|
+
backgroundKeepAspectRatio: imageBackgroundParams.backgroundKeepAspectRatio,
|
|
15827
|
+
backgroundScale: imageScale,
|
|
15828
|
+
backgroundOffsetX: imageOffsetX,
|
|
15829
|
+
backgroundOffsetY: imageOffsetY,
|
|
15830
|
+
backgroundPosition: imagePosition
|
|
15831
|
+
});
|
|
15832
|
+
}
|
|
15529
15833
|
let DefaultCanvasImageRender = class extends BaseRender {
|
|
15530
15834
|
constructor(graphicRenderContributions) {
|
|
15531
15835
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -15540,6 +15844,11 @@
|
|
|
15540
15844
|
cornerRadius = imageAttribute.cornerRadius,
|
|
15541
15845
|
fillStrokeOrder = imageAttribute.fillStrokeOrder,
|
|
15542
15846
|
cornerType = imageAttribute.cornerType,
|
|
15847
|
+
imageMode = imageAttribute.imageMode,
|
|
15848
|
+
imageScale = imageAttribute.imageScale,
|
|
15849
|
+
imageOffsetX = imageAttribute.imageOffsetX,
|
|
15850
|
+
imageOffsetY = imageAttribute.imageOffsetY,
|
|
15851
|
+
imagePosition = imageAttribute.imagePosition,
|
|
15543
15852
|
image: url
|
|
15544
15853
|
} = image.attribute,
|
|
15545
15854
|
data = this.valid(image, imageAttribute, fillCb);
|
|
@@ -15556,22 +15865,33 @@
|
|
|
15556
15865
|
const width = image.width,
|
|
15557
15866
|
height = image.height;
|
|
15558
15867
|
context.beginPath();
|
|
15559
|
-
let
|
|
15560
|
-
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),
|
|
15868
|
+
let needCornerClip = !1;
|
|
15869
|
+
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);
|
|
15561
15870
|
const _runFill = () => {
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15871
|
+
doFill && (fillCb ? fillCb(context, image.attribute, imageAttribute) : fVisible && (context.setCommonStyle(image, image.attribute, x, y, imageAttribute), drawImageWithLayout(context, res.data, x, y, width, height, {
|
|
15872
|
+
repeatX: repeatX,
|
|
15873
|
+
repeatY: repeatY,
|
|
15874
|
+
imageMode: imageMode,
|
|
15875
|
+
imageScale: imageScale,
|
|
15876
|
+
imageOffsetX: imageOffsetX,
|
|
15877
|
+
imageOffsetY: imageOffsetY,
|
|
15878
|
+
imagePosition: imagePosition
|
|
15879
|
+
})));
|
|
15570
15880
|
},
|
|
15571
15881
|
_runStroke = () => {
|
|
15572
15882
|
doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
|
|
15573
|
-
}
|
|
15574
|
-
|
|
15883
|
+
},
|
|
15884
|
+
needLayoutClip = shouldClipImageByLayout({
|
|
15885
|
+
repeatX: repeatX,
|
|
15886
|
+
repeatY: repeatY,
|
|
15887
|
+
imageMode: imageMode,
|
|
15888
|
+
imageScale: imageScale,
|
|
15889
|
+
imageOffsetX: imageOffsetX,
|
|
15890
|
+
imageOffsetY: imageOffsetY,
|
|
15891
|
+
imagePosition: imagePosition
|
|
15892
|
+
}),
|
|
15893
|
+
needClip = needCornerClip || needLayoutClip;
|
|
15894
|
+
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);
|
|
15575
15895
|
}
|
|
15576
15896
|
draw(image, renderService, drawContext) {
|
|
15577
15897
|
const {
|
|
@@ -16426,7 +16746,7 @@
|
|
|
16426
16746
|
return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
|
|
16427
16747
|
}
|
|
16428
16748
|
clearScreen(renderService, context, drawContext) {
|
|
16429
|
-
var _a, _b, _c;
|
|
16749
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
16430
16750
|
const {
|
|
16431
16751
|
clear: clear,
|
|
16432
16752
|
viewBox: viewBox
|
|
@@ -16436,9 +16756,20 @@
|
|
|
16436
16756
|
if (clear) {
|
|
16437
16757
|
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);
|
|
16438
16758
|
const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
|
|
16439
|
-
if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
|
|
16440
|
-
const res = stage.resources.get(clear);
|
|
16441
|
-
res && "success" === res.state && res.data
|
|
16759
|
+
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) {
|
|
16760
|
+
const res = stage.resources.get(getBackgroundImage(clear));
|
|
16761
|
+
if (res && "success" === res.state && res.data) {
|
|
16762
|
+
const backgroundBounds = boundsAllocate.allocate(0, 0, 0 + width, 0 + height);
|
|
16763
|
+
drawBackgroundImage(context, res.data, backgroundBounds, {
|
|
16764
|
+
backgroundMode: null !== (_e = stage.attribute.backgroundMode) && void 0 !== _e ? _e : DefaultAttribute.backgroundMode,
|
|
16765
|
+
backgroundFit: null !== (_f = stage.attribute.backgroundFit) && void 0 !== _f ? _f : DefaultAttribute.backgroundFit,
|
|
16766
|
+
backgroundKeepAspectRatio: null !== (_g = stage.attribute.backgroundKeepAspectRatio) && void 0 !== _g ? _g : DefaultAttribute.backgroundKeepAspectRatio,
|
|
16767
|
+
backgroundScale: null !== (_h = stage.attribute.backgroundScale) && void 0 !== _h ? _h : DefaultAttribute.backgroundScale,
|
|
16768
|
+
backgroundOffsetX: null !== (_j = stage.attribute.backgroundOffsetX) && void 0 !== _j ? _j : DefaultAttribute.backgroundOffsetX,
|
|
16769
|
+
backgroundOffsetY: null !== (_k = stage.attribute.backgroundOffsetY) && void 0 !== _k ? _k : DefaultAttribute.backgroundOffsetY,
|
|
16770
|
+
backgroundPosition: null !== (_l = stage.attribute.backgroundPosition) && void 0 !== _l ? _l : DefaultAttribute.backgroundPosition
|
|
16771
|
+
}), boundsAllocate.free(backgroundBounds);
|
|
16772
|
+
}
|
|
16442
16773
|
} else context.fillStyle = createColor(context, clear, {
|
|
16443
16774
|
AABBBounds: {
|
|
16444
16775
|
x1: 0,
|
|
@@ -16941,7 +17272,7 @@
|
|
|
16941
17272
|
return null !== (_a = this._background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND;
|
|
16942
17273
|
}
|
|
16943
17274
|
set background(b) {
|
|
16944
|
-
this._background = b;
|
|
17275
|
+
this._background = b, this.syncBackgroundImage(b);
|
|
16945
17276
|
}
|
|
16946
17277
|
get defaultLayer() {
|
|
16947
17278
|
return this.at(0);
|
|
@@ -16955,6 +17286,18 @@
|
|
|
16955
17286
|
set ticker(ticker) {
|
|
16956
17287
|
ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
|
|
16957
17288
|
}
|
|
17289
|
+
syncBackgroundImage(background) {
|
|
17290
|
+
var _a;
|
|
17291
|
+
const source = null !== (_a = null == background ? void 0 : background.background) && void 0 !== _a ? _a : background;
|
|
17292
|
+
this.backgroundImg = !1, this.isImageBackgroundSource(source) && this.loadImage(source, !0);
|
|
17293
|
+
}
|
|
17294
|
+
isImageBackgroundSource(source) {
|
|
17295
|
+
if (!source) return !1;
|
|
17296
|
+
if ("string" == typeof source) return source.startsWith("<svg") || isValidUrl$1(source) || source.includes("/") || isBase64$1(source);
|
|
17297
|
+
if (!isObject$8(source)) return !1;
|
|
17298
|
+
const gradientSource = source;
|
|
17299
|
+
return "string" != typeof gradientSource.gradient || !Array.isArray(gradientSource.stops);
|
|
17300
|
+
}
|
|
16958
17301
|
constructor(params = {}) {
|
|
16959
17302
|
var _a, _b;
|
|
16960
17303
|
super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
|
|
@@ -16993,9 +17336,7 @@
|
|
|
16993
17336
|
main: !0
|
|
16994
17337
|
})), 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 = {
|
|
16995
17338
|
tickRenderMode: "effect"
|
|
16996
|
-
}), this.optmize(params.optimize), params.background &&
|
|
16997
|
-
background: this._background
|
|
16998
|
-
}), this.initAnimate(params), this.rafId = null !== (_b = params.rafId) && void 0 !== _b ? _b : Math.floor(6 * Math.random());
|
|
17339
|
+
}), 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());
|
|
16999
17340
|
}
|
|
17000
17341
|
initAnimate(params) {
|
|
17001
17342
|
var _a;
|
|
@@ -17330,12 +17671,12 @@
|
|
|
17330
17671
|
throw new Error("暂不支持");
|
|
17331
17672
|
}
|
|
17332
17673
|
release() {
|
|
17333
|
-
var _a, _b;
|
|
17674
|
+
var _a, _b, _d;
|
|
17334
17675
|
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 => {
|
|
17335
17676
|
layer.release();
|
|
17336
17677
|
}), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
|
|
17337
17678
|
item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
|
|
17338
|
-
}), 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 = [];
|
|
17679
|
+
}), 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 = [];
|
|
17339
17680
|
}
|
|
17340
17681
|
setStage(stage) {}
|
|
17341
17682
|
dirty(b, matrix) {
|
|
@@ -21646,7 +21987,7 @@
|
|
|
21646
21987
|
this._sliderRenderBounds = null, this._sliderLimitRange = null;
|
|
21647
21988
|
}
|
|
21648
21989
|
release(all) {
|
|
21649
|
-
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).
|
|
21990
|
+
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
|
|
21650
21991
|
passive: !1
|
|
21651
21992
|
}), this._clearDragEvents();
|
|
21652
21993
|
}
|
|
@@ -23229,17 +23570,21 @@
|
|
|
23229
23570
|
} = this.attribute.label;
|
|
23230
23571
|
textStyle = isFunction$3(textStyle) ? merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer)) : textStyle;
|
|
23231
23572
|
const labelAlign = this.getLabelAlign(vector, inside, textStyle.angle);
|
|
23232
|
-
|
|
23573
|
+
textStyle = merge(labelAlign, textStyle), isFunction$3(textStyle.text) && (textStyle.text = textStyle.text({
|
|
23233
23574
|
label: tickDatum.label,
|
|
23234
23575
|
value: tickDatum.rawValue,
|
|
23235
23576
|
index: tickDatum.index,
|
|
23236
23577
|
layer: layer
|
|
23237
|
-
}))
|
|
23578
|
+
}));
|
|
23579
|
+
let reactStyle = textStyle.react;
|
|
23580
|
+
return isFunction$3(reactStyle) && (reactStyle = reactStyle(tickDatum, index, tickData, layer)), Object.assign(Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
|
|
23238
23581
|
text: null != text ? text : textContent,
|
|
23239
23582
|
_originText: tickDatum.label,
|
|
23240
23583
|
lineHeight: null == textStyle ? void 0 : textStyle.fontSize,
|
|
23241
23584
|
type: type
|
|
23242
|
-
}), textStyle)
|
|
23585
|
+
}), textStyle), {
|
|
23586
|
+
react: reactStyle
|
|
23587
|
+
});
|
|
23243
23588
|
}
|
|
23244
23589
|
getLabelPosition(point, vector, text, style) {
|
|
23245
23590
|
return point;
|
|
@@ -24268,6 +24613,8 @@
|
|
|
24268
24613
|
this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
|
|
24269
24614
|
timeline.tick(delta);
|
|
24270
24615
|
}), this.emit("tick", delta));
|
|
24616
|
+
}, this._handleGraphTick = () => {
|
|
24617
|
+
this.initHandler(!1);
|
|
24271
24618
|
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
|
|
24272
24619
|
}
|
|
24273
24620
|
bindStage(stage) {
|
|
@@ -24277,9 +24624,7 @@
|
|
|
24277
24624
|
this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
|
|
24278
24625
|
}
|
|
24279
24626
|
init() {
|
|
24280
|
-
this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker",
|
|
24281
|
-
this.initHandler(!1);
|
|
24282
|
-
}), application.global.env && this.initHandler(!1);
|
|
24627
|
+
this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", this._handleGraphTick), application.global.env && this.initHandler(!1);
|
|
24283
24628
|
}
|
|
24284
24629
|
addTimeline(timeline) {
|
|
24285
24630
|
this.timelines.push(timeline);
|
|
@@ -24352,7 +24697,7 @@
|
|
|
24352
24697
|
}
|
|
24353
24698
|
release() {
|
|
24354
24699
|
var _a;
|
|
24355
|
-
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
|
|
24700
|
+
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);
|
|
24356
24701
|
}
|
|
24357
24702
|
checkSkip(delta) {
|
|
24358
24703
|
var _a, _b, _c;
|
|
@@ -24466,6 +24811,7 @@
|
|
|
24466
24811
|
if (custom.prototype.constructor === custom) {
|
|
24467
24812
|
const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
|
|
24468
24813
|
if (descriptor && !descriptor.writable) return 1;
|
|
24814
|
+
if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
|
|
24469
24815
|
}
|
|
24470
24816
|
return 2;
|
|
24471
24817
|
}
|
|
@@ -24612,7 +24958,7 @@
|
|
|
24612
24958
|
let parsedFromProps = null,
|
|
24613
24959
|
props = params.to,
|
|
24614
24960
|
from = params.from;
|
|
24615
|
-
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);
|
|
24961
|
+
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);
|
|
24616
24962
|
let totalDelay = 0;
|
|
24617
24963
|
oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
|
|
24618
24964
|
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;
|
|
@@ -24675,7 +25021,7 @@
|
|
|
24675
25021
|
let parsedFromProps = null,
|
|
24676
25022
|
props = effect.to,
|
|
24677
25023
|
from = effect.from;
|
|
24678
|
-
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
|
|
25024
|
+
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);
|
|
24679
25025
|
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
24680
25026
|
customType = effect.custom ? effect.customType : getCustomType(custom);
|
|
24681
25027
|
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
@@ -24694,22 +25040,31 @@
|
|
|
24694
25040
|
animate.play(customAnimate);
|
|
24695
25041
|
}
|
|
24696
25042
|
createPropsFromChannel(channel, graphic) {
|
|
25043
|
+
var _a;
|
|
24697
25044
|
const props = {};
|
|
24698
25045
|
let from = null;
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
}
|
|
25046
|
+
if (!channel) return {
|
|
25047
|
+
from: from,
|
|
25048
|
+
props: props,
|
|
25049
|
+
attrOutChannel: null
|
|
25050
|
+
};
|
|
25051
|
+
const attrOutChannel = {};
|
|
25052
|
+
let hasAttrs = !1;
|
|
25053
|
+
const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
|
|
25054
|
+
if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
|
|
25055
|
+
to: diffAttrs[key]
|
|
25056
|
+
}), res), {})), Object.keys(channel).forEach(key => {
|
|
24704
25057
|
var _a, _b, _c, _d;
|
|
24705
25058
|
const config = channel[key];
|
|
24706
25059
|
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);
|
|
24707
|
-
}), {
|
|
24708
|
-
|
|
24709
|
-
props
|
|
24710
|
-
}
|
|
25060
|
+
}), diffAttrs) for (const key in diffAttrs) {
|
|
25061
|
+
const value = diffAttrs[key];
|
|
25062
|
+
void 0 !== value && (props.hasOwnProperty(key) || (attrOutChannel[key] = value, hasAttrs = !0));
|
|
25063
|
+
}
|
|
25064
|
+
return {
|
|
24711
25065
|
from: from,
|
|
24712
|
-
props: props
|
|
25066
|
+
props: props,
|
|
25067
|
+
attrOutChannel: hasAttrs ? attrOutChannel : null
|
|
24713
25068
|
};
|
|
24714
25069
|
}
|
|
24715
25070
|
resolveValue(value, graphic, defaultValue) {
|
|
@@ -31283,6 +31638,16 @@
|
|
|
31283
31638
|
strokeBoundsBuffer: 0
|
|
31284
31639
|
}
|
|
31285
31640
|
};
|
|
31641
|
+
const LAYOUT_LEVEL = {
|
|
31642
|
+
background: 0,
|
|
31643
|
+
preview: 1,
|
|
31644
|
+
dragMask: 2,
|
|
31645
|
+
selectedBackground: 3,
|
|
31646
|
+
selectedPreview: 4,
|
|
31647
|
+
handler: 5,
|
|
31648
|
+
handlerText: 5,
|
|
31649
|
+
handlerMask: 999
|
|
31650
|
+
};
|
|
31286
31651
|
|
|
31287
31652
|
const isTextOverflow = (componentBoundsLike, textBounds, layout, isHorizontal) => {
|
|
31288
31653
|
if (!textBounds) return !1;
|
|
@@ -31413,12 +31778,14 @@
|
|
|
31413
31778
|
x: position.x + start * width,
|
|
31414
31779
|
y: position.y,
|
|
31415
31780
|
width: (end - start) * width,
|
|
31416
|
-
height: height
|
|
31781
|
+
height: height,
|
|
31782
|
+
zIndex: LAYOUT_LEVEL.dragMask
|
|
31417
31783
|
}, dragMaskStyle), "rect") : this._dragMask = this._getContainer().createOrUpdateChild("dragMask", Object.assign({
|
|
31418
31784
|
x: position.x,
|
|
31419
31785
|
y: position.y + start * height,
|
|
31420
31786
|
width: width,
|
|
31421
|
-
height: (end - start) * height
|
|
31787
|
+
height: (end - start) * height,
|
|
31788
|
+
zIndex: LAYOUT_LEVEL.dragMask
|
|
31422
31789
|
}, dragMaskStyle), "rect"), {
|
|
31423
31790
|
start: start,
|
|
31424
31791
|
end: end
|
|
@@ -31442,7 +31809,8 @@
|
|
|
31442
31809
|
y: position.y,
|
|
31443
31810
|
width: width,
|
|
31444
31811
|
height: height,
|
|
31445
|
-
cursor: brushSelect ? "crosshair" : "auto"
|
|
31812
|
+
cursor: brushSelect ? "crosshair" : "auto",
|
|
31813
|
+
zIndex: LAYOUT_LEVEL.background
|
|
31446
31814
|
}, backgroundStyle), {
|
|
31447
31815
|
pickable: !zoomLock && (null === (_a = backgroundStyle.pickable) || void 0 === _a || _a)
|
|
31448
31816
|
}), "rect");
|
|
@@ -31475,7 +31843,8 @@
|
|
|
31475
31843
|
x: position.x + start * width,
|
|
31476
31844
|
y: position.y - middleHandlerBackgroundSize,
|
|
31477
31845
|
width: (end - start) * width,
|
|
31478
|
-
height: middleHandlerBackgroundSize
|
|
31846
|
+
height: middleHandlerBackgroundSize,
|
|
31847
|
+
zIndex: LAYOUT_LEVEL.handler
|
|
31479
31848
|
}, null === (_d = middleHandlerStyle.background) || void 0 === _d ? void 0 : _d.style), {
|
|
31480
31849
|
pickable: !zoomLock && (null === (_g = null === (_f = null === (_e = middleHandlerStyle.background) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.pickable) || void 0 === _g || _g)
|
|
31481
31850
|
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
@@ -31483,24 +31852,29 @@
|
|
|
31483
31852
|
y: position.y - middleHandlerBackgroundSize / 2,
|
|
31484
31853
|
strokeBoundsBuffer: 0,
|
|
31485
31854
|
angle: 0,
|
|
31486
|
-
symbolType: null !== (_j = null === (_h = middleHandlerStyle.icon) || void 0 === _h ? void 0 : _h.symbolType) && void 0 !== _j ? _j : "square"
|
|
31855
|
+
symbolType: null !== (_j = null === (_h = middleHandlerStyle.icon) || void 0 === _h ? void 0 : _h.symbolType) && void 0 !== _j ? _j : "square",
|
|
31856
|
+
zIndex: LAYOUT_LEVEL.handler
|
|
31487
31857
|
}, middleHandlerStyle.icon), {
|
|
31488
31858
|
pickable: !zoomLock && (null === (_k = middleHandlerStyle.icon.pickable) || void 0 === _k || _k)
|
|
31489
31859
|
}), "symbol");
|
|
31490
31860
|
}
|
|
31491
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
31861
|
+
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign(Object.assign({
|
|
31492
31862
|
x: position.x + start * width,
|
|
31493
31863
|
y: position.y + height / 2,
|
|
31494
31864
|
size: height,
|
|
31495
31865
|
symbolType: null !== (_l = startHandlerStyle.symbolType) && void 0 !== _l ? _l : "square"
|
|
31496
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal),
|
|
31866
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
31867
|
+
zIndex: LAYOUT_LEVEL.handler
|
|
31868
|
+
}), startHandlerStyle), {
|
|
31497
31869
|
pickable: !zoomLock && (null === (_m = startHandlerStyle.pickable) || void 0 === _m || _m)
|
|
31498
|
-
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
31870
|
+
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign(Object.assign({
|
|
31499
31871
|
x: position.x + end * width,
|
|
31500
31872
|
y: position.y + height / 2,
|
|
31501
31873
|
size: height,
|
|
31502
31874
|
symbolType: null !== (_o = endHandlerStyle.symbolType) && void 0 !== _o ? _o : "square"
|
|
31503
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal),
|
|
31875
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
31876
|
+
zIndex: LAYOUT_LEVEL.handler
|
|
31877
|
+
}), endHandlerStyle), {
|
|
31504
31878
|
pickable: !zoomLock && (null === (_p = endHandlerStyle.pickable) || void 0 === _p || _p)
|
|
31505
31879
|
}), "symbol");
|
|
31506
31880
|
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize),
|
|
@@ -31514,7 +31888,7 @@
|
|
|
31514
31888
|
height: startHandlerHeight,
|
|
31515
31889
|
fill: "white",
|
|
31516
31890
|
fillOpacity: 0,
|
|
31517
|
-
zIndex:
|
|
31891
|
+
zIndex: LAYOUT_LEVEL.handlerMask
|
|
31518
31892
|
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
31519
31893
|
pickable: !zoomLock
|
|
31520
31894
|
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
@@ -31524,7 +31898,7 @@
|
|
|
31524
31898
|
height: endHandlerHeight,
|
|
31525
31899
|
fill: "white",
|
|
31526
31900
|
fillOpacity: 0,
|
|
31527
|
-
zIndex:
|
|
31901
|
+
zIndex: LAYOUT_LEVEL.handlerMask
|
|
31528
31902
|
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
31529
31903
|
pickable: !zoomLock
|
|
31530
31904
|
}), "rect");
|
|
@@ -31535,7 +31909,8 @@
|
|
|
31535
31909
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
|
|
31536
31910
|
y: position.y + start * height,
|
|
31537
31911
|
width: middleHandlerBackgroundSize,
|
|
31538
|
-
height: (end - start) * height
|
|
31912
|
+
height: (end - start) * height,
|
|
31913
|
+
zIndex: LAYOUT_LEVEL.handler
|
|
31539
31914
|
}, null === (_r = middleHandlerStyle.background) || void 0 === _r ? void 0 : _r.style), {
|
|
31540
31915
|
pickable: !zoomLock && (null === (_u = null === (_t = null === (_s = middleHandlerStyle.background) || void 0 === _s ? void 0 : _s.style) || void 0 === _t ? void 0 : _t.pickable) || void 0 === _u || _u)
|
|
31541
31916
|
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
@@ -31543,23 +31918,27 @@
|
|
|
31543
31918
|
y: position.y + (start + end) / 2 * height,
|
|
31544
31919
|
angle: Math.PI / 180 * 90,
|
|
31545
31920
|
symbolType: null !== (_w = null === (_v = middleHandlerStyle.icon) || void 0 === _v ? void 0 : _v.symbolType) && void 0 !== _w ? _w : "square",
|
|
31546
|
-
strokeBoundsBuffer: 0
|
|
31921
|
+
strokeBoundsBuffer: 0,
|
|
31922
|
+
zIndex: LAYOUT_LEVEL.handler
|
|
31547
31923
|
}, middleHandlerStyle.icon), {
|
|
31548
31924
|
pickable: !zoomLock && (null === (_y = null === (_x = middleHandlerStyle.icon) || void 0 === _x ? void 0 : _x.pickable) || void 0 === _y || _y)
|
|
31549
31925
|
}), "symbol");
|
|
31550
31926
|
}
|
|
31551
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
31927
|
+
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign(Object.assign({
|
|
31552
31928
|
x: position.x + width / 2,
|
|
31553
31929
|
y: position.y + start * height,
|
|
31554
31930
|
size: width,
|
|
31555
31931
|
symbolType: null !== (_z = startHandlerStyle.symbolType) && void 0 !== _z ? _z : "square"
|
|
31556
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical),
|
|
31932
|
+
}, DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
31933
|
+
zIndex: LAYOUT_LEVEL.handler
|
|
31934
|
+
}), startHandlerStyle), {
|
|
31557
31935
|
pickable: !zoomLock && (null === (_0 = startHandlerStyle.pickable) || void 0 === _0 || _0)
|
|
31558
31936
|
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
31559
31937
|
x: position.x + width / 2,
|
|
31560
31938
|
y: position.y + end * height,
|
|
31561
31939
|
size: width,
|
|
31562
|
-
symbolType: null !== (_1 = endHandlerStyle.symbolType) && void 0 !== _1 ? _1 : "square"
|
|
31940
|
+
symbolType: null !== (_1 = endHandlerStyle.symbolType) && void 0 !== _1 ? _1 : "square",
|
|
31941
|
+
zIndex: LAYOUT_LEVEL.handler
|
|
31563
31942
|
}, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
|
|
31564
31943
|
pickable: !zoomLock && (null === (_2 = endHandlerStyle.pickable) || void 0 === _2 || _2)
|
|
31565
31944
|
}), "symbol");
|
|
@@ -31574,7 +31953,7 @@
|
|
|
31574
31953
|
height: endHandlerWidth,
|
|
31575
31954
|
fill: "white",
|
|
31576
31955
|
fillOpacity: 0,
|
|
31577
|
-
zIndex:
|
|
31956
|
+
zIndex: LAYOUT_LEVEL.handlerMask
|
|
31578
31957
|
}, DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
31579
31958
|
pickable: !zoomLock
|
|
31580
31959
|
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
@@ -31584,7 +31963,7 @@
|
|
|
31584
31963
|
height: endHandlerWidth,
|
|
31585
31964
|
fill: "white",
|
|
31586
31965
|
fillOpacity: 0,
|
|
31587
|
-
zIndex:
|
|
31966
|
+
zIndex: LAYOUT_LEVEL.handlerMask
|
|
31588
31967
|
}, DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
31589
31968
|
pickable: !zoomLock
|
|
31590
31969
|
}), "rect");
|
|
@@ -31613,7 +31992,8 @@
|
|
|
31613
31992
|
y: position.y,
|
|
31614
31993
|
width: (end - start) * width,
|
|
31615
31994
|
height: height,
|
|
31616
|
-
cursor: brushSelect ? "crosshair" : "move"
|
|
31995
|
+
cursor: brushSelect ? "crosshair" : "move",
|
|
31996
|
+
zIndex: LAYOUT_LEVEL.selectedBackground
|
|
31617
31997
|
}, selectedBackgroundStyle), {
|
|
31618
31998
|
pickable: !zoomLock && (null === (_a = selectedBackgroundChartStyle.pickable) || void 0 === _a || _a)
|
|
31619
31999
|
}), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
@@ -31621,14 +32001,16 @@
|
|
|
31621
32001
|
y: position.y + start * height,
|
|
31622
32002
|
width: width,
|
|
31623
32003
|
height: (end - start) * height,
|
|
31624
|
-
cursor: brushSelect ? "crosshair" : "move"
|
|
32004
|
+
cursor: brushSelect ? "crosshair" : "move",
|
|
32005
|
+
zIndex: LAYOUT_LEVEL.selectedBackground
|
|
31625
32006
|
}, selectedBackgroundStyle), {
|
|
31626
32007
|
pickable: !zoomLock && (null === (_b = selectedBackgroundStyle.pickable) || void 0 === _b || _b)
|
|
31627
32008
|
}), "rect");
|
|
31628
32009
|
}
|
|
31629
32010
|
_setPreviewAttributes(type, group) {
|
|
31630
32011
|
this._previewGroup || (this._previewGroup = group.createOrUpdateChild("previewGroup", {
|
|
31631
|
-
pickable: !1
|
|
32012
|
+
pickable: !1,
|
|
32013
|
+
zIndex: LAYOUT_LEVEL.preview
|
|
31632
32014
|
}, "group")), "line" === type ? this._previewLine = this._previewGroup.createOrUpdateChild("previewLine", {}, "line") : this._previewArea = this._previewGroup.createOrUpdateChild("previewArea", {
|
|
31633
32015
|
curveType: "basis"
|
|
31634
32016
|
}, "area");
|
|
@@ -31647,7 +32029,8 @@
|
|
|
31647
32029
|
}
|
|
31648
32030
|
_setSelectedPreviewClipAttributes(type, group) {
|
|
31649
32031
|
this._selectedPreviewGroupClip || (this._selectedPreviewGroupClip = group.createOrUpdateChild("selectedPreviewGroupClip", {
|
|
31650
|
-
pickable: !1
|
|
32032
|
+
pickable: !1,
|
|
32033
|
+
zIndex: LAYOUT_LEVEL.selectedPreview
|
|
31651
32034
|
}, "group"), this._selectedPreviewGroup = this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup", {}, "group"));
|
|
31652
32035
|
const {
|
|
31653
32036
|
start: start,
|
|
@@ -31849,7 +32232,8 @@
|
|
|
31849
32232
|
visible: this._showText,
|
|
31850
32233
|
pickable: !1,
|
|
31851
32234
|
childrenPickable: !1,
|
|
31852
|
-
textStyle: startTextAlignStyle
|
|
32235
|
+
textStyle: startTextAlignStyle,
|
|
32236
|
+
zIndex: LAYOUT_LEVEL.handlerText
|
|
31853
32237
|
}), "data-zoom-start-text"), this._endText = this._maybeAddLabel(this._getContainer(), merge({}, restEndTextStyle, {
|
|
31854
32238
|
text: endTextValue,
|
|
31855
32239
|
x: endTextPosition.x,
|
|
@@ -31857,7 +32241,8 @@
|
|
|
31857
32241
|
visible: this._showText,
|
|
31858
32242
|
pickable: !1,
|
|
31859
32243
|
childrenPickable: !1,
|
|
31860
|
-
textStyle: endTextAlignStyle
|
|
32244
|
+
textStyle: endTextAlignStyle,
|
|
32245
|
+
zIndex: LAYOUT_LEVEL.handlerText
|
|
31861
32246
|
}), "data-zoom-end-text");
|
|
31862
32247
|
}
|
|
31863
32248
|
_maybeAddLabel(container, attributes, name) {
|
|
@@ -31981,7 +32366,7 @@
|
|
|
31981
32366
|
});
|
|
31982
32367
|
}
|
|
31983
32368
|
clearVGlobalEvents() {
|
|
31984
|
-
("browser" === vglobal.env ? vglobal : this.stage).
|
|
32369
|
+
("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
|
|
31985
32370
|
passive: !1
|
|
31986
32371
|
});
|
|
31987
32372
|
}
|
|
@@ -33701,7 +34086,31 @@
|
|
|
33701
34086
|
return graphicCreator.symbol(style);
|
|
33702
34087
|
}
|
|
33703
34088
|
_renderHandlerText(value, position) {
|
|
33704
|
-
|
|
34089
|
+
return graphicCreator.text(this._getHandlerTextAttributes(value, position));
|
|
34090
|
+
}
|
|
34091
|
+
_getHandlerPosition(isStart) {
|
|
34092
|
+
return this.attribute.range && isStart ? "start" : "end";
|
|
34093
|
+
}
|
|
34094
|
+
_getHandlerTextStyle(value, position) {
|
|
34095
|
+
const {
|
|
34096
|
+
align: align,
|
|
34097
|
+
handlerSize = 14,
|
|
34098
|
+
handlerText = {},
|
|
34099
|
+
railHeight: railHeight,
|
|
34100
|
+
railWidth: railWidth,
|
|
34101
|
+
slidable: slidable
|
|
34102
|
+
} = this.attribute;
|
|
34103
|
+
return isFunction$3(handlerText.style) ? handlerText.style(value, position, {
|
|
34104
|
+
layout: this.attribute.layout,
|
|
34105
|
+
align: align,
|
|
34106
|
+
railWidth: railWidth,
|
|
34107
|
+
railHeight: railHeight,
|
|
34108
|
+
handlerSize: handlerSize,
|
|
34109
|
+
slidable: slidable
|
|
34110
|
+
}) : handlerText.style;
|
|
34111
|
+
}
|
|
34112
|
+
_getHandlerTextAttributes(value, position) {
|
|
34113
|
+
var _a, _b;
|
|
33705
34114
|
const {
|
|
33706
34115
|
align: align,
|
|
33707
34116
|
handlerSize = 14,
|
|
@@ -33713,13 +34122,13 @@
|
|
|
33713
34122
|
isHorizontal = this._isHorizontal,
|
|
33714
34123
|
pos = this.calculatePosByValue(value, position),
|
|
33715
34124
|
textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
|
|
34125
|
+
handlerTextStyle = this._getHandlerTextStyle(value, position),
|
|
33716
34126
|
textStyle = {
|
|
33717
34127
|
text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
|
|
33718
|
-
lineHeight: null
|
|
34128
|
+
lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
|
|
33719
34129
|
cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
|
|
33720
34130
|
};
|
|
33721
|
-
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);
|
|
33722
|
-
return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
|
|
34131
|
+
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);
|
|
33723
34132
|
}
|
|
33724
34133
|
_renderTooltip() {
|
|
33725
34134
|
var _a;
|
|
@@ -33847,31 +34256,19 @@
|
|
|
33847
34256
|
}
|
|
33848
34257
|
}
|
|
33849
34258
|
_updateHandler(handler, position, value) {
|
|
33850
|
-
var _a;
|
|
33851
34259
|
const isHorizontal = this._isHorizontal;
|
|
33852
34260
|
handler.setAttribute(isHorizontal ? "x" : "y", position);
|
|
33853
34261
|
const updateHandlerText = handler.name === SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
|
|
33854
34262
|
if (updateHandlerText) {
|
|
33855
|
-
const
|
|
33856
|
-
|
|
33857
|
-
} = this.attribute;
|
|
33858
|
-
updateHandlerText.setAttributes({
|
|
33859
|
-
text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
|
|
33860
|
-
[isHorizontal ? "x" : "y"]: position
|
|
33861
|
-
});
|
|
34263
|
+
const handlerPosition = this._getHandlerPosition(handler.name === SLIDER_ELEMENT_NAME.startHandler);
|
|
34264
|
+
updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
|
|
33862
34265
|
}
|
|
33863
34266
|
handler.name === SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
|
|
33864
34267
|
}
|
|
33865
34268
|
_updateHandlerText(handlerText, position, value) {
|
|
33866
|
-
var _a;
|
|
33867
34269
|
const isHorizontal = this._isHorizontal,
|
|
33868
|
-
|
|
33869
|
-
|
|
33870
|
-
} = this.attribute;
|
|
33871
|
-
handlerText.setAttributes({
|
|
33872
|
-
[isHorizontal ? "x" : "y"]: position,
|
|
33873
|
-
text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
|
|
33874
|
-
});
|
|
34270
|
+
handlerPosition = this._getHandlerPosition(handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText);
|
|
34271
|
+
handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
|
|
33875
34272
|
const updateHandler = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
|
|
33876
34273
|
updateHandler && updateHandler.setAttributes({
|
|
33877
34274
|
[isHorizontal ? "x" : "y"]: position
|
|
@@ -33907,7 +34304,7 @@
|
|
|
33907
34304
|
};
|
|
33908
34305
|
}
|
|
33909
34306
|
release(all) {
|
|
33910
|
-
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).
|
|
34307
|
+
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
|
|
33911
34308
|
passive: !1
|
|
33912
34309
|
}), this._clearAllDragEvents();
|
|
33913
34310
|
}
|
|
@@ -60091,11 +60488,11 @@
|
|
|
60091
60488
|
onUpdate(end, ratio, out) {
|
|
60092
60489
|
if (this.from.x !== this.to.x) {
|
|
60093
60490
|
const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
|
|
60094
|
-
this.params.table.scrollLeft = x;
|
|
60491
|
+
this.params.table.scrollLeft = x, 1 === ratio && -1 !== this.to.targetCol && this.params.table.scrollToCol(this.to.targetCol, !1);
|
|
60095
60492
|
}
|
|
60096
60493
|
if (this.from.y !== this.to.y) {
|
|
60097
60494
|
const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
|
|
60098
|
-
this.params.table.scrollTop = y;
|
|
60495
|
+
this.params.table.scrollTop = y, 1 === ratio && -1 !== this.to.targetRow && this.params.table.scrollToRow(this.to.targetRow, !1);
|
|
60099
60496
|
}
|
|
60100
60497
|
}
|
|
60101
60498
|
}
|
|
@@ -60127,7 +60524,9 @@
|
|
|
60127
60524
|
colDecimal && (left += colDecimal * cellRect.width), rowDecimal && (top += rowDecimal * cellRect.height);
|
|
60128
60525
|
const to = {
|
|
60129
60526
|
x: isNumber$2(col) ? left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
|
|
60130
|
-
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop
|
|
60527
|
+
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop,
|
|
60528
|
+
targetCol: null != col ? col : -1,
|
|
60529
|
+
targetRow: null != row ? row : -1
|
|
60131
60530
|
},
|
|
60132
60531
|
duration = isBoolean$2(animationOption) ? animationOption ? 3e3 : 0 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3,
|
|
60133
60532
|
easing = isBoolean$2(animationOption) ? animationOption ? "linear" : "" : null !== (_b = null == animationOption ? void 0 : animationOption.easing) && void 0 !== _b ? _b : "linear";
|
|
@@ -60214,7 +60613,7 @@
|
|
|
60214
60613
|
}
|
|
60215
60614
|
constructor(container, options = {}) {
|
|
60216
60615
|
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;
|
|
60217
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.22.13-alpha.
|
|
60616
|
+
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");
|
|
60218
60617
|
this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
60219
60618
|
options: options,
|
|
60220
60619
|
container: container
|
|
@@ -61143,17 +61542,18 @@
|
|
|
61143
61542
|
this.release();
|
|
61144
61543
|
}
|
|
61145
61544
|
release() {
|
|
61146
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
61545
|
+
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;
|
|
61546
|
+
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();
|
|
61147
61547
|
const internalProps = this.internalProps;
|
|
61148
61548
|
if (this.isReleased) return;
|
|
61149
|
-
null === (
|
|
61549
|
+
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 => {
|
|
61150
61550
|
null == legend || legend.release();
|
|
61151
|
-
}), null === (
|
|
61551
|
+
}), 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 => {
|
|
61152
61552
|
var _a;
|
|
61153
61553
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
61154
61554
|
}), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
61155
|
-
const parentElement = null === (
|
|
61156
|
-
parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), null === (
|
|
61555
|
+
const parentElement = null === (_x = internalProps.element) || void 0 === _x ? void 0 : _x.parentElement;
|
|
61556
|
+
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();
|
|
61157
61557
|
}
|
|
61158
61558
|
fireListeners(type, event) {
|
|
61159
61559
|
return super.fireListeners(type, event);
|
|
@@ -62322,6 +62722,7 @@
|
|
|
62322
62722
|
});
|
|
62323
62723
|
}
|
|
62324
62724
|
scrollToCell(cellAddr, animationOption) {
|
|
62725
|
+
var _a;
|
|
62325
62726
|
if (animationOption) return void this.animationManager.scrollTo(cellAddr, animationOption);
|
|
62326
62727
|
const drawRange = this.getDrawRange();
|
|
62327
62728
|
if (isValid$1(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
|
|
@@ -62331,8 +62732,10 @@
|
|
|
62331
62732
|
}
|
|
62332
62733
|
if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
|
|
62333
62734
|
const frozenHeight = this.getFrozenRowsHeight(),
|
|
62334
|
-
|
|
62335
|
-
|
|
62735
|
+
rowInt = Math.floor(cellAddr.row),
|
|
62736
|
+
rowFloat = cellAddr.row - rowInt;
|
|
62737
|
+
let top = this.internalProps._rowHeightsMap.getSumInRange(0, rowInt - 1);
|
|
62738
|
+
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);
|
|
62336
62739
|
}
|
|
62337
62740
|
this.render();
|
|
62338
62741
|
}
|
|
@@ -76532,7 +76935,7 @@
|
|
|
76532
76935
|
PluginManager: PluginManager
|
|
76533
76936
|
});
|
|
76534
76937
|
|
|
76535
|
-
const version = "1.22.13-alpha.
|
|
76938
|
+
const version = "1.22.13-alpha.11";
|
|
76536
76939
|
|
|
76537
76940
|
exports.Gantt = Gantt;
|
|
76538
76941
|
exports.TYPES = index$4;
|