From e6e74589c187dc0f82b5a76c68fbc65fe9293c17 Mon Sep 17 00:00:00 2001 From: ajvpot <553597+ajvpot@users.noreply.github.com> Date: Mon, 29 Sep 2025 18:06:11 +0200 Subject: [PATCH] save map position, stroke width slider --- src/app/globals.css | 58 +++++++++++++++++++++++++++ src/components/MapLayerSettings.tsx | 24 +++++++++++ src/components/MapView.tsx | 62 +++++++++++++++++++---------- src/hooks/useLocalStorage.ts | 23 ++++++----- src/hooks/useMapLayerSettings.ts | 2 + src/hooks/useMapPosition.ts | 19 +++++++++ 6 files changed, 158 insertions(+), 30 deletions(-) create mode 100644 src/hooks/useMapPosition.ts diff --git a/src/app/globals.css b/src/app/globals.css index 8e770ff..86fa421 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -207,4 +207,62 @@ html { font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,0.07); z-index: 1; +} + +/* Range slider styles */ +.slider { + -webkit-appearance: none; + appearance: none; + background: transparent; + cursor: pointer; +} + +.slider::-webkit-slider-track { + background: #e5e7eb; + height: 8px; + border-radius: 4px; +} + +.dark .slider::-webkit-slider-track { + background: #4b5563; +} + +.slider::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + background: #2563eb; + height: 16px; + width: 16px; + border-radius: 50%; + border: 2px solid #ffffff; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); +} + +.slider::-webkit-slider-thumb:hover { + background: #1d4ed8; +} + +.slider::-moz-range-track { + background: #e5e7eb; + height: 8px; + border-radius: 4px; + border: none; +} + +.dark .slider::-moz-range-track { + background: #4b5563; +} + +.slider::-moz-range-thumb { + background: #2563eb; + height: 16px; + width: 16px; + border-radius: 50%; + border: 2px solid #ffffff; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); + cursor: pointer; +} + +.slider::-moz-range-thumb:hover { + background: #1d4ed8; } \ No newline at end of file diff --git a/src/components/MapLayerSettings.tsx b/src/components/MapLayerSettings.tsx index c3dd0f7..927f878 100644 --- a/src/components/MapLayerSettings.tsx +++ b/src/components/MapLayerSettings.tsx @@ -147,6 +147,30 @@ export default function MapLayerSettingsComponent({ onSettingsChange }: MapLayer Show all neighbors + {/* Path stroke width */} +
+ + updateSetting('strokeWidth', parseInt(e.target.value))} + className="w-full h-2 bg-gray-200 dark:bg-neutral-600 rounded-lg appearance-none cursor-pointer slider" + /> +
+ 1px + {settings.strokeWidth}px + 8px +
+

+ Controls the thickness of neighbor connection lines +

+
+ {/* Use colors - indented sub-option */}