PHP Classes

How get current zoom level to store in textbox

Recommend this page to a friend!

      gmaps3simple  >  All threads  >  How get current zoom level to store...  >  (Un) Subscribe thread alerts  
Subject:How get current zoom level to store...
Summary:How get current zoom level to store in textbox
Messages:2
Author:girish
Date:2012-11-18 15:54:48
Update:2012-12-05 23:03:05
 

  1. How get current zoom level to store...   Reply   Report abuse  
Picture of girish girish - 2012-11-18 15:54:48
Hello Friend,
I would like to store current zoom level to textbox for future use. Please help.

Thanks for Great Script.


  2. Re: How get current zoom level to store...   Reply   Report abuse  
Picture of Federico Ghedina Federico Ghedina - 2012-12-05 23:03:05 - In reply to message 1 from girish
Hi, I'm glad U foun it useful.
About your question the matter is that you cannot access from the DOM the google.Map object generated by the script wrote by the class, because it's scope is not public. But you can still do something, I tested that ..and works.

-open the class

-look for
var '.$this->map_id.' = new google.maps.Map(document.getElementById("'.$this->map_id.'"), myOptions); (should be ~ln.1622)

-just after this line type
window.'.$this->map_id.' = '.$this->map_id.';
//this adds a reference the map object to the global scope,
//the map object is visible by any scope

save and You're done, now the global scope contains the object You where looking for, that variable is named as the "id" parameter you pass to the class constructor. (let's say that it is "my_map")…be sure to delete any related cache file done by the class….

now obtain zoom using : my_map.getZoom();

hope it helps.. sorry for the delay.

Greetings

Federico