Fix proximity lines update on drag and toggle
Deploy Standortplaner / deploy (push) Successful in 17s
Details
Deploy Standortplaner / deploy (push) Successful in 17s
Details
This commit is contained in:
parent
f4092ed95d
commit
e823b10e93
59
app.js
59
app.js
|
|
@ -534,35 +534,36 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
if (!isDragUpdating) {
|
if (!isDragUpdating) {
|
||||||
isDragUpdating = true;
|
isDragUpdating = true;
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
if (!latestDragPos) {
|
try {
|
||||||
|
if (!latestDragPos) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
turbine.latlng = latestDragPos;
|
||||||
|
|
||||||
|
// Recalculate all geometries live during drag
|
||||||
|
const newGeoms = calculateGeometries(latestDragPos, turbine.rd, turbine.hh, turbine.fr, turbine.ksfAngle, turbine.ksfMirrored, turbine.hersteller);
|
||||||
|
turbine.layers.sweptArea.clearLayers().addData(newGeoms.sweptArea);
|
||||||
|
turbine.layers.techDist.clearLayers().addData(newGeoms.techDist);
|
||||||
|
turbine.layers.techDistSmall.clearLayers().addData(newGeoms.techDistSmall);
|
||||||
|
turbine.layers.loadRadius.clearLayers().addData(newGeoms.loadRadius);
|
||||||
|
turbine.layers.foundation.clearLayers().addData(newGeoms.foundation);
|
||||||
|
turbine.layers.ksf.clearLayers().addData(newGeoms.ksf);
|
||||||
|
turbine.layers.blf.clearLayers().addData(newGeoms.blf);
|
||||||
|
turbine.layers.mf.clearLayers().addData(newGeoms.mf);
|
||||||
|
|
||||||
|
// Move rotation handle along with it during drag
|
||||||
|
updateRotationHandlePos(turbine);
|
||||||
|
updateProximityLines(); // Abstandslinien ebenfalls live aktualisieren
|
||||||
|
|
||||||
|
if (activeTurbine?.id === turbine.id) {
|
||||||
|
// Keep fields updated
|
||||||
|
editNr.value = turbine.nr;
|
||||||
|
updateEditPanelPosition(); // Sync floating panel
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
isDragUpdating = false;
|
isDragUpdating = false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
turbine.latlng = latestDragPos;
|
|
||||||
|
|
||||||
// Recalculate all geometries live during drag
|
|
||||||
const newGeoms = calculateGeometries(latestDragPos, turbine.rd, turbine.hh, turbine.fr, turbine.ksfAngle, turbine.ksfMirrored, turbine.hersteller);
|
|
||||||
turbine.layers.sweptArea.clearLayers().addData(newGeoms.sweptArea);
|
|
||||||
turbine.layers.techDist.clearLayers().addData(newGeoms.techDist);
|
|
||||||
turbine.layers.techDistSmall.clearLayers().addData(newGeoms.techDistSmall);
|
|
||||||
turbine.layers.loadRadius.clearLayers().addData(newGeoms.loadRadius);
|
|
||||||
turbine.layers.foundation.clearLayers().addData(newGeoms.foundation);
|
|
||||||
turbine.layers.ksf.clearLayers().addData(newGeoms.ksf);
|
|
||||||
turbine.layers.blf.clearLayers().addData(newGeoms.blf);
|
|
||||||
turbine.layers.mf.clearLayers().addData(newGeoms.mf);
|
|
||||||
|
|
||||||
// Move rotation handle along with it during drag
|
|
||||||
updateRotationHandlePos(turbine);
|
|
||||||
updateProximityLines(); // Abstandslinien ebenfalls live aktualisieren
|
|
||||||
|
|
||||||
if (activeTurbine?.id === turbine.id) {
|
|
||||||
// Keep fields updated
|
|
||||||
editNr.value = turbine.nr;
|
|
||||||
updateEditPanelPosition(); // Sync floating panel
|
|
||||||
}
|
|
||||||
|
|
||||||
isDragUpdating = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -779,6 +780,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
state.map.removeLayer(proxLayer);
|
state.map.removeLayer(proxLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateProximityLines();
|
||||||
updateLegend();
|
updateLegend();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -982,6 +984,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
function updateProximityLines() {
|
function updateProximityLines() {
|
||||||
proximityLinesLayer.clearLayers();
|
proximityLinesLayer.clearLayers();
|
||||||
|
|
||||||
|
const checkShowProximity = document.getElementById('checkShowProximity');
|
||||||
|
if (checkShowProximity && !checkShowProximity.checked) return;
|
||||||
|
|
||||||
// Only show lines if the current variant layer is visible
|
// Only show lines if the current variant layer is visible
|
||||||
if (!state.map.hasLayer(variantLayers[state.activeVariant])) return;
|
if (!state.map.hasLayer(variantLayers[state.activeVariant])) return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue