1
0
Fork 0

GUI: less jumpy experience while debugging in the graph

This commit is contained in:
mrexodia 2016-10-17 16:31:29 +02:00
parent 02723f7335
commit b1a52477b5
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
1 changed files with 16 additions and 6 deletions

View File

@ -1255,12 +1255,22 @@ void DisassemblerGraphView::show_cur_instr()
{
if(this->cur_instr == instr.addr)
{
auto x = block.x + int(block.width / 2);
auto y = block.y + (2 * this->charWidth) + int((row + 0.5) * this->charHeight);
this->horizontalScrollBar()->setValue(x + this->renderXOfs -
int(this->horizontalScrollBar()->pageStep() / 2));
this->verticalScrollBar()->setValue(y + this->renderYOfs -
int(this->verticalScrollBar()->pageStep() / 2));
//Don't update the view for blocks that are already fully in view
int xofs = this->horizontalScrollBar()->value();
int yofs = this->verticalScrollBar()->value();
QRect viewportRect = this->viewport()->rect();
QPoint translation(this->renderXOfs - xofs, this->renderYOfs - yofs);
viewportRect.translate(-translation.x(), -translation.y());
if(!viewportRect.contains(QRect(block.x + this->charWidth , block.y + this->charWidth,
block.width - (2 * this->charWidth), block.height - (2 * this->charWidth))))
{
auto x = block.x + int(block.width / 2);
auto y = block.y + (2 * this->charWidth) + int((row + 0.5) * this->charHeight);
this->horizontalScrollBar()->setValue(x + this->renderXOfs -
int(this->horizontalScrollBar()->pageStep() / 2));
this->verticalScrollBar()->setValue(y + this->renderYOfs -
int(this->verticalScrollBar()->pageStep() / 2));
}
return;
}
row += int(instr.text.lines.size());