Closed (works as designed)
Project:
GMap Module
Version:
5.x-0.6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
27 Jun 2007 at 15:45 UTC
Updated:
10 Mar 2011 at 20:45 UTC
After adding the scripts from post #5 on this issue http://drupal.org/node/131034 enables me to display a map within a tab using the jstools tabs module. I've put the following code in the contemplate for my node type:
$mymarkers=array(array('latitude' => $location['latitude'],
'longitude'=>$location['longitude'],));
$mymap=array( 'id' => 'myGmap',
'latitude' => $location['latitude'],
'longitude'=> $location['longitude'],
'zoom' => 13,
'width' => '300px',
'height' => '300px',
'type' => 'Map',
'markers' => $mymarkers,
);
$myGmap = theme('gmap', array('#settings' => $mymap));
$form = array();
$form['example1'] = array(
'#type' => 'tabset',
);
$form['example1']['tab1'] = array(
'#type' => 'tabpage',
'#title' => t('Video'),
'#content' => t('first tab content'),
);
$form['example1']['tab2'] = array(
'#type' => 'tabpage',
'#title' => t('Map'),
'#content' => $myGmap,
);
$form['example1']['tab3'] = array(
'#type' => 'tabpage',
'#title' => t('The Bees'),
'#content' => t('buzzzzzzzzzzzzzzz'),
);
return tabs_render($form);
The map loads with the correct size, with the marker in the correct location, however the map is not centered on the marker. The marker point and (and desired center) of the map is in the extreme top left of the map.
Is there a way to center the map on the marker (i suspect it would somehow inlcude a 'center' option in the $mymap array instead of 'latitude' and 'longtitude'. I've tried this with no luck.
Comments
Comment #1
bdragon commentedYou need to make the map checkResize() itself.
Try something like
Drupal.gmap.globalChange('widthchange');to force the map to checkResize...Comment #2
ff1 commentedI currently have the same problem. Did the suggestion above work?
Where should this code be placed?
Does it have any adverse effects?
If this code all works successfully, should a patch be created so that it can be incorporated in Gmap module?
Thanks
Ian
Comment #3
bdragon commentedThis is one of those unsolvable-from-gmap problems.