You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
720 B
22 lines
720 B
function createSVG(element){
|
|
return document.createElementNS('http://www.w3.org/2000/svg', element);
|
|
}
|
|
|
|
function addLine(line, svg_parent){
|
|
var svgline = createSVG('line');
|
|
svgline.setAttribute('x1', line.starting_point.x);
|
|
svgline.setAttribute('y1', line.starting_point.y);
|
|
svgline.setAttribute('x2', line.end_point.x);
|
|
svgline.setAttribute('y2', line.end_point.y);
|
|
|
|
svg_parent.appendChild(svgline);
|
|
return svgline;
|
|
}
|
|
|
|
function updateLine(svgline, abstractline){
|
|
svgline.setAttribute('x1', abstractline.starting_point.x);
|
|
svgline.setAttribute('y1', abstractline.starting_point.y);
|
|
svgline.setAttribute('x2', abstractline.end_point.x);
|
|
svgline.setAttribute('y2', abstractline.end_point.y);
|
|
return svgline;
|
|
}
|