From c0adb9d9eb8fbf228f9254e324691d6444b5d787 Mon Sep 17 00:00:00 2001
From: Mathieu L Bouchard <matju@artengine.ca>
Date: Thu, 7 Aug 2014 12:45:25 -0400
Subject: [PATCH] fixed bug in gop move-handle introduced by one of my last
 commits

---
 pd/src/g_canvas.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 817756826..75578e82c 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -2018,7 +2018,6 @@ void canvasgop__motionhook(t_scalehandle *sh,t_floatarg f1, t_floatarg f2)
 {
     t_canvas *x = (t_canvas *)(sh->h_master);
     int dx = (int)f1, dy = (int)f2;
-    int newx, newy;
     
     if (sh->h_dragon)
     {
@@ -2037,8 +2036,8 @@ void canvasgop__motionhook(t_scalehandle *sh,t_floatarg f1, t_floatarg f2)
                 sx = maxi(sx,x2-x1);
                 sy = maxi(sy,y2-y1);
             }*/ // does not work, needs a gobj_getrect that does not use pixwidth & pixheight
-            newx = x->gl_xmargin + sx;
-            newy = x->gl_ymargin + sy;
+            int newx = x->gl_xmargin + sx;
+            int newy = x->gl_ymargin + sy;
 
             sys_vgui(".x%x.c coords %s %d %d %d %d\n",
                 x, sh->h_outlinetag, x->gl_xmargin, x->gl_ymargin, newx, newy);
@@ -2065,13 +2064,10 @@ void canvasgop__motionhook(t_scalehandle *sh,t_floatarg f1, t_floatarg f2)
                 properties_set_field_int(properties,
                     "n.canvasdialog.y.f2.entry4",x->gl_ymargin + dy);
             }
-
+            int x1 = x->gl_xmargin+dx, x2 = x1+x->gl_pixwidth;
+            int y1 = x->gl_ymargin+dy, y2 = y1+x->gl_pixheight;
             sys_vgui(".x%x.c coords GOP %d %d %d %d %d %d %d %d %d %d\n",
-                        x, newx, newy, newx+x->gl_pixwidth, newy,
-                        newx+x->gl_pixwidth, newy+x->gl_pixheight,
-                        newx, newy+x->gl_pixheight,
-                        newx, newy);
-
+                        x, x1, y1, x2, y1, x2, y2, x1, y2, x1, y1);
             sh->h_dragx = dx;
             sh->h_dragy = dy;            
         }
-- 
GitLab