fix(measure): Messlinie verschwand nach dem Abschliessen (v1.5.9)
Ursache: finishMeasure schaltete auf 'select' um → der Reset-Effekt (drawMode !== 'measure') löschte die eben gezeichnete Linie sofort; die Höhen-Labels kamen asynchron danach und blieben, die Linie nicht. - Nach dem Abschliessen bleibt der Mess-Modus aktiv → Linie + Labels + Panel bleiben stehen (Tippen fügt keinen Punkt mehr hinzu, da bereits fertig) - Gemeinsamer clearMeasurement-Helfer: Panel-X und „Neue Messung" räumen jetzt Linie, Marker, Höhen-Labels und Panel vollständig auf - Beenden weiterhin über „Neue Messung" oder Wahl eines anderen Werkzeugs Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lageplan",
|
||||
"version": "1.5.8",
|
||||
"version": "1.5.9",
|
||||
"description": "Feuerwehr Lageplan - Krokier-App für Einsatzdokumentation",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -2141,6 +2141,20 @@ export function MapView({
|
||||
onDrawModeChangeRef.current?.('select')
|
||||
}, [])
|
||||
|
||||
// Messung komplett entfernen (Linie, Marker, Höhen-Labels, Panel, Zustand)
|
||||
const clearMeasurement = useCallback(() => {
|
||||
measureMarkersRef.current.forEach(m => m.remove())
|
||||
measureMarkersRef.current = []
|
||||
measureCoordsRef.current = []
|
||||
setMeasurePointCount(0)
|
||||
setMeasureFinished(false)
|
||||
setMeasureResult(null)
|
||||
if (map.current) {
|
||||
const src = map.current.getSource('measure-line') as maplibregl.GeoJSONSource
|
||||
if (src) src.setData({ type: 'FeatureCollection', features: [] })
|
||||
}
|
||||
}, [])
|
||||
|
||||
// Finish measurement handler
|
||||
const finishMeasure = useCallback(() => {
|
||||
drawingRef.current.isDrawing = false
|
||||
@@ -2152,8 +2166,9 @@ export function MapView({
|
||||
if (src) src.setData({ type: 'FeatureCollection', features: [] })
|
||||
}
|
||||
fetchElevationsAndUpdateRef.current()
|
||||
// Apple-style: auto-return to select mode after finishing measurement
|
||||
onDrawModeChangeRef.current?.('select')
|
||||
// WICHTIG: im Mess-Modus bleiben, sonst löscht der Reset-Effekt (drawMode !== 'measure')
|
||||
// die eben gezeichnete Linie sofort wieder. Der Nutzer beendet über „Neue Messung"
|
||||
// oder durch Wahl eines anderen Werkzeugs.
|
||||
}, [])
|
||||
|
||||
return (
|
||||
@@ -2358,17 +2373,7 @@ export function MapView({
|
||||
{/* Neue Messung starten */}
|
||||
{drawMode === 'measure' && measureFinished && (
|
||||
<button
|
||||
onClick={() => {
|
||||
measureMarkersRef.current.forEach(m => m.remove())
|
||||
measureMarkersRef.current = []
|
||||
measureCoordsRef.current = []
|
||||
setMeasurePointCount(0)
|
||||
setMeasureFinished(false)
|
||||
if (map.current) {
|
||||
const src = map.current.getSource('measure-line') as maplibregl.GeoJSONSource
|
||||
if (src) src.setData({ type: 'FeatureCollection', features: [] })
|
||||
}
|
||||
}}
|
||||
onClick={clearMeasurement}
|
||||
style={{
|
||||
position: 'absolute', top: 16, left: '50%', transform: 'translateX(-50%)',
|
||||
zIndex: 1000, padding: '12px 28px', fontSize: '15px', fontWeight: 700,
|
||||
@@ -2385,7 +2390,7 @@ export function MapView({
|
||||
<MeasurePanel
|
||||
measurement={measureResult.measurement}
|
||||
hoseTypes={measureResult.hoseTypes}
|
||||
onClose={() => setMeasureResult(null)}
|
||||
onClose={clearMeasurement}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user