Revert geometry drag to live updates and fix rotation handle map insertion
Deploy Standortplaner / deploy (push) Successful in 16s
Details
Deploy Standortplaner / deploy (push) Successful in 16s
Details
This commit is contained in:
parent
dcd72a1268
commit
ce91cddb94
35
app.js
35
app.js
|
|
@ -524,11 +524,22 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
if (state.isEditMode) openEditPanel(turbine);
|
||||
});
|
||||
|
||||
// Drag Update (Nur Marker und Panel bewegen, Geometrien erst bei dragend)
|
||||
// Drag Update (Geometrien ziehen jetzt wieder live mit)
|
||||
turbine.layers.marker.on('drag', (e) => {
|
||||
const newPos = e.target.getLatLng();
|
||||
turbine.latlng = newPos;
|
||||
|
||||
// Recalculate all geometries live during drag
|
||||
const newGeoms = calculateGeometries(newPos, 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);
|
||||
|
||||
|
|
@ -542,19 +553,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
turbine.layers.marker.on('dragend', (e) => {
|
||||
const newPos = e.target.getLatLng();
|
||||
turbine.latlng = newPos;
|
||||
|
||||
// Recalculate all geometries ONCE after dragging is finished to avoid lagging
|
||||
const newGeoms = calculateGeometries(newPos, 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);
|
||||
|
||||
updateRotationHandlePos(turbine);
|
||||
updateLabel(turbine, newGeoms);
|
||||
updateProximityLines();
|
||||
triggerAutoSave();
|
||||
|
|
@ -577,24 +576,26 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
if (activeTurbine?.id === turbine.id) {
|
||||
editKsfAngle.value = angle.toFixed(1);
|
||||
}
|
||||
});
|
||||
|
||||
turbine.layers.rotationHandle.on('dragend', (e) => {
|
||||
// Nach dem Drehen alle Geometrien aktualisieren und Handle auf Kreisbahn einrasten lassen
|
||||
// Live Rotation Update
|
||||
const newGeoms = calculateGeometries(turbine.latlng, turbine.rd, turbine.hh, turbine.fr, turbine.ksfAngle, turbine.ksfMirrored, turbine.hersteller);
|
||||
turbine.layers.ksf.clearLayers().addData(newGeoms.ksf);
|
||||
turbine.layers.blf.clearLayers().addData(newGeoms.blf);
|
||||
turbine.layers.mf.clearLayers().addData(newGeoms.mf);
|
||||
|
||||
});
|
||||
|
||||
turbine.layers.rotationHandle.on('dragend', (e) => {
|
||||
updateRotationHandlePos(turbine);
|
||||
triggerAutoSave();
|
||||
});
|
||||
|
||||
turbine.layers.marker.on('add', function() {
|
||||
if (!state.isEditMode && this.dragging) this.dragging.disable();
|
||||
else if (state.isEditMode && this.dragging) this.dragging.enable();
|
||||
});
|
||||
turbine.layers.rotationHandle.on('add', function() {
|
||||
if (!state.isEditMode && this.dragging) this.dragging.disable();
|
||||
else if (state.isEditMode && this.dragging) this.dragging.enable();
|
||||
});
|
||||
|
||||
state.turbines.push(turbine);
|
||||
|
|
|
|||
Loading…
Reference in New Issue