diff --git a/client/src/proxguiqt.cpp b/client/src/proxguiqt.cpp index 23ba3f332..760257bcd 100644 --- a/client/src/proxguiqt.cpp +++ b/client/src/proxguiqt.cpp @@ -1260,33 +1260,55 @@ void Plot::keyPressEvent(QKeyEvent *event) { RepaintGraphWindow(); break; - case Qt::Key_BracketLeft: + case Qt::Key_BracketLeft: { if(event->modifiers() & Qt::ControlModifier) { CursorAPos -= 5; } else { CursorAPos -= 1; } + if((CursorAPos >= g_GraphStop) || (CursorAPos <= g_GraphStart)) { + uint32_t halfway = PageWidth / 2; + + if((CursorAPos - halfway) > g_GraphTraceLen) { + g_GraphStart = 0; + } else { + g_GraphStart = CursorAPos - halfway; + } + } + if(CursorAPos < g_GraphStart) { CursorAPos = g_GraphStart; } RepaintGraphWindow(); break; + } - case Qt::Key_BracketRight: + case Qt::Key_BracketRight: { if(event->modifiers() & Qt::ControlModifier) { CursorAPos += 5; } else { CursorAPos += 1; } + if((CursorAPos >= g_GraphStop) || (CursorAPos <= g_GraphStart)) { + uint32_t halfway = PageWidth / 2; + + if((CursorAPos + halfway) >= g_GraphTraceLen) { + g_GraphStart = g_GraphTraceLen - halfway; + } else { + g_GraphStart = CursorAPos - halfway; + } + } + if(CursorAPos >= g_GraphTraceLen) { CursorAPos = g_GraphTraceLen; } RepaintGraphWindow(); break; + } case Qt::Key_BraceLeft: if(event->modifiers() & Qt::ControlModifier) {