Thread: [SailfishOS] Mapbox GL Native QML plugin
View Single Post
Posts: 1,414 | Thanked: 7,547 times | Joined on Aug 2016 @ Estonia
#43
Originally Posted by jdrescher View Post
@rinigus another question:
on double tap on the map I want to zoom in and center the map at this position. Problem is the fitView does not work. I tried:
Code:
onDoubleClicked:
            {
                console.log("onDoubleClicked: " + mouse)
                map.setZoomLevel(map.zoomLevel + 1, Qt.point(mouse.x, mouse.y) );
            }
            onDoubleClickedGeo:
            {
                console.log("onDoubleClickedGeo: " + geocoordinate);
                map.fitView(geocoordinate);    //TODO: does not work!
            }
I have also problems with fitView if I want to center on a specific coordinate, it just does not work:
Code:
map.fitView(QtPositioning.coordinate(51.9854, 9.2743));  //TODO does not work!
Morning! Try to give it as a list:

Code:
map.fitView([geocoordinate]);
An example use in Poor Maps GL: https://github.com/rinigus/poor-maps...l/Map.qml#L400

Its designed to fit many points, but should fit one point as well. I have added an issue to improve the documentation in this respect. Please let me know if it helps. And let me know here or file issues at https://github.com/rinigus/mapbox-gl-qml/issues if something is not clear.
 

The Following 3 Users Say Thank You to rinigus For This Useful Post: