-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Description
When I add a container to the MapContainer it won't get displayed properly in the simulator:
my sample code:
final String API_KEY = "key";
final MapContainer mapContainer = new MapContainer(API_KEY);
Form f = new Form("Maps", new LayeredLayout());
f.setScrollable(false);
f.add(mapContainer);
String[] coordinates = new String[] {
"50.963642, 7.121855"
};
final List<Coord> coords = new ArrayList<>();
EncodedImage ei = EncodedImage.createFromImage(
FontImage.createMaterial(FontImage.MATERIAL_GPS_FIXED, f.getUnselectedStyle())
, false);
for(String cStr : coordinates) {
Coord c = toCoordinate(cStr);
MapContainer.MarkerOptions mo = new MapContainer.MarkerOptions(c, ei)
.anchor(0.5f, 0.5f)
.onClick((evt) -> {
//mapLayout.addLayoutComponent(c, new Label("Hey"), mapContainer);
//mapContainer.add(c, new Label("hihi"));
log.p("clicked on marker" + c);
});
MapContainer.MapObject obj = mapContainer.addMarker(mo);
coords.add(c);
}
mapContainer.zoom(coords.get(0), 10);
f.revalidate();
UITimer.timer(2000, false, f, () -> {
final Coord c = coords.get(0);
final Container box = BoxLayout.encloseY(new Label("title"), new Button("button"));
box.setUIID("Button");
mapContainer.addMarker(box, c, 0.5f, 1f);
mapContainer.revalidate();
});
f.show();
