You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
I notice after you initialize the map you cant access it by calling it from another js that had not been registered using this line of code:
$map->appendScript(implode("\n", $js));
This is important if you need to perform an action for example after pushing a button outside of the map canvas (example: draw a polyline with the push of a button)
I suggest making the map variable global by adding this line of code in Map.php right before line 407
$js[] = "var {$this->getName()};";
And change line 414 to:
$js[] = "{$this->getName()} = new google.maps.Map(container, mapOptions);";
Please correct me if I'm wrong but I cant seam to get a reference to the map if I want to register custom JS at the bottom of the page using $this->registerJs($js);
The text was updated successfully, but these errors were encountered:
The problem with global variables is that they could conflict with other in same scope. Thats why the resulting JS is in a module pattern.
I am currently creating a new version for PHP 7+, where we won't have that issue and will work with latest release of Google Maps API and fully tested and integrated with Travis. I will provide the option for devs to setup callables that will receive the instance of the map.
That library will contain Yii adapters (widget) as this one, but will also be able to be used on other frameworks. Current state is that I am about to finish the Layers...
Thats my prove of work and commitment to improve it.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I notice after you initialize the map you cant access it by calling it from another js that had not been registered using this line of code:
$map->appendScript(implode("\n", $js));
This is important if you need to perform an action for example after pushing a button outside of the map canvas (example: draw a polyline with the push of a button)
I suggest making the map variable global by adding this line of code in Map.php right before line 407
$js[] = "var {$this->getName()};";
And change line 414 to:
$js[] = "{$this->getName()} = new google.maps.Map(container, mapOptions);";
Please correct me if I'm wrong but I cant seam to get a reference to the map if I want to register custom JS at the bottom of the page using $this->registerJs($js);
The text was updated successfully, but these errors were encountered: