@flexem/fc-gui 3.0.0-alpha.170 → 3.0.0-alpha.171

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.
@@ -42906,7 +42906,7 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
42906
42906
  }, 300);
42907
42907
  }
42908
42908
  });
42909
- // 初始化显示容器
42909
+ // 初始化显示容器scroll-alarm-element.js
42910
42910
  this.initDisplayContainer();
42911
42911
  // 获取字体设置 - 参考 text-element.ts 的实现方式
42912
42912
  this.headerFont = ((_f = this.model.generalSetting) === null || _f === void 0 ? void 0 : _f.headerFont) || {};
@@ -43598,7 +43598,7 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
43598
43598
  this.isScrolling = false;
43599
43599
  return;
43600
43600
  }
43601
- // 如果是首次加载或当前没有数据,直接渲染并启动滚动
43601
+ // 如果当前没有数据(数据从空变为有),重新开始滚动
43602
43602
  if (this.displayedItems.length === 0) {
43603
43603
  this.displayedItems = newItems;
43604
43604
  while (this.allAlarmsContainer.firstChild) {
@@ -43615,13 +43615,19 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
43615
43615
  requestAnimationFrame(() => {
43616
43616
  this._rebaseTextNodes(() => {
43617
43617
  this.isReplacingContent = false;
43618
- this.isScrolling = false;
43619
- this.initScrolling();
43618
+ // 直接重启滚动定时器,不调用 initScrolling()
43619
+ this.isScrolling = true;
43620
+ clearInterval(this.scrollIntervalId);
43621
+ this.scrollIntervalId = setInterval(() => {
43622
+ if (this.isScrolling) {
43623
+ this.scrollContent();
43624
+ }
43625
+ }, 100);
43620
43626
  });
43621
43627
  });
43622
43628
  return;
43623
43629
  }
43624
- // 保存当前的滚动位置
43630
+ // 保存当前的滚动位置(数据从有变为有)
43625
43631
  const currentScrollPosition = this.currentLeft;
43626
43632
  // 清空所有SVG text节点,重新用 renderNewPage 渲染
43627
43633
  while (this.allAlarmsContainer.firstChild) {
@@ -43641,21 +43647,37 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
43641
43647
  this.currentLeft = currentScrollPosition;
43642
43648
  this.allAlarmsContainer.setAttribute('transform', `translate(${this.currentLeft}, 0)`);
43643
43649
  this.isReplacingContent = false;
43644
- this.isScrolling = false;
43645
- this.initScrolling();
43650
+ // 直接重启滚动定时器,而不调用 initScrolling(),避免位置被重置
43651
+ this.isScrolling = true;
43652
+ clearInterval(this.scrollIntervalId);
43653
+ this.scrollIntervalId = setInterval(() => {
43654
+ if (this.isScrolling) {
43655
+ this.scrollContent();
43656
+ }
43657
+ }, 100);
43646
43658
  });
43647
43659
  });
43648
43660
  return;
43649
43661
  }
43650
- // 重置标志,内容更新完成后重新启动滚动
43662
+ // 查询成功但没有返回有效数据,重启滚动
43651
43663
  this.isReplacingContent = false;
43652
- this.isScrolling = false;
43653
- this.initScrolling();
43664
+ this.isScrolling = true;
43665
+ clearInterval(this.scrollIntervalId);
43666
+ this.scrollIntervalId = setInterval(() => {
43667
+ if (this.isScrolling) {
43668
+ this.scrollContent();
43669
+ }
43670
+ }, 100);
43654
43671
  }, (error) => {
43655
43672
  // 错误处理:重置标志,恢复滚动
43656
43673
  this.isReplacingContent = false;
43657
- this.isScrolling = false;
43658
- this.initScrolling();
43674
+ this.isScrolling = true;
43675
+ clearInterval(this.scrollIntervalId);
43676
+ this.scrollIntervalId = setInterval(() => {
43677
+ if (this.isScrolling) {
43678
+ this.scrollContent();
43679
+ }
43680
+ }, 100);
43659
43681
  this.logger.error('Failed to replace scrolling content:', error);
43660
43682
  });
43661
43683
  }