Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up and document event propagation properties #5880

Merged
merged 3 commits into from Oct 27, 2017

Conversation

perliedman
Copy link
Member

@perliedman perliedman commented Oct 26, 2017

I had somehow missed #4510 and was a bit surprised to find out about this undocumented hack to get FeatureGroup to work.

Thinking about it, I think the approach in itself is sane, but the real problem lies in the naming of the event property - layer is very specific to FeatureGroup's utilization of the property.

On the other hand, there's probably a lot of code out there that use this property, so I'm going for deprecating this property, although actually removing it is not something we need to do soon.

Instead, I added two properties:

  • sourceTarget - this is the original target of the event, the object it was first fire on before any propagation occured
  • propagatedFrom - this is exactly the same as the current layer; that is, the previous object in the chain of object propagating the event (to be honest, I don't feel 100% about the name of this property, so feel free to suggest a better one)

Ideally, we should have made this analog to the DOM's target and currentTarget, but we already use the property target with the same semantic as the DOM's currentTarget, so that will unfortunately not work.

Also documents events' target, sourceTarget, propagatedFrom
and layer properties.

Fixes #4510.
For propagated events, the last object that propagated the event to its
event parent.
@property layer: Object
**Deprecated.** The same as `propagetedFrom`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here: propageted vs propagated

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍, fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants