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.

Google Maps Offset After Render

See original GitHub issue

version: html2canvas v1.0.0-alpha.12 tested browsers: chrome, ff, safari

I’ve been struggling to find a solution to a seeming rendering bug where google maps will render “offset”. This happens if the map is panned, zoomed, or just not touched whatsoever. In the below screenshot, you see the border that should contain the entirety of the map, but after rendering it always shifts to this position (or higher, vertically if panned).

I’ve seen (and tried) suggestions found of SO regarding calculating the transform but it seems gmaps v3 does things differently as the transform values given are always “none”.

Any insight into what might be causing this issues would be awesome. I’m not doing anything special I don’t believe, but here’s the applicable code and a screenshot:

html2canvas(document.getElementById("capture"), { useCORS: true, imageTimeout: 30000 }).then(function(canvas) { //do other UI related stuff return false;

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

6reactions
vinnygambinycommented, May 23, 2018

I have done with this

html2canvas($(‘.gm-style>div:first’)[0], { useCORS: true, imageTimeout: 30000}).then(function (canvas) { });

0reactions
blueBoundercommented, Jun 30, 2018

This is a duplicate of several other issues on here regarding css3 transform. I ran into a silly issue due to having multiple maps on the same page, just need to use the following and make sure you select the correct map:

function transform() { var transform=$(“#capture .gm-style>div:first>div”).css(“transform”); var comp=transform.split(“,”); var mapleft=parseFloat(comp[4]); var maptop=parseFloat(comp[5]); $(“#capture .gm-style>div:first>div”).css({ “transform”:“none”, “left”:mapleft, “top”:maptop, }); }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Maps API - Strange Map "Offset" Behaviour
To render the map fully again on changing div visibility you can use this code. google.maps.event.trigger(map, 'resize');. This will rerender your map ...
Read more >
Google Maps JavaScript API V3 Reference
Google Maps JavaScript API V3 Reference ... google.maps; Settings (beta); Event system; Errors. Maps ... Properties: fixedRotation , icon , offset , repeat....
Read more >
Google Satellite Imagery Offset in QGIS - GIS Stack Exchange
I am using Google Satellite imagery as a base map to capture the vector data in QGIS 3.2.2 for past couple of months....
Read more >
Tutorial: Migrate a web app from Google Maps - Microsoft Learn
Data sources and rendering layers should be added to the map after the ready event has fired. HTML Markers are rendered as DOM...
Read more >
React Google Maps Api Style Guide
GoogleMap - The map component inside which all other components render. The simplest way to get a functional map is: ⚠️ Make sure...
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