This commit is contained in:
barsdeveloper
2022-04-02 11:13:34 +02:00
parent 9ab8801eee
commit e901932953
26 changed files with 392 additions and 279 deletions

View File

@@ -1,6 +1,5 @@
// @ts-check
import Configuration from "../Configuration"
import html from "./html"
import ITemplate from "./ITemplate"
import sanitizeText from "./sanitizeText"

View File

@@ -1,6 +1,5 @@
// @ts-check
import Configuration from "../Configuration"
import html from "./html"
import ITemplate from "./ITemplate"
import sanitizeText from "./sanitizeText"

View File

@@ -48,7 +48,7 @@ export default class NodeTemplate extends SelectableDraggableTemplate {
}
node.dataset.name = node.getNodeName()
if (node.entity.AdvancedPinDisplay) {
node.dataset.advancedDisplay = node.entity.AdvancedPinDisplay
node.dataset.advancedDisplay = node.entity.AdvancedPinDisplay.toString()
}
node.style.setProperty("--ueb-position-x", sanitizeText(node.location[0]))
node.style.setProperty("--ueb-position-y", sanitizeText(node.location[1]))

View File

@@ -12,6 +12,10 @@ import Utility from "../Utility"
*/
export default class PinTemplate extends ITemplate {
hasInput() {
return false
}
/**
* Computes the html content of the pin.
* @param {PinElement} pin html element
@@ -72,7 +76,9 @@ export default class PinTemplate extends ITemplate {
const targetPin = pin.blueprint.getPin(pinReference)
if (targetPin) {
const [sourcePin, destinationPin] = pin.isOutput() ? [pin, targetPin] : [targetPin, pin]
pin.blueprint.addGraphElement(new LinkElement(sourcePin, destinationPin))
pin.blueprint.addGraphElement(
new LinkElement(/** @type {PinElement} */(sourcePin), /** @type {PinElement} */(destinationPin))
)
}
})
}
@@ -82,7 +88,7 @@ export default class PinTemplate extends ITemplate {
* @param {PinElement} pin
*/
applyConnected(pin) {
if (pin.isConnected()) {
if (pin.isLinked()) {
pin.classList.add("ueb-pin-fill")
} else {
pin.classList.remove("ueb-pin-fill")

View File

@@ -8,6 +8,10 @@ import PinTemplate from "./PinTemplate"
*/
export default class StringPinTemplate extends PinTemplate {
hasInput() {
return true
}
/**
* @param {PinElement} pin
*/
@@ -16,8 +20,9 @@ export default class StringPinTemplate extends PinTemplate {
return html`
<span class="ueb-pin-input">
<span class="ueb-pin-input-content" role="textbox" contenteditable="true"
onkeydown="${stopEventPropagation}" onkeyup="${stopEventPropagation}"
oncopy="${stopEventPropagation}" onpaste="${stopEventPropagation}"></span>
onfocus="_ => this.closest('ueb-blueprint').editText = true"
onfocusout="_ => this.closest('ueb-blueprint').editText = false"
></span>
</span>
`
}