mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 18:38:51 +00:00
Fix arrow offset when scrolling with arrows or zooming in. (#1677)
This commit is contained in:
parent
cbdc4b70e1
commit
239fde50be
@ -379,18 +379,21 @@ void DisassemblyWidget::zoomIn()
|
|||||||
{
|
{
|
||||||
mDisasTextEdit->zoomIn();
|
mDisasTextEdit->zoomIn();
|
||||||
updateMaxLines();
|
updateMaxLines();
|
||||||
|
leftPanel->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisassemblyWidget::zoomOut()
|
void DisassemblyWidget::zoomOut()
|
||||||
{
|
{
|
||||||
mDisasTextEdit->zoomOut();
|
mDisasTextEdit->zoomOut();
|
||||||
updateMaxLines();
|
updateMaxLines();
|
||||||
|
leftPanel->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisassemblyWidget::zoomReset()
|
void DisassemblyWidget::zoomReset()
|
||||||
{
|
{
|
||||||
setupFonts();
|
setupFonts();
|
||||||
updateMaxLines();
|
updateMaxLines();
|
||||||
|
leftPanel->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisassemblyWidget::highlightCurrentLine()
|
void DisassemblyWidget::highlightCurrentLine()
|
||||||
@ -746,6 +749,12 @@ void DisassemblyScrollArea::resetScrollBars()
|
|||||||
verticalScrollBar()->blockSignals(false);
|
verticalScrollBar()->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal DisassemblyTextEdit::textOffset() const
|
||||||
|
{
|
||||||
|
return (blockBoundingGeometry(document()->begin()).topLeft() +
|
||||||
|
contentOffset()).y();
|
||||||
|
}
|
||||||
|
|
||||||
bool DisassemblyTextEdit::viewportEvent(QEvent *event)
|
bool DisassemblyTextEdit::viewportEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
@ -826,7 +835,7 @@ void DisassemblyLeftPanel::paintEvent(QPaintEvent *event)
|
|||||||
constexpr int arrowWidth = 5;
|
constexpr int arrowWidth = 5;
|
||||||
int rightOffset = size().rwidth();
|
int rightOffset = size().rwidth();
|
||||||
auto tEdit = qobject_cast<DisassemblyTextEdit*>(disas->getTextWidget());
|
auto tEdit = qobject_cast<DisassemblyTextEdit*>(disas->getTextWidget());
|
||||||
int topOffset = int(tEdit->document()->documentMargin() + tEdit->contentsMargins().top());
|
int topOffset = int(tEdit->contentsMargins().top() + tEdit->textOffset());
|
||||||
int lineHeight = disas->getFontMetrics().height();
|
int lineHeight = disas->getFontMetrics().height();
|
||||||
QColor arrowColorDown = ConfigColor("flow");
|
QColor arrowColorDown = ConfigColor("flow");
|
||||||
QColor arrowColorUp = ConfigColor("cflow");
|
QColor arrowColorUp = ConfigColor("cflow");
|
||||||
|
@ -125,6 +125,7 @@ public:
|
|||||||
this->lockScroll = lock;
|
this->lockScroll = lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal textOffset() const;
|
||||||
protected:
|
protected:
|
||||||
bool viewportEvent(QEvent *event) override;
|
bool viewportEvent(QEvent *event) override;
|
||||||
void scrollContentsBy(int dx, int dy) override;
|
void scrollContentsBy(int dx, int dy) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user