fix: canvas移到map容器外(同级节点)避免overflow:hidden裁剪
canvas作为mapContainer的sibling插入到map之后, z-index:99999确保在所有Leaflet图层之上 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user