Skip to content

Heritable properties #5

@different55

Description

@different55

Writing down some thoughts on this issue from the original repo: metafizzy#4

Could be nice to have an inherit property or something similar where anything stashed inside will be passed down to all of its children, including the inherit property itself, which would then get passed onto grandchildren...

Could be useful in multiple situations. Like the group example in the issue, but also instances where you're copying a whole graph and want to change a property across the whole graph, like color. Say, copy a cone+cylinder=arrow graph and change the color of the whole arrow without having to change the parent and separately reach inside to change the child.

As far as implementation, at a glance right now it looks like it would be best slipped inside addChild, so when any child is added those properties can be copied over. Maybe a child could also set inherit: false to decline inherited properties or define its own inherits to override its parents. Maybe an updateInherits method similar to updatePath if those are updated on the fly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions