@flexem/fc-gui 3.0.0-alpha.134 → 3.0.0-alpha.136
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.
|
@@ -392,9 +392,9 @@ export class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
|
|
|
392
392
|
this.getAlarmData();
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
// 当内容完全滚出容器左侧时(currentLeft + totalWidth <
|
|
396
|
-
//
|
|
397
|
-
if (this.currentLeft + this.totalWidth <
|
|
395
|
+
// 当内容完全滚出容器左侧时(currentLeft + totalWidth < -50)
|
|
396
|
+
// 说明所有内容都已经滚出视图(不开启自动循环时多滚动50px确保最后一个字完全滚出)
|
|
397
|
+
if (this.currentLeft + this.totalWidth < -50) {
|
|
398
398
|
if (this.autoCycle) {
|
|
399
399
|
// 自动循环模式:无缝衔接回到容器右侧
|
|
400
400
|
if (this.hasMoreData) {
|
|
@@ -645,9 +645,9 @@ export class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
|
|
|
645
645
|
this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
|
|
646
646
|
// 当内容完全滚出容器左侧时(内容右边缘完全移出容器左边缘)
|
|
647
647
|
// currentLeft + totalWidth 表示内容右边缘的位置
|
|
648
|
-
// 当这个值 <=
|
|
648
|
+
// 当这个值 <= -50 时,表示内容完全不可见(不开启自动循环时多滚动50px确保最后一个字完全滚出)
|
|
649
649
|
const rightEdge = this.currentLeft + this.totalWidth;
|
|
650
|
-
if (rightEdge <=
|
|
650
|
+
if (rightEdge <= -50) {
|
|
651
651
|
if (this.autoCycle) {
|
|
652
652
|
// 自动循环模式:重置到容器右侧(使用配置宽度)
|
|
653
653
|
this.currentLeft = this.model.size.width;
|
|
@@ -708,13 +708,22 @@ export class ScrollAlarmElement extends ConditionalDynamicDisplayElement {
|
|
|
708
708
|
}
|
|
709
709
|
return;
|
|
710
710
|
}
|
|
711
|
-
//
|
|
711
|
+
// 如果是首次加载或当前没有数据,直接渲染并启动滚动
|
|
712
712
|
if (this.displayedItems.length === 0) {
|
|
713
713
|
this.displayedItems = newItems;
|
|
714
714
|
this.allAlarmsContainer.innerHTML = '';
|
|
715
715
|
this.totalWidth = 0;
|
|
716
716
|
this.pageWidths = [];
|
|
717
|
+
// 设置 hasMoreData 状态,防止滚动时误触发 getAlarmData
|
|
718
|
+
this.hasMoreData = result.totalCount > newItems.length;
|
|
719
|
+
// 设置初始位置到容器右侧
|
|
720
|
+
this.currentLeft = this.container.clientWidth;
|
|
721
|
+
this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
|
|
717
722
|
this.renderNewPage(newItems);
|
|
723
|
+
// 启动滚动
|
|
724
|
+
if (!this.isScrolling) {
|
|
725
|
+
this.initScrolling();
|
|
726
|
+
}
|
|
718
727
|
return;
|
|
719
728
|
}
|
|
720
729
|
// 保存当前的滚动位置
|