mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Merge pull request #2373 from jlitewski/marker-oob-fix
Fix OOB segfault with markers
This commit is contained in:
commit
d714902fc0
1 changed files with 15 additions and 7 deletions
|
@ -1268,14 +1268,22 @@ void Plot::wheelEvent(QWheelEvent *event) {
|
||||||
|
|
||||||
void Plot::mouseMoveEvent(QMouseEvent *event) {
|
void Plot::mouseMoveEvent(QMouseEvent *event) {
|
||||||
int x = event->x();
|
int x = event->x();
|
||||||
x -= WIDTH_AXES;
|
|
||||||
x = (int)(x / g_GraphPixelsPerPoint);
|
|
||||||
x += g_GraphStart;
|
|
||||||
|
|
||||||
if ((event->buttons() & Qt::LeftButton)) {
|
//Only run the marker place code if a mouse button is pressed
|
||||||
g_MarkerA.pos = x;
|
if((event->buttons() & Qt::LeftButton) || (event->buttons() & Qt::RightButton)) {
|
||||||
} else if (event->buttons() & Qt::RightButton) {
|
x -= WIDTH_AXES;
|
||||||
g_MarkerB.pos = x;
|
x = (int)(x / g_GraphPixelsPerPoint);
|
||||||
|
x += g_GraphStart;
|
||||||
|
|
||||||
|
if(x > (int)g_GraphTraceLen) x = 0; // Set to 0 if the number is stupidly big
|
||||||
|
else if(x < (int)g_GraphStart) x = (int)g_GraphStart; // Bounds checking for the start of the Graph Window
|
||||||
|
else if(x > (int)g_GraphStop) x = (int)g_GraphStop; // Bounds checking for the end of the Graph Window
|
||||||
|
|
||||||
|
if ((event->buttons() & Qt::LeftButton)) { // True for left click, false otherwise
|
||||||
|
g_MarkerA.pos = x;
|
||||||
|
} else {
|
||||||
|
g_MarkerB.pos = x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue