@visactor/vchart-extension 2.0.0-alpha.4 → 2.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -10210,9 +10210,9 @@
10210
10210
  setWidthHeightWithoutTransform(aabbBounds) {
10211
10211
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
10212
10212
  }
10213
- setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context) {
10213
+ setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
10214
10214
  this.setAttributes(params, forceUpdateTag, context), this.animates && this.animates.forEach(animate => {
10215
- Object.keys(params).forEach(key => {
10215
+ (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach(key => {
10216
10216
  animate.preventAttr(key);
10217
10217
  });
10218
10218
  });
@@ -10383,7 +10383,7 @@
10383
10383
  });
10384
10384
  } else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
10385
10385
  type: AttributeUpdateType.STATE
10386
- });
10386
+ }), this.finalAttribute && Object.assign(this.finalAttribute, attrs);
10387
10387
  this._emitCustomEvent("afterStateUpdate", {
10388
10388
  type: AttributeUpdateType.STATE
10389
10389
  });
@@ -17689,6 +17689,10 @@
17689
17689
  target.attribute.x = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
17690
17690
  }, this.y = (key, from, to, ratio, step, target) => {
17691
17691
  target.attribute.y = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
17692
+ }, this.dx = (key, from, to, ratio, step, target) => {
17693
+ target.attribute.dx = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
17694
+ }, this.dy = (key, from, to, ratio, step, target) => {
17695
+ target.attribute.dy = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
17692
17696
  }, this.angle = (key, from, to, ratio, step, target) => {
17693
17697
  target.attribute.angle = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
17694
17698
  }, this.scaleX = (key, from, to, ratio, step, target) => {
@@ -17865,7 +17869,7 @@
17865
17869
  return this._animateCount;
17866
17870
  }
17867
17871
  constructor() {
17868
- super(), this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
17872
+ super(), this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this._animationEndFlag = !0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
17869
17873
  }
17870
17874
  isRunning() {
17871
17875
  return !this.paused && this._animateCount > 0;
@@ -17894,10 +17898,11 @@
17894
17898
  }
17895
17899
  tick(delta) {
17896
17900
  if (this.paused) return;
17901
+ this._animationEndFlag && (this._animationEndFlag = !1, this.emit("animationStart"));
17897
17902
  const scaledDelta = delta * this._playSpeed;
17898
17903
  this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
17899
17904
  animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0) : animate.status !== AnimateStatus.RUNNING && animate.status !== AnimateStatus.INITIAL || animate.advance(scaledDelta);
17900
- }), 0 === this._animateCount && this.emit("animationEnd");
17905
+ }), 0 === this._animateCount && (this._animationEndFlag = !0, this.emit("animationEnd"));
17901
17906
  }
17902
17907
  clear() {
17903
17908
  this.forEachAccessAnimate(animate => {
@@ -17961,7 +17966,9 @@
17961
17966
  return this._timeline;
17962
17967
  }
17963
17968
  bind(target) {
17964
- return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
17969
+ return this.target = target, this.target.animates || (this.target.animates = new Map()), this.target.animates.set(this.id, this), this.onRemove(() => {
17970
+ this.stop(), this.target.animates.delete(this.id);
17971
+ }), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
17965
17972
  }
17966
17973
  to(props, duration = 300, easing = "linear") {
17967
17974
  const step = new Step(AnimateStepType.to, props, duration, easing);
@@ -18175,8 +18182,8 @@
18175
18182
  }
18176
18183
  init() {
18177
18184
  this.interval = 16, this.status = STATUS.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
18178
- this.initHandler();
18179
- }), application.global.env && this.initHandler();
18185
+ this.initHandler(!1);
18186
+ }), application.global.env && this.initHandler(!1);
18180
18187
  }
18181
18188
  addTimeline(timeline) {
18182
18189
  this.timelines.push(timeline);
@@ -18187,10 +18194,11 @@
18187
18194
  getTimelines() {
18188
18195
  return this.timelines;
18189
18196
  }
18190
- initHandler() {
18191
- this.setupTickHandler();
18197
+ initHandler(force = !1) {
18198
+ this.setupTickHandler(force);
18192
18199
  }
18193
- setupTickHandler() {
18200
+ setupTickHandler(force = !1) {
18201
+ if (!force && this.tickerHandler) return !0;
18194
18202
  const handler = new RAFTickHandler();
18195
18203
  return this.tickerHandler && this.tickerHandler.release(), this.tickerHandler = handler, !0;
18196
18204
  }
@@ -18241,7 +18249,7 @@
18241
18249
  return this.status = STATUS.RUNNING, this.tickerHandler.tick(0, this.handleTick), !0;
18242
18250
  }
18243
18251
  stop() {
18244
- this.status = STATUS.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
18252
+ this.status = STATUS.INITIAL, this.setupTickHandler(!0), this.lastFrameTime = -1;
18245
18253
  }
18246
18254
  trySyncTickStatus() {
18247
18255
  this.status === STATUS.INITIAL && this.timelines.some(timeline => timeline.isRunning()) ? this.start() : this.status === STATUS.RUNNING && this.timelines.every(timeline => !timeline.isRunning()) && this.stop();
@@ -18502,7 +18510,11 @@
18502
18510
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
18503
18511
  var _a, _b, _c, _d;
18504
18512
  if (custom && customType) {
18505
- const customParams = this.resolveValue(customParameters, graphic, {}),
18513
+ const customParams = Object.assign({
18514
+ width: graphic.stage.width,
18515
+ height: graphic.stage.height,
18516
+ group: this._target.parent
18517
+ }, this.resolveValue(customParameters, graphic)),
18506
18518
  objOptions = isFunction$1(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParams) : options;
18507
18519
  customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
18508
18520
  } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
@@ -18767,7 +18779,6 @@
18767
18779
  }
18768
18780
  animate(params) {
18769
18781
  var _a, _b, _c;
18770
- this.animates || (this.animates = new Map());
18771
18782
  const animate = new Animate(null == params ? void 0 : params.id, null !== (_b = null !== (_a = null == params ? void 0 : params.timeline) && void 0 !== _a ? _a : this.stage && this.stage.getTimeline()) && void 0 !== _b ? _b : defaultTimeline, null == params ? void 0 : params.slience);
18772
18783
  if (animate.bind(this), params) {
18773
18784
  const {
@@ -18777,9 +18788,7 @@
18777
18788
  } = params;
18778
18789
  null != onStart && animate.onStart(onStart), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove);
18779
18790
  }
18780
- return this.animates.set(animate.id, animate), animate.onRemove(() => {
18781
- animate.stop(), this.animates.delete(animate.id);
18782
- }), null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
18791
+ return null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
18783
18792
  }
18784
18793
  createTimeline() {
18785
18794
  return new DefaultTimeline();
@@ -18818,7 +18827,7 @@
18818
18827
 
18819
18828
  class ACustomAnimate extends Step {
18820
18829
  constructor(customFrom, customTo, duration, easing, params) {
18821
- super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params;
18830
+ super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params, this.from = customFrom, this.to = customTo;
18822
18831
  }
18823
18832
  update(end, ratio, out) {
18824
18833
  if (this.onStart(), !this.props || !this.propKeys) return;
@@ -21917,6 +21926,18 @@
21917
21926
  const changeEvent = new CustomEvent(eventName, details);
21918
21927
  changeEvent.manager = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem.manager, this.dispatchEvent(changeEvent);
21919
21928
  }
21929
+ eventPosToStagePos(e) {
21930
+ var _a, _b;
21931
+ const result = {
21932
+ x: 0,
21933
+ y: 0
21934
+ },
21935
+ stagePoints = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventPointTransform(e)) && void 0 !== _b ? _b : {
21936
+ x: 0,
21937
+ y: 0
21938
+ };
21939
+ return this.globalTransMatrix.transformPoint(stagePoints, result), result;
21940
+ }
21920
21941
  }
21921
21942
 
21922
21943
  const DEFAULT_TEXT_FONT_FAMILY = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";