Skip to content
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

Synchronize map resize with overlay resize #19

Closed
ibgreen opened this issue Nov 13, 2015 · 5 comments
Closed

Synchronize map resize with overlay resize #19

ibgreen opened this issue Nov 13, 2015 · 5 comments

Comments

@ibgreen
Copy link
Contributor

ibgreen commented Nov 13, 2015

This component currently debounces resize events. This makes it hard to synchronize resizing of overlays leading to the overlays temporarily having incorrect offsets during window resizing.
The resizes can be caused by browser window resize, but can also result from the opening/closing of variable width UI components like side bars etc that modify the size of the map component to ensure that the map stays centered.

@vicapow
Copy link
Contributor

vicapow commented Dec 12, 2015

@wwwtyro want to try digging into this one first? Seems like a good ticket to get familiar with the library.

@wwwtyro
Copy link
Contributor

wwwtyro commented Dec 13, 2015

Sounds good; I'm on it!
On Dec 12, 2015 5:33 PM, "Victor" notifications@github.com wrote:

@wwwtyro https://github.com/wwwtyro want to try digging into this one
first? Seems like a good ticket to get familiar with the library.


Reply to this email directly or view it on GitHub
#19 (comment).

@wwwtyro
Copy link
Contributor

wwwtyro commented Dec 13, 2015

@vicapow Seems like the debounce (if necessary) should be relegated to the user of react-map-gl? e.g.,

var UserApp = React.createClass({

  ...

   componentDidMount: function componentDidMount() {
     window.addEventListener('resize', debounce(function onResize() { // <-- debounce
       this.setState({
         viewport: assign({}, this.state.viewport, {
           width: window.innerWidth,
           height: window.innerHeight
         })
       });
     }.bind(this)), 100);
   },

  ...

}

Everything stays in sync, this way. If so, the solution would be to simply remove the debounce from MapGL._resizeMap. Is that anywhere close to what you guys had in mind as a solution to this?

@vicapow
Copy link
Contributor

vicapow commented Dec 13, 2015

@wwwtyro that sounds good to me.

@wwwtyro
Copy link
Contributor

wwwtyro commented Dec 13, 2015

#33 🎉

@vicapow vicapow closed this as completed Dec 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants