Skip to content

Commit

Permalink
fix: remove sidebar-map CSS-class, fix left/right CSS with !important…
Browse files Browse the repository at this point in the history
…, remove sidebar-container with map.id
  • Loading branch information
trafficonese committed Aug 6, 2024
1 parent b0d619f commit 96298c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions inst/htmlwidgets/lfx-sidebar/leaflet-sidebar-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ LeafletWidget.methods.addSidebar = function(id, options) {
}

// Move Sidebar inside Map-Div
/*var mapid = "#"+map.id*/
var mapid = "#" + (map.id ? map.id : map._container.id);
if (options && options.fit === true) {
// Append sidebar container to map div
Expand Down Expand Up @@ -74,14 +73,10 @@ LeafletWidget.methods.removeSidebar = function(sidebar_id) {
var sidebar = $(`#${tid}`);
if (sidebar[0]) {
// Remove left/right CSS
if (L.DomUtil.hasClass(sidebar[0], 'leafsidebar-left')) {
$('.sidebar-map .leaflet-left').css('left', 0);
} else {
$('.sidebar-map .leaflet-right').css('right', 0);
}
map._container.classList.remove("sidebar-map")
// Remove Sidebar and Delete from map
sidebar.remove();
$(".leaflet-sidebar-container").remove();
$("#" + map.id + " .leaflet-sidebar-container").remove();
delete map.sidebar[tid];
}
}
Expand Down
4 changes: 2 additions & 2 deletions inst/htmlwidgets/lfx-sidebar/leaflet-sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@
}

.sidebar-map .leaflet-left {
left: 40px;
left: 40px !important;
}
.sidebar-map .leaflet-right {
right: 40px;
right: 40px !important;
}

.leafsidebar.leaflet-touch {
Expand Down

0 comments on commit 96298c7

Please sign in to comment.