summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--edit.html29
-rw-r--r--edit.js (renamed from r.js)40
2 files changed, 58 insertions, 11 deletions
diff --git a/edit.html b/edit.html
index a1394ec..c0905d9 100644
--- a/edit.html
+++ b/edit.html
@@ -1,21 +1,30 @@
<!DOCTYPE html>
<!-- 2015-08-26 -->
-<html lang='en'>
+<html lang="en">
<head>
- <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>derivation editor</title>
- <script src='raphael.js' type='text/javascript' charset='utf-8'></script>
- <script src='r.js' type='text/javascript' charset='utf-8'></script>
- <script src='Raphael.InlineTextEditing/raphael.inline_text_editing.js' charset='utf-8'></script>
+ <script src="raphael.js" type="text/javascript" charset="utf-8"></script>
+ <script src="Raphael.InlineTextEditing/raphael.inline_text_editing.js" charset="utf-8"></script>
+ <script src="edit.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
- <div id='holder'></div>
- <input type='button' value='+' onClick='add_obj()' />
- <input type='button' value='D' onClick='extract_data()' onClick='extract_data()' />
- <p id='debug'></p>
- <pre id='data'></pre>
+ <div id="wrapper">
+ <div id="holder"></div>
+ </div>
+ <input type="button" value="+" onClick="add_obj()" />
+ <input type="button" value="reset" onClick="reset();" />
+ <input type="button" value="D" onClick="extract_data()" />
+ <pre id="data">
+ <p id="debug">&nbsp;</p>
+ </pre>
<h3>TODO</h3>
<ul>
+ <li><strike>edit text and resize, move (dblclick)</strike></li>
+ <li><strike>remove objs (move to special field)</strike></li>
+ <li><strike>add objs ("+" button, far right)</strike></li>
+ <li><strike>add alignments (click source, then target)</strike></li>
+ <li><strike>extract data</strike></li>
<li>integrate into MT system</li>
</ul>
</body>
diff --git a/r.js b/edit.js
index 811aa61..35ef20a 100644
--- a/r.js
+++ b/edit.js
@@ -412,7 +412,7 @@ var extract_data = function ()
///////////////////////////////////////////////////////////////////////////////
-window.onload = function ()
+var init = function ()
{
// canvas
r = Raphael("holder",0,0);
@@ -439,5 +439,43 @@ window.onload = function ()
make_objs(target, "target");
// initial connections from alignment
make_conns_from_a(align);
+},
+reset = function()
+{
+ shapes_by_id = {};
+ curDrag = null;
+ curEd = null;
+ curEdShape = null;
+ shapes = [];
+ target_shapes = [];
+ texts = [];
+ connections = {};
+ 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;
+ id = 0;
+ connect_mode = false;
+ connect_mode_shape = null;
+ edit_mode = false;
+ rm_shape = null;
+
+ document.getElementById("holder").parentElement.removeChild(document.getElementById("holder"));
+ var new_holder = document.createElement("div");
+ new_holder.setAttribute("id","holder");
+ document.getElementById("wrapper").appendChild(new_holder);
+
+ init();
+};
+
+window.onload = function ()
+{
+ init();
};