mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-26 10:14:43 +08:00
Naming refactoring
This commit is contained in:
@@ -22,7 +22,7 @@ export default class PinElement extends IElement {
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback()
|
||||
this.#color = window.getComputedStyle(this).getPropertyValue("--ueb-node-value-color")
|
||||
this.#color = window.getComputedStyle(this).getPropertyValue("--ueb-pin-color")
|
||||
}
|
||||
|
||||
createInputObjects() {
|
||||
@@ -42,10 +42,6 @@ export default class PinElement extends IElement {
|
||||
return this.entity.PinName
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return PinEntity.attributes
|
||||
}
|
||||
|
||||
isInput() {
|
||||
return this.entity.isInput()
|
||||
}
|
||||
|
||||
@@ -7,8 +7,4 @@ export default class FunctionReferenceEntity extends IEntity {
|
||||
MemberParent: ObjectReferenceEntity,
|
||||
MemberName: ""
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return FunctionReferenceEntity.attributes
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,6 @@ export default class GuidEntity extends IEntity {
|
||||
return new GuidEntity({ valud: guid })
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return GuidEntity.attributes
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
@@ -50,6 +50,6 @@ export default class IEntity {
|
||||
target[property] = defaultValue
|
||||
}
|
||||
}
|
||||
defineAllAttributes([], this, this.getAttributes())
|
||||
defineAllAttributes([], this, this.constructor.attributes)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,6 @@ export default class IntegerEntity extends IEntity {
|
||||
value: Number
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return IntegerEntity.attributes
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
if (options.constructor === Number || options.constructor === String) {
|
||||
options = {
|
||||
|
||||
@@ -9,8 +9,4 @@ export default class KeyBindingEntity extends IEntity {
|
||||
Key: String,
|
||||
CommandName: String,
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return KeyBindingEntity.attributes
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ export default class LocalizedTextEntity extends IEntity {
|
||||
key: String,
|
||||
value: String
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return LocalizedTextEntity.attributes
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,6 @@ export default class ObjectEntity extends IEntity {
|
||||
CustomProperties: [PinEntity]
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return ObjectEntity.attributes
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {String} The name of the node
|
||||
|
||||
@@ -6,8 +6,4 @@ export default class ObjectReferenceEntity extends IEntity {
|
||||
type: String,
|
||||
path: String
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return ObjectReferenceEntity.attributes
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,6 @@ export default class PathSymbolEntity extends IEntity {
|
||||
value: String
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return PathSymbolEntity.attributes
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
@@ -38,10 +38,6 @@ export default class PinEntity extends IEntity {
|
||||
bOrphanedPin: false,
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return PinEntity.attributes
|
||||
}
|
||||
|
||||
isInput() {
|
||||
return !this.bHidden && this.Direction !== "EGPD_Output"
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ export default class PinReferenceEntity extends IEntity {
|
||||
objectName: PathSymbol,
|
||||
pinGuid: GuidEntity
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return PinReferenceEntity.attributes
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,4 @@ export default class VariableReferenceEntity extends IEntity {
|
||||
MemberGuid: GuidEntity,
|
||||
bSelfContext: false
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return VariableReferenceEntity.attributes
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ export default class LinkTemplate extends ITemplate {
|
||||
link.blueprint.dataset.creatingLink = true
|
||||
const referencePin = link.getSourcePin() ?? link.getDestinationPin()
|
||||
if (referencePin) {
|
||||
link.style.setProperty("--ueb-node-value-color", referencePin.getColor())
|
||||
link.style.setProperty("--ueb-pin-color", referencePin.getColor())
|
||||
}
|
||||
link.classList.add("ueb-link-dragging")
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ export default class PinTemplate extends ITemplate {
|
||||
render(pin) {
|
||||
if (pin.isInput()) {
|
||||
return html`
|
||||
<span class="ueb-node-value-icon ${pin.isConnected() ? 'ueb-node-value-fill' : ''}"></span>
|
||||
<span class="ueb-pin-icon"></span>
|
||||
${sanitizeText(pin.getPinDisplayName())}
|
||||
`
|
||||
} else {
|
||||
return html`
|
||||
${sanitizeText(pin.getPinDisplayName())}
|
||||
<span class="ueb-node-value-icon ${pin.isConnected() ? 'ueb-node-value-fill' : ''}"></span>
|
||||
<span class="ueb-pin-icon"></span>
|
||||
`
|
||||
}
|
||||
}
|
||||
@@ -34,17 +34,32 @@ export default class PinTemplate extends ITemplate {
|
||||
apply(pin) {
|
||||
super.apply(pin)
|
||||
pin.classList.add(
|
||||
"ueb-node-" + (pin.isInput() ? "input" : pin.isOutput() ? "output" : "hidden"), "ueb-node-value-" + sanitizeText(pin.getType()))
|
||||
"ueb-node-" + (pin.isInput() ? "input" : pin.isOutput() ? "output" : "hidden"),
|
||||
"ueb-pin-" + sanitizeText(pin.getType()),
|
||||
pin.isConnected() ? "ueb-pin-fill" : null
|
||||
)
|
||||
pin.clickableElement = pin
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the connection style to the element.
|
||||
* @param {PinElement} pin
|
||||
*/
|
||||
applyConnected(pin) {
|
||||
if (pin.isConnected()) {
|
||||
pin.classList.add("ueb-pin-fill")
|
||||
} else {
|
||||
pin.classList.remove("ueb-pin-fill")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {PinElement} pin
|
||||
* @returns
|
||||
*/
|
||||
getLinkLocation(pin) {
|
||||
const rect = pin.querySelector(".ueb-node-value-icon").getBoundingClientRect()
|
||||
const rect = pin.querySelector(".ueb-pin-icon").getBoundingClientRect()
|
||||
return pin.blueprint.compensateTranslation(Utility.convertLocation(
|
||||
[(rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2],
|
||||
pin.blueprint.gridElement))
|
||||
|
||||
Reference in New Issue
Block a user