Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions inst/htmlwidgets/leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -1601,11 +1601,17 @@ methods.addPolygons = function (polygons, layerId, group, options, popup, popupO
var df = new _dataframe2.default().col("shapes", polygons).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).col("highlightOptions", highlightOptions).cbind(options);

addLayers(this, "shape", df, function (df, i) {
var shapes = df.get(i, "shapes");
shapes = shapes.map(function (polygon) {
// This code used to use L.multiPolygon, but that caused
// double-click on a multipolygon to fail to zoom in on the
// map. Surprisingly, putting all the rings in a single
// polygon seems to still work; complicated multipolygons
// are still rendered correctly.
var shapes = df.get(i, "shapes").map(function (polygon) {
return polygon.map(_htmlwidgets2.default.dataframeToD3);
});
return _leaflet2.default.multiPolygon(shapes, df.get(i));
}).reduce(function (acc, val) {
return acc.concat(val);
}, []);
return _leaflet2.default.polygon(shapes, df.get(i));
});
}
};
Expand Down Expand Up @@ -2290,6 +2296,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// pixel of the original image has some contribution to the downscaled image)
// as opposed to a single-step downscaling which will discard a lot of data
// (and with sparse images at small scales can give very surprising results).

var Mipmapper = function () {
function Mipmapper(img) {
_classCallCheck(this, Mipmapper);
Expand Down
14 changes: 9 additions & 5 deletions javascript/src/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,15 @@ methods.addPolygons = function(polygons, layerId, group, options, popup, popupOp
.cbind(options);

addLayers(this, "shape", df, function(df, i) {
let shapes = df.get(i, "shapes");
shapes = shapes.map(function(polygon) {
return polygon.map(HTMLWidgets.dataframeToD3);
});
return L.multiPolygon(shapes, df.get(i));
// This code used to use L.multiPolygon, but that caused
// double-click on a multipolygon to fail to zoom in on the
// map. Surprisingly, putting all the rings in a single
// polygon seems to still work; complicated multipolygons
// are still rendered correctly.
let shapes = df.get(i, "shapes")
.map(polygon => polygon.map(HTMLWidgets.dataframeToD3))
.reduce((acc, val) => acc.concat(val), []);
return L.polygon(shapes, df.get(i));
});
}
};
Expand Down