hs-furtwangen / FUDGE

https://hs-furtwangen.github.io/FUDGE/
MIT License
2 stars 1 forks source link

undefined string doesn't show in interface #20

Open JirkaDellOro opened 2 months ago

JirkaDellOro commented 2 months ago

Joints use the attribute nameChildToConnect, which is undefined by default and can be typed by a creator in the editor. This attribute doesn't show anymore in the generated user interface. The commit that introduced the problem is

Date: Mon Jul 29 2024 14:17:23 GMT+0200 (Central European Summer Time)

I was able to make it show defining getAttributeTypes in Joint and it shows "Drop your string here...", but the element can't be changed.

plojo commented 2 months ago

You need to provide "String" with a capital "S" in the AttributeTypes:

public getMutatorAttributeTypes(_mutator: Mutator): MutatorAttributeTypes {
  let types: MutatorAttributeTypes = super.getMutatorAttributeTypes(_mutator);
  types.nameChildToConnect = "String";
  return types;
}

This because the CustomElementTextInput gets registered for String.name. However we now have other options available to do this: using the @type(Node) decorator it is possibile to tell the editor that a Node can be dropped directly on a property. As of now this doesn't work with JavaScript #privateField and the serialization is rather messy.

plojo commented 2 months ago

I am also thinking if it would be better for MutatorAttributeTypes to store the classes (constructors) rather than a string i.e.:

export interface MutatorAttributeTypes {
  [attribute: string]: string | Object;
}

to:

export interface MutatorAttributeTypes {
  [attribute: string]: Function | Object;
}

This would align it with the new MetaAttributeTypes.