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() {
|
function _ensureFlowCanvas() {
|
||||||
if (!SA.map) return null;
|
if (!SA.map) return null;
|
||||||
|
const mapEl = SA.map.getContainer();
|
||||||
let c = document.getElementById(_trafficCanvasId);
|
let c = document.getElementById(_trafficCanvasId);
|
||||||
if (!c) {
|
if (!c) {
|
||||||
c = document.createElement('canvas');
|
c = document.createElement('canvas');
|
||||||
c.id = _trafficCanvasId;
|
c.id = _trafficCanvasId;
|
||||||
c.style.cssText = 'position:absolute;top:0;left:0;pointer-events:none;z-index:10000;';
|
c.style.cssText = 'position:absolute;pointer-events:none;z-index:99999;';
|
||||||
SA.map.getContainer().appendChild(c);
|
// Insert as sibling AFTER map container to stay on top
|
||||||
|
mapEl.parentNode.insertBefore(c, mapEl.nextSibling);
|
||||||
}
|
}
|
||||||
const s = SA.map.getSize();
|
const s = SA.map.getSize();
|
||||||
if (c.width !== s.x || c.height !== s.y) {
|
const mr = mapEl.getBoundingClientRect();
|
||||||
c.width = s.x; c.height = s.y;
|
const pr = mapEl.parentNode.getBoundingClientRect();
|
||||||
c.style.width = s.x + 'px'; c.style.height = s.y + 'px';
|
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;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user