Use regular UI when touch events are present

292 views
Skip to first unread message

Ugo Riboni

unread,
Feb 27, 2011, 11:01:53 AM2/27/11
to google-map...@googlegroups.com
Hi all,
I'm writing an application that displays a map using the V3 API inside a QtWebkit component.
QtWebkit exposes the touch event handlers like ontouchstart and ontouchend, and because of this (I think) Google maps use the "mobile" UI.
However I don't want the mobile UI, but the standard one.
Is there any way in the V3 API to force the UI to NOT use the touch events and just use regular mouse events instead ?

Esa

unread,
Feb 27, 2011, 7:32:48 PM2/27/11
to Google Maps JavaScript API v3
What is "mobile" UI and why should that block touch events? Please
tell us more.

Ugo Riboni

unread,
Feb 28, 2011, 6:19:39 AM2/28/11
to google-map...@googlegroups.com
Ok, I think I didn't explain myself properly.

Here's two images that should help understand better what I mean: http://imgur.com/a/RiFOc
The first one is how the page looks on a regular browser on a desktop machine (Chromium on Linux in this case).
The second one is how the page looks with what I call the "mobile" UI (e.g. what you get in Android or iPhone, I think - but in this case it's on my custom Webkit application).

The difference between the two, besides of the position of the controls, is the fact that to drag the map in the first one you can use the mouse, but in the second one you can *only* use touch events (e.g. touch-and-drag to drag or pinch to zoom).

I don't know how Google decides to send one version of the UI or the other.
Initially I thought that it decided it by looking at the user agent. However I made my application send the same UA as Chromium, and I still get a different result, so Google must use some other way to decide to send me a different UI and enable touch instead of mouse.

My theory is that the maps API JS looks at the presence of touch event handlers like document.documentElement.ontouchstart and if they are present it will believe we're on a mobile and send the "mobile" Ui. I checked and Chromium doesn't have these handlers, while Webkit in my application does, so it seems that the theory may be right.

So, assuming all of the above is correct, what I would need is a way to ask to the maps API to ignore the presence of touch events and send the regular mouse-enabled version of the UI.

Hope it's more clear now.

Chris Broadfoot

unread,
Feb 28, 2011, 9:01:03 AM2/28/11
to google-map...@googlegroups.com, Ugo Riboni
You can read more about default UI here:

If there is something lacking, consider filing a feature request on the issue tracker.

To me, it sounds like the browser is broken if it exposes touch events when there really aren't any.

Also of interest may be the list of supported browsers:

Chris

Ugo Riboni

unread,
Mar 4, 2011, 5:28:43 AM3/4/11
to Google Maps JavaScript API v3
> You can read more about default UI here:http://code.google.com/apis/maps/documentation/javascript/controls.ht...
> If there is something lacking, consider filing a feature request on the issue tracker.
> To me, it sounds like the browser is broken if it exposes touch events when there really aren't any.
> Also of interest may be the list of supported browsers:http://code.google.com/apis/maps/faq.html#browsersupport

Hi Chris,
thanks for your answer.
I'll see if I can get this fixed in WebKit, it seems like a more
proper solution especially considering Webkit isn't officially
supported by Google.
Cheers,
--
Ugo

Esa

unread,
Mar 4, 2011, 4:19:58 PM3/4/11
to Google Maps JavaScript API v3
This is the list of supported browsers
http://code.google.com/apis/maps/faq.html#browsersupport

There are mostly WebKit browsers on the list.
Reply all
Reply to author
Forward
0 new messages