Skip to content

Commit 83bee11

Browse files
fix no. 2 on addRasterImage now displaying correctly but not working with layerControl (viewRGB); cc @tim-salabim
1 parent 96667e3 commit 83bee11

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

inst/htmlwidgets/leaflet.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,9 +2107,15 @@ methods.addRasterImage = function (uri, bounds, opacity, attribution, layerId, g
21072107
async: true
21082108
});
21092109

2110-
canvasTiles.createTile = function (tilePoint) {
2110+
canvasTiles.createTile = function (tilePoint, done) {
21112111
var zoom = tilePoint.z;
21122112
var canvas = _leaflet2.default.DomUtil.create("canvas", "leaflet-tile");
2113+
var error = void 0;
2114+
2115+
// setup tile width and height according to the options
2116+
var size = this.getTileSize();
2117+
canvas.width = size.x;
2118+
canvas.height = size.y;
21132119

21142120
getImageData(function (imgData, w, h, mipmapper) {
21152121
try {
@@ -2239,7 +2245,7 @@ methods.addRasterImage = function (uri, bounds, opacity, attribution, layerId, g
22392245

22402246
if ((typeof _ret7 === "undefined" ? "undefined" : _typeof(_ret7)) === "object") return _ret7.v;
22412247
} finally {
2242-
return canvas;
2248+
done(error, canvas);
22432249
}
22442250
});
22452251
return canvas;

javascript/src/methods.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,9 +1041,15 @@ methods.addRasterImage = function(uri, bounds, opacity, attribution, layerId, gr
10411041
async: true
10421042
});
10431043

1044-
canvasTiles.createTile = function(tilePoint) {
1044+
canvasTiles.createTile = function(tilePoint, done) {
10451045
let zoom = tilePoint.z;
10461046
let canvas = L.DomUtil.create("canvas", "leaflet-tile");
1047+
let error;
1048+
1049+
// setup tile width and height according to the options
1050+
var size = this.getTileSize();
1051+
canvas.width = size.x;
1052+
canvas.height = size.y;
10471053

10481054
getImageData(function(imgData, w, h, mipmapper) {
10491055
try {
@@ -1174,7 +1180,7 @@ methods.addRasterImage = function(uri, bounds, opacity, attribution, layerId, gr
11741180
}
11751181
}
11761182
} finally {
1177-
return canvas;
1183+
done(error, canvas);
11781184
}
11791185
});
11801186
return canvas;

0 commit comments

Comments
 (0)