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
Make resetBoundsOnResize
preserve center when full-screened
#482
Make resetBoundsOnResize
preserve center when full-screened
#482
Conversation
adding note about `resetBoundsOnResize` to readme (google-map-react#307)
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 your PR! It is looking good, I left a comment that is more like a question
src/google_map.js
Outdated
@@ -398,7 +399,7 @@ export default class GoogleMap extends Component { | |||
window.removeEventListener('keydown', this._onKeyDownCapture); | |||
mapDom.removeEventListener('mousedown', this._onMapMouseDownNative, true); | |||
window.removeEventListener('mouseup', this._onChildMouseUp, false); | |||
if (this.props.resetBoundsOnResize) { | |||
if (this.props.resetBoundsOnResize || this.props.lockCenter) { |
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.
Wondering if || this.props.lockCenter
is really needed, as resetBoundsOnResize
should be set to true if we want to lock the center, not sure if I am explaining myself, but I believe the map always should re-set the center when reseting the bounds on resize.
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.
Hmm, I think I see what you're saying. I hadn't used resetBoundsOnResize
before, but I just tried it out on the master branch and on this PR's branch by running yarn start
and visiting http://localhost:4000/resizable. On both branches, resizing by dragging the lower- the map keeps the map centered, but only with this PR does clicking the fullscreen button also keep the map centered. I think it makes sense for resetBoundsOnResize
to include the lockCenter
behavior, so I removed the lockCenter
stuff while keeping the behavioral changes. See 692e15b
lockCenter
prop to preserve center on resizeresetBoundsOnResize
preserve center when full-screened
e9de437
to
692e15b
Compare
@josephfrazier Just to confirm, did you test latest changes? Could you upload something? |
Yes, I verified the fix as outlined above, by running |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This supersedes and resolves #308,
as specified in #308 (comment)