Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

component not displayed and pinned properly during simulation #32

Open
kutoman opened this issue Dec 10, 2018 · 2 comments
Open

component not displayed and pinned properly during simulation #32

kutoman opened this issue Dec 10, 2018 · 2 comments
Assignees
Labels

Comments

@kutoman
Copy link
Contributor

kutoman commented Dec 10, 2018

When I add a container to the MapContainer it won't get displayed properly in the simulator:

Sample simulated

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();
@shannah shannah added the bug label Dec 10, 2018
@shannah shannah self-assigned this Dec 10, 2018
@shannah
Copy link
Collaborator

shannah commented Dec 10, 2018

This is a bug related to screen density and or zoom in the simulator. When dragging the map, it generates an image of the marker component and adds it to the map. Evidently, due to screen density, the image is generated in the wrong size.

This bug should only affect the simulator, and will not be present in any device

@kutoman
Copy link
Contributor Author

kutoman commented Dec 18, 2018

@shannah as a sidenote: Even though it is not as like as on the simulator, but on an iPad device there are also issues that the added component might jump arround or even gets displayed replicated while panning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants