Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17941] MobileWeb: When hiding a Ti.map view and showing it again the view is reloaded

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-11-24T18:24:48.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsMobileWeb
Labelsqe-testadded, supportTeam
ReporterMarco Cota
AssigneeChris Barber
Created2014-10-29T22:46:33.000+0000
Updated2015-01-16T23:35:23.000+0000

Description

Issue

When working on mobile web and using ti.map if the map visible property is set to false and the is set to true again the map will be reloaded to the original state instead of keeping the same location and zoom.

Steps to repro

1. Run test code 2. Move and zoom in the map view 3. Click on the toggle button to hide it 4. Click on the toggle button to show it

Expected Result

The map will be shown again with the last location and zoom

Actual Result

The map is reloaded to the original state

Test code

var win = Ti.UI.createWindow({
	layout:'vertical'
});

var bt = Ti.UI.createButton({
	top:20,
	title:'Toggle'
});

var map = Ti.Map.createView({
	visible:true,
	top:20,
	userLocation:true
});

Ti.Geolocation.MobileWeb.locationTimeout = 10000; 
Ti.Geolocation.getCurrentPosition(locationCallback); 

function locationCallback(e) { 
	console.log(e); 
} 
var last;
bt.addEventListener('click',function(){
	map.visible = !map.visible;
});

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

Comments

  1. Chris Barber 2014-11-24

    Master pull request: https://github.com/appcelerator/titanium_mobile/pull/6380
  2. Tim Poulsen 2014-11-24

    Works as expected using the original code on the ticket. The code from Ingo doesn't work for me, however. Each time I hide/show the map I get different coordinates. If I understand his comments correctly, though, that's expected and isn't a valid test for this change.
  3. Ewan Harris 2015-01-16

    Verified fix on: Mac OSX 10.10.1 Appcelerator Studio, build: 3.4.1.201410281743 Titanium SDK build: 3.6.0.v20150116070927 Titanium CLI, build: 3.4.1 Alloy: 1.5.1 Google Chrome iPhone 6 Plus (8.1.1) Built and packaged using the app.js provided, when viewing from browser and device then zooming and toggling, the map always stays zoomed. Closing ticket.

JSON Source