Re: [問題] Google Maps API, right click, on ipad
Thanks for all your suggestions.
Here is how it turned out:
1. implement longclick event; basically just calculate time difference
between mousedown and mouseup.
2. (1) triggers another problem: if you simply drag the map, it will still be
considered as mousedown + mouseup, and hence trigger longclick.
3. to prevent (2), put "tmpmoved = false" in mousedown,
and put "tmpmoved = true" in mousemove. In mouseup use tmpmoved to
differentiate longclick/click and drag. longclick and click are further
differeentiated by, of course, time difference calculated in (1).
4. (2) can be solved by calculating "point" of mousedown and mouseup (in pixel)
on the DOM and check the difference, by using map.getProjection().fromLatLngToPoint(latlng)
This however requires getting a reference point (usually top-left of the map)
and calculate the "offset" between reference point and event.latLng, The
problem is that, the top-left of mousedown and mouseup should be different,
in my WIndows laptop they are indeed diffeerent, but on my ipad the are the
same, which makes the idea of (4) totally useless, because event.latLng
of mousedown and mouseup are identical.
I don't know why (4) happened on my ipad. If any of you have the solutionj,
please let me know. Thank you very much.
※ 引述《cckh ()》之銘言:
: Hi guys,
: This is the question that has bothered me for a long while.
: I am working a website with Google Maps API functionalities,
: Everything works just fine until we need to allow it on ipad.
: Clearly there is no "right click" on a tablet,
: but I didn't figure out any other mouse motion that can replace right click.
: Is there anyone know how to resolve this issue?
: Thank you very much.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 143.215.17.252
推
03/13 13:39, , 1F
03/13 13:39, 1F
→
03/13 13:40, , 2F
03/13 13:40, 2F
→
03/13 13:42, , 3F
03/13 13:42, 3F
→
03/14 01:49, , 4F
03/14 01:49, 4F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):