From 2b3454790257a4aefe1f3535fa114629e424f2f7 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 10 Feb 2025 02:47:44 +0100 Subject: [PATCH] Feature(hotkeys): add `H` to jump to home location --- langs/en.json | 2 ++ src/Models/ThemeViewState/UserMapFeatureswitchState.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/langs/en.json b/langs/en.json index f235fb9e85..cf86f4bc10 100644 --- a/langs/en.json +++ b/langs/en.json @@ -192,6 +192,7 @@ "openOsmcha": "See latest edits made with {theme}", "openOsmchaLastWeek": "See edits from the last 7 days", "openPanoramax": "Open Panoramax here", + "openStatistics": "See statistics for {theme}", "openThemeDocumentation": "Open the documentation for thematic map {name}", "panoramaxHelp": "Panoramax is an online service which gathers street-level pictures and offers them under a free license. Contributors are allowed to use these pictures to improve OpenStreetMap", "panoramaxLicenseCCBYSA": "Your pictures are published under CC-BY-SA - everyone can reuse your image if they mention your name", @@ -526,6 +527,7 @@ "action": "Action", "closeSidebar": "Close the sidebar", "geolocate": "Pan the map to the current location or zoom the map to the current location. Requests geopermission", + "homeLocation": "Jump to your home location. Only works if you did set your home location in the user preferences", "intro": "MapComplete supports the following keys:", "key": "Key combination", "openFilterPanel": "Opens the POI-layers and filter panel", diff --git a/src/Models/ThemeViewState/UserMapFeatureswitchState.ts b/src/Models/ThemeViewState/UserMapFeatureswitchState.ts index 1f7d50d275..0f466f07d1 100644 --- a/src/Models/ThemeViewState/UserMapFeatureswitchState.ts +++ b/src/Models/ThemeViewState/UserMapFeatureswitchState.ts @@ -225,6 +225,14 @@ export class UserMapFeatureswitchState extends WithUserRelatedState { this.geolocationControl.handleClick() }) + Hotkeys.RegisterHotkey({ nomod: "H" }, Translations.t.hotkeyDocumentation.homeLocation, () => { + const home = this.userRelatedState.osmConnection.userDetails.data?.home + if (!home) { + console.log("No home location set") + } + this.mapProperties.location.set(home) + }) + Hotkeys.RegisterHotkey( { shift: "T",