Skip to content

Commit

Permalink
round CSS translate values to avoid blurry tiles (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
ma7moudat authored Dec 4, 2022
1 parent 03a48a9 commit ee177c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Fix [#29](https://github.com/maplibre/maplibre-gl-leaflet/issues/29) - layer is mis-aligned with map when panning the map off screen ([#31](https://github.com/maplibre/maplibre-gl-leaflet/pulls/31))

## 0.0.19 - 2022-11-30

### Fixed

- round CSS translate values to avoid blurry tiles ([#41](https://github.com/maplibre/maplibre-gl-leaflet/issues/41)).

## 0.0.18 - 2022-11-11

### Fixed

- import MapOptions instead of obsolete MapboxOptions for compatibility with neuer maplibre-gl versions ([#25](https://github.com/maplibre/maplibre-gl-leaflet/issues/25)).
- import MapOptions instead of obsolete MapboxOptions for compatibility with neuer maplibre-gl versions ([#25](https://github.com/maplibre/maplibre-gl-leaflet/issues/25)).

## 0.0.15 - 2021-07-08

Expand Down
8 changes: 6 additions & 2 deletions leaflet-maplibre-gl.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
getPaneName: function () {
return this._map.getPane(this.options.pane) ? this.options.pane : 'tilePane';
},

_roundPoint: function(p) {
return {x: Math.round(p.x), y: Math.round(p.y)}
},

_initContainer: function () {
var container = this._container = L.DomUtil.create('div', 'leaflet-gl-layer');
Expand All @@ -110,7 +114,7 @@

var topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);

L.DomUtil.setPosition(container, topLeft);
L.DomUtil.setPosition(container, this._roundPoint(topLeft));
},

_initGL: function () {
Expand Down Expand Up @@ -164,7 +168,7 @@
offset = this._map.getSize().multiplyBy(this.options.padding),
topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);

L.DomUtil.setPosition(container, topLeft);
L.DomUtil.setPosition(container, this._roundPoint(topLeft));

this._transformGL(gl);

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maplibre/maplibre-gl-leaflet",
"version": "0.0.18",
"version": "0.0.19",
"description": "binding from maplibre gl to the leaflet api",
"main": "leaflet-maplibre-gl.js",
"directories": {
Expand Down

0 comments on commit ee177c9

Please sign in to comment.