Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4205] Android: Map Centers on selectAnnotation

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-06-13T08:43:55.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sSprint 2011-23, Release 1.7.2, Release 1.8.0
ComponentsAndroid
Labelsn/a
ReporterDawson Toth
AssigneeOpie Cyrus
Created2011-05-24T15:17:36.000+0000
Updated2011-07-08T13:35:45.000+0000

Description

Problem

Given a map view, if you call "selectAnnotation" on a particular annotation, the map will automatically center on that annotation. This is a problem if you don't want it to automatically do this. It's also an inconsistency with iOS.

Solution

Provide an argument to selectAnnotation that can disable this behavior. Something like "doNotAutoCenter".

Sample Code

The following app.js should select the annotation on the map and bump the map up north of the annotation. With Android's current behavior, it will center on the annotation.
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var map = Ti.Map.createView({
    mapType: Ti.Map.STANDARD_TYPE,
    regionFit: true
});
var annotation = Ti.Map.createAnnotation({
    latitude: 59.93473,
    longitude: 10.760797,
    title: 'Print House AS',
    subtitle: 'Sandakerveien 24 C Bygg A2, 0473 Oslo',
    animate: true,
    pincolor: Ti.Map.ANNOTATION_PURPLE
});
map.addAnnotation(annotation);
map.selectAnnotation(annotation);
map.setLocation({ latitude: 60, longitude: 10.760797, latitudeDelta: 0.035, longitudeDelta: 0.035 });

win.add(map);
win.open();

Associated Helpdesk Ticket

http://support-admin.appcelerator.com/display/RSN-92979-828

Attachments

FileDateSize
app.js2011-06-09T11:59:12.000+0000629
tsDefault.zip2011-06-07T10:56:55.000+00005208270

Comments

  1. Opie Cyrus 2011-06-07

    test app showing the toggle behavior for centering on annotation via selectAnnotation call
  2. Opie Cyrus 2011-06-09

    test app.js modified from original test case that sets the center property to false
  3. Don Thorp 2011-06-13

    Verified with master.
  4. Don Thorp 2011-06-23

    merged onto 1_7_X
  5. Eric Merriman 2011-07-08

    Verified fixed using sample code set to both "true" and "False" with Xoom 3.1 and Droid 1, 2.2.1. SDKs 1.7.2 r3d44999e and 1.8.0 r4b694252.

JSON Source