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.

Canvas Size issues

See original GitHub issue

Hi, Im my code I have the following structure

<div>
<some other div>
<the map>
</div>

“Some other div” is sometimes there and sometimes not. In one case the map gets 50% for the containerStyle and in the other case 100%. The initial rendering is always correct. When “some other div” is not rendered the <div class=“mapboxgl-map” updates correctly, but the canvas still got the old width. When I slightly change the window size, the canvas updates to the correct value. Do you have any hint on how to force the canvas to update.

Thanks Andreas

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
victcebespcommented, Mar 3, 2022

Hello guys! I am still having this issue and I am currently using version 7.0.7 from react-map-gl. The issue is that now the property onStyleLoad is not available on the react-map-gl Map so that is no longer a solution and the issue is still active. The rendered canvas is first rendered with an incorrect width and height. However, once I resize the window, it is correctly resized. Any clues?

Thanks!

3reactions
mlg87commented, Aug 20, 2018

@dedan call it on the map that is passed to onStyleLoad (i suppose you could probably also do it in componentDidMount assuming you have a ref to the map and its defined). here is an example:

render() {
  return (
    <ReactMapboxGlMap
      containerStyle={{ height: '100%', width: '100%' }}
      onStyleLoad={this.handleStyleLoad}
    />
  )
}

handleStyleLoad = map => (map.resize())
Read more comments on GitHub >

github_iconTop Results From Across the Web

Large canvas size | FAQs and known issues - Adobe Support
Creating artwork on a large canvas? Learn about common questions, known issues, and troubleshooting tips.
Read more >
Problem sizing canvas - Board of Innovation
Problem sizing canvas. Use this tool to assess the size of a customer problem and determine if solving it could produce value for...
Read more >
Problems with canvas size - Beginners - Processing Foundation
Hi there, I am happy to have started to learn Processing however I seem to have fallen at the first hurdle. When I...
Read more >
CANVAS SIZE PROBLEM!! - Pixelmator Community
Ugh. There's no easy solution. There's three compromise solutions that (and one daft non-solution) that come to mind: 1. Work in pixels. Work...
Read more >
Feature Enhancement: Define Canvas Size #4093 - GitHub
Please allow for defined canvas sizes. It was requested to open a new issue here: #38 The infinite scroll is not always ideal....
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