Harmoniser les styles de la carte : réglages communs, thèmes clair et sombre, composants uniques
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -1,18 +1,55 @@
|
||||
/* Carte LiDAR — tuiles XYZ, habillage minimal type carte grand public. */
|
||||
|
||||
/* Réglages communs : toute règle y puise (couleurs, texte, arrondis,
|
||||
espacements, ombres, superpositions). Deux palettes : claire par défaut,
|
||||
sombre si le système le demande (sauf clair forcé) ou si elle est forcée. */
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
--bg: #0b0e13;
|
||||
--card: rgba(16, 20, 27, 0.94);
|
||||
--border: rgba(255, 255, 255, 0.10);
|
||||
--text: #d9dee6;
|
||||
--muted: #8b94a3;
|
||||
--accent: #5aa9e6;
|
||||
--radius: 12px;
|
||||
color-scheme: light;
|
||||
--bg: #eef0f3;
|
||||
--surface: rgba(251, 251, 250, 0.96);
|
||||
--surface-2: #eef0f3; /* champs, segments, boutons neutres */
|
||||
--border: #d6d9de;
|
||||
--text: #1d232b;
|
||||
--muted: #5b6573;
|
||||
--accent: #1f6fb2;
|
||||
--on-accent: #ffffff;
|
||||
--track: #cfd4da;
|
||||
--print: #d99a00;
|
||||
--gen-running: #d9730d;
|
||||
--gen-pending: #0b8fc0;
|
||||
--gen-failed: #c8452c;
|
||||
--gen-sel: var(--accent);
|
||||
--fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-lg: 16px;
|
||||
--r-sm: 6px; --r-md: 10px; --r-full: 999px;
|
||||
--sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
|
||||
--shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.18);
|
||||
--shadow-lg: 0 6px 24px rgba(0, 0, 0, 0.28);
|
||||
--z-map-ui: 800; --z-panel: 900; --z-popup: 950;
|
||||
--z-loading: 960; --z-toast: 1000; --z-modal: 1100;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme="light"]) {
|
||||
color-scheme: dark;
|
||||
--bg: #0b0e13; --surface: rgba(16, 20, 27, 0.95); --surface-2: rgba(255, 255, 255, 0.06);
|
||||
--border: rgba(255, 255, 255, 0.12); --text: #d9dee6; --muted: #8b94a3;
|
||||
--accent: #5aa9e6; --on-accent: #0b0e13; --track: rgba(255, 255, 255, 0.18);
|
||||
--print: #ffd166; --gen-running: #f4a261; --gen-pending: #4cc9f0; --gen-failed: #e76f51;
|
||||
--shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.4); --shadow-lg: 0 6px 24px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
}
|
||||
:root[data-theme="dark"] {
|
||||
color-scheme: dark;
|
||||
--bg: #0b0e13; --surface: rgba(16, 20, 27, 0.95); --surface-2: rgba(255, 255, 255, 0.06);
|
||||
--border: rgba(255, 255, 255, 0.12); --text: #d9dee6; --muted: #8b94a3;
|
||||
--accent: #5aa9e6; --on-accent: #0b0e13; --track: rgba(255, 255, 255, 0.18);
|
||||
--print: #ffd166; --gen-running: #f4a261; --gen-pending: #4cc9f0; --gen-failed: #e76f51;
|
||||
--shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.4); --shadow-lg: 0 6px 24px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
[hidden] { display: none !important; }
|
||||
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
|
||||
font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
|
||||
font: var(--fs-md)/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
|
||||
#map { position: absolute; inset: 0; background: var(--bg); }
|
||||
.leaflet-container { background: var(--bg); font: inherit; }
|
||||
/* Fond OSM assombri pour laisser ressortir les rendus LiDAR. Filtre posé sur
|
||||
@ -21,164 +58,158 @@ html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(-
|
||||
−30 % de CPU (moteur de rendu + GPU) en déplacement, mesuré sous Chrome. */
|
||||
.leaflet-tile-pane .leaflet-layer.base-dark { filter: brightness(0.38) contrast(1.1) saturate(0.7); }
|
||||
|
||||
.card { position: fixed; z-index: 900; background: var(--card); color: var(--text);
|
||||
border: 1px solid var(--border); border-radius: var(--radius);
|
||||
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
|
||||
.card { position: fixed; z-index: var(--z-panel); background: var(--surface); color: var(--text);
|
||||
border: 1px solid var(--border); border-radius: var(--r-md);
|
||||
box-shadow: var(--shadow-lg);
|
||||
backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
|
||||
#layercard { left: 12px; bottom: 12px; width: 320px; max-width: calc(100vw - 24px); }
|
||||
#tilecard { left: 12px; top: 12px; width: 340px; max-width: calc(100vw - 24px);
|
||||
max-height: calc(100vh - 24px); overflow-y: auto; }
|
||||
.info-sec { margin-top: 10px; }
|
||||
.info-sec h4 { margin: 0 0 4px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
|
||||
.info-sec h4 { margin: 0 0 4px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em;
|
||||
text-transform: uppercase; color: var(--muted); }
|
||||
.info-kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; font-size: 12.5px; }
|
||||
.info-kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; font-size: var(--fs-sm); }
|
||||
.info-kv dt { color: var(--muted); }
|
||||
.info-kv dd { margin: 0; overflow-wrap: anywhere; }
|
||||
.info-dl { display: inline-block; margin-top: 6px; padding: 6px 10px; border-radius: 6px;
|
||||
background: rgba(90, 160, 255, 0.18); color: var(--text); text-decoration: none; font-weight: 600; }
|
||||
.info-dl:hover { background: rgba(90, 160, 255, 0.3); }
|
||||
.info-dl { display: inline-block; margin-top: 6px; padding: 6px 10px; border-radius: var(--r-sm);
|
||||
background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); text-decoration: none; font-weight: 600; }
|
||||
.info-dl:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
|
||||
#rose { right: 12px; bottom: 190px; padding: 8px 8px 6px; display: flex; flex-direction: column;
|
||||
align-items: center; gap: 2px; z-index: 800; }
|
||||
align-items: center; gap: 2px; z-index: var(--z-map-ui); }
|
||||
#rose canvas { width: 132px; height: 132px; }
|
||||
.rose-cap { font-size: 11px; text-align: center; color: var(--text); line-height: 1.3; }
|
||||
.rose-cap span { color: var(--muted); font-size: 10.5px; }
|
||||
#usecard { left: 50%; top: 12px; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); z-index: 910; }
|
||||
.rose-cap { font-size: var(--fs-xs); text-align: center; color: var(--text); line-height: 1.3; }
|
||||
.rose-cap span { color: var(--muted); font-size: var(--fs-xs); }
|
||||
#usecard { left: 50%; top: 12px; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); z-index: var(--z-popup); }
|
||||
.card-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
|
||||
.card-title { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
|
||||
.card-stat { margin-left: auto; font-size: 11px; color: var(--muted); }
|
||||
.card-title { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
|
||||
.card-stat { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
|
||||
.card-body { padding: 6px 8px 8px; max-height: min(60vh, 520px); overflow-y: auto; }
|
||||
#layercard.collapsed .card-body { display: none; }
|
||||
#layercard.collapsed #cardToggle { transform: rotate(-90deg); }
|
||||
.card-foot { display: flex; gap: 8px; padding: 8px 4px 2px; margin-top: 6px; border-top: 1px solid var(--border); }
|
||||
|
||||
button { background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--border);
|
||||
border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; }
|
||||
button:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--accent); }
|
||||
.icon-btn { border: none; background: none; color: var(--muted); padding: 2px 6px; font-size: 14px; }
|
||||
.icon-btn:hover { color: var(--text); background: none; }
|
||||
.link-btn { flex: 1; font-size: 11.5px; }
|
||||
/* --- composants communs --------------------------------------------------- */
|
||||
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-1);
|
||||
min-height: 32px; padding: 0 var(--sp-3); border-radius: var(--r-sm); border: 1px solid var(--border);
|
||||
background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
|
||||
.btn:hover, button:hover { border-color: var(--accent); }
|
||||
.btn:disabled, button:disabled { opacity: 0.5; cursor: default; }
|
||||
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
|
||||
.btn-primary:hover { filter: brightness(1.08); }
|
||||
.btn-ghost { background: transparent; }
|
||||
.btn-icon { min-height: 0; padding: var(--sp-1) var(--sp-2); border: none; background: none;
|
||||
color: var(--muted); font-size: var(--fs-lg); }
|
||||
.btn-icon:hover { color: var(--text); }
|
||||
.row { display: flex; gap: var(--sp-2); align-items: center; }
|
||||
.row > .btn, .row > .field { flex: 1; min-width: 0; }
|
||||
.field { height: 32px; min-width: 0; width: 100%; padding: 0 var(--sp-2); border-radius: var(--r-sm);
|
||||
border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
|
||||
font: inherit; font-size: var(--fs-sm); }
|
||||
select.field[multiple] { height: auto; padding: var(--sp-1); }
|
||||
.field option { background-color: var(--surface); color: var(--text); }
|
||||
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border);
|
||||
border-radius: var(--r-sm); overflow: hidden; }
|
||||
.seg button { min-height: 32px; border: none; border-radius: 0; background: var(--surface-2); color: var(--muted); }
|
||||
.seg button + button { border-left: 1px solid var(--border); }
|
||||
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
|
||||
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
|
||||
.hint { font-size: var(--fs-sm); color: var(--muted); margin: var(--sp-1) 0; }
|
||||
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px;
|
||||
background: transparent; cursor: pointer; }
|
||||
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--track); }
|
||||
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px;
|
||||
margin-top: -5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
|
||||
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
|
||||
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%;
|
||||
background: var(--accent); border: 2px solid var(--surface); }
|
||||
@media (max-width: 720px) {
|
||||
.btn, button, .field, .seg button { min-height: 40px; }
|
||||
.field { height: 40px; }
|
||||
}
|
||||
|
||||
/* Ligne du fond de carte : œil, nom, opacité. */
|
||||
.layer-row { display: grid; grid-template-columns: 14px 24px minmax(0, 1fr) auto 34px;
|
||||
align-items: center; gap: 6px; padding: 5px 4px; border-radius: 8px; user-select: none; }
|
||||
.layer-ctl { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 84px;
|
||||
gap: 6px; align-items: center; padding: 2px 0 2px 38px; }
|
||||
.layer-row:hover { background: rgba(255, 255, 255, 0.05); }
|
||||
.base-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center;
|
||||
gap: var(--sp-2); padding: var(--sp-1) 0; }
|
||||
.base-row .base-ctl { grid-column: 2 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 40px;
|
||||
gap: var(--sp-2); align-items: center; }
|
||||
/* Affichage : une couche principale, la précision seule ou superposée. */
|
||||
.view-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
|
||||
gap: 8px; padding: 8px 4px 4px; border-top: 1px solid var(--border); margin-top: 4px; }
|
||||
.view-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
|
||||
.view-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
|
||||
.view-row .layer-name { color: var(--text); }
|
||||
.view-sel { background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--border);
|
||||
border-radius: 6px; padding: 2px 4px; font: inherit; font-size: 12px; min-width: 0; width: 100%; height: 24px; }
|
||||
.view-sel option { background-color: #10141b; color: var(--text); }
|
||||
.mode-seg { display: grid; grid-template-columns: repeat(3, 1fr); margin: 6px 4px 2px;
|
||||
border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
|
||||
.mode-seg button { border: none; border-radius: 0; background: rgba(255, 255, 255, 0.04);
|
||||
color: var(--muted); padding: 6px 4px; font-size: 12px; }
|
||||
.mode-seg button + button { border-left: 1px solid var(--border); }
|
||||
.mode-seg button:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
|
||||
.mode-seg button[aria-pressed="true"] { background: var(--accent); color: #0b0e13; font-weight: 600; }
|
||||
.mode-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
|
||||
.prec-ctl { display: grid; grid-template-columns: auto minmax(0, 1fr) 34px; gap: 8px;
|
||||
align-items: center; padding: 6px 4px 0; font-size: 11.5px; color: var(--muted); }
|
||||
align-items: center; padding: 6px 4px 0; font-size: var(--fs-xs); color: var(--muted); }
|
||||
.prec-legend { padding: 8px 4px 2px; }
|
||||
.prec-bar { display: grid; grid-template-columns: repeat(16, 1fr); height: 10px;
|
||||
border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
|
||||
.prec-ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted);
|
||||
.prec-ticks { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted);
|
||||
font-variant-numeric: tabular-nums; margin-top: 2px; }
|
||||
.prec-cap { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
|
||||
.grip { color: var(--muted); cursor: grab; text-align: center; font-size: 12px; }
|
||||
.grip::before { content: '⠿'; }
|
||||
#baseRow .grip::before { content: ''; }
|
||||
.prec-cap { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
|
||||
.eye { width: 24px; height: 24px; padding: 0; border: none; background: none; color: var(--muted);
|
||||
display: flex; align-items: center; justify-content: center; }
|
||||
.eye.on { color: var(--accent); }
|
||||
.eye svg { width: 16px; height: 16px; }
|
||||
.layer-name { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.layer-row.on .layer-name { color: var(--text); }
|
||||
.pct { font-size: 10.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
|
||||
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px;
|
||||
background: transparent; cursor: pointer; }
|
||||
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.18); }
|
||||
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
|
||||
background: var(--accent); margin-top: -4.5px; border: 2px solid #0b0e13; }
|
||||
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.18); }
|
||||
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid #0b0e13; }
|
||||
.layer-name { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.pct { font-size: var(--fs-xs); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
|
||||
|
||||
#tools { position: fixed; right: 12px; bottom: 12px; z-index: 900; display: flex; flex-direction: column; gap: 6px; }
|
||||
#tools button { width: 38px; height: 38px; padding: 0; font-size: 17px; background: var(--card);
|
||||
border: 1px solid var(--border); box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
|
||||
#gps.busy { color: var(--accent); border-color: var(--accent); }
|
||||
#tools { position: fixed; right: 12px; bottom: 12px; z-index: var(--z-panel); display: flex; flex-direction: column; gap: 6px; }
|
||||
#tools button { width: 38px; height: 38px; padding: 0; font-size: var(--fs-lg); background: var(--surface);
|
||||
border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
|
||||
/* Indicateur de chargement : tuiles restantes pour finir la vue courante
|
||||
(fond + LiDAR), barre de progression du lot en cours. */
|
||||
.tileload { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 905;
|
||||
display: flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px;
|
||||
background: var(--card); border: 1px solid var(--border); font-size: 12px;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); pointer-events: none;
|
||||
.tileload { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: var(--z-loading);
|
||||
display: flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: var(--r-full);
|
||||
background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-sm);
|
||||
box-shadow: var(--shadow-sm); pointer-events: none;
|
||||
transition: opacity 0.3s ease; white-space: nowrap; }
|
||||
.tileload.done { opacity: 0; }
|
||||
.tl-spin { width: 12px; height: 12px; border-radius: 50%; flex: none;
|
||||
border: 2px solid rgba(90, 169, 230, 0.25); border-top-color: var(--accent);
|
||||
.tl-spin { width: 12px; height: 12px; border-radius: var(--r-full); flex: none;
|
||||
border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent);
|
||||
animation: tlspin 0.8s linear infinite; }
|
||||
.tileload.done .tl-spin { animation: none; border-color: var(--accent); }
|
||||
@keyframes tlspin { to { transform: rotate(360deg); } }
|
||||
.tl-bar { width: 60px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1);
|
||||
.tl-bar { width: 60px; height: 4px; border-radius: var(--r-sm); background: var(--track);
|
||||
overflow: hidden; flex: none; }
|
||||
.tl-bar span { display: block; height: 100%; width: 0; background: var(--accent);
|
||||
transition: width 0.2s ease; }
|
||||
.toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 1000;
|
||||
background: var(--card); border: 1px solid var(--border); border-radius: 8px;
|
||||
padding: 7px 12px; font-size: 12px; color: var(--text); max-width: 80vw; text-align: center; }
|
||||
.toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: var(--z-toast);
|
||||
background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
|
||||
padding: 7px 12px; font-size: var(--fs-sm); color: var(--text); max-width: 80vw; text-align: center; }
|
||||
|
||||
.meta { font-size: 11.5px; color: var(--muted); margin: 2px 0; }
|
||||
.meta { font-size: var(--fs-xs); color: var(--muted); margin: 2px 0; }
|
||||
.meta b { color: var(--text); font-weight: 600; }
|
||||
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px;
|
||||
background: rgba(255,255,255,0.06); border: 1px solid var(--border); border-radius: 6px;
|
||||
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: var(--fs-xs);
|
||||
background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
|
||||
padding: 6px 8px; word-break: break-all; margin: 4px 0 8px; }
|
||||
.use-row { display: flex; gap: 6px; align-items: center; margin-bottom: 2px; }
|
||||
.use-row select { flex: 1; min-width: 0; background: rgba(255,255,255,0.06); color: var(--text);
|
||||
border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font: inherit; font-size: 12px; }
|
||||
.use-note { font-size: 11px; color: var(--muted); line-height: 1.5; }
|
||||
.leaflet-control-attribution { background: rgba(11,14,19,0.8) !important; color: var(--muted) !important; }
|
||||
.use-note { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
|
||||
.leaflet-control-attribution { background: var(--surface) !important; color: var(--muted) !important; }
|
||||
.leaflet-control-attribution a { color: var(--accent) !important; }
|
||||
|
||||
/* --- génération de tuiles ------------------------------------------------ */
|
||||
#gencard { right: 12px; top: 56px; width: 340px; max-width: calc(100vw - 24px); }
|
||||
#printcard { right: 60px; bottom: 12px; width: 340px; max-width: calc(100vw - 84px); }
|
||||
#printTitle { flex: 1; min-width: 0; background: rgba(255,255,255,0.06); color: var(--text);
|
||||
border: 1px solid rgba(255,255,255,0.15); border-radius: 6px; padding: 4px 6px; }
|
||||
.print-hint { margin: 4px 0; font-size: 12px; opacity: 0.75; }
|
||||
.print-msg { font-size: 12px; margin-left: 8px; }
|
||||
.print-msg { font-size: var(--fs-sm); margin-left: 8px; }
|
||||
.print-handle { display: flex; align-items: center; justify-content: center; cursor: move;
|
||||
font-size: 20px; color: #1b1b1b; background: #ffd166; border: 2px solid #1b1b1b;
|
||||
border-radius: 50%; box-shadow: 0 1px 6px rgba(0,0,0,0.5); }
|
||||
font-size: var(--fs-lg); color: #1b1b1b; background: var(--print); border: 2px solid #1b1b1b;
|
||||
border-radius: var(--r-full); box-shadow: 0 1px 6px rgba(0,0,0,0.5); }
|
||||
body.drawing { cursor: crosshair !important; }
|
||||
body.drawing .leaflet-container { cursor: crosshair !important; }
|
||||
/* Barre de génération : en HAUT à droite de l'écran, boutons accentués —
|
||||
c'est l'entrée principale du traitement, elle ne se confond pas avec les
|
||||
icônes de navigation (zoom/GPS) du coin bas droit. */
|
||||
#gentools { position: fixed; top: 12px; right: 12px; z-index: 900; display: flex; gap: 8px; }
|
||||
#gentools button { background: var(--card); color: var(--accent); border: 1px solid var(--accent);
|
||||
border-radius: 10px; padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 600;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
|
||||
#gentools button:hover { background: var(--accent); color: #0b0e13; }
|
||||
#gentools button.accent { background: var(--accent); color: #0b0e13; }
|
||||
#gentools { position: fixed; top: 12px; right: 12px; z-index: var(--z-panel); display: flex; gap: 8px; }
|
||||
#gentools button { background: var(--surface); color: var(--accent); border: 1px solid var(--accent);
|
||||
border-radius: var(--r-md); padding: 8px 14px; font: inherit; font-size: var(--fs-md); font-weight: 600;
|
||||
box-shadow: var(--shadow-sm); }
|
||||
#gentools button:hover { background: var(--accent); color: var(--on-accent); }
|
||||
#gentools button.accent { background: var(--accent); color: var(--on-accent); }
|
||||
.gen-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px;
|
||||
align-items: center; margin: 4px 0; font-size: 11.5px; color: var(--muted); }
|
||||
#genViz { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--border);
|
||||
border-radius: 6px; padding: 3px 4px; font: inherit; font-size: 11.5px; }
|
||||
#genViz option { background-color: #10141b; }
|
||||
#genClass, .gen-input { background: rgba(255,255,255,0.06); color: var(--text);
|
||||
border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px;
|
||||
font: inherit; font-size: 11.5px; width: 100%; height: 24px; }
|
||||
.chk { display: flex; gap: 7px; align-items: center; font-size: 11.5px;
|
||||
align-items: center; margin: 4px 0; font-size: var(--fs-xs); color: var(--muted); }
|
||||
.chk { display: flex; gap: 7px; align-items: center; font-size: var(--fs-xs);
|
||||
color: var(--muted); margin: 4px 0; cursor: pointer; }
|
||||
.chk input { accent-color: var(--accent); }
|
||||
button.primary { background: var(--accent); border-color: var(--accent); color: #0b0e13; font-weight: 600; }
|
||||
button.primary:hover { filter: brightness(1.12); }
|
||||
.gen-log { font: 10.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted);
|
||||
background: rgba(0,0,0,0.35); border: 1px solid var(--border); border-radius: 6px;
|
||||
.gen-log { font: var(--fs-xs)/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted);
|
||||
background: rgba(0,0,0,0.35); border: 1px solid var(--border); border-radius: var(--r-sm);
|
||||
padding: 6px 8px; max-height: 130px; overflow-y: auto; white-space: pre-wrap;
|
||||
word-break: break-all; margin: 6px 0; }
|
||||
#tools button.accent { color: var(--accent); border-color: var(--accent); }
|
||||
@ -186,10 +217,10 @@ button.primary:hover { filter: brightness(1.12); }
|
||||
/* Cadres des dalles du run : orange pulsant = rendu en cours, bleu = en
|
||||
attente, rouge = échec. Les dalles faites n'ont pas de cadre. */
|
||||
@keyframes genpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
|
||||
.gen-frame-running { stroke: #f4a261; fill: #f4a26122; animation: genpulse 1.4s ease-in-out infinite; }
|
||||
.gen-frame-pending { stroke: #4cc9f0; fill: #4cc9f014; stroke-dasharray: 6 4; }
|
||||
.gen-frame-failed { stroke: #e76f51; fill: #e76f5133; }
|
||||
.gen-sel { stroke: var(--accent); fill: #5aa9e61f; cursor: pointer; }
|
||||
.gen-frame-running { stroke: var(--gen-running); fill: color-mix(in srgb, var(--gen-running) 13%, transparent); animation: genpulse 1.4s ease-in-out infinite; }
|
||||
.gen-frame-pending { stroke: var(--gen-pending); fill: color-mix(in srgb, var(--gen-pending) 8%, transparent); stroke-dasharray: 6 4; }
|
||||
.gen-frame-failed { stroke: var(--gen-failed); fill: color-mix(in srgb, var(--gen-failed) 20%, transparent); }
|
||||
.gen-sel { stroke: var(--accent); fill: color-mix(in srgb, var(--accent) 12%, transparent); cursor: pointer; }
|
||||
@media (max-width: 720px) {
|
||||
#layercard { width: calc(100vw - 24px); }
|
||||
#tilecard { width: calc(100vw - 24px); }
|
||||
|
||||
@ -13,27 +13,26 @@
|
||||
|
||||
<div id="layercard" class="card">
|
||||
<div class="card-head">
|
||||
<button id="cardToggle" class="icon-btn" title="Replier / déplier">▾</button>
|
||||
<button id="cardToggle" class="btn-icon" title="Replier / déplier">▾</button>
|
||||
<span class="card-title">Couches</span>
|
||||
<span id="stat" class="card-stat"></span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="layer-row" id="baseRow">
|
||||
<span class="grip"></span>
|
||||
<div class="base-row" id="baseRow">
|
||||
<button class="eye on" id="baseToggle" title="Afficher / masquer le fond de carte"></button>
|
||||
<span class="layer-name" id="baseName" title="Cliquer : fond clair / assombri">Fond OpenStreetMap</span>
|
||||
<span class="pct" id="basePct"></span>
|
||||
<div class="layer-ctl">
|
||||
<div class="base-ctl">
|
||||
<input type="range" id="baseOpacity" min="0" max="100" step="1" title="Opacité du fond">
|
||||
</div>
|
||||
</div>
|
||||
<div class="view-row">
|
||||
<span class="view-label">Affichage</span>
|
||||
<span class="layer-name" id="mainName"></span>
|
||||
<select id="mainSel" class="view-sel" title="Couche d'affichage principal" hidden></select>
|
||||
<select id="mainSel" class="field" title="Couche d'affichage principal" hidden></select>
|
||||
</div>
|
||||
<div id="precBlock" hidden>
|
||||
<div class="mode-seg" id="modeSeg" role="group" aria-label="Relief, précision ou les deux (touche P)">
|
||||
<div class="seg" id="modeSeg" role="group" aria-label="Relief, précision ou les deux (touche P)">
|
||||
<button type="button" data-mode="relief" title="Relief seul (touche P : mode suivant)">Relief</button>
|
||||
<button type="button" data-mode="precision" title="Précision géométrique seule : densité de points sol">Précision</button>
|
||||
<button type="button" data-mode="both" title="Précision en produit sur le relief : les zones peu fiables s'assombrissent">Les deux</button>
|
||||
@ -50,12 +49,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-foot">
|
||||
<button id="btnShare" class="link-btn" title="Copier un lien vers cette vue">⎘ Partager la vue</button>
|
||||
<button id="btnUse" class="link-btn" title="Utiliser ces rendus comme fond d'imagerie (JOSM, QGIS, iD…)">⤓ Utiliser dans JOSM / QGIS</button>
|
||||
<button id="btnShare" class="btn" title="Copier un lien vers cette vue">⎘ Partager la vue</button>
|
||||
<button id="btnUse" class="btn" title="Utiliser ces rendus comme fond d'imagerie (JOSM, QGIS, iD…)">⤓ Utiliser dans JOSM / QGIS</button>
|
||||
</div>
|
||||
<div class="card-foot">
|
||||
<button id="btnDefault" class="link-btn" title="Figer l'affichage courant (couche principale, mode, opacité de la précision, fond) comme configuration par défaut de tous les navigateurs">★ Définir par défaut</button>
|
||||
<button id="btnReset" class="link-btn" title="Revenir à la configuration par défaut">↺ Réinitialiser</button>
|
||||
<button id="btnDefault" class="btn" title="Figer l'affichage courant (couche principale, mode, opacité de la précision, fond) comme configuration par défaut de tous les navigateurs">★ Définir par défaut</button>
|
||||
<button id="btnReset" class="btn" title="Revenir à la configuration par défaut">↺ Réinitialiser</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -63,7 +62,7 @@
|
||||
<div id="tilecard" class="card" hidden>
|
||||
<div class="card-head">
|
||||
<span class="card-title" id="tileTitle">Dalle</span>
|
||||
<button id="tileClose" class="icon-btn" title="Fermer">×</button>
|
||||
<button id="tileClose" class="btn-icon" title="Fermer">×</button>
|
||||
</div>
|
||||
<div class="card-body" id="tileBody"></div>
|
||||
</div>
|
||||
@ -76,7 +75,7 @@
|
||||
<div id="usecard" class="card" hidden>
|
||||
<div class="card-head">
|
||||
<span class="card-title">Fond d'imagerie XYZ</span>
|
||||
<button id="useClose" class="icon-btn" title="Fermer">×</button>
|
||||
<button id="useClose" class="btn-icon" title="Fermer">×</button>
|
||||
</div>
|
||||
<div class="card-body" id="useBody"></div>
|
||||
</div>
|
||||
@ -85,23 +84,23 @@
|
||||
<div class="card-head">
|
||||
<span class="card-title">Export PDF</span>
|
||||
<span id="printInfo" class="card-stat"></span>
|
||||
<button id="printClose" class="icon-btn" title="Fermer">×</button>
|
||||
<button id="printClose" class="btn-icon" title="Fermer">×</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="use-row"><select id="printPaper" title="Format papier">
|
||||
<div class="row"><select id="printPaper" class="field" title="Format papier">
|
||||
<option value="A4" selected>A4</option><option value="A3">A3</option></select>
|
||||
<select id="printOrient" title="Orientation">
|
||||
<select id="printOrient" class="field" title="Orientation">
|
||||
<option value="paysage" selected>Paysage</option><option value="portrait">Portrait</option></select>
|
||||
<select id="printScale" title="Échelle d'impression">
|
||||
<select id="printScale" class="field" title="Échelle d'impression">
|
||||
<option value="1000">1:1 000</option><option value="2000" selected>1:2 000</option>
|
||||
<option value="5000">1:5 000</option><option value="10000">1:10 000</option></select></div>
|
||||
<div class="use-row"><input id="printTitle" type="text" maxlength="120"
|
||||
<div class="row"><input id="printTitle" class="field" type="text" maxlength="120"
|
||||
placeholder="Titre (optionnel)" title="Titre imprimé dans le cartouche"></div>
|
||||
<p class="print-hint">Faites glisser la poignée ✥ pour placer le cadre jaune sur la zone à imprimer.</p>
|
||||
<div class="use-row"><button id="printHere" class="link-btn"
|
||||
<p class="hint">Faites glisser la poignée ✥ pour placer le cadre jaune sur la zone à imprimer.</p>
|
||||
<div class="row"><button id="printHere" class="btn"
|
||||
title="Placer le cadre au centre de la vue">⌖ Centrer ici</button>
|
||||
<button id="printFit" class="link-btn" title="Zoomer sur le cadre">⤢ Voir le cadre</button></div>
|
||||
<div class="card-foot"><button id="printGo">Exporter le PDF</button>
|
||||
<button id="printFit" class="btn" title="Zoomer sur le cadre">⤢ Voir le cadre</button></div>
|
||||
<div class="card-foot"><button id="printGo" class="btn btn-primary">Exporter le PDF</button>
|
||||
<span id="printMsg" class="print-msg"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
@ -110,19 +109,18 @@
|
||||
<div class="card-head">
|
||||
<span class="card-title">Génération</span>
|
||||
<span id="genBadge" class="card-stat"></span>
|
||||
<button id="genClose" class="icon-btn" title="Fermer">×</button>
|
||||
<button id="genClose" class="btn-icon" title="Fermer">×</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="genMsg" class="meta">Dessinez une zone (+) ou complétez les dalles existantes (⤒).</div>
|
||||
<div id="genOpts">
|
||||
<div class="gen-row"><span class="gen-lbl">Couches</span>
|
||||
<select id="genViz" multiple size="4" title="Laisser vide pour les couches du panneau"></select></div>
|
||||
<select id="genViz" class="field" multiple size="4" title="Laisser vide pour les couches du panneau"></select></div>
|
||||
<label class="chk"><input type="checkbox" id="genRegen"> Régénérer les tuiles existantes</label>
|
||||
<div class="meta">Sol : classification IGN · bords raccordés aux dalles voisines (bande 100 m)</div>
|
||||
</div>
|
||||
<div id="genClassInfo" class="meta"></div>
|
||||
<div class="card-foot" id="genActions">
|
||||
<button id="genGo" class="primary" title="Télécharge (géoplateforme IGN) puis traite les dalles sélectionnées">Générer</button>
|
||||
<button id="genGo" class="btn btn-primary" title="Télécharge (géoplateforme IGN) puis traite les dalles sélectionnées">Générer</button>
|
||||
<button id="genClear" title="Vider la sélection de dalles">Effacer la sélection</button>
|
||||
</div>
|
||||
<div id="genRun" hidden>
|
||||
@ -146,6 +144,7 @@
|
||||
<button id="zoomFit" title="Recadrer sur les données">⤢</button>
|
||||
<button id="gps" title="Centrer sur ma position">⌖</button>
|
||||
<button id="btnPrint" title="Exporter la zone en PDF (impression terrain)">⎙</button>
|
||||
<button id="btnTheme" class="btn-icon" title="Thème">◐</button>
|
||||
</nav>
|
||||
<div id="toast" class="toast" hidden></div>
|
||||
<div id="tileload" class="tileload" hidden aria-live="polite">
|
||||
|
||||
@ -6,6 +6,24 @@
|
||||
const UI_VERSION = "__UI_VERSION__";
|
||||
const LS_KEY = 'lidarMapView_v2';
|
||||
const el = (id) => document.getElementById(id);
|
||||
|
||||
// --- stockage local ---------------------------------------------------------
|
||||
// Tous les accès passent ici : en navigation privée (ou stockage bloqué),
|
||||
// localStorage lève — la carte démarre alors sur ses défauts.
|
||||
function lsGet(key, fallback) {
|
||||
try {
|
||||
const raw = localStorage.getItem(key);
|
||||
return raw == null ? fallback : JSON.parse(raw);
|
||||
} catch (e) { return fallback; }
|
||||
}
|
||||
function lsSet(key, value) {
|
||||
try { localStorage.setItem(key, JSON.stringify(value)); } catch (e) { /* privé */ }
|
||||
}
|
||||
function lsDel(key) {
|
||||
try { localStorage.removeItem(key); } catch (e) { /* privé */ }
|
||||
}
|
||||
// --- fin stockage ------------------------------------------------------------
|
||||
|
||||
const SVG_EYE = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>';
|
||||
const SVG_EYE_OFF = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19M14.12 14.12a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>';
|
||||
|
||||
@ -26,6 +44,35 @@ const PREC_LEVELS = 16;
|
||||
|
||||
let META = null;
|
||||
let STATE = null;
|
||||
|
||||
// --- thème ------------------------------------------------------------------
|
||||
// auto = suit le système ; ☀/☾ force clair ou sombre ; 3ᵉ appui : auto.
|
||||
const THEME_LS = 'lidar-theme';
|
||||
const THEME_NEXT = { auto: 'light', light: 'dark', dark: 'auto' };
|
||||
const THEME_ICON = { auto: '◐', light: '☀', dark: '☾' };
|
||||
const THEME_TITLE = { auto: 'Thème : suit le système', light: 'Thème : clair', dark: 'Thème : sombre' };
|
||||
const darkQuery = window.matchMedia ? window.matchMedia('(prefers-color-scheme: dark)') : null;
|
||||
|
||||
function themeIsDark() {
|
||||
const t = document.documentElement.dataset.theme;
|
||||
return t === 'dark' || (t !== 'light' && !!(darkQuery && darkQuery.matches));
|
||||
}
|
||||
|
||||
function applyTheme(pref) {
|
||||
const p = THEME_NEXT[pref] ? pref : 'auto';
|
||||
if (p === 'auto') delete document.documentElement.dataset.theme;
|
||||
else document.documentElement.dataset.theme = p;
|
||||
const btn = el('btnTheme');
|
||||
if (btn) { btn.textContent = THEME_ICON[p]; btn.title = THEME_TITLE[p] + ' (cliquer pour changer)'; }
|
||||
if (typeof applyLayers === 'function' && STATE) applyLayers(); // fond OSM assombri
|
||||
return p;
|
||||
}
|
||||
|
||||
function cssVar(name) {
|
||||
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
||||
}
|
||||
let THEME = applyTheme(lsGet(THEME_LS, 'auto'));
|
||||
|
||||
const LAYERS = new Map(); // clé → L.TileLayer
|
||||
|
||||
const map = L.map('map', {
|
||||
@ -154,23 +201,20 @@ function defaultState(meta) {
|
||||
precOpacity: clamp01(meta.default_precision_opacity, 0.6),
|
||||
base: { on: b.on !== undefined ? !!b.on : true,
|
||||
opacity: b.opacity !== undefined ? Number(b.opacity) : 0.85,
|
||||
dark: b.dark !== undefined ? !!b.dark : true },
|
||||
dark: b.dark !== undefined ? !!b.dark : null },
|
||||
};
|
||||
}
|
||||
|
||||
function loadState(meta) {
|
||||
const def = defaultState(meta);
|
||||
let st = def;
|
||||
try {
|
||||
const raw = localStorage.getItem(LS_KEY);
|
||||
if (raw) {
|
||||
const s = JSON.parse(raw);
|
||||
st = { main: validMain(meta, s.main) || def.main,
|
||||
mode: validMode(s.mode) || def.mode,
|
||||
precOpacity: clamp01(s.precOpacity, def.precOpacity),
|
||||
base: Object.assign({}, def.base, s.base || {}) };
|
||||
}
|
||||
} catch (e) { st = def; }
|
||||
const s = lsGet(LS_KEY, null);
|
||||
if (s) {
|
||||
st = { main: validMain(meta, s.main) || def.main,
|
||||
mode: validMode(s.mode) || def.mode,
|
||||
precOpacity: clamp01(s.precOpacity, def.precOpacity),
|
||||
base: Object.assign({}, def.base, s.base || {}) };
|
||||
}
|
||||
// Lien partagé : prime sur l'état local (les anciens liens &L=… de la
|
||||
// pile de couches sont ignorés, la vue s'ouvre alors sur l'état courant).
|
||||
const hash = parseHash();
|
||||
@ -183,7 +227,7 @@ function loadState(meta) {
|
||||
}
|
||||
|
||||
function saveState() {
|
||||
try { localStorage.setItem(LS_KEY, JSON.stringify(STATE)); } catch (e) { /* privé */ }
|
||||
lsSet(LS_KEY, STATE);
|
||||
}
|
||||
|
||||
// --- hash de vue ----------------------------------------------------------
|
||||
@ -220,8 +264,9 @@ function viewHash(full) {
|
||||
if (full) {
|
||||
if (STATE.main) h += '&M=' + STATE.main;
|
||||
h += '&P=' + STATE.mode + ':' + Math.round(STATE.precOpacity * 100);
|
||||
const dark = STATE.base.dark === null || STATE.base.dark === undefined ? themeIsDark() : STATE.base.dark;
|
||||
h += '&B=' + (STATE.base.on ? '1' : '0') + ':' + Math.round(STATE.base.opacity * 100)
|
||||
+ ':' + (STATE.base.dark ? '1' : '0');
|
||||
+ ':' + (dark ? '1' : '0');
|
||||
}
|
||||
return h;
|
||||
}
|
||||
@ -330,7 +375,8 @@ function applyLayers() {
|
||||
else if (map.hasLayer(base)) map.removeLayer(base);
|
||||
base.setOpacity(STATE.base.opacity);
|
||||
const container = base.getContainer && base.getContainer();
|
||||
if (container) container.classList.toggle('base-dark', STATE.base.dark);
|
||||
const dark = STATE.base.dark === null || STATE.base.dark === undefined ? themeIsDark() : STATE.base.dark;
|
||||
if (container) container.classList.toggle('base-dark', dark);
|
||||
updateRose();
|
||||
}
|
||||
|
||||
@ -468,7 +514,7 @@ function calageSection(c) {
|
||||
|
||||
function renderTileCard(data, ign) {
|
||||
const regenBtn = (GEN.available && GEN.allowed)
|
||||
? '<div class="card-foot"><button id="tileRegen" class="link-btn" title="Ajouter cette dalle à la sélection de génération (téléchargement IGN + traitement)">↻ ' + (data.found ? 'Régénérer' : 'Générer') + ' cette dalle</button></div>'
|
||||
? '<div class="card-foot"><button id="tileRegen" class="btn" title="Ajouter cette dalle à la sélection de génération (téléchargement IGN + traitement)">↻ ' + (data.found ? 'Régénérer' : 'Générer') + ' cette dalle</button></div>'
|
||||
: '';
|
||||
el('tileTitle').textContent = 'Dalle ' + data.col + ' · ' + data.row;
|
||||
const bb = data.l93_bbox || [];
|
||||
@ -583,8 +629,8 @@ function renderUseCard() {
|
||||
const opts = META.layers.map(l =>
|
||||
'<option value="' + l.key + '">' + l.label + '</option>').join('');
|
||||
el('useBody').innerHTML =
|
||||
'<div class="use-row"><select id="useLayer">' + opts + '</select>' +
|
||||
'<button id="useCopy">Copier</button></div>' +
|
||||
'<div class="row"><select id="useLayer" class="field">' + opts + '</select>' +
|
||||
'<button id="useCopy" class="btn btn-primary">Copier</button></div>' +
|
||||
'<div class="meta">URL XYZ (JOSM « TMS », QGIS « XYZ Tiles », uMap, MapLibre) :</div>' +
|
||||
'<div class="mono" id="useUrl"></div>' +
|
||||
'<div class="meta">TileJSON : <a id="useJson" href="#"></a></div>' +
|
||||
@ -724,7 +770,7 @@ map.on('mousedown', (e) => {
|
||||
genDrawStart = e.latlng;
|
||||
if (genDrawRect) genDrawRect.remove();
|
||||
genDrawRect = L.rectangle([genDrawStart, genDrawStart], {
|
||||
pane: 'genDraw', color: '#4cc9f0', weight: 2, dashArray: '6 4',
|
||||
pane: 'genDraw', color: cssVar('--gen-pending'), weight: 2, dashArray: '6 4',
|
||||
fillOpacity: 0.05, interactive: false,
|
||||
}).addTo(map);
|
||||
});
|
||||
@ -913,18 +959,16 @@ function printQuery(s, withTitle) {
|
||||
function printSave() {
|
||||
const s = printSettings();
|
||||
if (PRINT.center) s.center = [PRINT.center.lat, PRINT.center.lng];
|
||||
try { localStorage.setItem(PRINT_LS, JSON.stringify(s)); } catch (e) { /* privé */ }
|
||||
lsSet(PRINT_LS, s);
|
||||
}
|
||||
|
||||
function printLoad() {
|
||||
try {
|
||||
const s = JSON.parse(localStorage.getItem(PRINT_LS) || '{}');
|
||||
for (const [k, id] of [['paper', 'printPaper'], ['orient', 'printOrient'],
|
||||
['scale', 'printScale'], ['title', 'printTitle']]) {
|
||||
if (s[k] != null) el(id).value = s[k];
|
||||
}
|
||||
if (Array.isArray(s.center) && s.center.length === 2) PRINT.center = L.latLng(s.center);
|
||||
} catch (e) { /* privé ou illisible : réglages par défaut */ }
|
||||
const s = lsGet(PRINT_LS, {});
|
||||
for (const [k, id] of [['paper', 'printPaper'], ['orient', 'printOrient'],
|
||||
['scale', 'printScale'], ['title', 'printTitle']]) {
|
||||
if (s[k] != null) el(id).value = s[k];
|
||||
}
|
||||
if (Array.isArray(s.center) && s.center.length === 2) PRINT.center = L.latLng(s.center);
|
||||
}
|
||||
|
||||
// Recadre sur le cadre en laissant libre la bande basse couverte par les
|
||||
@ -945,7 +989,7 @@ function printFit() {
|
||||
function printDraw(corners) {
|
||||
PRINT.corners = corners;
|
||||
if (PRINT.rect) PRINT.rect.setLatLngs(corners);
|
||||
else PRINT.rect = L.polygon(corners, { pane: 'printFrame', color: '#ffd166', weight: 2,
|
||||
else PRINT.rect = L.polygon(corners, { pane: 'printFrame', color: cssVar('--print'), weight: 2,
|
||||
dashArray: '8 5', fill: false, interactive: false }).addTo(map);
|
||||
if (PRINT.handle) { PRINT.handle.setLatLng(PRINT.center); return; }
|
||||
PRINT.handle = L.marker(PRINT.center, {
|
||||
@ -1173,7 +1217,7 @@ el('precOpacity').addEventListener('change', saveState);
|
||||
|
||||
el('btnReset').addEventListener('click', () => {
|
||||
// Oublie l'état local et reprend la configuration servie par le serveur.
|
||||
try { localStorage.removeItem(LS_KEY); } catch (e) { /* privé */ }
|
||||
lsDel(LS_KEY);
|
||||
fetch('api/map/meta').then(r => r.json()).then(meta => {
|
||||
META = meta;
|
||||
STATE = defaultState(META);
|
||||
@ -1187,7 +1231,7 @@ el('baseToggle').addEventListener('click', () => {
|
||||
saveState(); renderBaseRow(); applyLayers();
|
||||
});
|
||||
el('baseName').addEventListener('click', () => {
|
||||
STATE.base.dark = !STATE.base.dark;
|
||||
STATE.base.dark = !(STATE.base.dark ?? themeIsDark());
|
||||
saveState(); applyLayers();
|
||||
});
|
||||
el('baseOpacity').addEventListener('input', (e) => {
|
||||
@ -1196,6 +1240,13 @@ el('baseOpacity').addEventListener('input', (e) => {
|
||||
base.setOpacity(STATE.base.opacity);
|
||||
});
|
||||
el('baseOpacity').addEventListener('change', saveState);
|
||||
el('btnTheme').addEventListener('click', () => {
|
||||
THEME = applyTheme(THEME_NEXT[THEME]);
|
||||
lsSet(THEME_LS, THEME);
|
||||
});
|
||||
if (darkQuery && darkQuery.addEventListener) {
|
||||
darkQuery.addEventListener('change', () => { if (THEME === 'auto' && STATE) applyLayers(); });
|
||||
}
|
||||
el('zoomIn').addEventListener('click', () => map.zoomIn(1));
|
||||
el('zoomOut').addEventListener('click', () => map.zoomOut(1));
|
||||
el('zoomFit').addEventListener('click', fitData);
|
||||
|
||||
Reference in New Issue
Block a user