diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js index ec30c9c3aa720b8d394bf0f335eece85f9266bb4..cf1cd6805e1d0d643d9b5e3cb865b07cdf30c31b 100644 --- a/pd/nw/pd_canvas.js +++ b/pd/nw/pd_canvas.js @@ -304,6 +304,12 @@ var canvas_events = (function() { }, keydown: function(evt) { pdgui.keydown(name, evt); + // prevent the default behavior of scrolling + // on arrow keys in editmode + if (document.querySelector("#patchsvg") + .classList.contains("editmode")) { + evt.preventDefault(); + } }, keypress: function(evt) { pdgui.keypress(name, evt); @@ -926,7 +932,7 @@ function register_window_id(cid, attr_array) { // Initialize the zoom level to the value retrieved from the patch, if any. nw.Window.get().zoomLevel = attr_array.zoom; pdgui.canvas_map(cid); // side-effect: triggers gui_canvas_get_scroll - pdgui.canvas_set_editmode(cid, attr_array.editmod); + pdgui.canvas_set_editmode(cid, attr_array.editmode); // For now, there is no way for the cord inspector to be turned on by // default. But if this changes we need to set its menu item checkbox // accordingly here diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 71cca8438eae4e37c57b1a84a6bfee5f38e07981..607b28e7925b80ae9d484b469c564f1f529906b6 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -4909,6 +4909,8 @@ function gui_textarea(cid, tag, type, x, y, width_spec, height_spec, text, var range, svg_view, p, gobj = get_gobj(cid, tag); if (state !== 0) { + // Make sure we're in editmode + canvas_set_editmode(cid, 1); // Hide the gobj while we edit. However, we want the gobj to // contribute to the svg's bbox-- that way when the new_object_textentry // goes away we still have the same dimensions. Otherwise the user