The latest version of GMapsFX has been released and includes a major bug fix and a few enhancements.
Last month I reported a bug that has been affecting users of GMapsFX on Mac OSX where the text appeared ‘garbled’. An example image is below.
The underlying issue is that the JavaFx WebView component on Mac OSX is rendering icons rather than letters for some websites, including Google Maps.
I receive a tweet from @ggeorgopoulos1 with a proposed work around that involves injecting CSS programatically into the page with the correct font. I’ve incorporated the code into the latest GMapsFX library and I am happy to say that it is working once again on Mac OSX!
Added a setKey() method to the GoogleMap compoment
This will allow a key to be set in the FXML and will eliminate the need to programatically set a key on the map object at runtime.
Support for Clustered Markers
Ability to Set Route Colors
Route colors can now be specified rather than having to rely on the default blue that Google Maps uses.
I have been receiving a lot of messages the last couple of months regarding the text in GMapsFX applications looking “garbled”, as illustrated in the screenshot below.
This is appears to only affect applications running on Mac OSX. GMapsFX makes use of the JavaFX WebView component under the hood, so I created a simple test app that loads Google Maps into a WebView to confirm the issue was the WebView component.
I filed a bug report with Oracle, but apparently this is a known issue that affects only some websites in WebView on Mac. Linux and Windows applications using the WebView component are unaffected.
The issue has been open for a couple of years now which leads me to think that a recent Mac update may be contributing to the problem becoming more widespread.
Unfortunately a fix for this won’t be available until Java 9, and there is no work around that I know of.
So now getting the Lat/Long of a mouse click is a relatively straightforward process.
We tell the map we want to add a click UI event listener and pass in an event handler which handles a GMapMouseEvent event object. From that object the latitude and longitude of the event can be determined.
Currently the Lat/Long are the only properties available on the GMapMouseEvent object, but additional properties will be added as demand warrants.
Below is a screenshot of one of the example applications included with the GMapsFX project that illustrates how to capture the lat/long of a mouse click.