From 46b22720d48e35e46c93848058c0cf2897557c9b Mon Sep 17 00:00:00 2001 From: Ramachandran Nellaiyappan Date: Sat, 6 Apr 2024 22:24:19 +0200 Subject: [PATCH] [Feat][UI/UX] Enhance coordinate input fields UI experience - varies paste options added for entering coordinates --- .../new-journey/new-journey.component.html | 10 ++++++- .../new-journey/new-journey.component.ts | 29 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/app/page/journeys/new-journey/new-journey.component.html b/src/app/page/journeys/new-journey/new-journey.component.html index 33e7998d..70cba1ed 100644 --- a/src/app/page/journeys/new-journey/new-journey.component.html +++ b/src/app/page/journeys/new-journey/new-journey.component.html @@ -115,10 +115,18 @@
- Coordinates + + diff --git a/src/app/page/journeys/new-journey/new-journey.component.ts b/src/app/page/journeys/new-journey/new-journey.component.ts index c33845c3..9f8c9be7 100644 --- a/src/app/page/journeys/new-journey/new-journey.component.ts +++ b/src/app/page/journeys/new-journey/new-journey.component.ts @@ -114,4 +114,33 @@ export class NewJourneyComponent { } } } + + swapCoordinates() { + let temp = this.coordinates[0]; + this.coordinates[0] = this.coordinates[1]; + this.coordinates[1] = temp; + this.refreshMapWithCoordinates(); + } + + async copyCoordinatesFromGoogleMap() { + const copiedValue = await navigator.clipboard.readText() + console.debug('Value copied from clipboard:', copiedValue); + if (copiedValue) { + let copiedCoordinates = copiedValue.split(','); + this.coordinates[0] = Number(copiedCoordinates.length < 2 ? copiedCoordinates[0] : copiedCoordinates[1]); + this.coordinates[1] = Number(copiedCoordinates[0]); + this.refreshMapWithCoordinates(); + } + } + + async copyCoordinatesFromClipboard() { + const copiedValue = await navigator.clipboard.readText() + console.debug('Value copied from clipboard:', copiedValue); + if (copiedValue) { + let copiedCoordinates = copiedValue.split(','); + this.coordinates[0] = Number(copiedCoordinates[0]); + this.coordinates[1] = Number(copiedCoordinates.length >= 2 ? copiedCoordinates[1] : copiedCoordinates[0]); + this.refreshMapWithCoordinates(); + } + } }