victordiaz / PHONK

PHONK is a coding playground for new and old Android devices
https://phonk.app
GNU General Public License v3.0
463 stars 25 forks source link

Lat and Lon mixed up on adding map marker #33

Closed Slord6 closed 4 years ago

Slord6 commented 4 years ago

https://github.com/victordiaz/PHONK/blob/9ae6a710ff830bab45be1da1e65c80a27b2c2d2a/phonk_apprunner/src/main/java/io/phonk/runner/apprunner/api/widgets/PMap.java#L283

The Lat and Lon parameters are backwards in this initalisation. Docs ref

Simple Repro:

/*  
 *  Description Live map
 *  by Sam :)
 */

ui.addTitle(app.name)

console.log("Hello!");

var map = ui.addMap(0, 0, 1, 1);
map.center(1, 12);
map.zoom(3);
map.showControls(true);

var marker = null;
sensors.location.onChange(function (data) {
  console.log("chg");
  if(!marker){
    console.log("new");
    marker = map.addMarker({
      lon: data.longitude,
      lat: data.latitude
    });
  } else {
    console.log("update", data);
    marker.position(data.latitude, data.longitude);
  }
  console.log("marker", marker);
});

sensors.location.start()
console.log("sensor started");
victordiaz commented 4 years ago

You are totally right :) I'll fix it and add it in the release of today, thanks for pointing it out

victordiaz commented 4 years ago

Version 1.2.5 is already up and with the fix :)

Slord6 commented 4 years ago

Great, thanks!