diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js index fedb37db77e6694e301fc4feb3ff13442408bf47..8894358c2d0c89839ee346178402c3b0b830d199 100644 --- a/pd/nw/pd_canvas.js +++ b/pd/nw/pd_canvas.js @@ -387,7 +387,6 @@ var canvas_events = (function() { document.querySelector("#canvas_find_text").addEventListener("focusin", canvas_find_focus, false ); - document.querySelector("#canvas_find_text").addEventListener("blur", canvas_find_blur, false ); @@ -411,7 +410,6 @@ var canvas_events = (function() { // set minimum window size gui.Window.get().setMinimumSize(150, 100); - return { none: function() { var name; @@ -518,11 +516,17 @@ var canvas_events = (function() { // we can create the menu and register event callbacks function register_canvas_id(cid) { name = cid; // hack + // We create the window menus and popup menu before doing anything else + // to ensure that we don't try to set the svg size before these are done. + // Otherwise we might set the svg size to the window viewport, only to have + // the menu push down the svg viewport and create scrollbars. Those same + // scrollbars will get erased once canvas_map triggers, causing a quick + // (and annoying) scrollbar flash + nw_create_patch_window_menus(cid); create_popup_menu(cid); canvas_events.register(cid); canvas_events.normal(); - nw_create_patch_window_menus(cid); - pdgui.canvas_map(cid); + pdgui.canvas_map(cid); // side-effect: triggers gui_canvas_getscroll from Pd } function create_popup_menu(name) { diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 24a966951de97d9eb4eadada5fbd0f4a7912c3bb..2edbfe82756e239be33a3c9ec2754af4689255c5 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -2513,7 +2513,15 @@ void canvas_vis(t_canvas *x, t_floatarg f) //if (g && (pd_class(&g->g_pd) == garray_class) // sys_vgui("pdtk_canvas_set_scrollless .x%lx\n", x); //else - scrollbar_update(x); + + /* We can't update the scrollbars here, because we have to wait + for the canvas window to load before anything else can happen. + So we just call canvas_getscroll in the GUI after the window + finishes loading. I'm not sure if there's an ulterior motive + to this scrollbar_update here-- possibly related to graphs-- + so let's keep it here for reference in case we run into a + but later. */ + //scrollbar_update(x); /* //newly opened arrays created prior to pd-l2ork require fittograph