Dimitris Monastiriotis
Posts: 0
Joined: Sat May 25, 2013 11:22 am

center map on marker

as you can see the marker is way off the center

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

center map on marker

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...

Dimitris Monastiriotis
Posts: 0
Joined: Sat May 25, 2013 11:22 am

center map on marker

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

center map on marker

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

center map on marker

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

Dimitris Monastiriotis
Posts: 0
Joined: Sat May 25, 2013 11:22 am

center map on marker

hi I did it but still the same,

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

center map on marker

Working on it...

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

center map on marker

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

center map on marker

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...

Dimitris Monastiriotis
Posts: 0
Joined: Sat May 25, 2013 11:22 am

center map on marker

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

Return to “Issues”