From bb007f253ac81e1be4af30c1de1df1f19c539716 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Sun, 12 Jul 2015 13:42:16 -0400 Subject: [PATCH] Use ints for svg height/width/viewBox to avoid what _might_ be a Chromium rendering bug --- pd/nw/pdgui.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index dd442203b..c66463ab8 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3582,9 +3582,17 @@ function do_getscroll(cid) { height = bbox.y > 0 ? bbox.y + bbox.height : bbox.height; if (width === 0) { width = patchwin[cid].window.document.body.clientWidth; + // Convert to int by dropping everything after the decimal place. + // Previously I was having trouble with the DOM height and width + // setters having a different precision than the viewBox, leading + // to a subtle rendering bug. + // Since the patchsvg isn't going to be transformed at all, ints + // should work just fine here. + width |= 0; } if (height === 0) { height = patchwin[cid].window.document.body.clientHeight; + height |= 0; } configure_item(svg, { viewBox: [bbox.x > 0 ? 0 : bbox.x, -- GitLab