mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-18 11:37:33 +08:00
WIP
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
import Configuration from "../Configuration"
|
||||
import html from "./html"
|
||||
import ITemplate from "./ITemplate"
|
||||
import sanitizeText from "./sanitizeText"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
import Configuration from "../Configuration"
|
||||
import html from "./html"
|
||||
import ITemplate from "./ITemplate"
|
||||
import sanitizeText from "./sanitizeText"
|
||||
|
||||
@@ -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]))
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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>
|
||||
`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user