GUI: less jumpy experience while debugging in the graph
This commit is contained in:
parent
02723f7335
commit
b1a52477b5
|
@ -1255,12 +1255,22 @@ void DisassemblerGraphView::show_cur_instr()
|
||||||
{
|
{
|
||||||
if(this->cur_instr == instr.addr)
|
if(this->cur_instr == instr.addr)
|
||||||
{
|
{
|
||||||
auto x = block.x + int(block.width / 2);
|
//Don't update the view for blocks that are already fully in view
|
||||||
auto y = block.y + (2 * this->charWidth) + int((row + 0.5) * this->charHeight);
|
int xofs = this->horizontalScrollBar()->value();
|
||||||
this->horizontalScrollBar()->setValue(x + this->renderXOfs -
|
int yofs = this->verticalScrollBar()->value();
|
||||||
int(this->horizontalScrollBar()->pageStep() / 2));
|
QRect viewportRect = this->viewport()->rect();
|
||||||
this->verticalScrollBar()->setValue(y + this->renderYOfs -
|
QPoint translation(this->renderXOfs - xofs, this->renderYOfs - yofs);
|
||||||
int(this->verticalScrollBar()->pageStep() / 2));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
row += int(instr.text.lines.size());
|
row += int(instr.text.lines.size());
|
||||||
|
|
Loading…
Reference in New Issue