change size with zoom

This commit is contained in:
Tykayn 2024-12-22 00:16:31 +01:00 committed by tykayn
parent 2a8b533e08
commit 4fb15d6423
2 changed files with 27 additions and 15 deletions

View File

@ -315,9 +315,10 @@ function bindEventsOnJosmRemote() {
})
}
let ratio_circle = 2
function displayPointsFromApi(points) {
function displayPointsFromApi(points = geojsondata) {
geojsondata = osmtogeojson(points)
// console.log('resultAsGeojson', geojsondata)
@ -347,7 +348,8 @@ function displayPointsFromApi(points) {
// console.log('déplacement terminé')
},
onzoomend: function (event) {
// console.log('event', event)
supprimerMarqueurs()
displayPointsFromApi()
},
onEachFeature: function (feature, layer) {
let popupContent = ''
@ -405,24 +407,33 @@ function displayPointsFromApi(points) {
let zoom = map.getZoom()
let radius = 20
let opacity = 0.5
let ratio_circle = 10
// quand on est loin, montrer d'avantage de couleur, pas le centre
if (zoom < 13) {
ratio_circle = 6
} else if (zoom < 15) {
ratio_circle = 4
if (zoom > 13) {
ratio_circle = 5
}
if (outPowerGuessed > 300) {
else if (zoom > 15) {
ratio_circle = 1
opacity = 0.25
}
else if (zoom >= 16) {
ratio_circle = 0.5
}
else if (zoom >= 18) {
ratio_circle = 0.25
}
if (outPowerGuessed >= 300) {
radius = 70 * ratio_circle
} else if (outPowerGuessed > 200) {
} else if (outPowerGuessed >= 200) {
radius = 60 * ratio_circle
} else if (outPowerGuessed > 100) {
} else if (outPowerGuessed >= 100) {
radius = 50 * ratio_circle
} else if (outPowerGuessed > 50) {
} else if (outPowerGuessed >= 50) {
radius = 40 * ratio_circle
} else if (outPowerGuessed > 20) {
} else if (outPowerGuessed >= 20) {
radius = 30 * ratio_circle
} else if (outPowerGuessed > 7) {
} else if (outPowerGuessed >= 7) {
radius = 20 * ratio_circle
}
@ -577,10 +588,11 @@ $(document).ready(function () {
cycleVariableState(display_unknown_max_power_station, '#filterUnkown')
showActiveFilter(display_unknown_max_power_station, '#filterUnkown')
})
showActiveFilter(display_unknown_max_power_station, '#filterUnkown')
})
function showActiveFilter(filterVariableName, selectorId) {
$(selectorId).classList = 'filter-state-' + filterVariableName
$(selectorId).className = 'filter-state-' + filterVariableName
}
function cycleVariableState(filterVariableName, selectorId) {

View File

@ -350,7 +350,7 @@ button {
color: #670a0a;
background: #fff;
}
.filter-group button.filter-state-display{
.filter-group button.filter-state-show{
color: green;
background: #96b1ea;