Links implementation WIP

This commit is contained in:
barsdeveloper
2022-02-02 18:20:00 +01:00
parent e4ff5efc80
commit b2c3ba14f3
6 changed files with 51 additions and 27 deletions

5
dist/ueblueprint.js vendored
View File

@@ -399,6 +399,7 @@ class SelectorTemplate extends Template {
*/
apply(selector) {
super.apply(selector);
selector.classList.add("ueb-positioned");
this.applyFinishSelecting(selector);
}
@@ -1494,6 +1495,7 @@ class LinkTemplate extends Template {
*/
apply(link) {
super.apply(link);
link.classList.add("ueb-positioned");
}
/**
@@ -1514,6 +1516,9 @@ class LinkTemplate extends Template {
applyDestinationLocation(link, finalPosition) {
link.style.setProperty("--ueb-to-x", sanitizeText(finalPosition[0]));
link.style.setProperty("--ueb-to-y", sanitizeText(finalPosition[1]));
const height = Math.abs(link.style.getPropertyValue("--ueb-from-y") - finalPosition[1]);
let skew = Math.atan(height / (finalPosition[0] - link.style.getPropertyValue("--ueb-from-x"))) - Math.PI / 2;
link.style.setProperty("--ueb-link-skew", skew);
}
}