Summary: | Invalid coordinates when moving end point of line | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Andrew Walker <arwalker> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version First Reported In: | 1.x | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Andrew Walker
2006-08-01 19:48:49 UTC
The problem is in KstGfxMouseHandlerUtils::newLine(...) which makes attempt to keep the end point of a line within its parent. This needs to be done and should be done cleverly (i.e. don't just clip the x and y values but find the point on the line that just lies within the parent). assert() is not a crash. SVN commit 568625 by dhanson: CCBUG:131679 fix assertion error when creating newLines. the problem when resizing lines does not occur in the viewaspect branch. something must have been backed out when merging, probably the patch for resize behaviour. currently, a 2 line change in KstTopLevelView::pressMoveLayoutModeEndPoint similar to the one commited is all that's necessary to fix the problem for moving lines, but i'll wait until we figure out what to do about the resizing behaviour before submitting it. M +2 -1 kstgfxmousehandlerutils.cpp --- trunk/extragear/graphics/kst/src/libkstapp/kstgfxmousehandlerutils.cpp #568624:568625 @@ -186,7 +186,8 @@ QRect KstGfxMouseHandlerUtils::newLine(const QPoint& pos, const QPoint& mouseOrigin, bool specialAspect, const QRect& bounds) { if (KDE_ISLIKELY(!specialAspect)) { - return QRect(mouseOrigin,pos); + QPoint npos = KstGfxMouseHandlerUtils::findNearestPtOnLine(mouseOrigin, pos, pos, bounds); + return QRect(mouseOrigin, npos); } else { //want special 45deg, or vertical, or horizontal line. QPoint npos; QPoint mouseDisplacement(pos - mouseOrigin); // for picking type of line.. George- I think that when you changed the QMIN/QMAX to kMin/kMax in KstTopLevelView::pressMoveLayoutModeEndPoint you changed npos to pos- so that npos inside the bounds is not correctly ensured. Changing this back will fix the assert crash when moving line endpoints. dh. On Tue, 2006-08-01 at 18:57 +0000, Duncan Hanson wrote: [bugs.kde.org quoted mail] Odd. I just did a diff off the branch and then "s/QMAX/kMax/g" and the same for QMIN. Can you adjust that as necessary in trunk? SVN commit 568692 by dhanson: BUG:131679 restore correct pos. odd indeed- we'll have to keep an eye out for any other miss-diffs. M +4 -4 ksttoplevelview.cpp --- trunk/extragear/graphics/kst/src/libkstapp/ksttoplevelview.cpp #568691:568692 @@ -785,10 +785,10 @@ QPoint npos(pos); //pos must be inside the parent - npos.setX(kMax(pos.x(), bounds.left())); - npos.setX(kMin(pos.x(), bounds.right())); - npos.setY(kMin(pos.y(), bounds.bottom())); - npos.setY(kMax(pos.y(), bounds.top())); + npos.setX(kMax(npos.x(), bounds.left())); + npos.setX(kMin(npos.x(), bounds.right())); + npos.setY(kMin(npos.y(), bounds.bottom())); + npos.setY(kMax(npos.y(), bounds.top())); if (KstViewLinePtr line = kst_cast<KstViewLine>(_pressTarget)) { QPoint movePoint, anchorPoint; |