Property editor minor refactoring

This commit is contained in:
Alexander Nozik 2024-01-01 14:37:22 +03:00
parent 30f6d51745
commit 067ed4aa3d
2 changed files with 9 additions and 5 deletions

View File

@ -31,7 +31,6 @@ public sealed class EditorPropertyState {
public data object Defined : EditorPropertyState() public data object Defined : EditorPropertyState()
public data class Default(public val source: String = "unknown") : EditorPropertyState() public data class Default(public val source: String = "unknown") : EditorPropertyState()
public data object Undefined : EditorPropertyState() public data object Undefined : EditorPropertyState()
} }
/** /**
@ -44,8 +43,8 @@ public fun PropertyEditor(
rootMeta: MutableMeta, rootMeta: MutableMeta,
getPropertyState: (Name) -> EditorPropertyState, getPropertyState: (Name) -> EditorPropertyState,
updates: Flow<Name>, updates: Flow<Name>,
name: Name = Name.EMPTY, name: Name,
rootDescriptor: MetaDescriptor? = null, rootDescriptor: MetaDescriptor?,
initialExpanded: Boolean? = null, initialExpanded: Boolean? = null,
) { ) {
var expanded: Boolean by remember { mutableStateOf(initialExpanded ?: true) } var expanded: Boolean by remember { mutableStateOf(initialExpanded ?: true) }
@ -97,8 +96,12 @@ public fun PropertyEditor(
} }
Span({ Span({
classes(TreeStyles.treeLabel) classes(TreeStyles.treeLabel)
if (editorPropertyState != EditorPropertyState.Defined) { when (editorPropertyState) {
classes(TreeStyles.treeLabelInactive) is EditorPropertyState.Default, EditorPropertyState.Undefined -> {
classes(TreeStyles.treeLabelInactive)
}
EditorPropertyState.Defined -> {}
} }
}) { }) {
Text(token) Text(token)

View File

@ -148,6 +148,7 @@ public fun ThreeView(
EditorPropertyState.Undefined EditorPropertyState.Undefined
} }
}, },
name = Name.EMPTY,
updates = vision.properties.changes, updates = vision.properties.changes,
rootDescriptor = vision.descriptor rootDescriptor = vision.descriptor
) )