Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Update index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullahGhanem authored Mar 28, 2024
1 parent ff87e68 commit 3201792
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions resources/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class mPoint {
constructor(public view: View, public projection: ProjectionLike) {
}

public onChange(callback: (lon: number, lat: number) => void) {
public onChange(callback: (lat: number, lon: number) => void) {
this.view.on('change', () => {
const [lat, lon] = this.getCoordinates()
const [lon, lat] = this.getCoordinates()
callback(lat, lon)
})
}
Expand Down Expand Up @@ -81,7 +81,6 @@ function GetPointMap(id: string, lat: number = 0, lon: number = 0, zoom: number
})
map.addControl(geocoder)
geocoder.on('addresschosen', function (evt: any) {
console.log(evt)
const feature = evt.feature as Feature<Point>
const coordinate = evt.coordinate as Coordinate
feature.setStyle(new Style({
Expand All @@ -97,9 +96,7 @@ function GetPointMap(id: string, lat: number = 0, lon: number = 0, zoom: number
})

function updateCenter() {
// Получаем новые координаты центра карты
const [lat, lon] = map.getView().getCenter()
// Обновляем координаты точки
const [lon, lat] = map.getView().getCenter()
point.getGeometry().setCoordinates([lat, lon])
}

Expand Down

0 comments on commit 3201792

Please sign in to comment.