Bug 131740 - Problem with resizing while maintaining aspect ratio
Summary: Problem with resizing while maintaining aspect ratio
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-02 19:43 UTC by Andrew Walker
Modified: 2006-08-02 20:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2006-08-02 19:43:35 UTC
Version:           HEAD (using KDE KDE 3.5.0)
OS:                Linux

PROBLEM:
If an object is resized while maintaining the aspect ratio the original size is not recovered

STEPS TO REPRODUCE:
Start Kst
Create a plot within the default window
Switch to layout mode
Select the right central resize point
While holding the shift key (to maintain the aspect ratio) drag the resize point to the left and back to its original position and then release the mouse button
The previous step can be repeated several times

RESULTS:
The width of the plot has decreased

EXPECTED RESULTS:
The width of the plot should remain unchanged
Comment 1 Duncan Hanson 2006-08-02 19:52:15 UTC
This is kind of by design. The ideal aspect ratio is set whenever the
user manually resizes the object. The idea was to make it possible for
them to intentionally stretch an image out. The drawback is that it
becomes possible for a (fairly determined) user to bork the image
aspect.

I suppose a reasonable workaround would be to only set _idealSize if the
resize is done without +_maintainAspect.

I'll try this out.

dh.

On Wed, 2006-08-02 at 17:43 +0000, Andrew Walker wrote:
[bugs.kde.org quoted mail]
Comment 2 Duncan Hanson 2006-08-02 20:28:01 UTC
SVN commit 569026 by dhanson:

BUG:131740 oh- nevermind, andrew's bug is different. i thought he was actually trying to resize the plots. here's the fix- those pesky 1's again introduced by the definition of width/height for QRects.

 M  +4 -4      kstgfxmousehandlerutils.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstgfxmousehandlerutils.cpp #569025:569026
@@ -114,8 +114,8 @@
       if (maintainAspect) {
         double newHalfHeight = originalSize.height() * abs(newWidth) / originalSize.width() / 2.0;
 
-        newHalfHeight = kMin(double(movePoint.y() - bounds.top()), newHalfHeight); // ensure we are still within the bounds.
-        newHalfHeight = kMin(double(bounds.bottom() - movePoint.y()), newHalfHeight);
+        newHalfHeight = kMin(double(movePoint.y() - bounds.top() + 1), newHalfHeight); // ensure we are still within the bounds.
+        newHalfHeight = kMin(double(bounds.bottom() - movePoint.y() + 1), newHalfHeight);
 
         if (newWidth == 0) { // anything better to be done?
           newWidth = 1;
@@ -136,8 +136,8 @@
       if (maintainAspect) {
         double newHalfWidth = originalSize.width() * abs(newHeight) / originalSize.height() / 2.0;
 
-        newHalfWidth = kMin(double(movePoint.x() - bounds.left()), newHalfWidth);
-        newHalfWidth = kMin(double(bounds.right() - movePoint.x()), newHalfWidth);
+        newHalfWidth = kMin(double(movePoint.x() - bounds.left() + 1), newHalfWidth);
+        newHalfWidth = kMin(double(bounds.right() - movePoint.x() + 1), newHalfWidth);
 
         if (newHeight == 0) {
           newHeight = 1;