Fix: Marker dragging and outline layer rendering
Deploy Bürgerwind / deploy (push) Successful in 17s
Details
Deploy Bürgerwind / deploy (push) Successful in 17s
Details
This commit is contained in:
parent
89dfcdff25
commit
94b985468d
19
app.js
19
app.js
|
|
@ -384,7 +384,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
ksfAngle, ksfMirrored,
|
ksfAngle, ksfMirrored,
|
||||||
totalHeight: geoms.totalHeight,
|
totalHeight: geoms.totalHeight,
|
||||||
layers: {
|
layers: {
|
||||||
marker: L.marker(latlng, { draggable: state.isEditMode, icon: turbineIcon }),
|
marker: L.marker(latlng, { draggable: true, icon: turbineIcon }),
|
||||||
sweptArea: L.geoJSON(geoms.sweptArea, { style: { color: '#00c8ff', weight: 1, dashArray: '4, 4', fillOpacity: 0.1 } }),
|
sweptArea: L.geoJSON(geoms.sweptArea, { style: { color: '#00c8ff', weight: 1, dashArray: '4, 4', fillOpacity: 0.1 } }),
|
||||||
techDist: L.geoJSON(geoms.techDist, { style: { color: '#ffcc00', weight: 2, dashArray: '5, 5', fillOpacity: 0 } }),
|
techDist: L.geoJSON(geoms.techDist, { style: { color: '#ffcc00', weight: 2, dashArray: '5, 5', fillOpacity: 0 } }),
|
||||||
techDistSmall: L.geoJSON(geoms.techDistSmall, { style: { color: '#ffcc00', weight: 1.5, dashArray: '2, 4', fillOpacity: 0 } }),
|
techDistSmall: L.geoJSON(geoms.techDistSmall, { style: { color: '#ffcc00', weight: 1.5, dashArray: '2, 4', fillOpacity: 0 } }),
|
||||||
|
|
@ -394,7 +394,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
blf: L.geoJSON(geoms.blf, { style: { color: '#9b59b6', weight: 1, dashArray: '3, 3', fillOpacity: 0.2 } }),
|
blf: L.geoJSON(geoms.blf, { style: { color: '#9b59b6', weight: 1, dashArray: '3, 3', fillOpacity: 0.2 } }),
|
||||||
mf: L.geoJSON(geoms.mf, { style: { color: '#95a5a6', weight: 1, dashArray: '2, 2', fillOpacity: 0.15 } }),
|
mf: L.geoJSON(geoms.mf, { style: { color: '#95a5a6', weight: 1, dashArray: '2, 2', fillOpacity: 0.15 } }),
|
||||||
rotationHandle: L.marker(latlng, {
|
rotationHandle: L.marker(latlng, {
|
||||||
draggable: state.isEditMode,
|
draggable: true,
|
||||||
icon: L.divIcon({
|
icon: L.divIcon({
|
||||||
className: 'rotation-handle',
|
className: 'rotation-handle',
|
||||||
html: `
|
html: `
|
||||||
|
|
@ -496,6 +496,13 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
turbine.layers.rotationHandle.on('dragend', triggerAutoSave);
|
turbine.layers.rotationHandle.on('dragend', triggerAutoSave);
|
||||||
|
|
||||||
|
turbine.layers.marker.on('add', function() {
|
||||||
|
if (!state.isEditMode && this.dragging) this.dragging.disable();
|
||||||
|
});
|
||||||
|
turbine.layers.rotationHandle.on('add', function() {
|
||||||
|
if (!state.isEditMode && this.dragging) this.dragging.disable();
|
||||||
|
});
|
||||||
|
|
||||||
state.turbines.push(turbine);
|
state.turbines.push(turbine);
|
||||||
updateProximityLines();
|
updateProximityLines();
|
||||||
triggerAutoSave();
|
triggerAutoSave();
|
||||||
|
|
@ -1227,7 +1234,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
// ---- Erzeuge zusätzlich den Umriss-Layer ----
|
// ---- Erzeuge zusätzlich den Umriss-Layer ----
|
||||||
const outlineLayerName = "Flurstücke & Eigentümer (Umriss)";
|
const outlineLayerName = "Flurstücke & Eigentümer (Umriss)";
|
||||||
const outlineLayer = L.geoJSON(geojson, {
|
// Clone the geojson to prevent any Leaflet reference conflicts
|
||||||
|
const outlineGeojson = JSON.parse(JSON.stringify(geojson));
|
||||||
|
const outlineLayer = L.geoJSON(outlineGeojson, {
|
||||||
style: () => ({ color: '#000', weight: 1.5, fillOpacity: 0, fillColor: 'transparent' }),
|
style: () => ({ color: '#000', weight: 1.5, fillOpacity: 0, fillColor: 'transparent' }),
|
||||||
onEachFeature: (feature, outLayer) => {
|
onEachFeature: (feature, outLayer) => {
|
||||||
if (feature.properties) {
|
if (feature.properties) {
|
||||||
|
|
@ -1276,7 +1285,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
state.map.addLayer(outlineLayer);
|
state.map.addLayer(outlineLayer);
|
||||||
}
|
}
|
||||||
layerControl.addOverlay(outlineLayer, outlineLayerName);
|
layerControl.addOverlay(outlineLayer, outlineLayerName);
|
||||||
outlineLayer.bringToFront();
|
if (state.map.hasLayer(outlineLayer)) {
|
||||||
|
outlineLayer.bringToFront();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manual Import & Bundling
|
// Manual Import & Bundling
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue