mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-06-12 06:03:08 +08:00
Large refactoring and new nodes
* Fix node reference when changing elements * Fix ScriptVariables parsing * Fix invariant text and niagara types * Niagara convert nodes * Move node tests to own files * More Niagara tests * Niagara float and smaller fixes * More Decoding * More decoding * WIP * Float is real * WIP * More types and colors * Test case and small polish * WIP * WIP * Fix niagara script variables merging * Fix Niagara variables * Fixing mirrored ExportPath * Fix Export paths name adjustments * Simplify arc calculation * Simplify a bit arc calculation * source / destionation => origin / target * Minor refactoring * Fix switched link position * Rename some properties for uniformity * Fix input escape * Simplify test * About window * Dialog backdrop style * About dialog touches * Remove dependency and minot improvement * Light mode * Fix link location and css small improvement * Link direction and minor fixes * Some minor fixes and refactoring * Refactoring WIP * Shorting repetitive bits * More tests * Simplify linking tests
This commit is contained in:
37
js/element/NodeElement.js
Normal file → Executable file
37
js/element/NodeElement.js
Normal file → Executable file
@@ -101,13 +101,13 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
|
||||
/** @param {String} name */
|
||||
#redirectLinksBeforeRename(name) {
|
||||
for (let sourcePinElement of this.getPinElements()) {
|
||||
for (let targetPinReference of sourcePinElement.getLinks()) {
|
||||
for (let originPinElement of this.getPinElements()) {
|
||||
for (let targetPinReference of originPinElement.getLinks()) {
|
||||
this.blueprint.getPin(targetPinReference).redirectLink(
|
||||
sourcePinElement,
|
||||
originPinElement,
|
||||
new PinReferenceEntity(
|
||||
new SymbolEntity(name),
|
||||
sourcePinElement.entity.PinId,
|
||||
originPinElement.entity.PinId,
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -135,21 +135,14 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
"Name",
|
||||
/** @param {InstanceType<typeof ObjectEntity.attributes.Name>} newName */
|
||||
newName => {
|
||||
this.#redirectLinksBeforeRename(newName.value)
|
||||
this.nodeTitle = newName.value
|
||||
this.#redirectLinksBeforeRename(newName?.toString())
|
||||
this.nodeTitle = newName?.toString()
|
||||
this.nodeDisplayName = nodeTitle(entity)
|
||||
this.acknowledgeUpdate()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async getUpdateComplete() {
|
||||
let result = await super.getUpdateComplete()
|
||||
for (const pin of this.getPinElements()) {
|
||||
result &&= await pin.updateComplete
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/** @param {NodeElement} commentNode */
|
||||
bindToComment(commentNode) {
|
||||
if (commentNode != this && !this.boundComments.includes(commentNode)) {
|
||||
@@ -192,14 +185,14 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
setNodeWidth(value) {
|
||||
this.entity.setNodeWidth(value)
|
||||
this.sizeX = value
|
||||
this.acknowledgeReflow()
|
||||
this.acknowledgeUpdate(true)
|
||||
}
|
||||
|
||||
/** @param {Number} value */
|
||||
setNodeHeight(value) {
|
||||
this.entity.setNodeHeight(value)
|
||||
this.sizeY = value
|
||||
this.acknowledgeReflow()
|
||||
this.acknowledgeUpdate(true)
|
||||
}
|
||||
|
||||
/** @param {IElement[]} nodesWhitelist */
|
||||
@@ -222,11 +215,13 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
super.setLocation(x, y, acknowledge)
|
||||
}
|
||||
|
||||
acknowledgeReflow() {
|
||||
this.requestUpdate()
|
||||
this.updateComplete.then(() => this.computeSizes())
|
||||
let reflowEvent = new CustomEvent(Configuration.nodeReflowEventName)
|
||||
this.dispatchEvent(reflowEvent)
|
||||
acknowledgeUpdate(resize = false) {
|
||||
const event = new CustomEvent(Configuration.nodeUpdateEventName)
|
||||
if (resize) {
|
||||
this.requestUpdate()
|
||||
this.updateComplete.then(() => this.computeSizes())
|
||||
}
|
||||
this.dispatchEvent(event)
|
||||
}
|
||||
|
||||
setShowAdvancedPinDisplay(value) {
|
||||
|
||||
Reference in New Issue
Block a user