diff --git a/legends.html b/legends.html
index d18cb244d..11c9fde80 100644
--- a/legends.html
+++ b/legends.html
@@ -237,7 +237,7 @@
Legends
{
"method": "addTiles",
"args": [
- "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
+ "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
null,
null,
{
@@ -258,7 +258,7 @@ Legends
"updateWhenIdle": null,
"detectRetina": false,
"reuseTiles": false,
- "attribution": "© OpenStreetMap\u003c/a> contributors, CC-BY-SA\u003c/a>"
+ "attribution": "© OpenStreetMap<\/a> contributors, CC-BY-SA<\/a>"
}
]
},
@@ -2420,7 +2420,7 @@ Legends
{
"method": "addTiles",
"args": [
- "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
+ "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
null,
null,
{
@@ -2441,7 +2441,7 @@ Legends
"updateWhenIdle": null,
"detectRetina": false,
"reuseTiles": false,
- "attribution": "© OpenStreetMap\u003c/a> contributors, CC-BY-SA\u003c/a>"
+ "attribution": "© OpenStreetMap<\/a> contributors, CC-BY-SA<\/a>"
}
]
},
@@ -4555,7 +4555,7 @@ Legends
"args": [
{
"colors": ["#D7191C", "#FDAE61", "#FFFFBF", "#ABD9E9", "#2C7BB6"],
- "labels": ["0% – 20%\u003c/span>", "20% – 40%\u003c/span>", "40% – 60%\u003c/span>", "60% – 80%\u003c/span>", "80% – 100%\u003c/span>"],
+ "labels": ["0% – 20%<\/span>", "20% – 40%<\/span>", "40% – 60%<\/span>", "60% – 80%<\/span>", "80% – 100%<\/span>"],
"na_color": null,
"na_label": "NA",
"opacity": 1,
diff --git a/libs/htmlwidgets/htmlwidgets.js b/libs/htmlwidgets/htmlwidgets.js
index ecda3ef8b..7193c78a5 100644
--- a/libs/htmlwidgets/htmlwidgets.js
+++ b/libs/htmlwidgets/htmlwidgets.js
@@ -489,7 +489,6 @@
// supported natively by Shiny at the time of this writing.
shinyBinding.renderValue = function(el, data) {
- Shiny.renderDependencies(data.deps);
// Resolve strings marked as javascript literals to objects
if (!(data.evals instanceof Array)) data.evals = [data.evals];
for (var i = 0; data.evals && i < data.evals.length; i++) {
@@ -513,6 +512,7 @@
elementData(el, "init_result", result);
}
}
+ Shiny.renderDependencies(data.deps);
bindingDef.renderValue(el, data.x, elementData(el, "init_result"));
evalAndRun(data.jsHooks.render, elementData(el, "init_result"), [el, data.x]);
};
diff --git a/libs/leaflet-binding/leaflet.js b/libs/leaflet-binding/leaflet.js
index 1aa9ae048..846125d95 100644
--- a/libs/leaflet-binding/leaflet.js
+++ b/libs/leaflet-binding/leaflet.js
@@ -1023,6 +1023,15 @@ var LayerManager = function () {
});
return result;
}
+ }, {
+ key: "getAllGroupNames",
+ value: function getAllGroupNames() {
+ var result = [];
+ _jquery2.default.each(this._groupContainers, function (k, v) {
+ result.push(k);
+ });
+ return result;
+ }
}, {
key: "clearGroup",
value: function clearGroup(group) {
@@ -1839,7 +1848,7 @@ methods.addLegend = function (options) {
labels.push(options.na_label);
}
for (var i = 0; i < colors.length; i++) {
- legendHTML += " " + labels[i] + "
";
+ legendHTML += " " + labels[i] + "
";
}
div.innerHTML = legendHTML;
}
@@ -1930,6 +1939,49 @@ methods.showGroup = function (group) {
});
};
+function setupShowHideGroupsOnZoom(map) {
+ if (map.leafletr._hasInitializedShowHideGroups) {
+ return;
+ }
+ map.leafletr._hasInitializedShowHideGroups = true;
+
+ function setVisibility(layer, visible) {
+ if (visible !== map.hasLayer(layer)) {
+ if (visible) map.addLayer(layer);else map.removeLayer(layer);
+ }
+ }
+
+ function showHideGroupsOnZoom() {
+ if (!map.layerManager) return;
+
+ var zoom = map.getZoom();
+ map.layerManager.getAllGroupNames().forEach(function (group) {
+ var layer = map.layerManager.getLayerGroup(group, false);
+ if (layer && typeof layer.zoomLevels !== "undefined") {
+ setVisibility(layer, layer.zoomLevels === true || layer.zoomLevels.indexOf(zoom) >= 0);
+ }
+ });
+ }
+
+ map.showHideGroupsOnZoom = showHideGroupsOnZoom;
+ map.on("zoomend", showHideGroupsOnZoom);
+}
+
+methods.setGroupOptions = function (group, options) {
+ var _this8 = this;
+
+ _jquery2.default.each((0, _util.asArray)(group), function (i, g) {
+ var layer = _this8.layerManager.getLayerGroup(g, true);
+ // This slightly tortured check is because 0 is a valid value for zoomLevels
+ if (typeof options.zoomLevels !== "undefined" && options.zoomLevels !== null) {
+ layer.zoomLevels = (0, _util.asArray)(options.zoomLevels);
+ }
+ });
+
+ setupShowHideGroupsOnZoom(this);
+ this.showHideGroupsOnZoom();
+};
+
methods.addRasterImage = function (uri, bounds, opacity, attribution, layerId, group) {
// uri is a data URI containing an image. We want to paint this image as a
// layer at (top-left) bounds[0] to (bottom-right) bounds[1].
@@ -2213,7 +2265,7 @@ methods.removeMeasure = function () {
};
methods.addSelect = function (ctGroup) {
- var _this8 = this;
+ var _this9 = this;
methods.removeSelect.call(this);
@@ -2224,32 +2276,32 @@ methods.addSelect = function (ctGroup) {
title: "Make a selection",
onClick: function onClick(btn, map) {
btn.state("select-active");
- _this8._locationFilter = new _leaflet2.default.LocationFilter2();
+ _this9._locationFilter = new _leaflet2.default.LocationFilter2();
if (ctGroup) {
(function () {
var selectionHandle = new global.crosstalk.SelectionHandle(ctGroup);
selectionHandle.on("change", function (e) {
if (e.sender !== selectionHandle) {
- if (_this8._locationFilter) {
- _this8._locationFilter.disable();
+ if (_this9._locationFilter) {
+ _this9._locationFilter.disable();
btn.state("select-inactive");
}
}
});
var handler = function handler(e) {
- _this8.layerManager.brush(_this8._locationFilter.getBounds(), { sender: selectionHandle });
+ _this9.layerManager.brush(_this9._locationFilter.getBounds(), { sender: selectionHandle });
};
- _this8._locationFilter.on("enabled", handler);
- _this8._locationFilter.on("change", handler);
- _this8._locationFilter.on("disabled", function () {
+ _this9._locationFilter.on("enabled", handler);
+ _this9._locationFilter.on("change", handler);
+ _this9._locationFilter.on("disabled", function () {
selectionHandle.close();
- _this8._locationFilter = null;
+ _this9._locationFilter = null;
});
})();
}
- _this8._locationFilter.addTo(map);
+ _this9._locationFilter.addTo(map);
}
}, {
stateName: "select-active",
@@ -2257,9 +2309,9 @@ methods.addSelect = function (ctGroup) {
title: "Dismiss selection",
onClick: function onClick(btn, map) {
btn.state("select-inactive");
- _this8._locationFilter.disable();
+ _this9._locationFilter.disable();
// If explicitly dismissed, clear the crosstalk selections
- _this8.layerManager.unbrush();
+ _this9.layerManager.unbrush();
}
}]
});
diff --git a/libs/navigation/tabsets.js b/libs/navigation/tabsets.js
index 501c0aa46..d7284e60d 100644
--- a/libs/navigation/tabsets.js
+++ b/libs/navigation/tabsets.js
@@ -1,5 +1,52 @@
+/**
+ * jQuery Plugin: Sticky Tabs
+ *
+ * @author Aidan Lister
+ * adapted by Ruben Arslan to activate parent tabs too
+ * http://www.aidanlister.com/2014/03/persisting-the-tab-state-in-bootstrap/
+ */
+(function($) {
+ "use strict";
+ $.fn.rmarkdownStickyTabs = function() {
+ var context = this;
+ // Show the tab corresponding with the hash in the URL, or the first tab
+ var showStuffFromHash = function() {
+ var hash = window.location.hash;
+ var selector = hash ? 'a[href="' + hash + '"]' : 'li.active > a';
+ var $selector = $(selector, context);
+ if($selector.data('toggle') === "tab") {
+ $selector.tab('show');
+ // walk up the ancestors of this element, show any hidden tabs
+ $selector.parents('.section.tabset').each(function(i, elm) {
+ var link = $('a[href="#' + $(elm).attr('id') + '"]');
+ if(link.data('toggle') === "tab") {
+ link.tab("show");
+ }
+ });
+ }
+ };
+
+
+ // Set the correct tab when the page loads
+ showStuffFromHash(context);
+
+ // Set the correct tab when a user uses their back/forward button
+ $(window).on('hashchange', function() {
+ showStuffFromHash(context);
+ });
+
+ // Change the URL when tabs are clicked
+ $('a', context).on('click', function(e) {
+ history.pushState(null, null, this.href);
+ showStuffFromHash(context);
+ });
+
+ return this;
+ };
+}(jQuery));
+
window.buildTabsets = function(tocID) {
// build a tabset from a section div with the .tabset class
@@ -80,6 +127,9 @@ window.buildTabsets = function(tocID) {
active.addClass('active');
if (fade)
active.addClass('in');
+
+ if (tabset.hasClass("tabset-sticky"))
+ tabset.rmarkdownStickyTabs();
}
// convert section divs with the .tabset class to tabsets