-
Notifications
You must be signed in to change notification settings - Fork 889
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
Feature - Support Map handlers when component updated #452
Feature - Support Map handlers when component updated #452
Conversation
Node 6 build failing on Travis CI with:
@PaulLeCam - don't know whether you've seen this before or whether its inconsistent, but if you can re-run that would be great. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR, good idea!
Could you merge from master please? That should fix the failing Travis build.
Could you also update the documentation regarding the "dynamic properties" of the Map component please?
} | ||
|
||
if (scrollWheelZoom !== fromProps.scrollWheelZoom) { | ||
if (scrollWheelZoom === true || typeof scrollWheelZoom === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why checking if scrollWheelZoom
is a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scrollWheelZoom
accepts a boolean value or a string in the latest leaflet documentation
} | ||
|
||
if (touchZoom !== fromProps.touchZoom) { | ||
if (touchZoom === true || typeof touchZoom === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why checking if touchZoom
is a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above - link
c1d2c14
to
d18b5c9
Compare
@PaulLeCam Updated as discussed. Just to note, I took another look at the Leaflet source code regarding the string value that can be passed for |
After looking at the leaflet source code it looks like you can only pass a boolean value or the string 'center'. Therefore I've made these conditionals stricter as it doesn't support any other string value.
d18b5c9
to
934442d
Compare
Thanks! One way to achieve this could be to update the |
Hey @PaulLeCam, I've reset the conditional logic for In terms of your first point, I'm not entirely sure what you mean. However, the logic checks whether the changed value is true OR a string type. In terms of the leaflet code, regardless of the value passed ( It checks the value passed down when performing an action e.g. scrollWheelZoom's _performZoom Let me know if you want me to update anything else. |
Thanks for the changes! Regarding enabling the handler when setting the value to |
Hey @PaulLeCam, apologies, now I know what you mean. Thanks for the detailed explanation above. I've updated the functionality in the latest commit. |
Hey @PaulLeCam, just checking (no rush) but is there anything else to add here? |
Looks great, thanks! |
Overview
Currently, if an end user changes any of the top level handler options in the
Map
component the associated Leaflet handlers aren't updated when the component updates.In our own use case, we switch on and off the
doubleClickZoom
functionality when switching between various modes in our application. I noticed the other handlers were missing so I've included these.