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:
BarsDev
2025-02-07 00:36:03 +02:00
committed by GitHub
parent 876b8ce47f
commit 6ba2705386
347 changed files with 10108 additions and 6417 deletions

0
js/input/IInput.js Normal file → Executable file
View File

0
js/input/InputCombination.js Normal file → Executable file
View File

View File

@@ -1,3 +1,4 @@
import NiagaraClipboardContent from "../../entity/objects/NiagaraClipboardContent.js"
import IInput from "../IInput.js"
/**
@@ -28,20 +29,8 @@ export default class Copy extends IInput {
window.removeEventListener("copy", this.#copyHandler)
}
getSerializedText() {
const allNodes = this.blueprint.getNodes(true).map(n => n.entity)
const exported = allNodes.filter(n => n.exported).map(n => n.serialize())
const result = allNodes.filter(n => !n.exported).map(n => n.serialize())
if (exported.length) {
this.blueprint.entity.ExportedNodes.value = btoa(exported.join(""))
result.splice(0, 0, this.blueprint.entity.serialize(false))
delete this.blueprint.entity.ExportedNodes
}
return result.join("")
}
copied() {
const value = this.getSerializedText()
const value = this.blueprint.getSerializedText()
navigator.clipboard.writeText(value)
return value
}

View File

@@ -33,13 +33,6 @@ export default class Cut extends IInput {
window.removeEventListener("cut", this.#cutHandler)
}
getSerializedText() {
return this.blueprint
.getNodes(true)
.map(node => node.entity.serialize())
.join("")
}
cut() {
this.blueprint.template.getCopyInputObject().copied()
this.blueprint.removeGraphElement(...this.blueprint.getNodes(true))

0
js/input/keyboard/KeyboardEnableZoom.js Normal file → Executable file
View File

0
js/input/keyboard/KeyboardShortcut.js Normal file → Executable file
View File

0
js/input/mouse/IMouseClickDrag.js Normal file → Executable file
View File

0
js/input/mouse/IPointing.js Normal file → Executable file
View File

0
js/input/mouse/MouseClick.js Normal file → Executable file
View File

View File

@@ -14,21 +14,15 @@ export default class MouseCreateLink extends IMouseClickDrag {
/** @type {NodeListOf<PinElement>} */
#listenedPins
/** @type {PinElement} */
#knotPin = null
/** @param {MouseEvent} e */
#mouseenterHandler = e => {
if (!this.enteredPin) {
this.linkValid = false
this.enteredPin = /** @type {PinElement} */(e.target)
const a = this.link.source ?? this.target // Remember target might have change
const a = this.link.origin ?? this.target // Remember target might have change
const b = this.enteredPin
const outputPin = a.isOutput() ? a : b
if (
a.nodeElement.getType() === Configuration.paths.knot
|| b.nodeElement.getType() === Configuration.paths.knot
) {
if (a.isKnot() || b.isKnot()) {
// A knot can be linked to any pin, it doesn't matter the type or input/output direction
this.link.setMessageCorrect()
this.linkValid = true
@@ -83,9 +77,6 @@ export default class MouseCreateLink extends IMouseClickDrag {
}
startDrag(location) {
if (this.target.nodeElement.getType() == Configuration.paths.knot) {
this.#knotPin = this.target
}
/** @type {LinkElement} */
this.link = /** @type {LinkElementConstructor} */(ElementFactory.getConstructor("ueb-link"))
.newObject(this.target, null)
@@ -99,11 +90,11 @@ export default class MouseCreateLink extends IMouseClickDrag {
}
})
this.link.startDragging()
this.link.setDestinationLocation(location)
this.link.setTargetLocation(location)
}
dragTo(location, movement) {
this.link.setDestinationLocation(location)
this.link.setTargetLocation(location)
}
endDrag() {
@@ -113,28 +104,30 @@ export default class MouseCreateLink extends IMouseClickDrag {
})
this.#listenedPins = null
if (this.enteredPin && this.linkValid) {
const knot = this.enteredPin.isKnot()
? this.enteredPin
: this.link.origin.isKnot() ? this.link.origin : null
// Knot can use wither the input or output (by default) part indifferently, check if a switch is needed
if (this.#knotPin) {
const otherPin = this.#knotPin !== this.link.source ? this.link.source : this.enteredPin
if (knot) {
const otherPin = knot !== this.link.origin ? this.link.origin : this.enteredPin
// Knot pin direction correction
if (this.#knotPin.isInput() && otherPin.isInput() || this.#knotPin.isOutput() && otherPin.isOutput()) {
const oppositePin = /** @type {KnotPinTemplate} */(this.#knotPin.template).getOppositePin()
if (this.#knotPin === this.link.source) {
this.link.source = oppositePin
if (knot.isInput() && otherPin.isInput() || knot.isOutput() && otherPin.isOutput()) {
const oppositePin = /** @type {KnotPinTemplate} */(knot.template).getoppositePin()
if (knot === this.link.origin) {
this.link.origin = oppositePin
} else {
this.enteredPin = oppositePin
}
}
} else if (this.enteredPin.nodeElement.getType() === Configuration.paths.knot) {
this.#knotPin = this.enteredPin
if (this.link.source.isOutput()) {
// Knot uses by default the output pin, let's switch to keep it coherent with the source node we have
this.enteredPin = /** @type {KnotPinTemplate} */(this.enteredPin.template).getOppositePin()
} else if (this.enteredPin.isKnot()) {
if (this.link.origin.isOutput()) {
// Knot uses by default the output pin, let's switch to keep it coherent with the origin node we have
this.enteredPin = /** @type {KnotPinTemplate} */(this.enteredPin.template).getoppositePin()
}
}
if (!this.link.source.getLinks().find(ref => ref.equals(this.enteredPin.createPinReference()))) {
if (!this.link.origin.getLinks().find(ref => ref.equals(this.enteredPin.createPinReference()))) {
this.blueprint.addGraphElement(this.link)
this.link.destination = this.enteredPin
this.link.target = this.enteredPin
} else {
this.link.remove()
}

0
js/input/mouse/MouseDbClick.js Normal file → Executable file
View File

0
js/input/mouse/MouseIgnore.js Normal file → Executable file
View File

0
js/input/mouse/MouseWheel.js Normal file → Executable file
View File