fixed modal

This commit is contained in:
2026-06-15 11:04:34 +03:00
parent 2f303134c1
commit e20b81c817
3 changed files with 47 additions and 10 deletions
@@ -143,6 +143,7 @@ public class MapFragment extends Fragment {
private Bitmap bitmapHill; private Bitmap bitmapHill;
private Marker hillMarker; private Marker hillMarker;
private Polyline hillPathLine; private Polyline hillPathLine;
private boolean hillActive;
private ElevationHeatmapLayer heatmapLayer; private ElevationHeatmapLayer heatmapLayer;
private boolean heatmapActive; private boolean heatmapActive;
private int heatmapRadiusM = 100; private int heatmapRadiusM = 100;
@@ -204,7 +205,7 @@ public class MapFragment extends Fragment {
setupCenterModeToggle(); setupCenterModeToggle();
if (btnFindHill != null) { if (btnFindHill != null) {
btnFindHill.setOnClickListener(v -> findNearestHill()); btnFindHill.setOnClickListener(v -> toggleHill());
} }
setupHeatmapUi(); setupHeatmapUi();
@@ -879,6 +880,27 @@ public class MapFragment extends Fragment {
return null; return null;
} }
private void toggleHill() {
if (hillActive) {
deactivateHill();
return;
}
findNearestHill();
}
private void deactivateHill() {
hillActive = false;
if (btnFindHill != null) {
btnFindHill.setActivated(false);
btnFindHill.setEnabled(true);
}
clearHillLayers();
if (mapHillStatus != null) {
mapHillStatus.setVisibility(View.GONE);
}
requestMapInvalidate();
}
private void findNearestHill() { private void findNearestHill() {
if (uploader == null || !isAdded()) { if (uploader == null || !isAdded()) {
return; return;
@@ -918,6 +940,10 @@ public class MapFragment extends Fragment {
} }
return; return;
} }
hillActive = true;
if (btnFindHill != null) {
btnFindHill.setActivated(true);
}
showHillOnMap(lat, lon, result); showHillOnMap(lat, lon, result);
}); });
} catch (Exception e) { } catch (Exception e) {
@@ -1293,17 +1319,12 @@ public class MapFragment extends Fragment {
} }
private boolean centerOnSelf() { private boolean centerOnSelf() {
if (uploader == null) { LatLong self = resolveSelfPosition();
if (self == null) {
return false; return false;
} }
String myId = uploader.getDeviceId(); centerOnPoint(self, (byte) 14);
for (DeviceInfo d : lastDevices) { return true;
if (myId.equals(d.device_id) && GeoUtils.isValidCoordinate(d.lat, d.lon)) {
centerOnPoint(new LatLong(d.lat, d.lon), (byte) 14);
return true;
}
}
return false;
} }
private boolean centerOnRole(String role) { private boolean centerOnRole(String role) {
+4
View File
@@ -7,6 +7,7 @@ from typing import Any, Optional
from fastapi import FastAPI, Header, HTTPException, Query from fastapi import FastAPI, Header, HTTPException, Query
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileResponse from fastapi.responses import FileResponse
from fastapi.staticfiles import StaticFiles
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from core.auth import ANDROID_CLIENT_HEADER, ANDROID_CLIENT_VALUE from core.auth import ANDROID_CLIENT_HEADER, ANDROID_CLIENT_VALUE
@@ -370,6 +371,9 @@ def health():
} }
app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
if __name__ == "__main__": if __name__ == "__main__":
import uvicorn import uvicorn
+12
View File
@@ -321,6 +321,18 @@
</div> </div>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="/static/radio-ui.js"></script> <script src="/static/radio-ui.js"></script>
<script>
if (typeof RadioUI === 'undefined') {
console.error('radio-ui.js not loaded — check /static/radio-ui.js');
window.RadioUI = {
roleLabel: (role) => role || '—',
parseRadioSnapshot: () => ({}),
diffSnapshots: () => new Set(),
formatRadioPanel: () => '—',
renderCompareGrid: () => '—'
};
}
</script>
<script> <script>
const map = L.map('map').setView([55.75, 37.62], 10); const map = L.map('map').setView([55.75, 37.62], 10);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {