fix and unify control button colors

This commit is contained in:
Laura Klünder 2018-12-23 17:09:54 +01:00
parent b8480accee
commit 30135c4ef0
2 changed files with 8 additions and 4 deletions

View file

@ -872,7 +872,7 @@ main:not([data-view=route-result]) #route-summary {
.leaflet-control-user-location a { .leaflet-control-user-location a {
font-size: 20px; font-size: 20px;
} }
body:not(.mobileclient) .leaflet-control-user-location a { .leaflet-bar .control-disabled, .leaflet-bar .control-disabled:hover {
color: #BBBBBB; color: #BBBBBB;
} }

View file

@ -1389,10 +1389,13 @@ c3nav = {
stroke: 0, stroke: 0,
fillOpacity: 1 fillOpacity: 1
}).addTo(layer); }).addTo(layer);
this._button.classList.toggle('control-disabled', false);
} else if (c3nav.hasLocationPermission()) { } else if (c3nav.hasLocationPermission()) {
$('.locationinput .locate, .leaflet-control-user-location a').text(c3nav._map_material_icon('location_searching')); $('.locationinput .locate, .leaflet-control-user-location a').text(c3nav._map_material_icon('location_searching'));
this._button.classList.toggle('control-disabled', false);
} else { } else {
$('.locationinput .locate, .leaflet-control-user-location a').text(c3nav._map_material_icon('location_disabled')); $('.locationinput .locate, .leaflet-control-user-location a').text(c3nav._map_material_icon('location_disabled'));
this._button.classList.toggle('control-disabled', true);
} }
if (mobileclient.isCurrentLocationRequested && mobileclient.isCurrentLocationRequested()) { if (mobileclient.isCurrentLocationRequested && mobileclient.isCurrentLocationRequested()) {
if (location) { if (location) {
@ -1580,6 +1583,7 @@ UserLocationControl = L.Control.extend({
this._container = L.DomUtil.create('div', 'leaflet-control-user-location leaflet-bar ' + this.options.addClasses); this._container = L.DomUtil.create('div', 'leaflet-control-user-location leaflet-bar ' + this.options.addClasses);
this._button = L.DomUtil.create('a', 'material-icons', this._container); this._button = L.DomUtil.create('a', 'material-icons', this._container);
this._button.innerHTML = c3nav._map_material_icon(c3nav.hasLocationPermission() ? 'location_searching' : 'location_disabled'); this._button.innerHTML = c3nav._map_material_icon(c3nav.hasLocationPermission() ? 'location_searching' : 'location_disabled');
this._button.classList.toggle('control-disabled', !c3nav.hasLocationPermission());
this._button.href = '#'; this._button.href = '#';
this.currentLevel = null; this.currentLevel = null;
return this._container; return this._container;
@ -1599,7 +1603,7 @@ SquareGridControl = L.Control.extend({
$(this._button).click(this.toggleGrid).dblclick(function(e) { e.stopPropagation(); }); $(this._button).click(this.toggleGrid).dblclick(function(e) { e.stopPropagation(); });
this._button.innerText = c3nav._map_material_icon('grid_off'); this._button.innerText = c3nav._map_material_icon('grid_off');
this._button.href = '#'; this._button.href = '#';
this._button.style.color = '#BBBBBB'; this._button.classList.toggle('control-disabled', true);
this.gridActive = false; this.gridActive = false;
if (localStorage && localStorage.getItem('showGrid')) { if (localStorage && localStorage.getItem('showGrid')) {
this.showGrid() this.showGrid()
@ -1620,7 +1624,7 @@ SquareGridControl = L.Control.extend({
if (this.gridActive) return; if (this.gridActive) return;
c3nav._gridLayer.addTo(c3nav.map); c3nav._gridLayer.addTo(c3nav.map);
this._button.innerText = c3nav._map_material_icon('grid_on'); this._button.innerText = c3nav._map_material_icon('grid_on');
this._button.style.color = ''; this._button.classList.toggle('control-disabled', false);
this.gridActive = true; this.gridActive = true;
if (localStorage) localStorage.setItem('showGrid', true); if (localStorage) localStorage.setItem('showGrid', true);
}, },
@ -1629,7 +1633,7 @@ SquareGridControl = L.Control.extend({
if (!this.gridActive) return; if (!this.gridActive) return;
c3nav._gridLayer.remove(); c3nav._gridLayer.remove();
this._button.innerText = c3nav._map_material_icon('grid_off'); this._button.innerText = c3nav._map_material_icon('grid_off');
this._button.style.color = '#BBBBBB'; this._button.classList.toggle('control-disabled', true);
this.gridActive = false; this.gridActive = false;
if (localStorage) localStorage.removeItem('showGrid'); if (localStorage) localStorage.removeItem('showGrid');
} }