v1.3.1: Fix symbol loading, DEL key, SOMA/Pendenzen in rapport, improved onboarding, org settings tab, logo upload
This commit is contained in:
@@ -6,7 +6,7 @@ import 'maplibre-gl/dist/maplibre-gl.css'
|
||||
import { useDrop } from 'react-dnd'
|
||||
import Moveable from 'react-moveable'
|
||||
import { getSymbolById, getSymbolDataUri } from '@/lib/fw-symbols'
|
||||
import type { Project, DrawFeature, DrawMode } from '@/app/app/page'
|
||||
import type { Project, DrawFeature, DrawMode } from '@/types'
|
||||
|
||||
// Haversine distance between two [lng, lat] points in meters
|
||||
function haversineDistance(a: number[], b: number[]): number {
|
||||
@@ -1892,9 +1892,19 @@ export function MapView({
|
||||
}
|
||||
}, [drawMode, deselectSymbol])
|
||||
|
||||
// ESC to cancel drawing / finalize measurement
|
||||
// ESC to cancel drawing, DEL to delete selected symbol
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
// DEL / Backspace → delete selected symbol
|
||||
if (e.key === 'Delete' || e.key === 'Backspace') {
|
||||
const tag = (e.target as HTMLElement)?.tagName
|
||||
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || (e.target as HTMLElement)?.isContentEditable) return
|
||||
if (selectedSymbolRef.current) {
|
||||
e.preventDefault()
|
||||
deleteSelectedSymbol()
|
||||
return
|
||||
}
|
||||
}
|
||||
if (e.key === 'Escape') {
|
||||
// In measure mode: finalize (keep line + labels), just stop adding
|
||||
if (drawModeRef.current === 'measure' && drawingRef.current.isDrawing) {
|
||||
@@ -1921,7 +1931,7 @@ export function MapView({
|
||||
}
|
||||
window.addEventListener('keydown', handleKeyDown)
|
||||
return () => window.removeEventListener('keydown', handleKeyDown)
|
||||
}, [])
|
||||
}, [deleteSelectedSymbol])
|
||||
|
||||
// Drop zone for symbols — use stable ref connection (no inline ref callback)
|
||||
const [, drop] = useDrop(() => ({
|
||||
|
||||
Reference in New Issue
Block a user