[TIMOB-19975] Need touch events for Map Module
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Parijat sahai |
Assignee | Unknown |
Created | 2015-08-24T13:42:49.000+0000 |
Updated | 2018-02-28T19:55:55.000+0000 |
Description
When can we get the touch events in the Map module? I want to be able to drag/pan the map on my app, and use an event that fires at the START of the drag/pan. Currently, the "regionchanged" event is the only event fired and it is at the END of the drag/pan of the map.
For the use case/purpose of my request, please refer to the location sharing feature on the whatsapp and telegram apps where the user starts panning the map, and the pin lifts up, and when the user stops panning, the pin drops to the center again. Currently, it isn't possible to create because of lack of touch events as far as I know. I'm sure there would be other use cases that could benefit from the touch events on the map.
Related Q&A: https://community.appcelerator.com/topic/3083/need-touch-events-for-map-module/3
I want to add one more request to the same ticket as it is another typical use case for map module: There should be a method to return a static image of the map for the specified coordinates. Google Maps API has the capability and it seems the Apple Mapkit also has the feature now. This request is more urgent and easier to implement, I'd hope. Just want to point out that the "toImage()" method isn't good enough. I'm trying to use it, and although it works for a previously loaded map, it doesn't work at all if I only have the coordinates in the code and want to get the image in the background without loading the map view itself. Thanks. Parijat.
[~parijatsahai] could you create a separate ticket for that other feature request?
For the "start of the drag event", there is already an event on the mapView called
pinchangedragstate
, which hasoldState
andnewState
properties that return one of theANNOTATION_DRAG_STATE_*
constants. Therefore, can we close this?No, the pinchangedragstate event is not what I'm referring to - in this case, I want to drag the map around. The "pinchangedragstate" event occurs only if I interact with the pin itself.
Thank you! We have some global View-events for that (
touchstart
,touchmove
andtouchend
). Did you try those? They should already be available on iOS and Android. If you think of something else, a link to the native implementation would help to tackle it more fast. Thanks!The Module documentation does not show the events that you mentioned, so I haven't tried those. How will those events help achieve the use case that I described earlier? How could one raise the pin, move the map around and drop the pin after moving the map and return the new location that the pin was dropped at? Again, I refer you to the map feature implemented by apps such as whatsapp etc. Also, what do you mean by "a link to the native implementation"? Would there be an enhancement to expose certain events and methods that are native, or do you expect the developers to modify the module code themselves to achieve such features? The feature I have requested I believe is a very common feature that everyone could use and should be standard in the module.
Hey [~parijatsahai], you don't have to implement it yourself. I requested a link to the native documentation / functionality to actually see some background information on this. You are saying it's a common behavior on other Apps, may you be able to make a quick screen video to demo that? I'm just sorting things out before rushing into it. Thanks!
Here is the video of the feature I am talking about (expires in 48 hrs, so please view it ASAP): http://expirebox.com/download/3b54cd9c7f62296877fd12f2c701a4d6.html
Alright, but that is the functionality we already have, right? Just set the
draggable
property on the annotations to true and you see exactly that behavior. So when you see it, the map is not moving, but the annotation does and so the (visible) region changes. See [this](http://docs.appcelerator.com/platform/latest/#!/api/Modules.Map.Annotation-property-draggable) documentation about that. Please confirm, thanks!Not really. Please review the video carefully. You'll notice that the map is moving, not the annotation. I am dragging the map, not the annotation. Hence what I need is touch events on the map itself so that when the map is dragged around, the touchend event should return the location of the "center of map" annotation (different from fixed annotations). With the current module, I can't find a way to easily implement this feature. I am currently using the regionchanged event and manually moving the annotation and it is clunky at best and nowhere nearly as slick as the native implementation that you see on the video.