diff --git a/docs/inheritance.md b/docs/inheritance.md index 88dc85b8..d99451f3 100644 --- a/docs/inheritance.md +++ b/docs/inheritance.md @@ -2,21 +2,16 @@ Inheritance is an ability of an element to transfer a pack of properties to its `children` elements 'wrapped inside'. -`VisionBase` -Properties have to be set in a specific order: -### Main properties' inheritance: -* styles - `StyleSheet` -* parents -* parent's styles -* defaults +Properties, which can be inherited by objects, are `styles`, `prototypes` (if the object is a reference), `inherit` (it stands for the presence of `parent` objects), and `defaults`. +All values of `styles` property are contained in class `StyleSheet`, where they all are defined at `Group`s level. The `prototypes` property tree is defined in `SolidGroup` class via `PrototypeHolder` interface, and +`SolidReference` class helps to reuse a template object. -`SolidReference` -As for `prototypes`, this property has to be set after styles, but before parents. So the order will be this: -### Reference properties' inheritance: -* styles -* prototypes - `PrototypeHolder` in `SolidGroup` -* parents +The order of inheritance of properties is set in function `getPropertyValue` in `VisionBase` class. +The order is this: +* own styles +* prototypes +* parent * parent's styles * defaults diff --git a/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/Vision.kt b/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/Vision.kt index 924dfdd1..1c8e3a28 100644 --- a/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/Vision.kt +++ b/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/Vision.kt @@ -36,7 +36,7 @@ public interface Vision : Described, Configurable { public val manager: VisionManager? get() = parent?.manager /** - * This Vision own properties (ignoring inheritance, styles and defaults + * This Vision own properties (ignoring inheritance, styles and defaults) */ override val meta: ObservableMutableMeta @@ -92,7 +92,7 @@ public val Vision.propertyChanges: Flow } /** - * Subscribe on property updates. The subscription is bound to the given [scope] and canceled when the scope is canceled + * Subscribe on property updates. The subscription is bound to the given scope and canceled when the scope is canceled */ public fun Vision.onPropertyChange(callback: Meta.(Name) -> Unit) { meta.onChange(null, callback)