Google Maps

tudorf

Active Member
Licensed User
Longtime User
Hi
I experiment with GoogleMapsWebView. I can´t see the standard Zoombutton (+/-) on the screen. Change the zoom with 2 fingers is terribel. The map jumps extrem. So I want to add 2 Button für change Zoom. I added a function in Javascript and start the function from b4a. I can´t change the Zoom. Why.

In Html
function zoomchange(ZoomLevel){map.SetZoom(ZoomLevel);}

In Button_Click
Dim Javascript As String

ZoomLevel = ZoomLevel + 1
Javascript="zoomchange("&ZoomLevel&")"

'Javascript="zoomchange(11)"

MapViewerExtra.executeJavascript(MapViewer, Javascript)

Martin
 

warwound

Expert
Licensed User
Longtime User
Hi again.

Javascript is case sensitive so your javascript function should be:

B4X:
function zoomchange(ZoomLevel){map.setZoom(ZoomLevel);}

(setZoom and not SetZoom).

https://developers.google.com/maps/documentation/javascript/reference#Map

I mentioned in your other thread that using WebViewExtras and it's addWebChromeClient method will enable all errors to be viewed in the B4A log - it'd make debugging simple errors such as this much easier for you.

Martin.
 
Upvote 0

tudorf

Active Member
Licensed User
Longtime User
Martin
You meen Online JavaScript beautifier ? Sorry I dont understand what you meen. My englisch is very bad. I have added the code in the Online JavaScript beautifier. The code was formated. Can I run und test the code? I can´t find it.
I can´t find a different between map.setZoom(zoomlevel) and map.setzoom(zoomlevel) in the program.
Martin
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
In Html
function zoomchange(ZoomLevel){map.SetZoom(ZoomLevel);}

Sorry for the delayed response!

You can see there that you'd used SetZoom instead of setZoom - maybe it was just a typo?

Did you get this working?
Did you add the WebChromeClient to your webView and see any javascript errors being logged?

Martin.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…