[gimp/metadata-browser] Bug 683050 - Copying a layer group to a new xcf results in portions...



commit 9545f7a38055c732f4caf6b0f3b1e5aed0c2f886
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 5 13:03:47 2012 +0200

    Bug 683050 - Copying a layer group to a new xcf results in portions...
    
    Use gimp_item_translate() not gimp_item_set_offset() to position
    dropped layers, because the latter doesn't affect child layers.

 app/display/gimpdisplayshell-dnd.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index cdb64e7..e401716 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -166,13 +166,13 @@ gimp_display_shell_dnd_position_item (GimpDisplayShell *shell,
 {
   gint item_width  = gimp_item_get_width  (item);
   gint item_height = gimp_item_get_height (item);
+  gint off_x, off_y;
 
   if (item_width  >= gimp_image_get_width  (image) &&
       item_height >= gimp_image_get_height (image))
     {
-      gimp_item_set_offset (item,
-                            (gimp_image_get_width  (image) - item_width)  / 2,
-                            (gimp_image_get_height (image) - item_height) / 2);
+      off_x = (gimp_image_get_width  (image) - item_width)  / 2;
+      off_y = (gimp_image_get_height (image) - item_height) / 2;
     }
   else
     {
@@ -181,10 +181,14 @@ gimp_display_shell_dnd_position_item (GimpDisplayShell *shell,
 
       gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
 
-      gimp_item_set_offset (item,
-                            x + (width  - item_width)  / 2,
-                            y + (height - item_height) / 2);
+      off_x = x + (width  - item_width)  / 2;
+      off_y = y + (height - item_height) / 2;
     }
+
+  gimp_item_translate (item,
+                       off_x - gimp_item_get_offset_x (item),
+                       off_y - gimp_item_get_offset_y (item),
+                       FALSE);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]