折线在JavaFX WebView上无法正确呈现

问题描述 投票:0回答:1

在桌面网络浏览器中绘制折线时,它将正确显示enter image description here但是当在javaFX Webview中绘制时,它看起来像这样enter image description here两种方法=(本地桌面和JFX webview)都使用相同的HTML,不知道出了什么问题,在基于chrome的JxBroswer中,它很好用,但是它是有偿的,很难更改[]

index.html

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Simple Polylines</title>
    <style>
        /* Always set the map height explicitly to define the size of the div
         * element that contains the map. */
        #map {
            height: 100%;
        }
        /* Optional: Makes the sample page fill the window. */
        html, body {
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
<div id="map"></div>
<script>

    // This example creates a 2-pixel-wide red polyline showing the path of
    // the first trans-Pacific flight between Oakland, CA, and Brisbane,
    // Australia which was made by Charles Kingsford Smith.

    function initMap() {
        var map = new google.maps.Map(document.getElementById('map'), {
            zoom: 3,
            center: {lat: 0, lng: -180},
            mapTypeId: google.maps.MapTypeId.ROADMAP
        });

        var flightPlanCoordinates = [
            {lat: 37.772, lng: -122.214},
            {lat: 21.291, lng: -157.821},
            {lat: -18.142, lng: 178.431},
            {lat: -27.467, lng: 153.027}
        ];
        var flightPath = new google.maps.Polyline({
            path: flightPlanCoordinates,
            geodesic: false,
            strokeColor: '#ff272f',
            strokeOpacity: 1,
            strokeWeight: 1
        });

        flightPath.setMap(map);
    }
</script>
<script async defer
        src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap">
</script>
</body>
</html>

[在桌面Web浏览器中绘制折线时,它可以正确渲染,但是在javaFX Webview中绘制时,它看起来像这样。两种方法=(本机桌面和JFX Webview都使用...

javascript google-maps-api-3 rendering google-maps-markers javafx-webengine
1个回答
0
投票
问题是Windows 10的显示比例设置被设置为125%,默认设置是因为在小型笔记本电脑屏幕上分辨率为全高清1080p。
© www.soinside.com 2019 - 2024. All rights reserved.