From 94dcd3d40d3a9da058af90e9068523be2120b3d3 Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Sat, 19 Sep 2015 16:17:02 +0200
Subject: data loading from JSON, highlighting mouseover
---
edit.js | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 81 insertions(+), 16 deletions(-)
diff --git a/edit.js b/edit.js
index 0cf7c67..85fc434 100644
--- a/edit.js
+++ b/edit.js
@@ -12,20 +12,22 @@ var r,
id = 0,
next_grid = 0,
// layout
- margin = 30,
- padding = margin/3,
- xbegin = 80,
- ybegin = 5,
- box_height = 50,
- line_margin = 150,
- ysource = ybegin,
- ytarget = ysource+line_margin;
- font_size = 20,
- font_width = -1,
- text_att = { "fill": "#000", "stroke": "none", "text-anchor": "start",
+ margin = 30,
+ padding = margin/3,
+ xbegin = 80,
+ ybegin = 5,
+ box_height = 50,
+ line_margin = 150,
+ ysource = ybegin,
+ ytarget = ysource+line_margin;
+ font_size = 13,
+ font_width = -1,
+ stroke_width = 1,
+ stroke_width_hi = 3,
+ text_att = { "fill": "#000", "stroke": "none", "text-anchor": "start",
"font-size": font_size, "font-family": "Times New Roman" },
shape_att = { "fill": "#eee", "stroke": "#000", "fill-opacity": 0,
- "stroke-width": 1 }
+ "stroke-width": stroke_width }
// dragging
cur_drag = null,
new_pos = -1,
@@ -42,7 +44,8 @@ var r,
// data
source = ["Das", "ist ein", "kleines", "Haus", "gewesen", "."],
target = ["This", "has been", "a", "small", "house", "."],
- align = [0, 1, 3, 4, 1, 5];
+ align = [0, 1, 3, 4, 1, 5],
+ data = null;
/*
* connection
@@ -101,12 +104,15 @@ rm_conn = function(id1, id2)
if (b)
break;
}
+ shapes_by_id[id1].attr({"stroke-width":stroke_width});
}
make_conns_from_a = function (align)
{
- var offset = source.length-1;
+ var offset = source.length;
for (var i=0; i < align.length; i++) {
- make_conn(shapes[i], shapes[offset+align[i]+1]);
+ for (var j=0; j