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

Customizable buffer sizes for rendered data #76

Merged
merged 2 commits into from
Apr 4, 2014

Conversation

Mr0grog
Copy link
Member

@Mr0grog Mr0grog commented Apr 4, 2014

Right now, the Map object always adds a 25% buffer to the data requested/rendered for each call to Map.render(). This is done to ensure that elements whose strict data doesn't overlap tiles but whose rendering does (e.g. a really fat line stroke, a large image or shield, or some long text) doesn't wind up getting visually cut off at the edge of a tile.

This is a nice convenience, but in many cases, it would be useful to be able to customize the size of the buffer area or to turn off buffering altogether (see #75). To that end, this patch adds a boundsBuffer option to both the Map constructor and to Map.render()/Map.renderGrid().

It can be:

  • A number, used as a ratio of the requested image width. e.g. 0.25 means add a buffer that is 25% of the width of the rendered image.
  • A function, which will be passed the requested bounds as an object and should return new bounds.

The option passed into render() will be preferred over the value set on the Map object. If no value is ever set, it will still default to 0.25.

@Mr0grog
Copy link
Member Author

Mr0grog commented Apr 4, 2014

How does this seem to you, @prashtx, @hampelm?

@prashtx
Copy link

prashtx commented Apr 4, 2014

Nice! This looks good to me.

@hampelm
Copy link

hampelm commented Apr 4, 2014

Looks great. Thanks!

@Mr0grog
Copy link
Member Author

Mr0grog commented Apr 4, 2014

Great, will bump versions and merge this in, then.

Mr0grog added a commit that referenced this pull request Apr 4, 2014
Customizable buffer sizes for rendered data via `Map.boundsBuffer`.
@Mr0grog Mr0grog merged commit f15d4a6 into master Apr 4, 2014
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

Successfully merging this pull request may close these issues.

None yet

3 participants