Fix rotation handle drag issue and optimize performance
Deploy Standortplaner / deploy (push) Successful in 16s
Details
Deploy Standortplaner / deploy (push) Successful in 16s
Details
This commit is contained in:
parent
21bd7f00be
commit
dcd72a1268
15
app.js
15
app.js
|
|
@ -566,11 +566,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
const centerUtm = proj4(wgs84, utm32, [turbine.latlng.lng, turbine.latlng.lat]);
|
||||
const handleUtm = proj4(wgs84, utm32, [handlePos.lng, handlePos.lat]);
|
||||
|
||||
// Calculate angle: Math.atan2(dx, dy). Note: y is North (up), x is East (right)
|
||||
// We want 0 deg to be South (down), following the KSF pattern if needed.
|
||||
// Moving handle CW (to West/-X) should increase angle.
|
||||
// Calculate angle
|
||||
const dx = handleUtm[0] - centerUtm[0];
|
||||
const dy = centerUtm[1] - handleUtm[1]; // Handle is South of center -> positive dy
|
||||
const dy = centerUtm[1] - handleUtm[1];
|
||||
|
||||
let angle = Math.atan2(-dx, dy) * (180 / Math.PI);
|
||||
if (angle < 0) angle += 360;
|
||||
|
|
@ -579,15 +577,18 @@ 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
|
||||
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);
|
||||
updateRotationHandlePos(turbine);
|
||||
});
|
||||
|
||||
turbine.layers.rotationHandle.on('dragend', triggerAutoSave);
|
||||
updateRotationHandlePos(turbine);
|
||||
triggerAutoSave();
|
||||
});
|
||||
|
||||
turbine.layers.marker.on('add', function() {
|
||||
if (!state.isEditMode && this.dragging) this.dragging.disable();
|
||||
|
|
|
|||
Loading…
Reference in New Issue