From da20034f4f5348716aefb401a17e77ba4f92940e Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Tue, 15 Dec 2015 21:51:59 -0500
Subject: [PATCH] keep iemguis aligned to pixel grid when resizing with the
 scalehandle

---
 pd/nw/pdgui.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index 72963b5a0..c3c314ccb 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -1654,10 +1654,13 @@ function gui_text_select_color(cid, tag) {
     }
 }
 
+// This adds a 0.5 offset to align to pixel grid, so it should
+// only be used to move gobjs to a new position.  (Should probably
+// be renamed to gobj_move to make this more obvious.)
 function elem_move(elem, x, y) {
     var t = elem.transform.baseVal.getItem(0);
-    t.matrix.e = x;
-    t.matrix.f = y;
+    t.matrix.e = x+0.5;
+    t.matrix.f = y+0.5;
 }
 
 function elem_displace(elem, dx, dy) {
-- 
GitLab