diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js index 25d8bba6cb34db5117fc1767aaa6a99895385287..5bd26a695305dec2fc39a71c388b58fdff3cd3fb 100644 --- a/pd/nw/pd_canvas.js +++ b/pd/nw/pd_canvas.js @@ -166,12 +166,16 @@ var canvas_events = (function() { }, grow_svg_for_element= function(elem) { // See if an element overflows the svg bbox, and - // enlarge the svg to accommodate it + // enlarge the svg to accommodate it. + // Note: window.scrollX and window.scrollY might not work + // with Android Chrome 43 and IE. var svg = document.getElementById("patchsvg"), elem_bbox = elem.getBoundingClientRect(), svg_viewbox = svg.getAttribute("viewBox").split(" "), - w = Math.max(elem_bbox.left + elem_bbox.width, svg_viewbox[2]), - h = Math.max(elem_bbox.top + elem_bbox.height, svg_viewbox[3]); + w = Math.max(elem_bbox.left + elem_bbox.width + window.scrollX, + svg_viewbox[2]), + h = Math.max(elem_bbox.top + elem_bbox.height + window.scrollY, + svg_viewbox[3]); svg.setAttribute("viewBox", [Math.min(elem_bbox.left, svg_viewbox[0]), Math.min(elem_bbox.top, svg_viewbox[1]), @@ -433,6 +437,10 @@ var canvas_events = (function() { }, text_keyup: function(evt) { evt.stopPropagation(); + if (evt.keyCode === 13) { + pdgui.post("growing the svg..."); + grow_svg_for_element(textbox()); + } //evt.preventDefault(); return false; },