@visactor/vrender 1.0.9 → 1.0.11-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/dist/index.js CHANGED
@@ -619,28 +619,59 @@
619
619
  }
620
620
  addEventListener(type, listener, options) {
621
621
  if (!listener) return;
622
+ const capture = this._resolveCapture(options),
623
+ once = this._resolveOnce(options),
624
+ listenerTypeMap = this._getOrCreateListenerTypeMap(type),
625
+ wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
626
+ if (wrappedMap.has(capture)) return;
622
627
  const wrappedListener = event => {
623
628
  const transformedEvent = this._eventListenerTransformer(event);
624
- "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
629
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
625
630
  };
626
- this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
631
+ wrappedMap.set(capture, {
632
+ wrappedListener: wrappedListener,
633
+ options: options
634
+ }), this._nativeAddEventListener(type, wrappedListener, options);
627
635
  }
628
636
  removeEventListener(type, listener, options) {
629
- var _a;
637
+ var _a, _b;
630
638
  if (!listener) return;
631
- const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
632
- wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
639
+ const capture = this._resolveCapture(options),
640
+ 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);
641
+ wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
633
642
  }
634
643
  dispatchEvent(event) {
635
644
  return this._nativeDispatchEvent(event);
636
645
  }
637
646
  clearAllEventListeners() {
638
- this._listenerMap.forEach((listenersMap, type) => {
639
- listenersMap.forEach((wrappedListener, originalListener) => {
640
- this._nativeRemoveEventListener(type, wrappedListener, void 0);
647
+ this._listenerMap.forEach((listenerMap, type) => {
648
+ listenerMap.forEach(wrappedMap => {
649
+ wrappedMap.forEach((wrappedRecord, capture) => {
650
+ this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
651
+ });
641
652
  });
642
653
  }), this._listenerMap.clear();
643
654
  }
655
+ _resolveCapture(options) {
656
+ return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
657
+ }
658
+ _resolveOnce(options) {
659
+ return "object" == typeof options && !!(null == options ? void 0 : options.once);
660
+ }
661
+ _getOrCreateListenerTypeMap(type) {
662
+ let listenerTypeMap = this._listenerMap.get(type);
663
+ return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
664
+ }
665
+ _getOrCreateWrappedMap(listenerTypeMap, listener) {
666
+ let wrappedMap = listenerTypeMap.get(listener);
667
+ return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
668
+ }
669
+ _deleteListenerRecord(type, listener, capture) {
670
+ const listenerTypeMap = this._listenerMap.get(type);
671
+ if (!listenerTypeMap) return;
672
+ const wrappedMap = listenerTypeMap.get(listener);
673
+ wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
674
+ }
644
675
  _nativeAddEventListener(type, listener, options) {
645
676
  throw new Error("_nativeAddEventListener must be implemented by derived classes");
646
677
  }
@@ -4377,7 +4408,8 @@
4377
4408
  y1: 0,
4378
4409
  strokeBoundsBuffer: 0,
4379
4410
  cornerRadius: 0,
4380
- cornerType: "round"
4411
+ cornerType: "round",
4412
+ drawStrokeWhenZeroWH: !1
4381
4413
  });
4382
4414
  const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4383
4415
  width: 0,
@@ -4386,7 +4418,8 @@
4386
4418
  y1: 0,
4387
4419
  cornerRadius: 0,
4388
4420
  length: 0,
4389
- cornerType: "round"
4421
+ cornerType: "round",
4422
+ drawStrokeWhenZeroWH: !1
4390
4423
  });
4391
4424
  const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4392
4425
  symbolType: "circle",
@@ -6854,7 +6887,9 @@
6854
6887
  var _a;
6855
6888
  if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
6856
6889
  const constructor = event.constructor;
6857
- this.eventPool.has(constructor) || this.eventPool.set(constructor, []), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
6890
+ this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
6891
+ e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
6892
+ }), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
6858
6893
  }
6859
6894
  notifyListeners(e, type) {
6860
6895
  const listeners = e.currentTarget._events[type];
@@ -9205,7 +9240,7 @@
9205
9240
  });
9206
9241
  }
9207
9242
  setAttributes(params, forceUpdateTag = !1, context) {
9208
- (params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context);
9243
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
9209
9244
  }
9210
9245
  _setAttributes(params, forceUpdateTag = !1, context) {
9211
9246
  const keys = Object.keys(params);
@@ -9606,7 +9641,7 @@
9606
9641
  });
9607
9642
  }
9608
9643
  release() {
9609
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
9644
+ this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
9610
9645
  }
9611
9646
  _emitCustomEvent(type, context) {
9612
9647
  var _a, _b;
@@ -10030,8 +10065,8 @@
10030
10065
  function strokeVisible(opacity, strokeOpacity) {
10031
10066
  return opacity * strokeOpacity > 0;
10032
10067
  }
10033
- function rectStrokeVisible(opacity, strokeOpacity, width, height) {
10034
- return opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
10068
+ function rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH) {
10069
+ return drawStrokeWhenZeroWH ? opacity * strokeOpacity > 0 : opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
10035
10070
  }
10036
10071
  function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
10037
10072
  const x10 = x1 - x0,
@@ -11639,14 +11674,10 @@
11639
11674
  attrs && (Object.assign(stateAttrs, attrs.attributes), (null === (_a = attrs.subAttributes) || void 0 === _a ? void 0 : _a.length) && subAttrs.forEach((subAttrs, index) => {
11640
11675
  Object.assign(subAttrs, attrs.subAttributes[index]);
11641
11676
  }));
11642
- }), this.subGraphic.forEach((graphic, index) => {
11643
- graphic.updateNormalAttrs(subAttrs[index]), graphic.applyStateAttrs(subAttrs[index], states, hasAnimation);
11644
11677
  }), this.updateNormalAttrs(stateAttrs), this.currentStates = states, this.applyStateAttrs(stateAttrs, states, hasAnimation);
11645
11678
  }
11646
11679
  clearStates(hasAnimation) {
11647
- this.stopStateAnimates(), this.hasState() && this.normalAttrs ? (this.currentStates = [], this.subGraphic.forEach(graphic => {
11648
- graphic.applyStateAttrs(graphic.normalAttrs, this.currentStates, hasAnimation, !0), graphic.normalAttrs = null;
11649
- }), this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [], this.normalAttrs = null;
11680
+ this.stopStateAnimates(), this.hasState() && this.normalAttrs ? (this.currentStates = [], this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [], this.normalAttrs = null;
11650
11681
  }
11651
11682
  clone() {
11652
11683
  const glyph = new Glyph(Object.assign({}, this.attribute));
@@ -15116,7 +15147,8 @@
15116
15147
  y1: y1,
15117
15148
  x: originX = rectAttribute.x,
15118
15149
  y: originY = rectAttribute.y,
15119
- fillStrokeOrder = rectAttribute.fillStrokeOrder
15150
+ fillStrokeOrder = rectAttribute.fillStrokeOrder,
15151
+ drawStrokeWhenZeroWH = rectAttribute.drawStrokeWhenZeroWH
15120
15152
  } = rect.attribute;
15121
15153
  let {
15122
15154
  width: width,
@@ -15124,7 +15156,7 @@
15124
15156
  } = rect.attribute;
15125
15157
  width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
15126
15158
  const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
15127
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
15159
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
15128
15160
  doFill = runFill(fill, background),
15129
15161
  doStroke = runStroke(stroke, lineWidth);
15130
15162
  if (!rect.valid || !visible) return;
@@ -17208,13 +17240,13 @@
17208
17240
  this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
17209
17241
  } else this._skipRender = 1;
17210
17242
  }, this.beforeRender = stage => {
17211
- this._beforeRender && this._beforeRender(stage);
17243
+ this._beforeRenderList.forEach(cb => cb(stage));
17212
17244
  }, this.afterClearScreen = drawParams => {
17213
17245
  this._afterClearScreen && this._afterClearScreen(drawParams);
17214
17246
  }, this.afterClearRect = drawParams => {
17215
17247
  this._afterClearRect && this._afterClearRect(drawParams);
17216
17248
  }, this.afterRender = stage => {
17217
- this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
17249
+ this.renderCount++, this._afterRenderList.forEach(cb => cb(stage)), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
17218
17250
  }, this.afterTickCb = () => {
17219
17251
  this.tickedBeforeRender = !0, "rendering" !== this.state && this.renderNextFrame();
17220
17252
  }, this.params = params, this.theme = new Theme(), this.hooks = {
@@ -17222,7 +17254,7 @@
17222
17254
  afterRender: new SyncHook(["stage"]),
17223
17255
  afterClearScreen: new SyncHook(["stage"]),
17224
17256
  afterClearRect: new SyncHook(["stage"])
17225
- }, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.graphicService = container.get(GraphicService), this.pluginService.active(this, params), this.window.create({
17257
+ }, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.graphicService = container.get(GraphicService), this.pluginService.active(this, params), this._beforeRenderList = [], this._afterRenderList = [], this.window.create({
17226
17258
  width: params.width,
17227
17259
  height: params.height,
17228
17260
  viewBox: params.viewBox,
@@ -17233,7 +17265,7 @@
17233
17265
  canvas: params.canvas
17234
17266
  }), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
17235
17267
  main: !0
17236
- })), 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), this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
17268
+ })), 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 = {
17237
17269
  tickRenderMode: "effect"
17238
17270
  }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
17239
17271
  background: this._background
@@ -17348,10 +17380,16 @@
17348
17380
  options.enableView3dTransform && this.enableView3dTransform();
17349
17381
  }
17350
17382
  setBeforeRender(cb) {
17351
- this._beforeRender = cb;
17383
+ this._beforeRenderList.push(cb);
17384
+ }
17385
+ removeBeforeRender(cb) {
17386
+ this._beforeRenderList = this._beforeRenderList.filter(c => c !== cb);
17352
17387
  }
17353
17388
  setAfterRender(cb) {
17354
- this._afterRender = cb;
17389
+ this._afterRenderList.push(cb);
17390
+ }
17391
+ removeAfterRender(cb) {
17392
+ this._afterRenderList = this._afterRenderList.filter(c => c !== cb);
17355
17393
  }
17356
17394
  afterNextRender(cb) {
17357
17395
  this._afterNextRenderCbs || (this._afterNextRenderCbs = []), this._afterNextRenderCbs.push(cb);
@@ -18824,7 +18862,7 @@
18824
18862
  });
18825
18863
  }, this.container = null != container ? container : document.body;
18826
18864
  const textAreaDom = document.createElement("textarea");
18827
- textAreaDom.autocomplete = "off", textAreaDom.innerText = "", this.applyStyle(textAreaDom), this.container.append(textAreaDom), this.textAreaDom = textAreaDom, this.isComposing = !1, this.composingConfigIdx = -1, this.onInputCbList = [], this.onChangeCbList = [], this.onFocusInList = [], this.onFocusOutList = [];
18865
+ textAreaDom.autocomplete = "off", textAreaDom.spellcheck = !1, textAreaDom.innerText = "", this.applyStyle(textAreaDom), this.container.append(textAreaDom), this.textAreaDom = textAreaDom, this.isComposing = !1, this.composingConfigIdx = -1, this.onInputCbList = [], this.onChangeCbList = [], this.onFocusInList = [], this.onFocusOutList = [];
18828
18866
  }
18829
18867
  onInput(cb) {
18830
18868
  this.onInputCbList.push(cb);
@@ -18839,7 +18877,7 @@
18839
18877
  this.onFocusOutList.push(cb);
18840
18878
  }
18841
18879
  applyStyle(textAreaDom) {
18842
- textAreaDom.setAttribute("style", "width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;"), textAreaDom.addEventListener("input", this.handleInput), textAreaDom.addEventListener("compositionstart", this.handleCompositionStart), textAreaDom.addEventListener("compositionend", this.handleCompositionEnd), textAreaDom.addEventListener("focusin", this.handleFocusIn), textAreaDom.addEventListener("focusout", this.handleFocusOut), application.global.addEventListener("keydown", this.handleKeyDown);
18880
+ textAreaDom.setAttribute("style", "width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"), textAreaDom.addEventListener("input", this.handleInput), textAreaDom.addEventListener("compositionstart", this.handleCompositionStart), textAreaDom.addEventListener("compositionend", this.handleCompositionEnd), textAreaDom.addEventListener("focusin", this.handleFocusIn), textAreaDom.addEventListener("focusout", this.handleFocusOut), application.global.addEventListener("keydown", this.handleKeyDown);
18843
18881
  }
18844
18882
  parseCompositionStr(configIdx) {
18845
18883
  var _a;
@@ -20090,7 +20128,7 @@
20090
20128
  super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
20091
20129
  }
20092
20130
  drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
20093
- var _a;
20131
+ var _a, _b;
20094
20132
  const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect,
20095
20133
  {
20096
20134
  fill = rectAttribute.fill,
@@ -20103,16 +20141,17 @@
20103
20141
  fillOpacity = rectAttribute.fillOpacity,
20104
20142
  lineWidth = rectAttribute.lineWidth,
20105
20143
  strokeOpacity = rectAttribute.strokeOpacity,
20106
- visible = rectAttribute.visible
20144
+ visible = rectAttribute.visible,
20145
+ drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
20107
20146
  } = rect.attribute;
20108
20147
  let {
20109
20148
  width: width,
20110
20149
  height: height
20111
20150
  } = rect.attribute;
20112
20151
  width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
20113
- const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
20152
+ const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
20114
20153
  fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
20115
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
20154
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
20116
20155
  doFill = runFill(fill),
20117
20156
  doStroke = runStroke(stroke, lineWidth);
20118
20157
  if (!rect.valid || !visible) return;
@@ -30489,6 +30528,7 @@
30489
30528
  return this.getEndProps();
30490
30529
  }
30491
30530
  stop() {}
30531
+ release() {}
30492
30532
  }
30493
30533
  class WaitStep extends Step {
30494
30534
  constructor(type, props, duration, easing) {
@@ -30706,7 +30746,9 @@
30706
30746
  this.status !== exports.AnimateStatus.END && this.onEnd(), this.status = exports.AnimateStatus.END, this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
30707
30747
  }
30708
30748
  release() {
30709
- this.status = exports.AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
30749
+ this.status = exports.AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [], this.forEachStep(step => {
30750
+ step.release();
30751
+ });
30710
30752
  }
30711
30753
  getDuration() {
30712
30754
  return this._duration;
@@ -30780,6 +30822,10 @@
30780
30822
  getLoop() {
30781
30823
  return this._loopCount;
30782
30824
  }
30825
+ forEachStep(cb) {
30826
+ let step = this._firstStep;
30827
+ for (; step;) cb(step), step = step.next;
30828
+ }
30783
30829
  }
30784
30830
 
30785
30831
  const performanceRAF = new PerformanceRAF();
@@ -31064,6 +31110,9 @@
31064
31110
  constructor(target) {
31065
31111
  this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
31066
31112
  }
31113
+ get started() {
31114
+ return this._started;
31115
+ }
31067
31116
  onStart(cb) {
31068
31117
  cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
31069
31118
  cb();
@@ -31204,14 +31253,14 @@
31204
31253
  return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
31205
31254
  }
31206
31255
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
31207
- var _a, _b, _c, _d;
31256
+ var _a, _b, _c, _d, _e, _f;
31208
31257
  if (custom && customType) {
31209
31258
  const customParams = Object.assign({
31210
- width: graphic.stage.width,
31211
- height: graphic.stage.height,
31259
+ width: (null === (_a = graphic.stage) || void 0 === _a ? void 0 : _a.width) || 0,
31260
+ height: (null === (_b = graphic.stage) || void 0 === _b ? void 0 : _b.height) || 0,
31212
31261
  group: this._target.parent
31213
31262
  }, this.resolveValue(customParameters, graphic)),
31214
- 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;
31263
+ objOptions = isFunction$1(options) ? options.call(null, null !== (_d = customParams && (null === (_c = customParams.data) || void 0 === _c ? void 0 : _c[0])) && void 0 !== _d ? _d : null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, customParams) : options;
31215
31264
  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);
31216
31265
  } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
31217
31266
  }
@@ -31431,7 +31480,7 @@
31431
31480
  reApplyState(state) {
31432
31481
  var _a;
31433
31482
  const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
31434
- if (stateInfo) {
31483
+ if (stateInfo && stateInfo.executor.started) {
31435
31484
  const stateList = this.stateList.slice();
31436
31485
  stateInfo.executor.stop(), this.stateList = stateList, stateInfo.executor.execute(stateInfo.animationConfig);
31437
31486
  }
@@ -31574,6 +31623,45 @@
31574
31623
  this._animator && this._animator.stop();
31575
31624
  }
31576
31625
  }
31626
+ class AStageAnimate extends ACustomAnimate {
31627
+ constructor(customFrom, customTo, duration, easing, params) {
31628
+ super(customFrom, customTo, duration, easing, params), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0, this._beforeStageRender = () => {
31629
+ if (!this.willCallBeforeStageRender) return;
31630
+ this.willCallBeforeStageRender = !1;
31631
+ const stage = this.target.stage,
31632
+ canvas = stage.window.getContext().canvas.nativeCanvas,
31633
+ outputCanvas = this.beforeStageRender(stage, canvas);
31634
+ outputCanvas && this.renderToStage(stage, outputCanvas);
31635
+ }, this._afterStageRender = () => {
31636
+ if (!this.willCallAfterStageRender) return;
31637
+ this.willCallAfterStageRender = !1;
31638
+ const stage = this.target.stage,
31639
+ canvas = stage.window.getContext().canvas.nativeCanvas,
31640
+ outputCanvas = this.afterStageRender(stage, canvas);
31641
+ outputCanvas && this.renderToStage(stage, outputCanvas);
31642
+ }, this.props = {};
31643
+ }
31644
+ beforeStageRender(stage, canvas) {
31645
+ return !1;
31646
+ }
31647
+ afterStageRender(stage, canvas) {
31648
+ return !1;
31649
+ }
31650
+ onFirstRun() {
31651
+ super.onFirstRun(), this.target.stage.setBeforeRender(this._beforeStageRender), this.target.stage.setAfterRender(this._afterStageRender), this.target.stage.disableDirtyBounds();
31652
+ }
31653
+ stop() {
31654
+ super.stop(), this.target.stage.removeBeforeRender(this._beforeStageRender), this.target.stage.removeAfterRender(this._afterStageRender);
31655
+ }
31656
+ onUpdate(end, ratio, out) {
31657
+ super.onUpdate(end, ratio, out), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0;
31658
+ }
31659
+ renderToStage(stage, canvas) {
31660
+ const stageCanvas = stage.window.getContext().canvas.nativeCanvas,
31661
+ ctx = stageCanvas.getContext("2d");
31662
+ return !!ctx && (ctx.clearRect(0, 0, stageCanvas.width, stageCanvas.height), ctx.drawImage(canvas, 0, 0), stageCanvas);
31663
+ }
31664
+ }
31577
31665
 
31578
31666
  class ComponentAnimator {
31579
31667
  constructor(component) {
@@ -32560,7 +32648,7 @@
32560
32648
  }
32561
32649
  class GrowAngleIn extends GrowAngleBase {
32562
32650
  onBind() {
32563
- var _a, _b;
32651
+ var _a, _b, _c;
32564
32652
  super.onBind();
32565
32653
  const {
32566
32654
  from: from,
@@ -32569,7 +32657,7 @@
32569
32657
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
32570
32658
  this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
32571
32659
  const finalAttribute = this.target.getFinalAttribute();
32572
- finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs), this.determineUpdateFunction();
32660
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs), this.determineUpdateFunction();
32573
32661
  }
32574
32662
  }
32575
32663
  class GrowAngleOut extends GrowAngleBase {
@@ -33177,7 +33265,7 @@
33177
33265
  }
33178
33266
  class GrowRadiusIn extends GrowPointsBase {
33179
33267
  onBind() {
33180
- var _a, _b;
33268
+ var _a, _b, _c;
33181
33269
  super.onBind();
33182
33270
  const {
33183
33271
  from: from,
@@ -33186,7 +33274,7 @@
33186
33274
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
33187
33275
  this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
33188
33276
  const finalAttribute = this.target.getFinalAttribute();
33189
- finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
33277
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs);
33190
33278
  }
33191
33279
  }
33192
33280
  class GrowRadiusOut extends GrowPointsBase {
@@ -33301,7 +33389,7 @@
33301
33389
  super(from, to, duration, easing, params);
33302
33390
  }
33303
33391
  onBind() {
33304
- var _a, _b;
33392
+ var _a, _b, _c;
33305
33393
  super.onBind();
33306
33394
  const {
33307
33395
  from: from,
@@ -33310,7 +33398,7 @@
33310
33398
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
33311
33399
  this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
33312
33400
  const finalAttribute = this.target.getFinalAttribute();
33313
- finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
33401
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs);
33314
33402
  }
33315
33403
  onEnd(cb) {
33316
33404
  super.onEnd(cb);
@@ -35098,7 +35186,7 @@
35098
35186
  AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
35099
35187
  };
35100
35188
 
35101
- const version = "1.0.9";
35189
+ const version = "1.0.11-alpha.0";
35102
35190
  preLoadAllModule();
35103
35191
  if (isBrowserEnv()) {
35104
35192
  loadBrowserEnv(container);
@@ -35131,12 +35219,15 @@
35131
35219
  registerReactAttributePlugin();
35132
35220
  registerDirectionalLight();
35133
35221
  registerOrthoCamera();
35222
+ registerCustomAnimate();
35223
+ registerAnimate();
35134
35224
 
35135
35225
  exports.AComponentAnimate = AComponentAnimate;
35136
35226
  exports.ACustomAnimate = ACustomAnimate;
35137
35227
  exports.ARC3D_NUMBER_TYPE = ARC3D_NUMBER_TYPE;
35138
35228
  exports.ARC_NUMBER_TYPE = ARC_NUMBER_TYPE;
35139
35229
  exports.AREA_NUMBER_TYPE = AREA_NUMBER_TYPE;
35230
+ exports.AStageAnimate = AStageAnimate;
35140
35231
  exports.Animate = Animate;
35141
35232
  exports.AnimateExecutor = AnimateExecutor;
35142
35233
  exports.AnimateStep = Step;