summaryrefslogtreecommitdiff
path: root/loleaflet
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2020-09-09 12:02:50 +0100
committerJan Holesovsky <kendy@collabora.com>2020-09-17 15:03:01 +0200
commit26e87932aee04b2bf23e4af9dc53755ac0e27c02 (patch)
tree5e3e2d9b748110b4dda82441decbb3f9631b0945 /loleaflet
parentd1971d3a7ddd1973c415b9cbe202f39a0b39faee (diff)
calc tiles: clarify some magic.
Change-Id: I2d95dd09b5640a5216e72366493ddf77541c8b73
Diffstat (limited to 'loleaflet')
-rw-r--r--loleaflet/src/layer/tile/CanvasTileLayer.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js
index 2b8eb00db..91be11179 100644
--- a/loleaflet/src/layer/tile/CanvasTileLayer.js
+++ b/loleaflet/src/layer/tile/CanvasTileLayer.js
@@ -161,7 +161,9 @@ L.CanvasTilePainter = L.Class.extend({
var tileBounds = new L.Bounds(tileTopLeft, tileTopLeft.add(ctx.tileSize));
for (var i = 0; i < ctx.paneBoundsList.length; ++i) {
+ // co-ordinates of this pane in core document pixels
var paneBounds = this._layer._cssBoundsToCore(ctx.paneBoundsList[i]);
+ // co-ordinates of the main-(bottom right) pane in core document pixels
var viewBounds = this._layer._cssBoundsToCore(ctx.viewBounds);
// into real pixel-land ...
@@ -171,9 +173,10 @@ L.CanvasTilePainter = L.Class.extend({
if (!paneBounds.intersects(tileBounds))
continue;
- var offset = paneBounds.getTopLeft(); // allocates
- offset.x = Math.min(offset.x, viewBounds.min.x);
- offset.y = Math.min(offset.y, viewBounds.min.y);
+ var paneOffset = paneBounds.getTopLeft(); // allocates
+ // Cute way to detect the in-canvas pixel offset of each pane
+ paneOffset.x = Math.min(paneOffset.x, viewBounds.min.x);
+ paneOffset.y = Math.min(paneOffset.y, viewBounds.min.y);
// intersect - to avoid state thrash through clipping
var crop = new L.Bounds(tileBounds.min, tileBounds.max);
@@ -189,8 +192,8 @@ L.CanvasTilePainter = L.Class.extend({
crop.min.x - tileBounds.min.x,
crop.min.y - tileBounds.min.y,
cropWidth, cropHeight,
- crop.min.x - offset.x,
- crop.min.y - offset.y,
+ crop.min.x - paneOffset.x,
+ crop.min.y - paneOffset.y,
cropWidth, cropHeight);
if (this._layer._debug)
{