Results 1 to 4 of 4

Thread: How to center the map?

  1. #1

    Default How to center the map?

    Hey guys,

    I am playing around with the examples and I currently try to extend the 'Guide example'.

    What I want is a new button that centers the map to my current location. Just in case I scroll around and want to get back.

    I created the button and that's already working but I am struggling with the rest.

    Here's what I got:
    HTML Code:
            var takeMeHome = function() {
              var coords = map.geo.coords;
     google.maps.LatLng(coords.latitude, coords.longitude));
    The only thing it does is that the screen flickrs when I click (touch.. ) the button, nothing more.

    I know the Google Maps API and I now that there is a 'setCenter()' function but I already tried that with no luck.

    Can someone please point me in the right direction? Thanks!

    For some strange reason, all examples that use the Geolocation only work in Firefox (with a broken layout) and on my iPhone. Safari 5 refuses to load the map which makes debugging a little complicated.
    One of the German guys.

  2. #2
    Sencha User VinylFox's Avatar
    Join Date
    Mar 2007
    Baltimore, MD


    Methods in the Google API are accessed via the map property of your map panel...

    PHP Code:
    var mapCenter = function(){
    pnt = new google.maps.LatLng(60105);
    There is no center method in the map panel component.

  3. #3


    Thanks, it's working now.

    Wouldn't have thought about using[...]
    One of the German guys.

  4. #4


    This was confusing for me too. I finally set the center point in the map options setting.

    Here is my code:
    HTML Code:
            var pnt = new google.maps.LatLng(32.842178,-96.774654);
            var mapdemo = new Ext.Map({
            		center: pnt,
            		zoom: 12,

Similar Threads

  1. Cannot get a google map!!!
    By tf.alves in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 2 Apr 2010, 12:26 PM
  2. How to get the child elements in center with Center layout
    By amjedonline in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 12 Dec 2009, 11:51 PM
  3. [CLOSED][3.0.0] does not fully center.
    By Straylight in forum Ext 3.x: Bugs
    Replies: 9
    Last Post: 16 Aug 2009, 11:53 AM
  4. Ext.Window - Center() should center to viewport, not page?
    By nutkenz in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 28 Dec 2008, 1:55 AM
  5. [2.0.1][CLOSED] doesn't center
    By Reen in forum Ext 2.x: Bugs
    Replies: 8
    Last Post: 22 Jul 2008, 11:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts