fix: 修正滑块填充残留、数值内联输入与信号/分组重命名,拖拽虚影跟随鼠标

- 滑块最小值时不再有超出圆钮的填充残留,三处滑块统一为共享实现
- 透明度/RGB/色号支持点击或双击直接输入,整段高亮、首次键入替换、回车提交、Ctrl+C 复制
- 双击信号行或分组名进入重命名编辑;分组竖线改为绘制而非字符
- 拖拽信号时曲线虚影跟随鼠标纵向位移
- 数据层新增展示名覆盖,面板改为持有可写数据集合
This commit is contained in:
DeepSeek V4.1 Flash committed 2026-09-30 09:38:22 +08:00
1 parent 542aa51e40
commit 261b8ac07d
13 files changed
+1074 -274

No files matched your search

+77
View File
@@ -419,6 +419,83 @@ namespace jdi
}
}
void UiDrawSlider(gd::Graphics& g, const gd::RectF& track, double ratio, std::uint32_t fillColor,
bool active, float scale)
{
if (track.Width <= 0.0f || track.Height <= 0.0f)
{
return;
}
if (ratio < 0.0)
{
ratio = 0.0;
}
if (ratio > 1.0)
{
ratio = 1.0;
}
const float radius = track.Height * 0.5f;
UiFillRoundRect(g, track, radius, 0x2A657B83u);
// 已填充部分严格止于圆钮中心,最小值时不会留下超出圆钮的填充残留。
const float fillWidth = static_cast<float>(ratio) * track.Width;
if (fillWidth > 0.5f)
{
UiFillRoundRect(g, gd::RectF(track.X, track.Y, fillWidth, track.Height), radius, fillColor);
}
const float knobRadius = radius + (active ? 2.5f * scale : 0.8f * scale);
const float knobX = track.X + static_cast<float>(ratio) * track.Width;
gd::SolidBrush knob(ToGdiColor(0xFFFFFFFFu));
gd::Pen knobPen(ToGdiColor(0xFF586E75u), 1.4f * scale);
g.FillEllipse(&knob, knobX - knobRadius, track.Y + radius - knobRadius, knobRadius * 2.0f,
knobRadius * 2.0f);
g.DrawEllipse(&knobPen, knobX - knobRadius, track.Y + radius - knobRadius, knobRadius * 2.0f,
knobRadius * 2.0f);
}
void UiDrawEditField(gd::Graphics& g, const gd::RectF& rect, const std::wstring& text, bool fresh,
HFONT font, float scale)
{
if (rect.Width <= 0.0f || rect.Height <= 0.0f || font == nullptr)
{
return;
}
const Theme& theme = SolarizedLight();
const float corner = 3.0f * scale;
UiFillRoundRect(g, rect, corner, theme.cardBg);
UiDrawRoundRect(g, rect, corner, theme.accent, 1.6f);
const std::wstring shown = text.empty() ? std::wstring(L" ") : text;
if (fresh)
{
// 整段内容处于“将被覆盖”状态:以强调色底衬表示已全选。
const float textWidth = UiTextWidth(g, shown, font) + 8.0f * scale;
const gd::RectF highlight(rect.X + (rect.Width - textWidth) * 0.5f, rect.Y + 2.0f * scale,
textWidth, rect.Height - 4.0f * scale);
UiFillRoundRect(g, highlight, 2.0f * scale, theme.accent);
UiText(g, shown, font, highlight, theme.textOnAccent, TextAlign::CENTER);
return;
}
UiText(g, shown, font, rect, theme.textStrong, TextAlign::CENTER);
// 已开始键入:在文本末尾显示插入符。
const float textWidth = UiTextWidth(g, shown, font);
const float caretX = rect.X + (rect.Width + textWidth) * 0.5f + 1.0f * scale;
if (caretX < rect.X + rect.Width - 2.0f * scale)
{
UiDrawLine(g, caretX, rect.Y + 4.0f * scale, caretX, rect.Y + rect.Height - 4.0f * scale,
theme.accent, 1.4f * scale);
}
}
bool UiSwatchNeedsOutline(float opacity)
{
return !(opacity >= kSwatchOutlineOpacity);