[TIMOB-1104] Map click events
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-05-11T17:43:07.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.7.0, Sprint 2011-13 |
Components | iOS |
Labels | click, defect, events, ios, mapview, release-1.7.0, reported-1.6.0, requires-4.0, rplist |
Reporter | ctredway |
Assignee | Reggie Seagraves |
Created | 2011-04-15T02:44:06.000+0000 |
Updated | 2011-05-11T17:43:07.000+0000 |
Description
Ok, it seems that a map view looses its click event listener after the location changes. The attached project demonstrates this.
Attachments
File | Date | Size |
---|---|---|
mappintest.zip | 2011-04-15T02:44:07.000+0000 | 52719 |
I had a similar problem where I wasn't able to get any events on a map view. A child view added to a map view would get a click event, but not the map view itself. I documented this behavior here.
http://developer.appcelerator.com/question/32451/mapview-ignoring-touchstart-event"> http://developer.appcelerator.com/question/32451/mapview-ignoring-t...
This is a duplicate bug and should have been fixed, but I cannot get the provided test to work. A simpler test needs to be provided. Map views do not receive click events except when a pin is selected.
I am unable to duplicate the behavior and I believe this was fixed as part of an earlier map view bug. Leaving open until I can confirm this.
Still waiting on a simpler example.
run Map View test in KS - click on map - no logging occurs (click event is not fired)
Pushing out again.
A pro client is interested in this fix now as well.
Sample Code
The following demonstrates the problem. Click on the annotation, and you will see the map's click event fires and an alert is shown. Click anywhere else, and nothing will happen.
Associated Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/64521">http://developer.appcelerator.com/helpdesk/view/64521
(from [5facf6d39cd9f693da29eab4548a651bf3f3f77d]) [#1104] Fix to provide click-on/click-off for user-defined annotations. https://github.com/appcelerator/titanium_mobile/commit/5facf6d39cd9f693da29eab4548a651bf3f3f77d"> https://github.com/appcelerator/titanium_mobile/commit/5facf6d39cd9...
A full fix for this actually requires a guarantee of iOS 3.2+ running on device. Extensive research has shown that Apple does not provide a way to intercept events on a map view in 3.1.x without using undocumented classes or features.
The previous commit is a slap patch to ensure that it is possible to detect when somebody "clicks off" an annotation. This can be done by checking the "source" property.
Forgot to mark "in-progress" as well. A full fix will be provided if possible.
Slap patch addresses customer issue. Going to bump the remainder of the bug (generic 'click' events) to TBS 1.7 so that we can discuss with the Android team about whether or not to break them and replace the name with something much more sensible.
Had a brief conversation with Marshall, we have parity on iOS and Android (only detect clicks on map overlays, i.e. pins and annotations). iOS has the addition of checking to see if you click OFF of either of these things and back on the map because that was a feature request.
So, consider this resolved for iOS. We will not support general/generic 'click' events on the map.
On Android, I don't see the click event firing if the background of the annotation is clicked.
Using this code, you might see 'title' in the info message (if you actually click the title element) but you won't see 'annotation'. The reason this is important is because a user might fail to click through to another page if they happen to miss one of the elements in the annotation.
// this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#000');
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var map = Titanium.Map.createView({
});
var myAnot = Titanium.Map.createAnnotation({
map.addAnnotation(myAnot);
map.addEventListener('click', function(e) {
Titanium.API.info(e.clicksource); });
win.add(map);
win.open();
Assigning to Don so that we can get an Android ticket requesting feature parity.
Actually, scratch that. Going to make a new ticket for Android instead. Durr.
added release-1.7.0 tag.
No longer able to reproduce with iPhone 4, iOS 4.3.3. KS 1.7.0, build 1.7.0.879871b. Tried both short test code and sample app. Both functioned as expected. Closing