修复右键网格菜单后悬停提示残留;修复实验性功能预览曲线导致的平移/拖光标卡顿
1) 右键弹出网格菜单前清空绘图区悬停状态(并让 OnMouseLeave 一并清 m_hoverLegend),菜单打开后信号光晕与「可拖拽」提示气泡不再残留。 2) 时间光标处派生取值胶囊原先把请求窗口取成「可见区间 ∪ 光标下标」的并集:光标在视界外时窗口达上千万采样,超缓存上限后每帧重算整段多次迭代滑动平均(实测单帧 300ms+),并随平移/拖滑块/拖光标/改色一起变卡。改为只请求光标所在采样点的小窗口,取值依赖由 CurveSpanFor 保护带覆盖,取值逐位一致、显示效果零变化。 离屏实测 VERY_BIG_DATA:均值滤波平移 326ms→16~23ms,中心轴边沿计数平移 300ms→20ms。
This commit is contained in:
1 parent
2322e76d8c
commit
2f7a6bc2d2
3 files changed
+54
-11
No files matched your search
@@ -2570,6 +2570,10 @@ namespace jdi
|
||||
const int laneIndex = m_plot.LaneIndexAt(x, y);
|
||||
if (laneIndex >= 0)
|
||||
{
|
||||
// 菜单打开后鼠标移动被菜单独占,绘图区不再收到移动事件;
|
||||
// 若不先清掉悬停状态,右键前停留在曲线上的「可拖拽光晕」与提示气泡
|
||||
// 会一直挂在原地(用户报告的"进入网格菜单后高亮/文本提示不消失")。
|
||||
m_plot.OnMouseLeave();
|
||||
ShowPlotContextMenu(laneIndex, x, y);
|
||||
InvalidateRect(hwnd, nullptr, FALSE);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
namespace jdi
|
||||
{
|
||||
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
const int kTimeTickTarget = 10; /**< 时间轴期望刻度数。 */
|
||||
@@ -4761,6 +4759,12 @@ namespace jdi
|
||||
m_hoverSignal = SignalRef();
|
||||
changed = true;
|
||||
}
|
||||
// 图例悬停半高亮同样随鼠标离开而消失(否则右键弹菜单/移出绘图区后残留在原地)。
|
||||
if (m_hoverLegend.IsValid())
|
||||
{
|
||||
m_hoverLegend = SignalRef();
|
||||
changed = true;
|
||||
}
|
||||
if (m_cursorHover)
|
||||
{
|
||||
m_cursorHover = false;
|
||||
@@ -7372,17 +7376,21 @@ namespace jdi
|
||||
}
|
||||
const int otherIndex =
|
||||
showDelta ? FindNearestSample(*resolved.file, otherTime) : -1;
|
||||
const std::size_t count =
|
||||
std::min(resolved.file->time.size(), resolved.data->values.size());
|
||||
std::size_t begin = 0;
|
||||
std::size_t end = 0;
|
||||
VisibleIndexRange(*resolved.file, count, begin, end);
|
||||
begin = std::min(begin, static_cast<std::size_t>(sampleIndex));
|
||||
end = std::max(end, static_cast<std::size_t>(sampleIndex) + 1);
|
||||
// 本函数**只需要光标所在采样点处的派生取值**(以及双光标另一端的取值),
|
||||
// 因此把请求窗口收窄到「需要的那几个下标」即可,均值滤波半径造成的取值
|
||||
// 依赖由 `CurveSpanFor` 自身的保护带负责覆盖。
|
||||
//
|
||||
// ⚠️ 绝不能把窗口扩成「光标 ↔ 视界边缘」的并集:光标停在视界之外(例如
|
||||
// 平移视界把光标甩到很远,或光标远离当前缩放区间)时会得到一个上千万采样的
|
||||
// 巨大窗口,超过缓存上限后走一次性缓冲 → **每帧重算整段滤波**,
|
||||
// 实测单帧 300ms+(用户报告的"平移/拖动光标异常卡顿"的直接原因)。
|
||||
std::size_t begin = static_cast<std::size_t>(sampleIndex);
|
||||
std::size_t end = begin + 1;
|
||||
if (otherIndex >= 0)
|
||||
{
|
||||
begin = std::min(begin, static_cast<std::size_t>(otherIndex));
|
||||
end = std::max(end, static_cast<std::size_t>(otherIndex) + 1);
|
||||
const std::size_t other = static_cast<std::size_t>(otherIndex);
|
||||
begin = std::min(begin, other);
|
||||
end = std::max(end, other + 1);
|
||||
}
|
||||
std::size_t spanBegin = 0;
|
||||
const std::vector<float>* curvePtr =
|
||||
|
||||
Reference in new issue
Block a user