Fix zoom level related tooltips for layer checkboxes
This commit is contained in:
parent
e409e83b48
commit
e8f2af833a
2 changed files with 28 additions and 5 deletions
|
@ -98,11 +98,15 @@ L.OSM.layers = function (options) {
|
|||
|
||||
var addOverlay = function (layer, name, maxArea) {
|
||||
var item = $("<li>")
|
||||
.tooltip({
|
||||
placement: "top"
|
||||
})
|
||||
.appendTo(overlays);
|
||||
|
||||
var tooltip;
|
||||
if (name === "notes" || name === "data") {
|
||||
item.attr("title", I18n.t("javascripts.site.map_" + name + "_zoom_in_tooltip"));
|
||||
tooltip = new bootstrap.Tooltip(item[0]);
|
||||
tooltip.disable();
|
||||
}
|
||||
|
||||
var label = $("<label>")
|
||||
.attr("class", "form-check-label")
|
||||
.appendTo(item);
|
||||
|
@ -145,8 +149,13 @@ L.OSM.layers = function (options) {
|
|||
}
|
||||
|
||||
$(item).attr("class", disabled ? "disabled" : "");
|
||||
item.attr("data-bs-original-title", disabled ? // has additional bug when zooming out from enabled state
|
||||
I18n.t("javascripts.site.map_" + name + "_zoom_in_tooltip") : "");
|
||||
if (tooltip) {
|
||||
if (disabled) {
|
||||
tooltip.enable();
|
||||
} else {
|
||||
tooltip.disable();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue