Flip Flop node info added and minor adjustments

This commit is contained in:
barsdeveloper
2023-04-16 13:37:15 +02:00
parent a82f61ac4a
commit c1bbbfef90
11 changed files with 137 additions and 49 deletions

View File

@@ -201,11 +201,6 @@ export default class ObjectEntity extends IEntity {
CustomProperties: {
type: [new UnionType(PinEntity, UnknownPinEntity)],
},
// Legacy
Pins: {
type: [ObjectReferenceEntity],
inlined: true,
},
}
static nameRegex = /^(\w+?)(?:_(\d+))?$/
@@ -306,12 +301,34 @@ export default class ObjectEntity extends IEntity {
/** @type {IntegerEntity?} */ this.ErrorType
/** @type {String?} */ this.ErrorMsg
/** @type {(PinEntity | UnknownPinEntity)[]} */ this.CustomProperties
// Legacy
/** @type {ObjectReferenceEntity[]} */ this.Pins
// Legacy objects transform into pins
if (this["Pins"] instanceof Array) {
this["Pins"]
.forEach(
/** @param {ObjectReferenceEntity} objectReference */
objectReference => {
const pinObject = this[Configuration.subObjectAttributeNameFromReference(objectReference, true)]
if (pinObject) {
const pinEntity = PinEntity.fromLegacyObject(pinObject)
pinEntity.LinkedTo = []
this.CustomProperties.push(pinEntity)
}
})
}
// Legacy path names
if (this.Class.type && !this.Class.type.startsWith("/")) {
const nodeType = Object.keys(Configuration.nodeType)
.find(type => Utility.getNameFromPath(Configuration.nodeType[type]) === this.Class.type)
if (nodeType) {
this.Class.type = Configuration.nodeType[nodeType]
}
}
}
getClass() {
return this.Class.path
return this.Class.path ? this.Class.path : this.Class.type
}
getType() {
@@ -591,6 +608,8 @@ export default class ObjectEntity extends IEntity {
case Configuration.nodeType.executionSequence:
case Configuration.nodeType.multiGate:
return SVGIcon.sequence
case Configuration.nodeType.flipflop:
return SVGIcon.flipflop
case Configuration.nodeType.forEachElementInEnum:
case Configuration.nodeType.forLoop:
case Configuration.nodeType.forLoopWithBreak:

View File

@@ -1,3 +1,4 @@
import Utility from "../Utility.js"
import IEntity from "./IEntity.js"
export default class ObjectReferenceEntity extends IEntity {
@@ -27,6 +28,6 @@ export default class ObjectReferenceEntity extends IEntity {
}
getName() {
return this.path.match(/[^\.\/]+$/)?.[0] ?? ""
return Utility.getNameFromPath(this.path)
}
}

View File

@@ -23,6 +23,7 @@ import VectorEntity from "./VectorEntity.js"
/**
* @typedef {import("./IEntity.js").AnyValue} AnyValue
* @typedef {import("./ObjectEntity.js").default} ObjectEntity
* @typedef {import("lit").CSSResult} CSSResult
*/
@@ -150,6 +151,11 @@ export default class PinEntity extends IEntity {
/** @type {Boolean} */ this.bOrphanedPin
}
/** @param {ObjectEntity} objectEntity */
static fromLegacyObject(objectEntity) {
return new PinEntity(objectEntity, true)
}
getType() {
const subCategory = this.PinType.PinSubCategoryObject
if (this.PinType.PinCategory === "struct" || this.PinType.PinCategory === "object") {