Skip to content

Layer event delegation - #4329

Merged
jfirebaugh merged 1 commit into
masterfrom
event-delegation
Mar 30, 2017
Merged

jfirebaugh merged 1 commit into
masterfrom
event-delegation

Conversation

@jfirebaugh

@jfirebaugh jfirebaugh commented Feb 25, 2017 •

Copy link
Copy Markdown
Contributor

Fixes #1002. I found that in order to really simplify most examples, we need special handling for mouseenter/mouseleave in addition to basic event delegation. But once we have that, a lot of common cases are simplified.

Launch Checklist

  • briefly describe the changes in this PR
  • should the special behavior apply to mouseenter/mouseleave or mouseover/mouseout?
    • both
  • document the behavior for enter/leave (or over/out)
  • leave/out event should also be triggered when cursor leaves the map element
  • write tests for all new functionality
  • manually test the debug page

@mourner mourner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fantastic! Would love merging this once the build is green.

Comment thread src/ui/map.js
* @returns {Map} `this`
*/
on(type, layer, listener) {
if (listener === undefined) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

return super.on(type, layer)?

Comment thread src/ui/map.js
* @returns {Map} `this`
*/
off(type, layer, listener) {
if (listener === undefined) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

super here too.

@mourner

mourner commented Feb 28, 2017

Copy link
Copy Markdown
Member

should the special behavior apply to mouseenter/mouseleave or mouseover/mouseout?

I think we could do both and alias one for the other, since there should be no difference in context of a map (in DOM context, there's only a difference when considering child elements, but we have a different model).

@mourner

mourner commented Mar 29, 2017

Copy link
Copy Markdown
Member

Any updates on this PR?

@jfirebaugh

Copy link
Copy Markdown
Contributor Author

Finally was able to carve out time to finish this off. 🏁

@jfirebaugh
jfirebaugh merged commit 2d44c23 into master Mar 30, 2017
@jfirebaugh
jfirebaugh deleted the event-delegation branch March 30, 2017 15:00
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.

2 participants