From 4982af6fac043e4dbc15f77df66f4e3c1d74c0eb Mon Sep 17 00:00:00 2001 From: melancholytron Date: Mon, 29 Dec 2025 23:13:41 -0600 Subject: [PATCH] Add Docker deployment and Claude Code documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add docker-compose.yml for nginx container deployment - Add CLAUDE.md with project architecture guidance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 9 +++++++ 2 files changed, 67 insertions(+) create mode 100644 CLAUDE.md create mode 100644 docker-compose.yml diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..5cae854 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,58 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +KML Track Editor is a single-page web application for viewing, editing, and navigating KML/GPS tracks on an interactive map. The entire application is contained in `index.html`. + +## Development + +To run locally, serve via HTTP (required for GPS geolocation API): +```bash +python -m http.server 8000 +``` +Then open http://localhost:8000 + +## Architecture + +### Single-File Application +Everything is in `index.html`: +- **Lines 1-325**: CSS styles +- **Lines 326-420**: HTML structure (map, controls sidebar, overlays) +- **Lines 421-end**: JavaScript application code + +### Key Libraries (loaded from CDN) +- **Leaflet.js 1.9.4**: Map rendering and interaction +- **leaflet-rotate 0.2.8**: Map rotation for navigation mode + +### Core State Variables (around line 457-514) +- `tracks[]`: All loaded track objects with `{id, name, coords, layer, color}` +- `selectedTracks[]`: Currently selected tracks for multi-selection operations +- `currentTool`: Active editing tool ('select', 'draw', 'reshape', 'smooth', 'delete') +- `navMode`: Whether in navigation mode vs edit mode +- `currentRoute`: Pathfinding result for navigation + +### Major Feature Areas + +**Track Editing**: +- Draw new tracks, reshape existing ones with rope physics, smooth brush tool +- Track snapping at endpoints (auto-splits target track at snap point) +- Multi-track selection and merge operations +- Undo system with 20-step history + +**Navigation Mode**: +- Graph-based pathfinding using Dijkstra's algorithm across connected trails +- Trail intersections detected within 5 meters (`INTERSECTION_THRESHOLD`) +- Real-time route recalculation when user deviates >50m from path +- Map rotation to face direction of travel (uses `map.setBearing()`) +- Auto-center on GPS position (toggleable) +- Destination persistence in localStorage + +**GPS Integration**: +- Uses `navigator.geolocation.watchPosition` with backup polling every 3 seconds +- Requires HTTPS or localhost to function + +### File Loading +- Automatically loads `default.kml` on startup if present +- KML parsing via DOMParser extracting `` coordinates diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5854f57 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +services: + web: + image: nginx:alpine + ports: + - "8080:80" + volumes: + - ./index.html:/usr/share/nginx/html/index.html:ro + - ./default.kml:/usr/share/nginx/html/default.kml:ro + restart: unless-stopped