diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2020-09-08 16:03:15 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2020-09-15 22:22:52 +0200 |
commit | f8877801831c85434f0e267706a63761d9b3445c (patch) | |
tree | 9c9823d37ed5feabd8a9018f051460012bb4a282 | |
parent | calc canvas: avoid lots of canvas context save/restores. (diff) | |
download | online-f8877801831c85434f0e267706a63761d9b3445c.tar.gz online-f8877801831c85434f0e267706a63761d9b3445c.zip |
calc canvas: round view co-ordinates to the real pixels we need.
Change-Id: I768cd9015da1f1301f3ddad242130d4eddb426d1
-rw-r--r-- | loleaflet/src/geometry/Bounds.js | 7 | ||||
-rw-r--r-- | loleaflet/src/layer/tile/CanvasTileLayer.js | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/loleaflet/src/geometry/Bounds.js b/loleaflet/src/geometry/Bounds.js index 8dacdc8327..e9ac075e8a 100644 --- a/loleaflet/src/geometry/Bounds.js +++ b/loleaflet/src/geometry/Bounds.js @@ -83,6 +83,13 @@ L.Bounds.prototype = { (this.min.y + this.max.y) / 2, round); }, + round: function() { + this.min.x = Math.round(this.min.x); + this.min.y = Math.round(this.min.y); + this.max.x = Math.round(this.max.x); + this.max.y = Math.round(this.max.y); + }, + getBottomLeft: function () { // -> Point return new L.Point(this.min.x, this.max.y); }, diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js index af8a7fcbc9..ab40e653a3 100644 --- a/loleaflet/src/layer/tile/CanvasTileLayer.js +++ b/loleaflet/src/layer/tile/CanvasTileLayer.js @@ -164,6 +164,10 @@ L.CanvasTilePainter = L.Class.extend({ var paneBounds = this._layer._cssBoundsToCore(ctx.paneBoundsList[i]); var viewBounds = this._layer._cssBoundsToCore(ctx.viewBounds); + // into real pixel-land ... + paneBounds.round(); + viewBounds.round(); + if (!paneBounds.intersects(tileBounds)) continue; |