Documentation
This commit is contained in:
parent
6675dcb272
commit
359d886767
1 changed files with 14 additions and 1 deletions
|
@ -204,6 +204,9 @@ export class SimpleLine {
|
|||
this.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for an element positino change and update accordingly
|
||||
*/
|
||||
positionCheck(){
|
||||
const startPos = {x: this.start.offsetLeft, y: this.start.offsetTop};
|
||||
const endPos = {x: this.end.offsetLeft, y: this.end.offsetTop};
|
||||
|
@ -275,6 +278,10 @@ export class SimpleLine {
|
|||
return { x: x, y: y, dir: {x: dirX, y: dirY}};
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the svg defs parts including the marker
|
||||
* @returns {Object}
|
||||
*/
|
||||
svgDefs(){
|
||||
const defs = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
||||
const marker = document.createElementNS("http://www.w3.org/2000/svg", "marker");
|
||||
|
@ -292,7 +299,10 @@ export class SimpleLine {
|
|||
return defs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (Re)Paint the arrow
|
||||
*
|
||||
*/
|
||||
update(){
|
||||
if(!this.active){ return;} // don't do this if we are no longer active
|
||||
|
||||
|
@ -417,6 +427,9 @@ export class SimpleLine {
|
|||
C ${startPos.dirx} ${startPos.diry}, ${endPos.dirx} ${endPos.diry}, ${endPos.x} ${endPos.y}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the line element from the dom and invalidate it.
|
||||
*/
|
||||
remove(){
|
||||
// remove the line
|
||||
this.svg.remove();
|
||||
|
|
Loading…
Reference in a new issue