[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Fri Dec 2 19:32:25 CET 2005
SVN commit 485053 by staikos:
fix the chopping of lines in the other two directions
M +1 -1 kstgfxarrowmousehandler.cpp
M +1 -1 kstgfxlinemousehandler.cpp
M +2 -3 kstgfxmousehandlerutils.cpp
M +1 -1 kstgfxmousehandlerutils.h
--- trunk/extragear/graphics/kst/kst/kstgfxarrowmousehandler.cpp #485052:485053
@@ -53,7 +53,7 @@
QRect old = _prevBand;
- _prevBand = KstGfxMouseHandlerUtils::newLine(pos, _mouseOrigin, shift);
+ _prevBand = KstGfxMouseHandlerUtils::newLine(pos, _mouseOrigin, shift, view->geometry());
if (old != _prevBand) {
QPainter p;
--- trunk/extragear/graphics/kst/kst/kstgfxlinemousehandler.cpp #485052:485053
@@ -49,7 +49,7 @@
const QRect old(_prevBand);
- _prevBand = KstGfxMouseHandlerUtils::newLine(pos, _mouseOrigin, shift);
+ _prevBand = KstGfxMouseHandlerUtils::newLine(pos, _mouseOrigin, shift, view->geometry());
if (old != _prevBand) {
QPainter p;
--- trunk/extragear/graphics/kst/kst/kstgfxmousehandlerutils.cpp #485052:485053
@@ -55,7 +55,7 @@
}
-QRect KstGfxMouseHandlerUtils::newLine(const QPoint& pos, const QPoint& mouseOrigin, bool shift) {
+QRect KstGfxMouseHandlerUtils::newLine(const QPoint& pos, const QPoint& mouseOrigin, bool shift, const QRect& boundingBox) {
QPoint fakePos = pos;
if (shift) {
int negOne = negativeOne(pos, mouseOrigin);
@@ -75,8 +75,7 @@
}
bool topLeft = (mouseOrigin.x() <= fakePos.x() && mouseOrigin.y() <= fakePos.y()) || (mouseOrigin.x() >= fakePos.x() && mouseOrigin.y() >= fakePos.y());
QRect lineRect(mouseOrigin, fakePos);
- QRect boundingRect(0, 0, kMax(mouseOrigin.x(), fakePos.x()), kMax(mouseOrigin.y(), fakePos.y()));
- QRect reduced = lineRect.normalize().intersect(boundingRect);
+ QRect reduced = lineRect.normalize().intersect(boundingBox);
if (topLeft) {
return reduced;
}
--- trunk/extragear/graphics/kst/kst/kstgfxmousehandlerutils.h #485052:485053
@@ -25,7 +25,7 @@
// returns a rectangle representing position and size
QRect newRect(const QPoint& pos, const QPoint& mouseOrigin, bool shift);
// returns a rectangle with topLeft = from, and bottomRight = to
- QRect newLine(const QPoint& pos, const QPoint& mouseOrigin, bool shift);
+ QRect newLine(const QPoint& pos, const QPoint& mouseOrigin, bool shift, const QRect& boundingBox);
// returns -1 if pos is in 1st or 3rd quadrant with origin mouseOrigin, 1 otherwise
int negativeOne(const QPoint& pos, const QPoint& mouseOrigin);
}
More information about the Kst
mailing list