Page 2 of 3

center map on marker

Posted: Wed Jul 10, 2013 2:35 pm
by Dimitris Monastiriotis

as you can see the marker is way off the center


center map on marker

Posted: Wed Jul 10, 2013 4:40 pm
by Maryna Brodina

Hello! You would need to create two local storage variables with latitude and longitude values. Here is a result http://appery.io/app/mobile-frame?src...


center map on marker

Posted: Wed Jul 10, 2013 4:46 pm
by Dimitris Monastiriotis

hi the link shows a permission error, could you explain your answer more? regarding the two variables? there already are two local variables that store the lat (shop_lat) and lon (shop_lon) and these we use to center the map


center map on marker

Posted: Wed Jul 10, 2013 4:50 pm
by Maryna Brodina

Sorry, disregard that answer. I'll update soon with more details.


center map on marker

Posted: Wed Jul 10, 2013 5:53 pm
by Maryna Brodina

Hi again, please refresh the map after you set map center with the following code:
codeAppery("googlemap_22").refresh();/code


center map on marker

Posted: Wed Jul 10, 2013 6:04 pm
by Dimitris Monastiriotis

hi I did it but still the same,


center map on marker

Posted: Wed Jul 10, 2013 8:11 pm
by Maryna Brodina

Working on it...


center map on marker

Posted: Thu Jul 11, 2013 7:11 am
by Kateryna Grynko

Could you please provide us with the valid data to open your app?
Opening Shop.html manually without authorization we see marker centered on both Chrome and Firefox:
Image


center map on marker

Posted: Thu Jul 11, 2013 12:30 pm
by Kateryna Grynko

Hi Dimitris,

1) Delete Page Show event handlers that set Google Maps.
2) On Page Show event create new Run JavaScript action with the following code:
precode
setTimeout( function(){
var shopLocation = new google.maps.LatLng(localStorage.getItem('shop_lat'), localStorage.getItem('shop_lon'));
// add markers
$("[name = 'googlemap_22']").gmap({
'zoom':15,
'center': shopLocation
});
}, 1000);/code/pre
Replace the comment "//add markers" with creating marker as described here: http://docs.appery.io/tutorials/addin...


center map on marker

Posted: Thu Jul 11, 2013 12:43 pm
by Dimitris Monastiriotis

wow !!! it works, thanks a lot for that, from the solution you propose I take it you introduce a small delay to allow the map to be initialised ? before applying the new center?

Also, another question when I try to debug myself the javascripts produced the debugger (firebug) does not show the scripts to allow me to set break points etc apart from the ones in the main menu screen. It only shows the js code if an undefined value or some other error occurs and then it prepends it with a VM[and a number] is there any way to be able to walk through the js code executed the various pages?

thanks again for your help, effort and support.
rgrds
dimitris