Skip to content

Add InfoWindow to current click position #190

@HaukeGulich

Description

@HaukeGulich

I want to open a InfoWindow when clicking on a polyline:

` map.addUIEventHandler(polygon, UIEventType.click, (JSObject obj) -> {

        System.out.println("Polygon click");
        InfoWindowOptions infoWindowOptions = new InfoWindowOptions();
        infoWindowOptions.position(new LatLong( 31.33255233509554    , 121.6711721454525 ));
        infoWindowOptions.content("<h2>Fred Wilkie</h2>"
                + "Current Location: Safeway<br>"
                + "ETA: 45 minutes" );

        InfoWindow fredWilkeInfoWindow = new InfoWindow(infoWindowOptions);
        fredWilkeInfoWindow.open(map);
    });

`

But how can I set the position to the position the mouse was clicked? In my case I have a shipping route and as soon as someone clicks on the route I want a popup at that position on the map.

Thanks for your help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions