Optimize drag performance, refine drilling markers, and update infrastructure icon to zap
Deploy TrassenPlaner / deploy (push) Waiting to run Details

This commit is contained in:
Johannes Baumeister 2026-04-20 14:30:42 +02:00
parent a0c9a45377
commit d35b9dee0f
1 changed files with 13 additions and 7 deletions

View File

@ -1303,7 +1303,7 @@
return L.marker(latlng, {
icon: L.divIcon({
className: 'infrastructure-icon',
html: '<i data-lucide="building-2"></i>',
html: '<i data-lucide="zap"></i>',
iconSize: [32, 32],
iconAnchor: [16, 16],
popupAnchor: [0, -16]
@ -1762,10 +1762,15 @@
lineOptions: { color: '#cca300', weight: 6 },
vertexOptions: { color: '#cca300', radius: 6 },
middleMarkerOptions: { color: '#cca300', opacity: 0.6, radius: 4 }
}).on('editable:vertex:drag editable:vertex:dragend editable:vertex:new editable:vertex:deleted editable:vertex:inserted', (e) => {
calculateStats(v);
}).on('editable:vertex:drag editable:drawing:move', (e) => {
calculateStats(v, true);
updateVariantStatsUI(v);
updateRouteLabels(v);
}).on('editable:vertex:dragend editable:vertex:new editable:vertex:deleted editable:vertex:inserted editable:drawing:end', (e) => {
calculateStats(v, false);
updateVariantStatsUI(v);
updateRouteLabels(v);
saveVariantToDB(v);
});
drillingLayers[v.id] = L.featureGroup({ interactive: false, pane: 'drillingPane' });
@ -1943,8 +1948,7 @@
activeV.routes = e.layer.getLatLngs();
}
calculateStats(activeV);
updateVariantStatsUI(activeV);
calculateStats(activeV, e.type.includes('drag') || e.type.includes('move'));
updateVariantStatsUI(activeV);
if (e.type.includes('end') || e.type === 'editable:created' || e.type.includes('dragend') || e.type === 'editable:vertex:inserted') {
renderVariants();
@ -2096,7 +2100,7 @@
// Cache for obstacles to avoid repeated filtering/lowercase during drag
let cachedObstacles = null;
function calculateStats(variant) {
function calculateStats(variant, isDragging = false) {
if (!variant) return;
const vDrill = drillingLayers[variant.id];
if (vDrill) vDrill.clearLayers();
@ -2119,6 +2123,8 @@
renderSegmentLabels(variant);
if (isDragging) return;
// Pre-filter obstacles
if (!cachedObstacles && state.usage.features) {
const keywords = ['bahn', 'gewässer', 'wasser', 'straße', 'verkehr', 'gehölz', 'baufläche', 'wald', 'forst', 'hecke', 'weg', 'pfad', 'graben', 'bach', 'fluss'];
@ -2218,7 +2224,7 @@
// Add Muffen markers
seg.muffen.forEach(mpos => {
L.circleMarker(mpos, {
radius: 5,
radius: 3,
color: '#000000',
weight: 2,
fillOpacity: drillingOpacity,