auto-sync: 2026-05-06 08:40:01

This commit is contained in:
Stream
2026-05-06 08:40:01 +03:00
parent b01dbfed49
commit 00b7cd9ab2
2 changed files with 32 additions and 20 deletions

View File

@@ -444,13 +444,13 @@ body.has-map-mode #sheet-backdrop.visible { pointer-events: none; }
left: 12px; right: 12px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 10px 14px;
border-radius: 8px;
padding: 5px 10px;
font-size: 13px; color: var(--text);
font-weight: 600; z-index: 200;
display: none; box-shadow: var(--shadow-sm);
}
#ruler-info.visible { display: flex; align-items: center; gap: 8px; }
#ruler-info.visible { display: flex; align-items: center; gap: 6px; }
#ruler-info #ruler-dist { flex: 1; }
.ruler-action-btn {
flex-shrink: 0;

View File

@@ -1702,16 +1702,16 @@ function updateRulerLabels() {
rulerTotal = 0;
for (let i = 0; i < rulerMarkers.length; i++) {
const markerEl = rulerMarkers[i].getElement();
const dot = markerEl.querySelector('.ruler-dot');
const label = markerEl.querySelector('.ruler-label');
const btn = markerEl.querySelector('.ruler-remove-btn');
const labelText = label ? label.querySelector('span') : null;
if (i === 0) {
if (label) label.textContent = '';
if (labelText) labelText.textContent = '';
} else {
const segDist = haversineKm(rulerPoints[i - 1], rulerPoints[i]);
rulerTotal += segDist;
if (label) {
label.textContent = segDist >= 1
if (labelText) {
labelText.textContent = segDist >= 1
? segDist.toFixed(1) + ' км'
: Math.round(segDist * 1000) + ' м';
}
@@ -1738,7 +1738,7 @@ function addRulerPoint(lngLat) {
rulerTotal += segDist;
}
// Wrapper element for dot + label + remove button
// Wrapper element for dot + label row
const wrapper = document.createElement('div');
wrapper.style.cssText = 'position:relative;display:flex;flex-direction:column;align-items:center;';
@@ -1747,27 +1747,31 @@ function addRulerPoint(lngLat) {
dot.className = 'ruler-dot';
dot.style.cssText = 'width:10px;height:10px;background:#0088ff;border:2px solid #fff;border-radius:50%;box-shadow:0 0 4px rgba(0,0,0,0.3);display:block;flex-shrink:0;';
// Remove button ×
const btn = document.createElement('div');
btn.className = 'ruler-remove-btn';
btn.textContent = '×';
btn.style.cssText = 'position:absolute;top:-10px;right:-10px;width:14px;height:14px;background:rgba(40,40,40,0.85);color:#fff;border-radius:50%;font-size:11px;line-height:14px;text-align:center;cursor:pointer;z-index:10;';
btn.onclick = (e) => { e.stopPropagation(); removeRulerPoint(idx); };
// Distance label below dot
// Label row: [distance text][× button] in one line
const label = document.createElement('div');
label.className = 'ruler-label';
label.style.cssText = 'margin-top:3px;display:flex;align-items:center;gap:2px;background:rgba(20,20,20,0.75);color:#fff;font-size:10px;padding:1px 4px;border-radius:3px;white-space:nowrap;';
const labelText = document.createElement('span');
if (idx === 0) {
label.textContent = '';
labelText.textContent = '';
} else {
label.textContent = segDist >= 1
labelText.textContent = segDist >= 1
? segDist.toFixed(1) + ' км'
: Math.round(segDist * 1000) + ' м';
}
label.style.cssText = 'margin-top:3px;background:rgba(20,20,20,0.75);color:#fff;font-size:10px;padding:1px 4px;border-radius:3px;white-space:nowrap;pointer-events:none;';
// Remove button × inline with label
const btn = document.createElement('span');
btn.className = 'ruler-remove-btn';
btn.textContent = '×';
btn.style.cssText = 'cursor:pointer;font-size:11px;line-height:1;opacity:0.85;padding-left:2px;';
btn.onclick = (e) => { e.stopPropagation(); removeRulerPoint(idx); };
label.appendChild(labelText);
label.appendChild(btn);
wrapper.appendChild(dot);
wrapper.appendChild(btn);
wrapper.appendChild(label);
const dotMarker = new maplibregl.Marker({ element: wrapper, anchor: 'top' })
@@ -1787,6 +1791,14 @@ function initRulerClicks(map) {
e.preventDefault();
exitRulerMode();
});
// Fix 3: tap on ruler line restores panel
map.on('click', 'ruler-line', (e) => {
if (rulerMode) return; // already active
if (rulerPoints.length > 0) {
document.getElementById('ruler-info').classList.add('visible');
e.preventDefault();
}
});
}
// ─── Фаза 4: Разведка ─────────────────────────────────────────────