Graph link work in progress

This commit is contained in:
barsdeveloper
2021-12-22 22:24:13 +01:00
parent 93acfb5d33
commit 352f235610
14 changed files with 399 additions and 159 deletions

View File

@@ -18,4 +18,32 @@ export default class LinkTemplate extends Template {
</svg>
`
}
/**
* Applies the style to the element.
* @param {GraphLink} link Element of the graph
*/
apply(link) {
super.apply(link)
}
/**
* Applies the style relative to the source pin location.
* @param {GraphLink} link Link element
*/
applySourceLocation(link, initialPosition) {
// Set initial position
link.style.setProperty("--ueb-link-from-x", sanitizeText(initialPosition[0]))
link.style.setProperty("--ueb-link-from-y", sanitizeText(initialPosition[1]))
}
/**
* Applies the style relative to the destination pin location.
* @param {GraphLink} link Link element
*/
applyDestinationLocation(link, finalPosition) {
link.style.setProperty("--ueb-link-to-x", sanitizeText(finalPosition[0]))
link.style.setProperty("--ueb-link-to-y", sanitizeText(finalPosition[1]))
}
}

View File

@@ -57,7 +57,7 @@ export default class NodeTemplate extends SelectableDraggableTemplate {
}
/**
* Returns the html elements rendered from this template.
* Applies the style to the element.
* @param {GraphNode} node Element of the graph
*/
apply(node) {