summaryrefslogtreecommitdiff
path: root/scripts/rz_core.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-11-11 16:51:34 +0200
committerAlon Levy <alon@pobox.com>2014-11-11 19:48:25 +0200
commit5331427d3afc42c69ca1e2d859388069259726c2 (patch)
tree5b1813bee045226399a7a34d16dbb67b8ecc3f6d /scripts/rz_core.js
parentfcbab7373eb42b9f2053a66babca1abd6dc61709 (diff)
rz_core: make edge name editing input appear at correct place wrt translation
Diffstat (limited to 'scripts/rz_core.js')
-rw-r--r--scripts/rz_core.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/rz_core.js b/scripts/rz_core.js
index 1f9fd003..eb3cc341 100644
--- a/scripts/rz_core.js
+++ b/scripts/rz_core.js
@@ -171,7 +171,7 @@ function update(no_relayout) {
.attr("text-anchor", "middle")
.on("click", function(d, i) {
if (d.state !== "temp") {
- editLink(d, i);
+ editLink(this, d, i);
}
});
@@ -590,12 +590,12 @@ function editNode(node, d, i) {
element.data().d = d;
}
-function editLink(d, i) {
- var dx = (d.source.x + d.target.x) / 2;
- var dy = (d.source.y + d.target.y) / 2;
- var oldname = d.name;
- $('.editlinkinfo').css('top', dy - 17);
- $('.editlinkinfo').css('left', dx - 18);
+function editLink(link, d, i) {
+ var offset = $(link).offset(),
+ oldname = d.name;
+
+ $('.editlinkinfo').css('top', offset.top);
+ $('.editlinkinfo').css('left', offset.left);
$('#editlinkname').val(oldname);
// TODO: handle escape as well to quit without changes (enter does submit)