From cd92b5173ab0e0e4c1bbf3ec6d13feb82cbbb13e Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Sun, 13 Dec 2015 10:48:09 -0500
Subject: [PATCH] align scalar selection rectangle to pixel grid

---
 pd/nw/pdgui.js    | 4 ++--
 pd/src/g_scalar.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index b06eba4bd..72963b5a0 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -2359,8 +2359,8 @@ function gui_scalar_draw_select_rect(cid, tag, state, x1, y1, x2, y2, basex, bas
     var g = get_gobj(cid, tag),
         b = g.querySelector(".border");
     configure_item(b, {
-        x: (x1 - basex),
-        y: (y1 - basey),
+        x: (x1 - basex) + 0.5,
+        y: (y1 - basey) + 0.5,
         width: x2 - x1,
         height: y2 - y1,
     });
diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index c53b45b04..81c1f4a34 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -554,10 +554,10 @@ void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state)
             gui_vmess("gui_scalar_draw_select_rect", "xsiiiiiff",
                 glist_getcanvas(glist), tagbuf,
                 state,
-                (int)(x1 / xscale + 0.499),
-                (int)(y1 / yscale + 0.499),
-                (int)(x2 / xscale + 0.499),
-                (int)(y2 / yscale + 0.499),
+                (int)(x1 / xscale),
+                (int)(y1 / yscale),
+                (int)(x2 / xscale),
+                (int)(y2 / yscale),
                 basex,
                 basey);
         }
-- 
GitLab