Description
The docs for event-set state:
The event-set component also works with components that have multiple properties using A-Frame component dot syntax (i.e., ${componentName}.${propertyName})
This seems to work fine - except in the case where a component has a dash in it's name, then event-set cannot set the property, and instead unpredictable results can follow.
For an example of the problem see this glitch:
https://prickle-boulder-worm.glitch.me/
The code for the two rectangles is identical except that one uses component "my-position" the other uses (identical) component "myposition". When Enter is pressed the 2nd one moves position as expected. The first simply disappears!
Looking at what's gong on in event-set in the debugger, it appears that by the time the component name "my-position" arrives in the event-set component, A-Frame has already transformed it into "myPosition". The later attempt to look this up in the components object seems to fail.
"animation" is an example of another A-Frame component which can set attributes on individual components. This uses a dedicated "property" attribute for the property to be set, and seems to work fine with all component names, whether or not they have dashes.
See this glitch for an illustration similar to the one above:
https://spiky-caring-bicycle.glitch.me/
So one solution might be to update the event-set interface to use an explicit "property" attribute to allow the specification of the property to be set.
I suspect this new interface could be supported in parallel with the old interface, to enable back-compatibility. I'd be happy to make this change as a PR if it would be accepted.
There may be other solutions to the problem, but it seems they would require some changes to the A-Frame infrastructure itself...
In the meantime, the workaround I have been using is, for any component with dashes in the name, where I want to use event-set, I create another wrapper component without the dashes, and I use that instead...