Naming refactoring

This commit is contained in:
barsdeveloper
2022-03-06 22:38:33 +01:00
parent 84dd01bfed
commit f613ea7924
22 changed files with 95 additions and 157 deletions

View File

@@ -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()
}

View File

@@ -7,8 +7,4 @@ export default class FunctionReferenceEntity extends IEntity {
MemberParent: ObjectReferenceEntity,
MemberName: ""
}
getAttributes() {
return FunctionReferenceEntity.attributes
}
}

View File

@@ -18,10 +18,6 @@ export default class GuidEntity extends IEntity {
return new GuidEntity({ valud: guid })
}
getAttributes() {
return GuidEntity.attributes
}
toString() {
return this.value
}

View File

@@ -50,6 +50,6 @@ export default class IEntity {
target[property] = defaultValue
}
}
defineAllAttributes([], this, this.getAttributes())
defineAllAttributes([], this, this.constructor.attributes)
}
}

View File

@@ -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 = {

View File

@@ -9,8 +9,4 @@ export default class KeyBindingEntity extends IEntity {
Key: String,
CommandName: String,
}
getAttributes() {
return KeyBindingEntity.attributes
}
}

View File

@@ -8,8 +8,4 @@ export default class LocalizedTextEntity extends IEntity {
key: String,
value: String
}
getAttributes() {
return LocalizedTextEntity.attributes
}
}

View File

@@ -25,10 +25,6 @@ export default class ObjectEntity extends IEntity {
CustomProperties: [PinEntity]
}
getAttributes() {
return ObjectEntity.attributes
}
/**
*
* @returns {String} The name of the node

View File

@@ -6,8 +6,4 @@ export default class ObjectReferenceEntity extends IEntity {
type: String,
path: String
}
getAttributes() {
return ObjectReferenceEntity.attributes
}
}

View File

@@ -6,10 +6,6 @@ export default class PathSymbolEntity extends IEntity {
value: String
}
getAttributes() {
return PathSymbolEntity.attributes
}
toString() {
return this.value
}

View File

@@ -38,10 +38,6 @@ export default class PinEntity extends IEntity {
bOrphanedPin: false,
}
getAttributes() {
return PinEntity.attributes
}
isInput() {
return !this.bHidden && this.Direction !== "EGPD_Output"
}

View File

@@ -8,8 +8,4 @@ export default class PinReferenceEntity extends IEntity {
objectName: PathSymbol,
pinGuid: GuidEntity
}
getAttributes() {
return PinReferenceEntity.attributes
}
}

View File

@@ -8,8 +8,4 @@ export default class VariableReferenceEntity extends IEntity {
MemberGuid: GuidEntity,
bSelfContext: false
}
getAttributes() {
return VariableReferenceEntity.attributes
}
}

View File

@@ -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")
}

View File

@@ -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))