-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[master][develop] Refresh is expecting coordinates? {in-progress} #230
Comments
@nmccready you got a clue? i recall it should be a boolean value |
This is the map directive? I'll have to look later or this weekend. I am slammed with work :/ . |
It looks like refresh is expected to be a function. Have you tried passing coords into the bounded refresh callback? IE whatever function you have linked to refresh. |
Actually whatever refresh is linked to should be returning coords. |
Wouldn't that just make the refresh attribute a way of panning/centering when the refresh evaluates to new coordinates? In my case I want to refresh the map when a specific page is visible, ie. refresh="isCurrentPage('map')" Actually I'm thinking that the content of this watch was copied from the watch on center, and never replaced. It should just call |
The refresh attribute on the google-map directive was (and I think should The refresh attribute is an expression. In the directive it is treated as a So: <google-map ... refresh="activeTab == 'myTab'">...</google-map> In this case, the refresh "function" in the directive is equivalent to: function () { return scope.activeTab == 'myTab'; } Sent from Gmail web On Tue, Jan 28, 2014 at 6:08 PM, jeppebemad [email protected]:
|
Exactly. The watch function works when written like this: scope.$watch("refresh()", function(newValue, oldValue) { |
In the legacy branch, this was handled like this: scope.$watch("refresh()", function (newValue, oldValue) {
if (newValue && !oldValue) {
_m.draw();
}
}); And // Refresh the existing instance
google.maps.event.trigger(_instance, "resize");
var instanceCenter = _instance.getCenter();
if (!floatEqual(instanceCenter.lat(), that.center.lat())
|| !floatEqual(instanceCenter.lng(), that.center.lng())) {
_instance.setCenter(that.center);
}
if (_instance.getZoom() != that.zoom) {
_instance.setZoom(that.zoom);
} @nmccready you have an idea why this has changed? |
I'll have to look into this deeper, but the m.draws() commented out due to performance issues, and unnecessary draws (I think). |
When I instantiate the built-in 'refresh' attribute in the map directive, it is just giving a grey screen in the map with no controls. Played around with it for too long with no luck. So I'd like to run the resize manually. For instance: google.maps.event.trigger(_m, "resize"); When I run this, it errors with:
Where/what is the map instance defined? |
You can grab the map instance via tiles loaded. See go to the google plus communities and search FAQ. |
In what context is this hook happening? I just want to refresh the map because it's staying locked as though it thinks it's only 1x1 pixels dimension, since it was hidden on page load. So do I add this to my controller? Then how to access the name? Can you give a concrete example? angular.extend($scope, {
map:{
events: {
tilesloaded: function (map, eventName, originalEventArgs) {
},
}
}); I simply want to call PS - Forgive my ignorance, I'm still getting the hang of this maps extension. Working well so far. |
I'll work on this if I have time this week, or definitely the weekend. |
Any action on this? Let me know what you think. Just looking for solid method to refresh the map manually. |
more info at #52 |
I am looking at this now and will have an answer for you shortly. |
So one issue is this problem goes back b4 I even started working on this. The refresh seems incorrect back here https://github.com/nlaplante/angular-google-maps/blob/aded23bd7922bca7055c73606dd3f78d00ee0fcc/src/directives/map.js |
And here f67acfc where m.draw is also commented out. |
Ok so back to r1-dev start so the copy paste problem probably happened then. https://github.com/nlaplante/angular-google-maps/blob/bdd6b4382e78258079171935fd592991e4e4979a/src/directives/map.js |
@jeppebemad @phongmedia I agree that using |
- version appended to non minified version same as develop Map.Control: - refresh and getGMap are now more functional oriented - the directive looks for a controller to have control= defined. The object is extended with refresh and getGMap which are direct callback hooks to the directive itself. Refresh: Accepts optional coordinated so that you can panTo or Center on a new postion after refresh / "resize" is triggered issue #230 See example.html for map.control.refresh and map.control.getGMap
Please check the above commit as this should satisfy everyones needs. Also this should make things a lot easier in the future without needing watching. |
- version appended to non minified version same as develop Map.Control: - refresh and getGMap are now more functional oriented - the directive looks for a controller to have control= defined. The object is extended with refresh and getGMap which are direct callback hooks to the directive itself. Refresh: Accepts optional coordinateis to panTo or Center on a new postion after refresh / "resize" is triggered issue #230 See example.html for map.control.refresh and map.control.getGMap
- version appended to non minified version same as develop Map.Control: - refresh and getGMap are now more functional oriented - the directive looks for a controller to have control= defined. The object is extended with refresh and getGMap which are direct callback hooks to the directive itself. Refresh: Accepts optional coordinates to panTo or Center on a new postion after refresh / "resize" is triggered issue #230 See example.html for map.control.refresh and map.control.getGMap
In master I will bump to 1.0.13 after a few more fixes |
First of all, thanks for the work on this module!
I'm trying to get my map to refresh, but I've found that the $watch function for refresh() is expecting coordinates. See below:
Is this a bug or am I missing something? Cheers.
The text was updated successfully, but these errors were encountered: