Skip to content

Commit

Permalink
keeping button pressed while changing slidades and update setup name
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeGuilherme committed Sep 5, 2024
1 parent 61d2773 commit 3b42abf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
29 changes: 12 additions & 17 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ filterGeo = (year, updateGeoJson = false) => {
...feature.properties,
edicoes_topo: [],
situacao_topo: "Não mapeado",
situacao: "Não mapeado"
}
}))
};
Expand All @@ -71,7 +70,6 @@ filterGeo = (year, updateGeoJson = false) => {
...feature.properties,
edicoes_orto: [],
situacao_orto: "Não mapeado",
situacao: "Não mapeado"
}
}))
};
Expand Down Expand Up @@ -108,9 +106,9 @@ loadLegend = (

let legendEl = document.getElementById(legendElId);

let initialVisibility1 = hideTopo ? 'hidden' : 'visible';
let initialVisibility2 = hideOrto ? 'hidden' : 'visible';
let initialDisplay = (hideOrto && hideOrto) ? 'none' : 'flex';
let initialVisibility1 = (slideIndex > 2 && slideIndex < 7) ? (hideTopo ? 'hidden' : 'visible') : 'visible';
let initialVisibility2 = (slideIndex > 2 && slideIndex < 7) ? (hideOrto ? 'hidden' : 'visible') : 'visible';
let initialDisplay = (slideIndex > 2 && slideIndex < 7) ? ((hideOrto && hideOrto) ? 'none' : 'flex') : 'flex';
let topoButtonColor = hideTopo ? 'rgba(70, 130, 180, 0.2)' : 'rgba(70, 130, 180, 0.6)';
let ortoButtonColor = hideOrto ? 'rgba(70, 130, 180, 0.2)' : 'rgba(70, 130, 180, 0.6)';

Expand All @@ -127,7 +125,7 @@ loadLegend = (
${legendTitle2}
</div>
` : '';

let subtitleCount = activeSubtitleCount;
let legendContent1 = layers.map((layer, i) => {
let color = colors[i];
Expand Down Expand Up @@ -164,7 +162,6 @@ loadLegend = (
<div id="legendContent2" style="flex: 1; visibility: ${initialVisibility2};">${legendContent2}</div>
</div>
`;

let year = (yearFilter >= yearInterval.min && yearFilter <= yearInterval.max) ? yearFilter : yearFilter < yearInterval.min ? yearInterval.min : yearInterval.max;
let sliderContent = (slideIndex > 2 && slideIndex < 7) ? `
<h4>Escolha a partir de qual ano exibir as cartas</h4>
Expand Down Expand Up @@ -221,18 +218,18 @@ loadLegend = (
let legendContentEl = document.getElementById("legendContent");

topoButton?.addEventListener('click', function() {
let isActive = legendContent1El.style.visibility !== 'hidden';
legendContent1El.style.visibility = isActive ? 'hidden' : 'visible';
topoButton.style.backgroundColor = isActive ? 'rgba(70, 130, 180, 0.2)' : 'rgba(70, 130, 180, 0.6)';
hideTopo = isActive ? true : false;
let isHidden = legendContent1El.style.visibility !== 'hidden';
legendContent1El.style.visibility = isHidden ? 'hidden' : 'visible';
topoButton.style.backgroundColor = isHidden ? 'rgba(70, 130, 180, 0.2)' : 'rgba(70, 130, 180, 0.6)';
hideTopo = isHidden ? true : false;
updateLegendDisplay();
});

ortoButton?.addEventListener('click', function() {
let isActive = legendContent2El.style.visibility !== 'hidden';
legendContent2El.style.visibility = isActive ? 'hidden' : 'visible';
ortoButton.style.backgroundColor = isActive ? 'rgba(70, 130, 180, 0.2)' : 'rgba(70, 130, 180, 0.6)';
hideOrto = isActive ? true : false;
let isHidden = legendContent2El.style.visibility !== 'hidden';
legendContent2El.style.visibility = isHidden ? 'hidden' : 'visible';
ortoButton.style.backgroundColor = isHidden ? 'rgba(70, 130, 180, 0.2)' : 'rgba(70, 130, 180, 0.6)';
hideOrto = isHidden ? true : false;
updateLegendDisplay();
});

Expand Down Expand Up @@ -384,8 +381,6 @@ function plugin({ swiper, extendParams, on }) {
return
}
if (mobileScreen()) document.getElementById("legend-icon").style.display = 'block'
hideTopo = false
hideOrto = false
await setCurrentChapter(currentSlideId, false)
});

Expand Down
8 changes: 4 additions & 4 deletions js/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var PROJECTS = {
lotes: [
{
name: 'situacao-geral-ct-25k',
subtitle: 'Carta Topográfica 1:25.000',
subtitle: 'Cartas 1:25.000',
description: ``,
zoom: [
[-58.00, -34.00], // southwestern corner of the bounds
Expand Down Expand Up @@ -120,7 +120,7 @@ var PROJECTS = {
lotes: [
{
name: 'situacao-geral-ct-50k',
subtitle: 'Carta Topográfica 1:50.000',
subtitle: 'Cartas 1:50.000',
description: ``,
zoom: [
[-58.125, -34.125], // southwestern corner of the bounds
Expand Down Expand Up @@ -186,7 +186,7 @@ var PROJECTS = {
lotes: [
{
name: 'situacao-geral-ct-100k',
subtitle: 'Carta Topográfica 1:100.000',
subtitle: 'Cartas 1:100.000',
description: ``,
zoom: [
[-58.250, -34.125], // southwestern corner of the bounds
Expand Down Expand Up @@ -252,7 +252,7 @@ var PROJECTS = {
lotes: [
{
name: 'situacao-geral-ct-250k',
subtitle: 'Carta Topográfica 1:250.000',
subtitle: 'Cartas 1:250.000',
description: ``,
zoom: [
[-58.625, -34.125], // southwestern corner of the bounds
Expand Down

0 comments on commit 3b42abf

Please sign in to comment.