From 47eedaa5183ffcdc5e116f18a5a2ffe5ecdad508 Mon Sep 17 00:00:00 2001 From: user <user@user-ThinkPad-X60.(none)> Date: Sun, 14 Jun 2015 20:10:41 -0400 Subject: [PATCH] fix bug with textarea placement --- pd/nw/pdgui.js | 8 +++++--- pd/src/g_rtext.c | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 7c509d760..0df09bcd8 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 c5b7317df..08887f9d1 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, -- GitLab