View Issue Details

IDProjectCategoryView StatusLast Update
0006649ScribusGraphics / Image Framespublic2008-01-14 20:24
Reportermetrics Assigned Tojghali  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.3.5svn 
Fixed in Version1.3.5svn 
Summary0006649: Allow scaling of image in ImageFrame in canvasgesture
DescriptionA small patch to allow a user to scale the image with the frame when resizing and the Alt modifier key is pressed.

Two files patched, canvasgesture_resize.cpp and canvasgesture_resize.h (just to change a parameter name).
TagsNo tags attached.
Patch

Relationships

child of 0005693 closedplinnell 1.3.5 bug collection (prior to roadmap) 

Activities

2008-01-11 13:08

 

canvasgesture_resize_cpp.patch (2,085 bytes)   
Index: canvasgesture_resize.cpp
===================================================================
--- canvasgesture_resize.cpp	(revision 11383)
+++ canvasgesture_resize.cpp	(working copy)
@@ -135,7 +135,7 @@
 }
 
 
-void ResizeGesture::doResize(bool scaleTextInGroup)
+void ResizeGesture::doResize(bool scaleContent)
 {
 	PageItem* currItem = m_doc->m_Selection->itemAt(0);
 	QRectF newBounds = m_canvas->globalToCanvas(m_bounds.normalized());
@@ -147,7 +147,7 @@
 		double scx = oldBounds.width() == 0? 1.0 : newBounds.width() / oldBounds.width();
 		double scy = oldBounds.height() == 0? 1.0 : newBounds.height() / oldBounds.height();
 		//CB #3012 only scale text in a group if alt is pressed
-		if ((currItem->itemType() == PageItem::TextFrame) && scaleTextInGroup)
+		if ((currItem->itemType() == PageItem::TextFrame) && scaleContent)
 			m_view->scaleGroup(scx, scy, true);
 		else
 			m_view->scaleGroup(scx, scy, false);
@@ -159,6 +159,22 @@
 	else
 	{
 		currItem->setXYPos(newBounds.x(), newBounds.y());
+                // Scale the image in the image frame if the scaleContent modifier is in use.
+                if ((currItem->itemType() == PageItem::ImageFrame) && scaleContent)
+                {
+                    double imgScX = newBounds.width() / currItem->width() * currItem->imageXScale();
+                    double imgScY = newBounds.height() / currItem->height() * currItem->imageYScale();
+                    // The aspect ratio has been fixed, so make the modification in the direction of the larger movement.
+                    if (currItem->AspectRatio) 
+                    {
+                        if (qAbs(newBounds.width() - currItem->width()) > qAbs(newBounds.height() - currItem->height()))
+                            imgScY = imgScX;
+                        else
+                            imgScX = imgScY;
+                    }
+
+                    currItem->setImageXYScale(imgScX, imgScY);
+                }
 		currItem->setWidth(newBounds.width());
 		currItem->setHeight(newBounds.height());
 		// rotation does not change
canvasgesture_resize_cpp.patch (2,085 bytes)   

2008-01-11 13:09

 

canvasgesture_resize_h.patch (403 bytes)   
Index: canvasgesture_resize.h
===================================================================
--- canvasgesture_resize.h	(revision 11383)
+++ canvasgesture_resize.h	(working copy)
@@ -70,7 +70,7 @@
 	
 private:
 	void adjustBounds(QMouseEvent *m);
-	void doResize(bool scaleTextInGroup);
+	void doResize(bool scaleContent);
 	Canvas::FrameHandle m_handle;
 	double m_rotation;
 	double m_origRatio;

Issue History

Date Modified Username Field Change
2008-01-11 13:08 metrics New Issue
2008-01-11 13:08 metrics File Added: canvasgesture_resize_cpp.patch
2008-01-11 13:09 metrics File Added: canvasgesture_resize_h.patch
2008-01-12 00:42 jghali Status new => resolved
2008-01-12 00:42 jghali Fixed in Version => 1.3.5svn
2008-01-12 00:42 jghali Resolution open => fixed
2008-01-12 00:42 jghali Assigned To => jghali
2008-01-14 18:25 christoph_s Status resolved => feedback
2008-01-14 18:25 christoph_s Resolution fixed => reopened
2008-01-14 18:25 christoph_s Relationship added child of 0005693
2008-01-14 18:25 christoph_s Status feedback => resolved
2008-01-14 18:25 christoph_s Resolution reopened => fixed
2008-01-14 20:24 cbradney Status resolved => closed
2015-09-17 20:10 Kunda Category Graphics / Image Frames => Graphics/Img Frames
2015-09-17 20:11 Kunda Category Graphics/Img Frames => Graphics / Image Frames