diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 7c509d7600405f8c04de6df721ff8db63c82db0c..0df09bcd820747c4c105a0f953d978b8abcfd261 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3489,15 +3489,17 @@ function select_text(cid, elem) { function gui_textarea(cid, tag, x, y, max_char_width, text, font_size, state) { gui_post("x/y is " + x + '/' + y); gui_post("state? " + state); - var range; + var range, svg_view; if (state !== 0) { var p = patchwin[cid].window.document.createElement('p'); configure_item(p, { id: 'new_object_textentry' }); + svg_view = patchwin[cid].window.document.getElementById('patchsvg') + .viewBox.baseVal; p.contentEditable = 'true'; - p.style.setProperty('left', x + 'px'); - p.style.setProperty('top', y + 'px'); + p.style.setProperty('left', (x - svg_view.x) + 'px'); + p.style.setProperty('top', (y - svg_view.y) + 'px'); p.style.setProperty('font-size', font_size + 'px'); p.style.setProperty('transform', 'translate(0px, 0px)'); p.style.setProperty('max-width', diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index c5b7317df67255aeab60c1c06833c814e77ffdd6..08887f9d1f89f126999838a74d147c988062db55 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -604,6 +604,9 @@ void rtext_activate(t_rtext *x, int state) */ widthspec = x->x_text->te_width; // width if any specified + /* we need to get scroll to make sure we've got the + correct bbox for the svg */ + canvas_getscroll(glist_getcanvas(canvas)); gui_vmess("gui_textarea", "xsiiisii", canvas, x->x_tag,