Links wip

This commit is contained in:
barsdeveloper
2022-03-10 22:31:47 +01:00
parent 9861b5cc00
commit 8bca6dcff4
9 changed files with 210 additions and 30 deletions

View File

@@ -25,7 +25,7 @@ export default class LinkTemplate extends ITemplate {
return x => a / x + q
}
/*
/**
* Returns a function performing a clamped line passing through two points. It is clamped after and before the
* points. It is easier explained with an example.
* b ______
@@ -55,7 +55,7 @@ export default class LinkTemplate extends ITemplate {
static c2DecreasingValue = LinkTemplate.decreasingValue(-0.06, [500, 130])
static c1Clamped = LinkTemplate.clampedLine([0, 100], [100, 30])
static c2Clamped = LinkTemplate.clampedLine([0, 100], [200, 30])
/**
* Computes the html content of the target element.
@@ -150,11 +150,8 @@ export default class LinkTemplate extends ITemplate {
: 10
)
* fillRatio
let c2 = LinkTemplate.clampedLine([0, 100], [100, 30])(xInverted ? -dx : dx) + start
c2 = Math.min(
c2,
LinkTemplate.c2DecreasingValue(width)
)
let c2 = LinkTemplate.c2Clamped(xInverted ? -dx : dx) + start
c2 = Math.min(c2, LinkTemplate.c2DecreasingValue(width))
const d = Configuration.linkRightSVGPath(start, c1, c2)
// TODO move to CSS when Firefox will support property d and css will have enough functions
link.pathElement.setAttribute("d", d)

View File

@@ -20,7 +20,7 @@ export default class NodeTemplate extends SelectableDraggableTemplate {
<div class="ueb-node-header">
<span class="ueb-node-name">
<span class="ueb-node-symbol"></span>
<span class="ueb-node-text">${sanitizeText(node.entity.getNodeDisplayName())}</span>
<span class="ueb-node-text">${sanitizeText(node.entity.getName())}</span>
</span>
</div>
<div class="ueb-node-body">

View File

@@ -4,6 +4,7 @@ import sanitizeText from "./sanitizeText"
import Utility from "../Utility"
/**
* @typedef {import("../element/NodeElement").default} NodeElement
* @typedef {import("../element/PinElement").default} PinElement
*/
export default class PinTemplate extends ITemplate {
@@ -39,6 +40,10 @@ export default class PinTemplate extends ITemplate {
pin.isConnected() ? "ueb-pin-fill" : null
)
pin.clickableElement = pin
pin.nodeElement = pin.closest("ueb-node")
if (!pin.nodeElement) {
window.customElements.whenDefined(linkMessage.constructor.tagName).then(linkMessage)
}
}
/**