Fixed coordinates mapping on map picker

This commit is contained in:
Daniele Verducci (Slimpenguin) 2022-01-12 08:24:26 +01:00
parent d009237679
commit d888485fc2

View File

@ -108,9 +108,8 @@ public class MapPickerActivity extends AppCompatActivity {
// Disable edit mode
if ((ViewHolder.this).coordsEditMode)
(ViewHolder.this).coordsEditMode(false);
// Convert XY coords to LatLng
Projection p = (ViewHolder.this).map.getProjection();
IGeoPoint igp = p.fromPixels(event.getX(), event.getY());
// Write coords on edittext
IGeoPoint igp = (ViewHolder.this).map.getMapCenter();
(ViewHolder.this).binding.latEt.setText(String.format(Locale.ENGLISH, "%.06f", igp.getLatitude()));
(ViewHolder.this).binding.lonEt.setText(String.format(Locale.ENGLISH, "%.06f", igp.getLongitude()));
return false;