Skip to content

Commit

Permalink
add zooming
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgilbers committed Sep 25, 2024
1 parent 2f66fb7 commit e00fa3b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ window.sendSearchQuery = (inputValue) => {
lastProduct.product.hideMarker()
}
product.product.showMarker()
map.fitBounds(product.astar.polyline.getBounds())
navigationButton.classList.remove('d-none')
lastProduct = product
}
Expand All @@ -139,6 +140,8 @@ function startNavigation () {
navigationButton.removeEventListener('click', startNavigation)
navigationButton.addEventListener('click', stopNavigation)

map.setZoom(3)

if (!isCentered) {
centerPosition()
}
Expand All @@ -156,7 +159,8 @@ function stopNavigation () {
deactivateCompass()
map.setBearing(0)
const inputValue = searchBar.value
findProduct(inputValue, userPosition)
const product = findProduct(inputValue, userPosition)
map.fitBounds(product.astar.polyline.getBounds())
}

/**
Expand Down

0 comments on commit e00fa3b

Please sign in to comment.