This is a migrated thread and some comments may be shown as answers.

Can just see part of the map

1 Answer 52 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gerhard
Top achievements
Rank 1
Gerhard asked on 25 Jun 2013, 01:17 PM
I added a map to my application with this piece of JavaScript code:

var curPos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
  if (map == undefined) {
   map = new google.maps.Map(document.getElementById('map-canvas'), {
    sensor: true,
    zoom: 13,
    center: curPos,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    panControl: false,
    streetViewControl: false,
    zoomControl: false
   });
   markerIcon = { path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW, scale: 6,  fillColor: '#DD88EE', fillOpacity: 1, strokeWeight: 1, rotation: 23 };
   currentPositionMarker = new google.maps.Marker({
    map: map,
    position: curPos,
    icon: markerIcon
   });
  }

I cannot find the reason why there is just a part of the map shown on my screen, and the marker is positioned in the very top left corner of it (not visible in the screenshot since it is 'outside' of the screen)

I have a sample application and would like to attach it to this post so that you can reproduce the problem, but .zip files are not allowed.

Kind regards,
Gerhard

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 26 Jun 2013, 03:54 PM
Hello,

It's seems that you are initializing google map in hidden div and then trying to show it(or something like that). You can read more about this issue here.

We had similar problem in one of our apps, where we initialize map on device ready
but map element was not shown in default view. We solve this issue by triggering map's resize event and reset the center point of the map on view show:

function onViewShow()
{
    google.maps.event.trigger(map, "resize");
    map.setCenter(point);
}

 I hope the below information will help you.

Regards,
Ivan Ivanov
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
Tags
General Discussion
Asked by
Gerhard
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or