@vvfx/sdk 0.2.11 → 0.2.12

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.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: TODO
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 赤芍,何即,不择,意绮
6
- * Version: v0.2.11
6
+ * Version: v0.2.12
7
7
  */
8
8
 
9
9
  import { math, spec, generateGUID, SpriteComponent, TextComponent, assertExist as assertExist$1, version, VFXItem, PrecompositionManager, AssetManager, FrameComponent, glContext, CompositionComponent, Texture as Texture$1, getStandardJSON, EffectComponent, Geometry as Geometry$1, Material, Player, EventEmitter as EventEmitter$1 } from '@galacean/effects';
@@ -70484,6 +70484,7 @@ var EDITING_VIEWPORT_PADDING = 48;
70484
70484
  var EDITING_VIEWPORT_BOX_SCALE = 1.1;
70485
70485
  var AUTO_HEIGHT_EPSILON = 0.5;
70486
70486
  var AUTO_HEIGHT_MAX_MULTIPLIER = 32;
70487
+ var AUTO_HEIGHT_FEEDBACK_STEP_LIMIT = 2;
70487
70488
  var CARD_RASTERIZE_READY_TIMEOUT = 3000;
70488
70489
  var CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
70489
70490
  var requestHTMLOverlayFrame = function requestHTMLOverlayFrame(callback) {
@@ -70531,6 +70532,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
70531
70532
  autoHeightCleanups: new Map(),
70532
70533
  autoHeightFrames: new Map(),
70533
70534
  autoHeightInitialHeights: new Map(),
70535
+ autoHeightFeedback: new Map(),
70534
70536
  autoHeightStreamPhases: new Map()
70535
70537
  };
70536
70538
  this.handleContainerDoubleClick = function(event) {
@@ -70684,6 +70686,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
70684
70686
  });
70685
70687
  this.state.autoHeightFrames.clear();
70686
70688
  this.state.autoHeightInitialHeights.clear();
70689
+ this.state.autoHeightFeedback.clear();
70687
70690
  this.state.autoHeightStreamPhases.clear();
70688
70691
  this.eventCleanups.forEach(function(cleanup) {
70689
70692
  cleanup();
@@ -71982,6 +71985,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
71982
71985
  cancelHTMLOverlayFrame(frame);
71983
71986
  this.state.autoHeightFrames.delete(id);
71984
71987
  }
71988
+ this.state.autoHeightFeedback.delete(id);
71985
71989
  };
71986
71990
  _proto.applyAutoHeight = function applyAutoHeight(id, height) {
71987
71991
  var item = this.options.getItems().find(function(candidate) {
@@ -72001,11 +72005,30 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
72001
72005
  if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
72002
72006
  return;
72003
72007
  }
72008
+ if (this.isAutoHeightFeedbackLoop(id, item.property.height, nextHeight)) {
72009
+ return;
72010
+ }
72004
72011
  this.options.setCardItemHeight(id, nextHeight, {
72005
72012
  anchor: this.getAutoHeightAnchor(item),
72006
72013
  previousHeight: item.property.height
72007
72014
  });
72008
72015
  };
72016
+ _proto.isAutoHeightFeedbackLoop = function isAutoHeightFeedbackLoop(id, currentHeight, nextHeight) {
72017
+ if (nextHeight <= currentHeight) {
72018
+ this.state.autoHeightFeedback.delete(id);
72019
+ return false;
72020
+ }
72021
+ var offset = nextHeight - currentHeight;
72022
+ var previous = this.state.autoHeightFeedback.get(id);
72023
+ var continues = previous !== undefined && Math.abs(previous.nextHeight - currentHeight) <= AUTO_HEIGHT_EPSILON && Math.abs(previous.offset - offset) <= AUTO_HEIGHT_EPSILON;
72024
+ var steps = continues ? previous.steps + 1 : 0;
72025
+ this.state.autoHeightFeedback.set(id, {
72026
+ nextHeight: nextHeight,
72027
+ offset: offset,
72028
+ steps: steps
72029
+ });
72030
+ return steps >= AUTO_HEIGHT_FEEDBACK_STEP_LIMIT;
72031
+ };
72009
72032
  _proto.setAutoHeightStreamPhase = function setAutoHeightStreamPhase(id, phase) {
72010
72033
  if (phase === 'parsing' || phase === 'draining' || phase === 'finalizing') {
72011
72034
  this.state.autoHeightStreamPhases.set(id, phase);