change size with zoom
This commit is contained in:
parent
2a8b533e08
commit
4fb15d6423
40
js/main.js
40
js/main.js
@ -315,9 +315,10 @@ function bindEventsOnJosmRemote() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let ratio_circle = 2
|
|
||||||
|
|
||||||
function displayPointsFromApi(points) {
|
|
||||||
|
function displayPointsFromApi(points = geojsondata) {
|
||||||
|
|
||||||
|
|
||||||
geojsondata = osmtogeojson(points)
|
geojsondata = osmtogeojson(points)
|
||||||
// console.log('resultAsGeojson', geojsondata)
|
// console.log('resultAsGeojson', geojsondata)
|
||||||
@ -347,7 +348,8 @@ function displayPointsFromApi(points) {
|
|||||||
// console.log('déplacement terminé')
|
// console.log('déplacement terminé')
|
||||||
},
|
},
|
||||||
onzoomend: function (event) {
|
onzoomend: function (event) {
|
||||||
// console.log('event', event)
|
supprimerMarqueurs()
|
||||||
|
displayPointsFromApi()
|
||||||
},
|
},
|
||||||
onEachFeature: function (feature, layer) {
|
onEachFeature: function (feature, layer) {
|
||||||
let popupContent = ''
|
let popupContent = ''
|
||||||
@ -405,24 +407,33 @@ function displayPointsFromApi(points) {
|
|||||||
let zoom = map.getZoom()
|
let zoom = map.getZoom()
|
||||||
let radius = 20
|
let radius = 20
|
||||||
let opacity = 0.5
|
let opacity = 0.5
|
||||||
|
let ratio_circle = 10
|
||||||
|
|
||||||
// quand on est loin, montrer d'avantage de couleur, pas le centre
|
// quand on est loin, montrer d'avantage de couleur, pas le centre
|
||||||
if (zoom < 13) {
|
if (zoom > 13) {
|
||||||
ratio_circle = 6
|
ratio_circle = 5
|
||||||
} else if (zoom < 15) {
|
|
||||||
ratio_circle = 4
|
|
||||||
}
|
}
|
||||||
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
|
radius = 70 * ratio_circle
|
||||||
} else if (outPowerGuessed > 200) {
|
} else if (outPowerGuessed >= 200) {
|
||||||
radius = 60 * ratio_circle
|
radius = 60 * ratio_circle
|
||||||
} else if (outPowerGuessed > 100) {
|
} else if (outPowerGuessed >= 100) {
|
||||||
radius = 50 * ratio_circle
|
radius = 50 * ratio_circle
|
||||||
} else if (outPowerGuessed > 50) {
|
} else if (outPowerGuessed >= 50) {
|
||||||
radius = 40 * ratio_circle
|
radius = 40 * ratio_circle
|
||||||
} else if (outPowerGuessed > 20) {
|
} else if (outPowerGuessed >= 20) {
|
||||||
radius = 30 * ratio_circle
|
radius = 30 * ratio_circle
|
||||||
} else if (outPowerGuessed > 7) {
|
} else if (outPowerGuessed >= 7) {
|
||||||
radius = 20 * ratio_circle
|
radius = 20 * ratio_circle
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,10 +588,11 @@ $(document).ready(function () {
|
|||||||
cycleVariableState(display_unknown_max_power_station, '#filterUnkown')
|
cycleVariableState(display_unknown_max_power_station, '#filterUnkown')
|
||||||
showActiveFilter(display_unknown_max_power_station, '#filterUnkown')
|
showActiveFilter(display_unknown_max_power_station, '#filterUnkown')
|
||||||
})
|
})
|
||||||
|
showActiveFilter(display_unknown_max_power_station, '#filterUnkown')
|
||||||
})
|
})
|
||||||
|
|
||||||
function showActiveFilter(filterVariableName, selectorId) {
|
function showActiveFilter(filterVariableName, selectorId) {
|
||||||
$(selectorId).classList = 'filter-state-' + filterVariableName
|
$(selectorId).className = 'filter-state-' + filterVariableName
|
||||||
}
|
}
|
||||||
|
|
||||||
function cycleVariableState(filterVariableName, selectorId) {
|
function cycleVariableState(filterVariableName, selectorId) {
|
||||||
|
@ -350,7 +350,7 @@ button {
|
|||||||
color: #670a0a;
|
color: #670a0a;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
.filter-group button.filter-state-display{
|
.filter-group button.filter-state-show{
|
||||||
color: green;
|
color: green;
|
||||||
background: #96b1ea;
|
background: #96b1ea;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user