Skip to content

Commit

Permalink
use map center as location bias
Browse files Browse the repository at this point in the history
  • Loading branch information
michaz committed Jul 17, 2024
1 parent b988eeb commit 1477065
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sidebar/search/AddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { useMediaQuery } from 'react-responsive'
import PopUp from '@/sidebar/search/PopUp'
import PlainButton from '@/PlainButton'
import { onCurrentLocationSelected } from '@/map/MapComponent'
import {toLonLat} from "ol/proj";
import {getMap} from "@/map/map";

export interface AddressInputProps {
point: QueryPoint
Expand Down Expand Up @@ -147,7 +149,8 @@ export default function AddressInput(props: AddressInputProps) {
// get the bias point for the geocoder
// (the query point above the current one)
const autocompleteIndex = props.points.findIndex(point => !point.isInitialized)
const biasCoord = props.points[autocompleteIndex - 1]?.coordinate
const lonlat = toLonLat(getMap().getView().getCenter()!)
const biasCoord = { lng: lonlat[0], lat: lonlat[1] }

return (
<div className={containerClass}>
Expand Down

0 comments on commit 1477065

Please sign in to comment.