Google Maps in the Windows Store App (C # / XAML) - No Scaling

Has anyone been able to successfully enable some kind of Google Maps in the Windows Store app (C # / XAML) for Windows 8.1 ? We chose Google Maps because of the cost of the Bing Maps license (which would be much simpler, since there is Metro's own control for Bing Maps).

I was able to run this article and include an html page inside a WebView control. I can also communicate with him and with him using my C # class (using ScriptNotify and window.external.notify ).

However, the hard zoom gesture is not recognized because it does not scale on the map.

Here is my webview

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid x:Name="GridOut">
        <WebView x:Name="MapWebView" ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Disabled" ManipulationMode="All" />
    </Grid>
</Grid>

And the html page with the map:

<html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head>
<meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=10" /> <!-- To get double tap for zoom to work-->
    <!– Google Maps API reference –>
    <script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=visualization"></script>
    <script type="text/javascript" src="libs/richmarker.js"></script>
    <script type="text/javascript" src="CountryInfo.js"></script>
    <script type="text/javascript" src="libs/infobox.js"></script>
    <!– map references –>
    <link href="map.css" rel="stylesheet" />
<script src="map.js"></script>
</head>
<body>
    <div id="mapdisplay" />
</body>
</html>

, HTML- IE ( IE Visual Studio), Pinch-to-zoom , , WebView. , WebView URL, , .

:

1) IFrame HTML-, .

2) JavaScript ( MSGestureChange), , , " "...

- ?

.

+4
1

, , , Google, :

1) Google Maps , /.

2) , , (, LatLong 0, 0, 2. , , ).

var mGesture = new MSGesture();

function InitGestureHandler()
{

    var mapDiv = document.getElementById('mapdisplay');
    mGesture.target = mapDiv;

    // You need to first register to MSPointerDown to be able to
    // have access to more complex Gesture events
    mapDiv.addEventListener("pointerdown", pointerdown, false);
    mapDiv.addEventListener("MSGestureChange", manipulateElement, false);

}

function manipulateElement(e) {

    //Can also add timestamps here to allow the code to run only every so milliseconds
    if (e.scale > 1.05) {
        map.setZoom(currentZoomLevel + 1);
    }
    else if (e.scale < 0.95) {
        map.setZoom(currentZoomLevel - 1);
    }
}
+1

Source: https://habr.com/ru/post/1526351/


All Articles