How did you resolve this issue?
onChangeHandler: flag for user generated event
I would like to know in the onChangeHandler if the event is triggered because of user interactions? Is that possible, or are you considering making that?
- weixin_39593061 4月前点赞 评论 复制链接分享
- weixin_39883065 4月前
Are you still facing this issue?点赞 评论 复制链接分享
- weixin_39676972 4月前
I have the same issue. I need the bounds to set based on the results. I cant do it on google api loaded because that happens when the website is loaded before the search. I defined bounds based on the results but I am having trouble actually setting them after the search results are set into state and the pins are rendered. Any feedback?点赞 评论 复制链接分享
- weixin_39883065 4月前
Here is an example https://github.com/google-map-react/google-map-react-examples/blob/master/src/examples/Main.js#L40点赞 评论 复制链接分享
- weixin_39710396 4月前
I need something like this as well. I'd like to lock the map from external updates if the user drags/zooms. Then when they want, they can press "reset map" which will switch back to automatic bounds.
But currently onChange is firing for all updates so it's locking automatically which is not what I want.点赞 评论 复制链接分享
Why you need this? What the real reason?点赞 评论 复制链接分享
And please describe what mean user-interaction - as even you change center or zoom props it's reaction on some of user interaction.点赞 评论 复制链接分享
BTW I understand the overall problem, I even wrote a part about in Doc.md
Calling onChange at initialization is needed blablaIt was my api design mistake to provide
boundsas and argument for
onChangeevent, so now every
zoomprops change cause
onChangeevent call, and this behaviour is not like in most controllable react components. In Doc.md I also wrote
NOTE: Now I think it was wrong decision to call onChange at initialization. In the future releases I'll remove such behavior and will provide helper to calculate size and bounds outside map control. I think about helper similar to AutoSizer it also will allow to remove resetBoundsOnResize, style properties
And having that the problem above and this problem have same root I will fix this in the future map version点赞 评论 复制链接分享
- weixin_39801613 4月前
So, this is the case. I am building a search map. So if the user search for something and get results, i will fit bounds to the search result (update zoom and center prop). In this case I will not handle onChange. But if the user is dragging the map, I want to update the bounds and do a new search based on bounds instead of what he searched for. Take a look here: https://www.livvin.com/map点赞 评论 复制链接分享
For now just check that if center and zoom is the same (with some eps) as you provided then do nothing点赞 评论 复制链接分享
- weixin_39593061 4月前
I also have this problem with current API. I need events like
dragend, but I can't rich them.
and also I don't have access to google events directly from
onGoogleApiLoadedmethod for example