From 51c0d5ad5341d48fd4af736e5ce6b5536a519406 Mon Sep 17 00:00:00 2001 From: TianXuan Developer Date: Sat, 25 Jul 2026 14:50:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20canvas=E7=A7=BB=E5=88=B0map=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E5=A4=96(=E5=90=8C=E7=BA=A7=E8=8A=82=E7=82=B9)?= =?UTF-8?q?=E9=81=BF=E5=85=8Doverflow:hidden=E8=A3=81=E5=89=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit canvas作为mapContainer的sibling插入到map之后, z-index:99999确保在所有Leaflet图层之上 Co-Authored-By: Claude --- .../simple_analysis/simple_analysis.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/simple_analysis/templates/simple_analysis/simple_analysis.html b/simple_analysis/templates/simple_analysis/simple_analysis.html index e49cb4d..1db8f58 100644 --- a/simple_analysis/templates/simple_analysis/simple_analysis.html +++ b/simple_analysis/templates/simple_analysis/simple_analysis.html @@ -2594,18 +2594,22 @@ function toggleTrafficPanel() { function _ensureFlowCanvas() { if (!SA.map) return null; + const mapEl = SA.map.getContainer(); let c = document.getElementById(_trafficCanvasId); if (!c) { c = document.createElement('canvas'); c.id = _trafficCanvasId; - c.style.cssText = 'position:absolute;top:0;left:0;pointer-events:none;z-index:10000;'; - SA.map.getContainer().appendChild(c); + c.style.cssText = 'position:absolute;pointer-events:none;z-index:99999;'; + // Insert as sibling AFTER map container to stay on top + mapEl.parentNode.insertBefore(c, mapEl.nextSibling); } const s = SA.map.getSize(); - if (c.width !== s.x || c.height !== s.y) { - c.width = s.x; c.height = s.y; - c.style.width = s.x + 'px'; c.style.height = s.y + 'px'; - } + const mr = mapEl.getBoundingClientRect(); + const pr = mapEl.parentNode.getBoundingClientRect(); + c.width = s.x; c.height = s.y; + c.style.width = s.x + 'px'; c.style.height = s.y + 'px'; + c.style.left = (mr.left - pr.left) + 'px'; + c.style.top = (mr.top - pr.top) + 'px'; return c; }