[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdegraphics/kdvi
From: Wilfried Huss <Wilfried.Huss () gmx ! at>
Date: 2005-09-26 11:01:27
Message-ID: 1127732487.253977.31555.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 464165 by whuss:
If on middleclick the mouse pointer is not exactly inside a source link,
jump to the closest target.
M +15 -0 dviWidget.cpp
--- branches/KDE/3.5/kdegraphics/kdvi/dviWidget.cpp #464164:464165
@@ -46,6 +46,9 @@
// Check if the mouse is pressed on a source-hyperlink
if ((e->button() == MidButton) && (pageData->sourceHyperLinkList.size() > 0))
{
+ int minIndex = 0;
+ int minimum = 0;
+
for(unsigned int i=0; i<pageData->sourceHyperLinkList.size(); i++)
{
if (pageData->sourceHyperLinkList[i].box.contains(e->pos()))
@@ -54,7 +57,19 @@
e->accept();
return;
}
+ // Remember the closest source link
+ QPoint center = pageData->sourceHyperLinkList[i].box.center();
+ int dx = center.x() - e->pos().x();
+ int dy = center.y() - e->pos().y();
+ if (dx*dx + dy*dy < minimum || i == 0)
+ {
+ minIndex = i;
+ minimum = dx*dx + dy*dy;
+ }
}
+ // If the mouse pointer is not exactly inside a source link, jump to the closest target.
+ emit(SRCLink(pageData->sourceHyperLinkList[minIndex].linkText, e, this));
+ e->accept();
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic