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();
|
this.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for an element positino change and update accordingly
|
||||||
|
*/
|
||||||
positionCheck(){
|
positionCheck(){
|
||||||
const startPos = {x: this.start.offsetLeft, y: this.start.offsetTop};
|
const startPos = {x: this.start.offsetLeft, y: this.start.offsetTop};
|
||||||
const endPos = {x: this.end.offsetLeft, y: this.end.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}};
|
return { x: x, y: y, dir: {x: dirX, y: dirY}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the svg defs parts including the marker
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
svgDefs(){
|
svgDefs(){
|
||||||
const defs = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
const defs = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
||||||
const marker = document.createElementNS("http://www.w3.org/2000/svg", "marker");
|
const marker = document.createElementNS("http://www.w3.org/2000/svg", "marker");
|
||||||
|
@ -292,7 +299,10 @@ export class SimpleLine {
|
||||||
return defs;
|
return defs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Re)Paint the arrow
|
||||||
|
*
|
||||||
|
*/
|
||||||
update(){
|
update(){
|
||||||
if(!this.active){ return;} // don't do this if we are no longer active
|
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}`);
|
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(){
|
||||||
// remove the line
|
// remove the line
|
||||||
this.svg.remove();
|
this.svg.remove();
|
||||||
|
|
Loading…
Reference in a new issue