From 4b770f404394a7b97f57e4add131b720d8875f95 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Fri, 14 Mar 2014 19:30:49 -0400
Subject: [PATCH] fixed improper scaling of scalars inside the gop-enabled
 subpatches

---
 pd/src/g_scalar.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index 6f2ed0691..78efae57f 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -458,11 +458,13 @@ static void scalar_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy)
     sys_vgui(".x%lx.c coords {select%lx} %d %d %d %d\n", glist, x,
         x->sc_x1 - 1, x->sc_y1 - 1, x->sc_x2 + 1, x->sc_y2 + 1);
 
-    t_float xscale = glist_xtopixels(glist, 1) - glist_xtopixels(glist, 0);
-    t_float yscale = glist_ytopixels(glist, 1) - glist_ytopixels(glist, 0);
+    t_float xscale = glist_xtopixels(x->sc_selected, 1) -
+        glist_xtopixels(x->sc_selected, 0);
+    t_float yscale = glist_ytopixels(x->sc_selected, 1) -
+        glist_ytopixels(x->sc_selected, 0);
 
     sys_vgui(".x%lx.c itemconfigure {.scalar%lx} -matrix { {%g %g} {%g %g} {%d %d} }\n",
-        glist_getcanvas(glist), x->sc_vec, 1.0, 0.0, 0.0, 1.0, (int)glist_xtopixels(x->sc_selected, basex) + (x->sc_selected == glist ? 0 : dx), (int)glist_ytopixels(x->sc_selected, basey) + (x->sc_selected == glist ? 0 : dy));
+        glist_getcanvas(glist), x->sc_vec, xscale, 0.0, 0.0, yscale, (int)glist_xtopixels(x->sc_selected, basex) + (x->sc_selected == glist ? 0 : dx), (int)glist_ytopixels(x->sc_selected, basey) + (x->sc_selected == glist ? 0 : dy));
 
     //scalar_redraw(x, glist);
 }
@@ -534,7 +536,7 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
         sys_vgui(".x%lx.c create group -tags {.scalar%lx} "
             "-matrix { {%g %g} {%g %g} {%d %d} }\n",
             glist_getcanvas(owner), x->sc_vec,
-            1.0, 0.0, 0.0, 1.0, (int)glist_xtopixels(owner, basex), (int)glist_ytopixels(owner, basey)
+            xscale, 0.0, 0.0, yscale, (int)glist_xtopixels(owner, basex), (int)glist_ytopixels(owner, basey)
             );
         sys_vgui(".x%lx.c create group -tags {.dgroup%lx} -parent {.scalar%lx}\n",
             glist_getcanvas(owner), x->sc_vec, x->sc_vec);
@@ -682,7 +684,7 @@ static t_widgetbehavior scalar_widgetbehavior =
     scalar_delete,
     scalar_vis,
     scalar_click,
-	scalar_displace_withtag,
+    scalar_displace_withtag,
 };
 
 static void scalar_free(t_scalar *x)
-- 
GitLab