输入框鼠标编辑、图例省略、信号跨视图共享选择与网格菜单布局修复

- 输入框:支持鼠标左键点击定位插入符、拖拽框选区域,并且不再限制字符长度
- 输入框:长文本使用 ETO_CLIPPED 裁剪绘制,避免字符溢出到编辑区域之外
- 图例:信号名称超过 200px 时省略号截断,不再挤压标尺区域
- 选中状态从 TabConfig 迁移到 DataSet,切换视图后信号选中状态保持一致
- 网格右键菜单:Y 轴最大值/最小值直接显示当前值,点击后原位置弹出内联编辑框
- 标尺数值改为绘制在图例下层,不再因避让图例而隐藏
- 移除已无用的 LegendBandRect,新增共享的编辑框布局与命中检测工具
- .gitignore 忽略 TestData 测试数据目录
This commit is contained in:
DeepSeek V4.1 Flash committed 2026-09-30 17:10:23 +08:00
1 parent e3744f3eff
commit 12b3531485
19 files changed
+790 -186

No files matched your search

+44 -5
View File
@@ -176,10 +176,7 @@ namespace jdi
// 重命名编辑态:在标签本体之上叠加输入框(标签底色与边框仍然保留)。
if (static_cast<int>(index) == m_editIndex)
{
const gd::RectF editRect(textLeft - 3.0f * m_scale, tab.rect.Y + 3.0f * m_scale,
std::max(40.0f, textWidth + 6.0f * m_scale),
tab.rect.Height - 6.0f * m_scale);
UiDrawEditField(g, editRect, m_edit, m_fonts->ui, m_scale);
UiDrawEditField(g, EditRect(), m_edit, m_fonts->ui, m_scale);
}
else
{
@@ -423,7 +420,7 @@ namespace jdi
}
m_editIndex = index;
m_edit.Begin(m_tabs[static_cast<std::size_t>(index)].name, true, EditFilter::ANY, 48);
m_edit.Begin(m_tabs[static_cast<std::size_t>(index)].name, true, EditFilter::ANY, 0u);
return true;
}
@@ -529,6 +526,48 @@ namespace jdi
return m_edit.DeselectToEnd();
}
gd::RectF TabBar::EditRect() const
{
if (m_editIndex < 0 || m_editIndex >= static_cast<int>(m_tabs.size()) || m_fonts == nullptr)
{
return gd::RectF();
}
const TabItem& tab = m_tabs[static_cast<std::size_t>(m_editIndex)];
const float textLeft = tab.rect.X + kTabPadding * m_scale;
const float textWidth = tab.closeRect.X - kCloseGap * m_scale - textLeft;
return gd::RectF(textLeft - 3.0f * m_scale, tab.rect.Y + 3.0f * m_scale,
std::max(40.0f, textWidth + 6.0f * m_scale), tab.rect.Height - 6.0f * m_scale);
}
bool TabBar::OnEditMouseDown(int x, int y)
{
if (m_editIndex < 0)
{
return false;
}
return UiEditFieldMouseDown(m_fonts->ui, EditRect(), m_edit, m_scale, x, y);
}
bool TabBar::OnEditMouseMove(int x)
{
if (m_editIndex < 0)
{
return false;
}
return UiEditFieldMouseMove(m_fonts->ui, EditRect(), m_edit, m_scale, x);
}
bool TabBar::OnEditMouseUp()
{
if (!m_edit.Dragging())
{
return false;
}
m_edit.EndDrag();
return true;
}
bool TabBar::OnRButtonDown(int x, int y, int screenX, int screenY, TabBarResult& result)
{
result = TabBarResult();