Commit efaeadb 1 parent ccd00e2 commit efaeadb Copy full SHA for efaeadb
File tree 1 file changed +23
-1
lines changed
src/routes/(customer)/routing
1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 40
40
import { updateStartDest } from ' $lib/util/updateStartDest' ;
41
41
import { odmPrice } from ' $lib/util/odmPrice' ;
42
42
import BookingSummary from ' $lib/ui/BookingSummary.svelte' ;
43
+ import { LocateFixed } from ' lucide-svelte' ;
44
+ import { posToLocation } from ' $lib/map/Location' ;
43
45
44
46
type LuggageType = ' none' | ' light' | ' heavy' ;
45
47
137
139
}
138
140
pushState (' ' , { selectedItinerary: itinerary });
139
141
};
142
+
143
+ const getLocation = () => {
144
+ if (navigator && navigator .geolocation ) {
145
+ navigator .geolocation .getCurrentPosition (applyPosition , (e ) => console .log (e ), {
146
+ enableHighAccuracy: true
147
+ });
148
+ }
149
+ };
150
+
151
+ const applyPosition = (position : { coords: { latitude: number ; longitude: number } }) => {
152
+ from = posToLocation ({ lat: position .coords .latitude , lon: position .coords .longitude }, 0 );
153
+ };
140
154
</script >
141
155
142
156
<div class =" md:min-h-[70dvh] md:w-96" >
291
305
value ={to .label }
292
306
/>
293
307
<Button
294
- class =" absolute right-4 top-6 z-10 rounded-full"
308
+ variant =" ghost"
309
+ class =" absolute z-10 right-0 top-0"
310
+ size =" icon"
311
+ onclick ={() => getLocation ()}
312
+ >
313
+ <LocateFixed class =" w-5 h-5" />
314
+ </Button >
315
+ <Button
316
+ class =" absolute right-10 top-6 z-10 rounded-full"
295
317
size =" icon"
296
318
onclick ={() => {
297
319
const tmp = to ;
You can’t perform that action at this time.
0 commit comments