Leaflet / Leaflet/Leaflet.VectorGrid
Retina display support?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 676
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
When I use the svg renderer, all the geometries look crisp on my retina display. But if I switch to canvas, the points and lines all look a little blurry. Is there any established method for handling this? This is at normal zoom levels, not overzooming.
My understanding is that the pixel resolution of the canvas has to be doubled for retina. Taking a very uneducated look at the code, I could see this:
L.Canvas.Tile = L.Canvas.extend({
initialize: function (tileCoord, tileSize, options) {
L.Canvas.prototype.initialize.call(this, options);
this._tileCoord = tileCoord;
this._size = tileSize;
this._initContainer();
this._container.setAttribute('width', this._size.x);
this._container.setAttribute('height', this._size.y);
And if I change the width/height attribute for the container to :
this._container.setAttribute('width', this._size.x*2);
this._container.setAttribute('height', this._size.y*2);
Everything looks very crisp indeed! But also now the coordinates are off. Does anyone know the full list (or right way) to make this modification? Increase the tile size of the protobuf tiles? Then change the tilesize of the gridlayer? So far anything I've tried hasn't worked.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the L.Canvas.Tile initialize code shown in the issue, especially how the canvas dimensions and coordinates are established. Determine the project-supported approach for retina rendering, then verify that canvas-rendered points and lines are crisp at normal zoom without coordinate offsets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100