question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

First render starts at very high zoom

See original GitHub issue

Please provide an explanation of the issue

First render starts at very high zoom. And when I save, the zoom gets normal

Your Environment

os: linux

node --version v16.15.0

react version ^18.2.0

webpack version not use

@babel version not use

@react-google-maps/api version ^2.12.2

How does it behave?

First render starts at very high zoom

How should it behave correctly?

should be started with zoom as I configured in prop zoom={17}

Basic implementation of incorrect behavior in codesandbox.com

video: when-I-save. The map zoom and center gets normal.webm

<video src="https://user-images.githubusercontent.com/16847836/187035122-42a4ab5d-fe04-40df-9333-6552a8b73c2a.webm"></video>

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
carloscalagecommented, Aug 29, 2022

I’m getting the same problem here with the versions. I needed my project to be ready quickly, so I came up with probably a bad solution, but it worked, at least until we get an answer.

So I created a zoomReset state and gave it a random number as the initial state. After that I put a setTimeout function inside the onLoad function, after setting the map state. I gave it 1000ms of delay and after that I set the ZoomReset to the value I wanted and voilà, it takes a second to set the zoom back to where it should be.

Sorry if that could cause any problem, but here in Brazil we are masters of gambiarras

const [zoomReset, setZoomReset] = useState(0)
const [map, setMap] = useState(null)

const onLoad = useCallback(
   function callback(map) {
     const bounds = new window.google.maps.LatLngBounds(center)
     map.fitBounds(bounds)

     setMap(map)

     setTimeout(() => setZoomReset(14), 1000)
   },
   []
 )

0reactions
JustFly1984commented, Sep 11, 2022

Yes. An example examples an onLoad prop. It is not required per se, it is just an example how to use map. There is an old google-maps-api lib, which used ref on class, to access map instance. It is not the case anymore. You can add comment to an example and improve it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

camera is zoomed in for a close up render but render is ...
Just keep zooming into your model and then make a new render, repeat till you get what you want. You might have to...
Read more >
Fix the Broken First Frame in Sequencer / Movie Render Queue!
This issue has been plaguing me for literally years. Fix that weird first frame in Sequencer/Movie Render Queue with a fix so easy...
Read more >
Rendering highly granular and "zoomed out" data
On a higher level: As you zoom into something and the camera gets closer to an object, it appears as if the world...
Read more >
Render a user's video - Zoom App Marketplace
Render a user's video. The Video SDK allows you to render the video of each user who join a session. Retrieve the IZoomVideoSDKUser...
Read more >
Is it possible to render a zoomed in on image not blurry?
If that's the case, rendering a zoomed in image more clearly isn't going to work ... in your initial post that you are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found