@flexem/fc-gui 3.0.0-alpha.185 → 3.0.0-alpha.187

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.
@@ -37367,19 +37367,6 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
37367
37367
  item.textContent = updatedTimePeriods[i].name;
37368
37368
  }
37369
37369
  });
37370
- // 文字更新后重新测量宽度,修正首次加载时文字为空导致宽度过小的问题
37371
- const prevDisplay = this.dropdownListEl.style.display;
37372
- const prevVisibility = this.dropdownListEl.style.visibility;
37373
- this.dropdownListEl.style.display = 'block';
37374
- this.dropdownListEl.style.visibility = 'hidden';
37375
- this.dropdownListEl.style.width = '';
37376
- const newWidth = this.dropdownListEl.offsetWidth;
37377
- this.dropdownListEl.style.display = prevDisplay;
37378
- this.dropdownListEl.style.visibility = prevVisibility;
37379
- this.dropdownListEl.style.width = newWidth + 'px';
37380
- if (this.dropdownTriggerEl) {
37381
- this.dropdownTriggerEl.style.width = newWidth + 'px';
37382
- }
37383
37370
  }
37384
37371
  // 更新触发按钮文字(显示当前选中项的最新语言文案)
37385
37372
  if (this.dropdownTriggerEl) {
@@ -37874,9 +37861,7 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
37874
37861
  .style('padding', '4px 8px')
37875
37862
  .style('cursor', 'pointer')
37876
37863
  .style('white-space', 'nowrap')
37877
- .style('font-size', (parseFloat(this.displayOption.operationSelectFontSize) * scale) + 'px')
37878
- .style('line-height', (this.displayOption.operationAreaHeight * scale - 8) + 'px')
37879
- .style('min-height', (this.displayOption.operationAreaHeight * scale - 8) + 'px')
37864
+ // 字号/行高在打开时动态根据 trigger 的视口实际尺寸设置,见 dropdownTrigger.on('click') 处理
37880
37865
  .style('background', tp.key === Number(this.currentTimePeriod) ? '#1890ff' : 'transparent')
37881
37866
  .style('color', tp.key === Number(this.currentTimePeriod) ? '#fff' : '#333')
37882
37867
  .text(tp.name)
@@ -37918,15 +37903,6 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
37918
37903
  this.reRenderElement(this.startTime, this.endTime, this.displayOption.dataLimit, HistoricalCurveTimeRange.BeginOpenEndOpen);
37919
37904
  });
37920
37905
  });
37921
- // 测量下拉列表最大宽度,让 trigger 和列表宽度一致
37922
- dropdownListEl.style.display = 'block';
37923
- dropdownListEl.style.visibility = 'hidden';
37924
- const listContentWidth = dropdownListEl.offsetWidth;
37925
- dropdownListEl.style.display = 'none';
37926
- dropdownListEl.style.visibility = '';
37927
- dropdownListEl.style.width = listContentWidth + 'px';
37928
- dropdownTrigger.node().style.width = listContentWidth + 'px';
37929
- dropdownTrigger.node().style.boxSizing = 'border-box';
37930
37906
  const hideDropdown = () => { dropdownListEl.style.display = 'none'; };
37931
37907
  dropdownTrigger.on('click', () => {
37932
37908
  const isVisible = dropdownListEl.style.display !== 'none';
@@ -37936,10 +37912,19 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
37936
37912
  else {
37937
37913
  const triggerNode = dropdownTrigger.node();
37938
37914
  const triggerRect = triggerNode.getBoundingClientRect();
37939
- // 设置宽度至少和 trigger 一样宽
37915
+ // trigger 在视口中的实际高度(已经过画布 transform 缩放),用于对齐下拉项尺寸。
37916
+ // 不能在渲染时写死设计像素,因为下拉挂在 body 上不受画布 transform 影响。
37917
+ const itemHeight = triggerRect.height;
37918
+ // 字号取行高的 60%,保证文字在行内垂直居中且不溢出
37919
+ const itemFontSize = Math.round(itemHeight * 0.6);
37920
+ dropdownList.selectAll('.hc-dropdown-item')
37921
+ .style('font-size', itemFontSize + 'px')
37922
+ .style('line-height', itemHeight + 'px')
37923
+ .style('min-height', itemHeight + 'px');
37924
+ // 设置宽度至少和 trigger 一样宽,先展示再测宽度
37925
+ dropdownListEl.style.display = 'block';
37940
37926
  dropdownListEl.style.minWidth = triggerRect.width + 'px';
37941
37927
  dropdownListEl.style.left = triggerRect.left + 'px';
37942
- dropdownListEl.style.display = 'block';
37943
37928
  const listHeight = dropdownListEl.offsetHeight;
37944
37929
  const spaceBelow = window.innerHeight - triggerRect.bottom;
37945
37930
  if (spaceBelow < listHeight) {