SVG Elements - Binding Property Path References

Is it possible to dynamically address an SGV element path? I have a binding that refers to a property within an element, and I want to be able to copy and paste the binding between multiple SVG elements that all have the same property without having ton manually update the array integers that address the specific element inside the binding.

Is there a way to reference the array position that the binding is in as the path to look for the property? So instead if using the integers 0,0 like my example, it just looks for the property inside the position that the binding is already in?

Unfortunately nope, you’re stuck with non-relative references for bindings to props within the same component. It would be VERY nice to have though

1 Like

Curious what the syntax would be here for a dynamic reference. It’s an interesting idea, just not sure how to make it approachable (if it’s even possible on the backend).

Perhaps something similar to the syntax used for parameters in a Named query?

{this.props.elements[:parentElemID].elements[:childElemID].name}

Something like

{thisItem.name}

{thisItem.parent.name}

{thisItem.element[2].name 
2 Likes

This would be super useful for things like this in the horizontal menu:

Instead, every time I add a new menu item I have to manually set the array index.
Replacing

{this.props.items[5].label}

with this

{thisItem.label}

would be amazing

2 Likes

I've created an idea:

2 Likes

While digging around making my own modules, you can access propsconfig. this.props.def.propconfig
Not sure if its easily mapped to the properties itself tho, but i guess it should, since its subscribed to it. And else you just gotta split the keys xd
image