Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8185895

Editable polylines in Google Maps don't rubber band correctly in JavaFx WebView

XMLWordPrintable

    • web
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_144"
      Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
      Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 / 10

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Tested on numerous machines with a variety of configurations

      A DESCRIPTION OF THE PROBLEM :
      Editable "polylines" as used by Google Maps don't "rubber band' correctly when an "edit point" is dragged.

      It would appear that there is some initial "rubber band" movement, but this then stops as the mouse pointer continues to frag. At the end of the drag, the "polyline" does snap to the correct place.

      I've included a minimal application to demonstrate the problem.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the minimal application provided below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      See the description above.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No exceptions thrown.
      No errors get reported in the WebConsoleListener.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ************ Copy the following to "WebViewBug.java" ************

      import com.sun.javafx.webkit.WebConsoleListener;
      import javafx.application.*;
      import javafx.scene.*;
      import javafx.scene.web.*;
      import javafx.stage.*;

      public class WebViewBug extends Application
      {
          public static void main(String[] args)
          {
              WebConsoleListener.setDefaultListener((view, message, ln, id) -> System.out.println("Log: [" + id + ":" + ln + "] " + message));
              Application.launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception
          {
              WebView browser = new WebView();
              WebEngine webEngine = browser.getEngine();
              webEngine.setJavaScriptEnabled(true);
              Platform.runLater(() -> webEngine.load(ClassLoader.getSystemClassLoader().getResource("bug.html").toString()));
              stage.setScene(new Scene(browser));
              stage.show();
          }
      }

      ************ Copy the following to "bug.html" ************

      <html>
        <head>
          <title>Polyline Test</title>
          <style>
            #map {height: 100%;}
            html, body {height: 100%; margin: 0; padding: 0;}
          </style>
        </head>
        <body>
          <div id="map"></div>
            <script>
            function initMap()
            {
              var map = new google.maps.Map(document.getElementById('map'), {zoom: 16, center: {lat: 43.6226766, lng: -83.8950228}});
              var poly = new google.maps.Polyline({strokeColor: '#000000', strokeOpacity: 1.0, strokeWeight: 3, editable: true});
              poly.setMap(map);
              poly.setPath([{lat:43.625908121970454 , lng:-83.90039517593384}, {lat:43.619829704159905, lng:-83.889314868927}]);
            }
            </script>
            <script async defer src="https://maps.googleapis.com/maps/api/js?callback=initMap"></script>
        </body>
      </html>
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Haven't found one.

      The "Google Maps Polylines" still work, just don't "rubber band" as they would in a browser.

      However, this may be the root of a more general issue.

        1. bug.html
          0.8 kB
          Priyanka Mangal
        2. WebViewBug.java
          0.9 kB
          Priyanka Mangal

            ghb Guru Hb (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: