Skip to content
Snippets Groups Projects
Commit afacc1d2 authored by Koichi Yasuoka's avatar Koichi Yasuoka
Browse files

bug fix

parent 0f81fe99
No related branches found
No related tags found
No related merge requests found
......@@ -6,9 +6,9 @@ conllusvg.writeNodesSVG=function(textid){
var n,g,t,w;
c.svg.setAttribute("width",c.width);
c.svg.setAttribute("height",c.height);
c.svg.setAttribute("transform","scale(-1,1)");
for(n in c.nodes){
g=document.createElementNS("http://www.w3.org/2000/svg","g");
g.setAttribute("transform","scale(-1,1) translate(-"+c.width+" 0)")
g.setAttribute("stroke","black");
g.setAttribute("fill","black");
if(c.nodes[n].svg!=null)
......@@ -105,9 +105,9 @@ conllusvg.writeLinksSVG=function(textid){
var n,g;
c.svg.setAttribute("width",c.width);
c.svg.setAttribute("height",c.height);
c.svg.setAttribute("transform","scale(-1,1)")
for(n in c.links){
g=document.createElementNS("http://www.w3.org/2000/svg","g");
g.setAttribute("transform","scale(-1,1) translate(-"+c.width+" 0)")
g.setAttribute("stroke","black");
g.setAttribute("fill","black");
if(c.links[n].svg!=null)
......@@ -251,40 +251,3 @@ conllusvg.writeLinksSVGdouble=function(link){
t.setAttribute("d","M "+link.toX+" "+link.toY+" l -4 -10 h 8 Z");
link.svg.appendChild(t);
}
conllusvg.redArrowSVG=function(textid){
var c=conllusvg.main[textid];
var r=c.svg.getBoundingClientRect();
var x=c.event.handler.clientX-r.left;
var y=c.event.handler.clientY-r.top;
var i=x-c.event.startX;
var j=y-c.event.startY;
var k=Math.sqrt(i*i+j*j);
var t;
if(k<15){
if(c.event.redArrow!=null){
c.svg.removeChild(c.event.redArrow);
c.svg.removeChild(c.event.redTriangle);
c.event.redArrow=c.event.redTriangle=null;
}
return;
}
x-=i*5/k;
y-=j*5/k;
if(c.event.redArrow==null){
t=document.createElementNS("http://www.w3.org/2000/svg","path");
t.setAttribute("stroke","red");
t.setAttribute("fill","none");
t.setAttribute("stroke-width",1);
t.setAttribute("d","M "+(c.width-c.event.startX)+" "+c.event.startY+" L "+(c.width-x)+" "+y);
c.svg.appendChild(t);
c.event.redArrow=t;
t=document.createElementNS("http://www.w3.org/2000/svg","path");
t.setAttribute("fill","red");
t.setAttribute("d","M 0 0 l -4 -10 h 8 Z");
c.svg.appendChild(t);
c.event.redTriangle=t;
}
else
c.event.redArrow.setAttribute("d","M "+(c.width-c.event.startX)+" "+c.event.startY+" L "+(c.width-x)+" "+y);
c.event.redTriangle.setAttribute("transform","matrix("+(-j/k)+" "+(-i/k)+" "+(-i/k)+" "+(j/k)+" "+(c.width-x)+" "+y+")");
}
......@@ -2,8 +2,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>CoNLL-U SVG Editor RtoL by Koichi Yasuoka, September 19, 2020.</title>
<script src="conllusvgview.js"></script>
<script src="conllusvgedit.js"></script>
<script src="conllusvgRtoL.js"></script>
<script src="conllusvgedit.js"></script>
<script src="conllusvgload.js"></script>
<script type="text/javascript">
function editorCheckURL(textid){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment