-
Notifications
You must be signed in to change notification settings - Fork 836
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
Marker component always placed in top-left of map #44
Comments
What if you explicitly set width and remove Does window resize helps? |
Hi @istarkov, window resize followed by moving the map does reposition the icon. I narrowed it down to being related to a css zoom animation applied to one of the outer components by Is there perhaps a way to defer the marker placement until after the animation completes? |
This is because on the moment of Other
example: // CALL THIS TO REFRESH SIZE
refresh() {
this.googleMapRef_._setViewSize();
// mb will work without changing center
this.setState({
center: {
lat: this.state.center.lat + 0.000000001,
lng: this.state.center.lng + 0.000000001,
},
});
}
render() {
return (
<GoogleMap ref={r => this.googleMapRef_ = r}
center={this.state.center}
defaultZoom={10}><Marker lat lng/>...
);
} |
Thank you for your help! |
@istarkov. tried your given hack solution and don't think it will work if change the height of div container after resize. |
@martingg88 Why u think so? @mbrookes Does this hack works for you? |
i tried it and it doesn't work.. it will work if i do not change height after resize. |
Provide source |
run the following function and then your hack solution in onresize event. _performLayoutFrame: function(){ |
In onresize event? Why? |
Also
Do u think this is react? |
i need to resize the container to fit into the visible screen when user resize the browser or rotate mobile device. |
|
it won't work after try to follow your suggestion. |
I can't say anything without full component source |
The following is working for me, but seems very smelly. Any improvements?
|
Not sure what I'm doing wrong, but my marker component (a material-icons icon) is being placed in the top left, regardless of the marker or map coordinates. It does then scroll with the map, but zooming the map makes the icon jump back to the corner.
(I also had to wrap the map in a fixed height div to get it to display within a flex container, otherwise it collapsed to 0 height, but that's a different issue.)
Here's my code:
Any pointers appreciated. Thanks!
(React 0.13.x)
The text was updated successfully, but these errors were encountered: