Re: [問題] Google Maps API, right click, on ipad

看板Web_Design作者時間12年前 (2012/03/13 12:24), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串2/2 (看更多)
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
jQuery provide event.pageX and event.pageY , it already
03/13 13:39, 1F

03/13 13:40, , 2F
eliminate the difference of platform.
03/13 13:40, 2F

03/13 13:42, , 3F
I think there is another way to check it.
03/13 13:42, 3F

03/14 01:49, , 4F
great, I will definitely take a look. Thanks!!!
03/14 01:49, 4F
文章代碼(AID): #1FNilyr9 (Web_Design)
文章代碼(AID): #1FNilyr9 (Web_Design)