@visactor/vrender-components 1.1.0-alpha.20 → 1.1.0-alpha.22
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/brush/brush.d.ts +4 -0
- package/cjs/brush/brush.js +30 -13
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/arc.js +13 -8
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +2 -0
- package/cjs/label/base.js +18 -8
- package/cjs/label/base.js.map +1 -1
- package/dist/index.es.js +181 -43
- package/es/brush/brush.d.ts +4 -0
- package/es/brush/brush.js +30 -14
- package/es/brush/brush.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/arc.js +13 -8
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +2 -0
- package/es/label/base.js +18 -8
- package/es/label/base.js.map +1 -1
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
|
@@ -2538,6 +2538,11 @@ class ResourceLoader {
|
|
|
2538
2538
|
data.loadState = (null == res ? void 0 : res.data) ? "success" : "fail", data.data = null == res ? void 0 : res.data, null === (_a = data.waitingMark) || void 0 === _a || _a.map((mark, index) => {
|
|
2539
2539
|
(null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(svgStr, res.data)) : (data.loadState = "fail", mark.imageLoadFail(svgStr));
|
|
2540
2540
|
}), data.waitingMark && (data.waitingMark = []);
|
|
2541
|
+
}).catch(() => {
|
|
2542
|
+
var _a;
|
|
2543
|
+
data.loadState = "fail", null === (_a = data.waitingMark) || void 0 === _a || _a.map(mark => {
|
|
2544
|
+
mark.imageLoadFail(svgStr);
|
|
2545
|
+
}), data.waitingMark && (data.waitingMark = []);
|
|
2541
2546
|
})) : (data.loadState = "fail", mark.imageLoadFail(svgStr)));
|
|
2542
2547
|
}
|
|
2543
2548
|
static GetFile(url, type) {
|
|
@@ -6138,10 +6143,18 @@ class Graphic extends Node {
|
|
|
6138
6143
|
setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
|
|
6139
6144
|
if (!params) return;
|
|
6140
6145
|
const keys = Object.keys(params);
|
|
6141
|
-
this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.visitTrackedAnimates(animate => {
|
|
6146
|
+
this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.syncFinalAttributesFromUpdateContext(context), this.visitTrackedAnimates(animate => {
|
|
6142
6147
|
(animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
|
|
6143
6148
|
}), this.applyTransientAttributes(params, forceUpdateTag, context);
|
|
6144
6149
|
}
|
|
6150
|
+
syncFinalAttributesFromUpdateContext(context) {
|
|
6151
|
+
var _a;
|
|
6152
|
+
const updateType = null == context ? void 0 : context.type;
|
|
6153
|
+
if (updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
|
|
6154
|
+
const finalAttrs = null === (_a = this.context) || void 0 === _a ? void 0 : _a.finalAttrs,
|
|
6155
|
+
setFinalAttributes = this.setFinalAttributes;
|
|
6156
|
+
finalAttrs && "function" == typeof setFinalAttributes && setFinalAttributes.call(this, finalAttrs);
|
|
6157
|
+
}
|
|
6145
6158
|
captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
|
|
6146
6159
|
var _a, _b;
|
|
6147
6160
|
const graphicContext = this.context,
|
|
@@ -11972,6 +11985,7 @@ class CanvasLayerHandlerContribution {
|
|
|
11972
11985
|
if (this.layer = layer, this.window = window, params.main) this.main = !0, this.context = window.getContext(), this.canvas = this.context.getCanvas();else {
|
|
11973
11986
|
let nativeCanvas;
|
|
11974
11987
|
this.main = !1, params.canvasId && (nativeCanvas = this.global.getElementById(params.canvasId)), nativeCanvas || (nativeCanvas = this.global.createCanvas({
|
|
11988
|
+
id: params.canvasId,
|
|
11975
11989
|
width: window.width,
|
|
11976
11990
|
height: window.height
|
|
11977
11991
|
})), nativeCanvas.style && (nativeCanvas.style["pointer-events"] = "none");
|
|
@@ -20955,7 +20969,7 @@ class AnimateExecutor {
|
|
|
20955
20969
|
AnimateExecutor.builtInAnimateMap[name] = animate;
|
|
20956
20970
|
}
|
|
20957
20971
|
constructor(target) {
|
|
20958
|
-
this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
|
|
20972
|
+
this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._activeConfigList = null, this._target = target;
|
|
20959
20973
|
}
|
|
20960
20974
|
get started() {
|
|
20961
20975
|
return this._started;
|
|
@@ -21064,7 +21078,15 @@ class AnimateExecutor {
|
|
|
21064
21078
|
return parsedParams;
|
|
21065
21079
|
}
|
|
21066
21080
|
execute(params) {
|
|
21067
|
-
Array.isArray(params)
|
|
21081
|
+
if (Array.isArray(params)) {
|
|
21082
|
+
const prevConfigList = this._activeConfigList;
|
|
21083
|
+
this._activeConfigList = params;
|
|
21084
|
+
try {
|
|
21085
|
+
params.forEach(param => this._execute(param));
|
|
21086
|
+
} finally {
|
|
21087
|
+
this._activeConfigList = prevConfigList;
|
|
21088
|
+
}
|
|
21089
|
+
} else this._execute(params);
|
|
21068
21090
|
}
|
|
21069
21091
|
_execute(params) {
|
|
21070
21092
|
if (params.selfOnly) return this._executeItem(params, this._target, 0, 1);
|
|
@@ -21090,6 +21112,7 @@ class AnimateExecutor {
|
|
|
21090
21112
|
}
|
|
21091
21113
|
executeTypeConfigItem(params, graphic, index, count) {
|
|
21092
21114
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
21115
|
+
this.syncFinalAttrsFromContext(graphic);
|
|
21093
21116
|
const {
|
|
21094
21117
|
type = "fromTo",
|
|
21095
21118
|
channel: channel,
|
|
@@ -21120,7 +21143,7 @@ class AnimateExecutor {
|
|
|
21120
21143
|
props = params.to,
|
|
21121
21144
|
from = params.from;
|
|
21122
21145
|
const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
|
|
21123
|
-
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
21146
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel, this.getAttrOutChannelExcludedKeys(graphic))), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel, this.getAttrOutChannelExcludedKeys(graphic))), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
21124
21147
|
let totalDelay = 0;
|
|
21125
21148
|
oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
|
|
21126
21149
|
const delayAfterValue = isFunction(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
|
|
@@ -21142,6 +21165,7 @@ class AnimateExecutor {
|
|
|
21142
21165
|
}
|
|
21143
21166
|
executeTimelineItem(params, graphic, index, count) {
|
|
21144
21167
|
var _a, _b, _c, _d;
|
|
21168
|
+
this.syncFinalAttrsFromContext(graphic);
|
|
21145
21169
|
const {
|
|
21146
21170
|
timeSlices: timeSlices,
|
|
21147
21171
|
startTime = 0,
|
|
@@ -21184,7 +21208,7 @@ class AnimateExecutor {
|
|
|
21184
21208
|
props = effect.to,
|
|
21185
21209
|
from = effect.from;
|
|
21186
21210
|
const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
|
|
21187
|
-
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel);
|
|
21211
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel, this.getAttrOutChannelExcludedKeys(graphic))), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel, this.getAttrOutChannelExcludedKeys(graphic))), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel);
|
|
21188
21212
|
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
21189
21213
|
customType = effect.custom ? effect.customType : getCustomType(custom);
|
|
21190
21214
|
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
@@ -21205,7 +21229,7 @@ class AnimateExecutor {
|
|
|
21205
21229
|
const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
|
|
21206
21230
|
animate.play(customAnimate);
|
|
21207
21231
|
}
|
|
21208
|
-
createPropsFromChannel(channel, graphic, includeAttrOutChannel = !0) {
|
|
21232
|
+
createPropsFromChannel(channel, graphic, includeAttrOutChannel = !0, excludedAttrOutKeys) {
|
|
21209
21233
|
var _a;
|
|
21210
21234
|
const props = {};
|
|
21211
21235
|
let from = null;
|
|
@@ -21226,7 +21250,7 @@ class AnimateExecutor {
|
|
|
21226
21250
|
}), diffAttrs && attrOutChannel) for (const key in diffAttrs) {
|
|
21227
21251
|
const value = diffAttrs[key];
|
|
21228
21252
|
if (void 0 === value) continue;
|
|
21229
|
-
props.hasOwnProperty(key) || !!(null == from ? void 0 : from.hasOwnProperty(key)) || (attrOutChannel[key] = value, hasAttrs = !0);
|
|
21253
|
+
props.hasOwnProperty(key) || !!(null == from ? void 0 : from.hasOwnProperty(key)) || (null == excludedAttrOutKeys ? void 0 : excludedAttrOutKeys[key]) || (attrOutChannel[key] = value, hasAttrs = !0);
|
|
21230
21254
|
}
|
|
21231
21255
|
return {
|
|
21232
21256
|
from: from,
|
|
@@ -21238,8 +21262,78 @@ class AnimateExecutor {
|
|
|
21238
21262
|
var _a, _b;
|
|
21239
21263
|
return void 0 === value ? defaultValue : "function" == typeof value && graphic ? value(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : value;
|
|
21240
21264
|
}
|
|
21265
|
+
getAttrOutChannelExcludedKeys(graphic) {
|
|
21266
|
+
var _a;
|
|
21267
|
+
const configList = this._activeConfigList,
|
|
21268
|
+
diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
|
|
21269
|
+
if (!configList || configList.length <= 1 || !diffAttrs) return null;
|
|
21270
|
+
let excludedKeys = null;
|
|
21271
|
+
for (let i = 0; i < configList.length; i++) excludedKeys = this.collectAnimatedDiffKeys(configList[i], graphic, diffAttrs, excludedKeys);
|
|
21272
|
+
return excludedKeys;
|
|
21273
|
+
}
|
|
21274
|
+
collectAnimatedDiffKeys(config, graphic, diffAttrs, keys) {
|
|
21275
|
+
if ("timeSlices" in config) {
|
|
21276
|
+
const slices = Array.isArray(config.timeSlices) ? config.timeSlices : [config.timeSlices];
|
|
21277
|
+
for (let i = 0; i < slices.length; i++) {
|
|
21278
|
+
const effects = Array.isArray(slices[i].effects) ? slices[i].effects : [slices[i].effects];
|
|
21279
|
+
for (let j = 0; j < effects.length; j++) keys = this.collectAnimatedDiffKeysFromEffect(effects[j], graphic, diffAttrs, keys);
|
|
21280
|
+
}
|
|
21281
|
+
return keys;
|
|
21282
|
+
}
|
|
21283
|
+
return this.collectAnimatedDiffKeysFromEffect(config, graphic, diffAttrs, keys);
|
|
21284
|
+
}
|
|
21285
|
+
collectAnimatedDiffKeysFromEffect(effect, graphic, diffAttrs, keys) {
|
|
21286
|
+
var _a;
|
|
21287
|
+
if ("update" === (null !== (_a = effect.type) && void 0 !== _a ? _a : "fromTo")) {
|
|
21288
|
+
const options = this.resolveValue(effect.options, graphic, void 0),
|
|
21289
|
+
excludeChannels = null == options ? void 0 : options.excludeChannels;
|
|
21290
|
+
for (const key in diffAttrs) Object.prototype.hasOwnProperty.call(diffAttrs, key) && void 0 !== diffAttrs[key] && !this.includesChannel(excludeChannels, key) && (null != keys || (keys = {}), keys[key] = !0);
|
|
21291
|
+
return keys;
|
|
21292
|
+
}
|
|
21293
|
+
return keys = this.collectExplicitAnimatedKeys(effect.to, diffAttrs, keys), keys = this.collectExplicitAnimatedKeys(effect.from, diffAttrs, keys), this.collectChannelAnimatedKeys(effect.channel, diffAttrs, keys);
|
|
21294
|
+
}
|
|
21295
|
+
collectExplicitAnimatedKeys(attrs, diffAttrs, keys) {
|
|
21296
|
+
if (!attrs) return keys;
|
|
21297
|
+
for (const key in attrs) Object.prototype.hasOwnProperty.call(attrs, key) && Object.prototype.hasOwnProperty.call(diffAttrs, key) && void 0 !== diffAttrs[key] && (null != keys || (keys = {}), keys[key] = !0);
|
|
21298
|
+
return keys;
|
|
21299
|
+
}
|
|
21300
|
+
collectChannelAnimatedKeys(channel, diffAttrs, keys) {
|
|
21301
|
+
if (!channel) return keys;
|
|
21302
|
+
if (Array.isArray(channel)) {
|
|
21303
|
+
for (let i = 0; i < channel.length; i++) {
|
|
21304
|
+
const key = channel[i];
|
|
21305
|
+
Object.prototype.hasOwnProperty.call(diffAttrs, key) && void 0 !== diffAttrs[key] && (null != keys || (keys = {}), keys[key] = !0);
|
|
21306
|
+
}
|
|
21307
|
+
return keys;
|
|
21308
|
+
}
|
|
21309
|
+
for (const key in channel) if (Object.prototype.hasOwnProperty.call(channel, key) && Object.prototype.hasOwnProperty.call(diffAttrs, key) && void 0 !== diffAttrs[key]) {
|
|
21310
|
+
const config = channel[key];
|
|
21311
|
+
void 0 === config.to && void 0 === config.from || (null != keys || (keys = {}), keys[key] = !0);
|
|
21312
|
+
}
|
|
21313
|
+
return keys;
|
|
21314
|
+
}
|
|
21315
|
+
includesChannel(channels, key) {
|
|
21316
|
+
if (!(null == channels ? void 0 : channels.length)) return !1;
|
|
21317
|
+
for (let i = 0; i < channels.length; i++) if (channels[i] === key) return !0;
|
|
21318
|
+
return !1;
|
|
21319
|
+
}
|
|
21320
|
+
syncFinalAttrsFromContext(graphic) {
|
|
21321
|
+
var _a;
|
|
21322
|
+
const finalAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.finalAttrs,
|
|
21323
|
+
setFinalAttributes = graphic.setFinalAttributes;
|
|
21324
|
+
finalAttrs && "function" == typeof setFinalAttributes && setFinalAttributes.call(graphic, finalAttrs);
|
|
21325
|
+
}
|
|
21241
21326
|
executeItem(params, graphic, index = 0, count = 1) {
|
|
21242
|
-
|
|
21327
|
+
if (Array.isArray(params)) {
|
|
21328
|
+
const prevConfigList = this._activeConfigList;
|
|
21329
|
+
this._activeConfigList = params;
|
|
21330
|
+
try {
|
|
21331
|
+
return params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean);
|
|
21332
|
+
} finally {
|
|
21333
|
+
this._activeConfigList = prevConfigList;
|
|
21334
|
+
}
|
|
21335
|
+
}
|
|
21336
|
+
return [this._executeItem(params, graphic, index, count)].filter(Boolean);
|
|
21243
21337
|
}
|
|
21244
21338
|
_executeItem(params, graphic, index = 0, count = 1) {
|
|
21245
21339
|
if (!graphic) return null;
|
|
@@ -21533,9 +21627,7 @@ class AnimateExtension {
|
|
|
21533
21627
|
return this.initAnimateExecutor(), this._animateExecutor.execute(config), this;
|
|
21534
21628
|
}
|
|
21535
21629
|
executeAnimations(configs) {
|
|
21536
|
-
return this.initAnimateExecutor(),
|
|
21537
|
-
this._animateExecutor.execute(config);
|
|
21538
|
-
}), this;
|
|
21630
|
+
return this.initAnimateExecutor(), this._animateExecutor.execute(configs), this;
|
|
21539
21631
|
}
|
|
21540
21632
|
getFinalAttribute() {
|
|
21541
21633
|
return this.finalAttribute;
|
|
@@ -24444,8 +24536,9 @@ class LabelBase extends AnimateComponent {
|
|
|
24444
24536
|
}, attrs, new CustomPath2D());
|
|
24445
24537
|
};
|
|
24446
24538
|
}
|
|
24447
|
-
|
|
24448
|
-
|
|
24539
|
+
const baseMarkAttrs = baseMark && this.getGraphicFinalLayoutAttributes(baseMark);
|
|
24540
|
+
if (baseMarkAttrs === null || baseMarkAttrs === void 0 ? void 0 : baseMarkAttrs.fill) {
|
|
24541
|
+
lineGraphic.setAttribute('stroke', baseMarkAttrs.fill);
|
|
24449
24542
|
}
|
|
24450
24543
|
if (this.attribute.line && !isEmpty(this.attribute.line.style)) {
|
|
24451
24544
|
lineGraphic.setAttributes(this.attribute.line.style);
|
|
@@ -24548,7 +24641,7 @@ class LabelBase extends AnimateComponent {
|
|
|
24548
24641
|
if (this._enableAnimation !== false) {
|
|
24549
24642
|
this._baseMarks.forEach(mark => {
|
|
24550
24643
|
markAttributeList.push(cloneAttributeSnapshot(mark.attribute));
|
|
24551
|
-
mark.initAttributes(
|
|
24644
|
+
mark.initAttributes(this.getGraphicFinalLayoutAttributes(mark));
|
|
24552
24645
|
});
|
|
24553
24646
|
}
|
|
24554
24647
|
const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;
|
|
@@ -24717,6 +24810,14 @@ class LabelBase extends AnimateComponent {
|
|
|
24717
24810
|
getRelatedGraphic(item) {
|
|
24718
24811
|
return this._idToGraphic.get(item.id);
|
|
24719
24812
|
}
|
|
24813
|
+
getGraphicFinalLayoutAttributes(graphic) {
|
|
24814
|
+
var _a, _b;
|
|
24815
|
+
return ((_b = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.finalAttrs) !== null && _b !== void 0 ? _b : graphic.getAttributes(true));
|
|
24816
|
+
}
|
|
24817
|
+
hasGraphicContextFinalLayoutAttributes(graphic) {
|
|
24818
|
+
var _a;
|
|
24819
|
+
return !!((_a = graphic === null || graphic === void 0 ? void 0 : graphic.context) === null || _a === void 0 ? void 0 : _a.finalAttrs);
|
|
24820
|
+
}
|
|
24720
24821
|
_initText(data = []) {
|
|
24721
24822
|
const { textStyle = {} } = this.attribute;
|
|
24722
24823
|
const labels = [];
|
|
@@ -24726,7 +24827,7 @@ class LabelBase extends AnimateComponent {
|
|
|
24726
24827
|
if (!baseMark) {
|
|
24727
24828
|
continue;
|
|
24728
24829
|
}
|
|
24729
|
-
const graphicAttribute =
|
|
24830
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(baseMark);
|
|
24730
24831
|
const labelAttribute = Object.assign(Object.assign({ fill: this._isCollectionBase
|
|
24731
24832
|
? isArray(graphicAttribute.stroke)
|
|
24732
24833
|
? graphicAttribute.stroke.find(entry => !!entry && entry !== true)
|
|
@@ -24978,9 +25079,9 @@ class LabelBase extends AnimateComponent {
|
|
|
24978
25079
|
var _a;
|
|
24979
25080
|
if (graphic) {
|
|
24980
25081
|
if (graphic.attribute.visible !== false) {
|
|
24981
|
-
if ((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.animationState) {
|
|
25082
|
+
if (((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.animationState) || this.hasGraphicContextFinalLayoutAttributes(graphic)) {
|
|
24982
25083
|
const clonedGraphic = graphic.clone();
|
|
24983
|
-
Object.assign(clonedGraphic.attribute,
|
|
25084
|
+
Object.assign(clonedGraphic.attribute, this.getGraphicFinalLayoutAttributes(graphic));
|
|
24984
25085
|
return clonedGraphic.AABBBounds;
|
|
24985
25086
|
}
|
|
24986
25087
|
return graphic.AABBBounds;
|
|
@@ -25169,8 +25270,9 @@ class LabelBase extends AnimateComponent {
|
|
|
25169
25270
|
continue;
|
|
25170
25271
|
}
|
|
25171
25272
|
const baseMark = this.getRelatedGraphic(label.attribute);
|
|
25172
|
-
|
|
25173
|
-
|
|
25273
|
+
const baseMarkAttrs = this.getGraphicFinalLayoutAttributes(baseMark);
|
|
25274
|
+
let backgroundColor = baseMarkAttrs.fill;
|
|
25275
|
+
const backgroundOpacity = baseMarkAttrs.fillOpacity;
|
|
25174
25276
|
let foregroundColor = label.attribute.fill;
|
|
25175
25277
|
if (isObject(backgroundColor) && backgroundColor.gradient) {
|
|
25176
25278
|
const firstStopColor = (_g = (_f = backgroundColor.stops) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.color;
|
|
@@ -25511,15 +25613,16 @@ class ArcLabel extends LabelBase {
|
|
|
25511
25613
|
this._arcRight.clear();
|
|
25512
25614
|
this._ellipsisWidth = ellipsisWidth;
|
|
25513
25615
|
let maxRadius = 0;
|
|
25514
|
-
currentMarks.forEach(
|
|
25515
|
-
|
|
25516
|
-
|
|
25616
|
+
currentMarks.forEach(currentMark => {
|
|
25617
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
25618
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
25619
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
25517
25620
|
}
|
|
25518
25621
|
});
|
|
25519
25622
|
data.forEach((d, index) => {
|
|
25520
25623
|
var _a, _b;
|
|
25521
25624
|
const currentMark = this._idToGraphic.get(d.id);
|
|
25522
|
-
const graphicAttribute =
|
|
25625
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
25523
25626
|
const center = { x: (_a = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.x) !== null && _a !== void 0 ? _a : 0, y: (_b = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.y) !== null && _b !== void 0 ? _b : 0 };
|
|
25524
25627
|
if (!isNil(data[index]) && !isNil(textBoundsArray[index])) {
|
|
25525
25628
|
const item = data[index] ? data[index] : null;
|
|
@@ -25704,8 +25807,9 @@ class ArcLabel extends LabelBase {
|
|
|
25704
25807
|
};
|
|
25705
25808
|
let maxRadius = 0;
|
|
25706
25809
|
currentMarks.forEach((currentMark) => {
|
|
25707
|
-
|
|
25708
|
-
|
|
25810
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
25811
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
25812
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
25709
25813
|
}
|
|
25710
25814
|
});
|
|
25711
25815
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -25938,8 +26042,9 @@ class ArcLabel extends LabelBase {
|
|
|
25938
26042
|
const labelConfig = attribute;
|
|
25939
26043
|
let maxRadius = 0;
|
|
25940
26044
|
currentMarks.forEach((currentMark) => {
|
|
25941
|
-
|
|
25942
|
-
|
|
26045
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
26046
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
26047
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
25943
26048
|
}
|
|
25944
26049
|
});
|
|
25945
26050
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -25981,8 +26086,9 @@ class ArcLabel extends LabelBase {
|
|
|
25981
26086
|
const plotRect = { width: center.x * 2, height: center.y * 2 };
|
|
25982
26087
|
let maxRadius = 0;
|
|
25983
26088
|
currentMarks.forEach((currentMark) => {
|
|
25984
|
-
|
|
25985
|
-
|
|
26089
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
26090
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
26091
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
25986
26092
|
}
|
|
25987
26093
|
});
|
|
25988
26094
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -26053,8 +26159,9 @@ class ArcLabel extends LabelBase {
|
|
|
26053
26159
|
const line1MinLength = labelConfig.line.line1MinLength;
|
|
26054
26160
|
let maxRadius = 0;
|
|
26055
26161
|
currentMarks.forEach((currentMark) => {
|
|
26056
|
-
|
|
26057
|
-
|
|
26162
|
+
const graphicAttribute = this.getGraphicFinalLayoutAttributes(currentMark);
|
|
26163
|
+
if (graphicAttribute.outerRadius > maxRadius) {
|
|
26164
|
+
maxRadius = graphicAttribute.outerRadius;
|
|
26058
26165
|
}
|
|
26059
26166
|
});
|
|
26060
26167
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -26142,7 +26249,7 @@ class ArcLabel extends LabelBase {
|
|
|
26142
26249
|
});
|
|
26143
26250
|
}
|
|
26144
26251
|
if (baseMark.type === 'arc3d' && baseMark) {
|
|
26145
|
-
const { beta, x, y } =
|
|
26252
|
+
const { beta, x, y } = this.getGraphicFinalLayoutAttributes(baseMark);
|
|
26146
26253
|
lineGraphic.setAttributes({
|
|
26147
26254
|
beta,
|
|
26148
26255
|
anchor3d: [x, y]
|
|
@@ -33937,6 +34044,7 @@ class Brush extends AbstractComponent {
|
|
|
33937
34044
|
this._operatingMaskMoveDy = 0;
|
|
33938
34045
|
this._operatingMaskMoveRangeX = [-Infinity, Infinity];
|
|
33939
34046
|
this._operatingMaskMoveRangeY = [-Infinity, Infinity];
|
|
34047
|
+
this._brushEventStage = null;
|
|
33940
34048
|
this._brushMaskAABBBoundsDict = {};
|
|
33941
34049
|
this._firstUpdate = true;
|
|
33942
34050
|
this._onBrushStart = (e) => {
|
|
@@ -33947,8 +34055,12 @@ class Brush extends AbstractComponent {
|
|
|
33947
34055
|
return;
|
|
33948
34056
|
}
|
|
33949
34057
|
const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, brushMoved = true } = this.attribute;
|
|
33950
|
-
|
|
33951
|
-
|
|
34058
|
+
const stage = this.stage;
|
|
34059
|
+
if (!stage) {
|
|
34060
|
+
return;
|
|
34061
|
+
}
|
|
34062
|
+
array(updateTrigger).forEach(t => stage.addEventListener(t, this._onBrushingWithDelay));
|
|
34063
|
+
array(endTrigger).forEach(t => stage.addEventListener(t, this._onBrushEnd));
|
|
33952
34064
|
e.stopPropagation();
|
|
33953
34065
|
this._firstUpdate = true;
|
|
33954
34066
|
this._activeMoveState = brushMoved && this._isPosInBrushMask(e);
|
|
@@ -34012,10 +34124,15 @@ class Brush extends AbstractComponent {
|
|
|
34012
34124
|
if (this.attribute.disableTriggerEvent) {
|
|
34013
34125
|
return;
|
|
34014
34126
|
}
|
|
34127
|
+
const stage = this.stage;
|
|
34128
|
+
if (!stage) {
|
|
34129
|
+
return;
|
|
34130
|
+
}
|
|
34131
|
+
this._brushEventStage = stage;
|
|
34015
34132
|
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
|
|
34016
34133
|
.attribute;
|
|
34017
|
-
array(trigger).forEach(t =>
|
|
34018
|
-
array(resetTrigger).forEach(t =>
|
|
34134
|
+
array(trigger).forEach(t => stage.addEventListener(t, this._onBrushStart));
|
|
34135
|
+
array(resetTrigger).forEach(t => stage.addEventListener(t, this._onBrushClear));
|
|
34019
34136
|
}
|
|
34020
34137
|
_initDraw(e) {
|
|
34021
34138
|
if (this.attribute.interactive === false) {
|
|
@@ -34153,17 +34270,38 @@ class Brush extends AbstractComponent {
|
|
|
34153
34270
|
const group = this.createOrUpdateChild('brush-container', {}, 'group');
|
|
34154
34271
|
this._container = group;
|
|
34155
34272
|
}
|
|
34273
|
+
setStage(stage, layer) {
|
|
34274
|
+
if (this._brushEventStage && this._brushEventStage !== stage) {
|
|
34275
|
+
this.releaseBrushEvents();
|
|
34276
|
+
}
|
|
34277
|
+
super.setStage(stage, layer);
|
|
34278
|
+
}
|
|
34279
|
+
release(all) {
|
|
34280
|
+
this.releaseBrushEvents();
|
|
34281
|
+
super.release(all);
|
|
34282
|
+
}
|
|
34156
34283
|
releaseBrushEvents() {
|
|
34284
|
+
var _a;
|
|
34285
|
+
const stage = (_a = this._brushEventStage) !== null && _a !== void 0 ? _a : this.stage;
|
|
34286
|
+
if (!stage) {
|
|
34287
|
+
return;
|
|
34288
|
+
}
|
|
34157
34289
|
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
|
|
34158
34290
|
.attribute;
|
|
34159
|
-
array(trigger).forEach(t =>
|
|
34160
|
-
array(resetTrigger).forEach(t =>
|
|
34161
|
-
this._releaseBrushUpdateEvents();
|
|
34291
|
+
array(trigger).forEach(t => stage.removeEventListener(t, this._onBrushStart));
|
|
34292
|
+
array(resetTrigger).forEach(t => stage.removeEventListener(t, this._onBrushClear));
|
|
34293
|
+
this._releaseBrushUpdateEvents(stage);
|
|
34294
|
+
this._brushEventStage = null;
|
|
34162
34295
|
}
|
|
34163
|
-
_releaseBrushUpdateEvents() {
|
|
34296
|
+
_releaseBrushUpdateEvents(stage) {
|
|
34297
|
+
var _a;
|
|
34298
|
+
if (stage === void 0) { stage = (_a = this._brushEventStage) !== null && _a !== void 0 ? _a : this.stage; }
|
|
34299
|
+
if (!stage) {
|
|
34300
|
+
return;
|
|
34301
|
+
}
|
|
34164
34302
|
const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger } = this.attribute;
|
|
34165
|
-
array(updateTrigger).forEach(t =>
|
|
34166
|
-
array(endTrigger).forEach(t =>
|
|
34303
|
+
array(updateTrigger).forEach(t => stage.removeEventListener(t, this._onBrushingWithDelay));
|
|
34304
|
+
array(endTrigger).forEach(t => stage.removeEventListener(t, this._onBrushEnd));
|
|
34167
34305
|
}
|
|
34168
34306
|
_computeMaskPoints() {
|
|
34169
34307
|
const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute;
|
|
@@ -36768,6 +36906,6 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
36768
36906
|
select: true
|
|
36769
36907
|
};
|
|
36770
36908
|
|
|
36771
|
-
const version = "1.1.0-alpha.
|
|
36909
|
+
const version = "1.1.0-alpha.22";
|
|
36772
36910
|
|
|
36773
36911
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IDataZoomEvent, IDataZoomInteractiveEvent, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SeriesNumberCellStateValue, SeriesNumberEvent, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, TableSeriesNumber, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, installPoptipToApp, installScrollbarToApp, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|
package/es/brush/brush.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ILayer, IStage } from '@visactor/vrender-core';
|
|
1
2
|
import { AbstractComponent } from '../core/base';
|
|
2
3
|
import type { BrushAttributes } from './type';
|
|
3
4
|
import type { ComponentOptions } from '../interface';
|
|
@@ -39,6 +40,7 @@ export declare class Brush extends AbstractComponent<Required<BrushAttributes>>
|
|
|
39
40
|
private _operatingMaskMoveRangeY;
|
|
40
41
|
private _cacheMovePoint;
|
|
41
42
|
private _operatingMask;
|
|
43
|
+
private _brushEventStage;
|
|
42
44
|
private _brushMaskAABBBoundsDict;
|
|
43
45
|
private _firstUpdate;
|
|
44
46
|
private _startPos;
|
|
@@ -56,6 +58,8 @@ export declare class Brush extends AbstractComponent<Required<BrushAttributes>>
|
|
|
56
58
|
private _drawEnd;
|
|
57
59
|
private _moveEnd;
|
|
58
60
|
protected render(): void;
|
|
61
|
+
setStage(stage?: IStage, layer?: ILayer): void;
|
|
62
|
+
release(all?: boolean): void;
|
|
59
63
|
releaseBrushEvents(): void;
|
|
60
64
|
private _releaseBrushUpdateEvents;
|
|
61
65
|
private _computeMaskPoints;
|
package/es/brush/brush.js
CHANGED
|
@@ -23,15 +23,16 @@ export class Brush extends AbstractComponent {
|
|
|
23
23
|
this.name = "brush", this._activeBrushState = !1, this._activeDrawState = !1, this._cacheDrawPoints = [],
|
|
24
24
|
this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0,
|
|
25
25
|
this._operatingMaskMoveRangeX = [ -1 / 0, 1 / 0 ], this._operatingMaskMoveRangeY = [ -1 / 0, 1 / 0 ],
|
|
26
|
-
this._brushMaskAABBBoundsDict = {}, this._firstUpdate = !0,
|
|
26
|
+
this._brushEventStage = null, this._brushMaskAABBBoundsDict = {}, this._firstUpdate = !0,
|
|
27
|
+
this._onBrushStart = e => {
|
|
27
28
|
if (!1 === this.attribute.interactive) return;
|
|
28
29
|
if (!1 === this._beforeBrushEvent(e)) return;
|
|
29
|
-
const {updateTrigger: updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger: endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, brushMoved: brushMoved = !0} = this.attribute;
|
|
30
|
-
array(updateTrigger).forEach((t =>
|
|
31
|
-
array(endTrigger).forEach((t =>
|
|
32
|
-
|
|
30
|
+
const {updateTrigger: updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger: endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, brushMoved: brushMoved = !0} = this.attribute, stage = this.stage;
|
|
31
|
+
stage && (array(updateTrigger).forEach((t => stage.addEventListener(t, this._onBrushingWithDelay))),
|
|
32
|
+
array(endTrigger).forEach((t => stage.addEventListener(t, this._onBrushEnd))), e.stopPropagation(),
|
|
33
|
+
this._firstUpdate = !0, this._activeMoveState = brushMoved && this._isPosInBrushMask(e),
|
|
33
34
|
this._activeDrawState = !this._activeMoveState, this._startPos = this.eventPosToStagePos(e),
|
|
34
|
-
this._cacheDrawPoints = [ this._startPos ];
|
|
35
|
+
this._cacheDrawPoints = [ this._startPos ]);
|
|
35
36
|
}, this._onBrushing = e => {
|
|
36
37
|
!1 !== this.attribute.interactive && !1 !== this._beforeBrushEvent(e) && (this._outOfInteractiveRange(e) || (e.stopPropagation(),
|
|
37
38
|
this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e),
|
|
@@ -49,9 +50,11 @@ export class Brush extends AbstractComponent {
|
|
|
49
50
|
}
|
|
50
51
|
_bindBrushEvents() {
|
|
51
52
|
if (this.releaseBrushEvents(), this.attribute.disableTriggerEvent) return;
|
|
53
|
+
const stage = this.stage;
|
|
54
|
+
if (!stage) return;
|
|
55
|
+
this._brushEventStage = stage;
|
|
52
56
|
const {trigger: trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger: resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger} = this.attribute;
|
|
53
|
-
array(trigger).forEach((t =>
|
|
54
|
-
array(resetTrigger).forEach((t => this.stage.addEventListener(t, this._onBrushClear)));
|
|
57
|
+
array(trigger).forEach((t => stage.addEventListener(t, this._onBrushStart))), array(resetTrigger).forEach((t => stage.addEventListener(t, this._onBrushClear)));
|
|
55
58
|
}
|
|
56
59
|
_initDraw(e) {
|
|
57
60
|
if (!1 === this.attribute.interactive) return;
|
|
@@ -115,16 +118,29 @@ export class Brush extends AbstractComponent {
|
|
|
115
118
|
const group = this.createOrUpdateChild("brush-container", {}, "group");
|
|
116
119
|
this._container = group;
|
|
117
120
|
}
|
|
121
|
+
setStage(stage, layer) {
|
|
122
|
+
this._brushEventStage && this._brushEventStage !== stage && this.releaseBrushEvents(),
|
|
123
|
+
super.setStage(stage, layer);
|
|
124
|
+
}
|
|
125
|
+
release(all) {
|
|
126
|
+
this.releaseBrushEvents(), super.release(all);
|
|
127
|
+
}
|
|
118
128
|
releaseBrushEvents() {
|
|
129
|
+
var _a;
|
|
130
|
+
const stage = null !== (_a = this._brushEventStage) && void 0 !== _a ? _a : this.stage;
|
|
131
|
+
if (!stage) return;
|
|
119
132
|
const {trigger: trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger: resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger} = this.attribute;
|
|
120
|
-
array(trigger).forEach((t =>
|
|
121
|
-
array(resetTrigger).forEach((t =>
|
|
122
|
-
this._releaseBrushUpdateEvents();
|
|
133
|
+
array(trigger).forEach((t => stage.removeEventListener(t, this._onBrushStart))),
|
|
134
|
+
array(resetTrigger).forEach((t => stage.removeEventListener(t, this._onBrushClear))),
|
|
135
|
+
this._releaseBrushUpdateEvents(stage), this._brushEventStage = null;
|
|
123
136
|
}
|
|
124
|
-
_releaseBrushUpdateEvents() {
|
|
137
|
+
_releaseBrushUpdateEvents(stage) {
|
|
138
|
+
var _a;
|
|
139
|
+
if (void 0 === stage && (stage = null !== (_a = this._brushEventStage) && void 0 !== _a ? _a : this.stage),
|
|
140
|
+
!stage) return;
|
|
125
141
|
const {updateTrigger: updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger: endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger} = this.attribute;
|
|
126
|
-
array(updateTrigger).forEach((t =>
|
|
127
|
-
array(endTrigger).forEach((t =>
|
|
142
|
+
array(updateTrigger).forEach((t => stage.removeEventListener(t, this._onBrushingWithDelay))),
|
|
143
|
+
array(endTrigger).forEach((t => stage.removeEventListener(t, this._onBrushEnd)));
|
|
128
144
|
}
|
|
129
145
|
_computeMaskPoints() {
|
|
130
146
|
const {brushType: brushType, xRange: xRange = [ 0, 0 ], yRange: yRange = [ 0, 0 ]} = this.attribute;
|