Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10009] Android: Mapview centers on selectAnnotation, parity with iOS

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-07-09T23:31:24.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-16 API, Release 2.1.2, Release 3.0.0
ComponentsAndroid
LabelsSupportTeam, api, parity
ReporterVarun Joshi
AssigneePing Wang
Created2012-07-17T13:48:44.000+0000
Updated2014-08-07T20:26:11.000+0000

Description

Issue

Given a map view, if we call "selectAnnotation" on a particular annotation, the map will automatically center on that annotation. If the map height is very small the top of the annotation can be cut off. The map should not center but should bump the map up north of the annotation so that it is fully visible, just like it happens on iOS.

Steps to Reproduce

1. Run the sample code below and click on different annotations. The ones near to the border have annotations cut-off. Running the same code on iOS shift the mapview so the annotations are clearly visible. {noformat} var win = Ti.UI.createWindow({ backgroundColor : 'white' }); win.open(); var mapObject = Titanium.Map.createView({ mapType : Titanium.Map.STANDARD_TYPE, animate : true, regionFit : true, userLocation : true, height : '150dp', zoomEnabled : true, region : { latitude : 37.77501, longitude : -122.419, latitudeDelta : 0.01, longitudeDelta : 0.01 }, }); var selectAnnotations = Ti.UI.createButton({ title : "Select Annotations", bottom : '20dp', height : '35dp', width : '180dp' }); var annotation = Titanium.Map.createAnnotation({ animate : true, title : 'Hello I am an annotation with lots of information:', subtitle : 'This is a subtitle to an large annotation', pincolor : Titanium.Map.ANNOTATION_RED, latitude : parseFloat(37.776), longitude : parseFloat(-122.419) }); var annotation2 = Titanium.Map.createAnnotation({ animate : true, title : '#2 Hello I am an annotation with lots of information:', subtitle : 'This is a subtitle to an large annotation', pincolor : Titanium.Map.ANNOTATION_RED, latitude : parseFloat(37.77501), longitude : parseFloat(-122.419) }); var annotation3 = Titanium.Map.createAnnotation({ animate : true, title : '#3 Hello I am an annotation with lots of information:', subtitle : 'This is a subtitle to an large annotation', pincolor : Titanium.Map.ANNOTATION_RED, latitude : parseFloat(37.770), longitude : parseFloat(-122.419) }); var annotation4 = Titanium.Map.createAnnotation({ animate : true, title : '#4 Hello I am an annotation with lots of information:', subtitle : 'This is a subtitle to an large annotation', pincolor : Titanium.Map.ANNOTATION_RED, latitude : parseFloat(37.770), longitude : parseFloat(-122.43) }); mapObject.addAnnotation(annotation); mapObject.addAnnotation(annotation2); mapObject.addAnnotation(annotation3); mapObject.addAnnotation(annotation4); win.add(mapObject); win.add(selectAnnotations); selectAnnotations.addEventListener('click', function(e) { mapObject.selectAnnotation(annotation2); }); {noformat}

Comments

  1. Ping Wang 2012-08-01

    PR https://github.com/appcelerator/titanium_mobile/pull/2666 Steps for functional test: 1. run the test case in description on Android. 2. click the button and all the pins. 3. the annotations (title, subtitle, etc) should show completely on screen. 4. repeat 1-3 on iOS to see the parity.
  2. Sabil Rahim 2012-08-14

    2_1_X backport PR [2730](https://github.com/appcelerator/titanium_mobile/pull/2730)
  3. Tamila Smolich 2012-08-15

    Closing as fixed. Tested and verified on: Titanium Studio, build: 2.1.1.201208091713 Titanium SDK, build: 2.1.2.v20120815081613 Devices: Nexus 7 tab (4.1), Android Emulator (2.2) Map annotations are fully visible.
  4. Samuel Dowse 2014-05-09

    Reopening this issue: Mac OSX 10.9.2 Appcelerator Studio, build: 3.2.3.201404181520 Titanium SDK, build: 3.2.3.GA Titanium CLI: 3.2.3 Using the test case provided in the description on Android does not center on the selected annotation. iOS works as expected.
  5. Eric Merriman 2014-07-09

    reopening to fix sprint.

JSON Source