-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Markers positions are not updated when models coords change. #1350
Comments
At the end of I also updated the plunker to AGM 2.1.2 with lodash 3.9.3 and Angular 1.3.15: I found an earlier issue discussing this briefly with the same resolution, #1022. It seems this or something like it used to be a bug: #946 Maybe it's resurfaced somehow @nmccready? Or is |
It should update . The code responsible for see what is new is here https://github.com/angular-ui/angular-google-maps/blob/master/src/coffee/directives/api/utils/models-watcher.coffee#L12-L31 . It relies on whatever the implementation is for the comparison callback. |
Uses the return from figureOutState and does the deletes , adds and updates here. https://github.com/angular-ui/angular-google-maps/blob/master/src/coffee/directives/api/models/parent/markers-parent-model.coffee#L148-L164 I do not have time to debug this right now. So hopefully someone else has the time. |
In the call to
Fwiw, Will try to pursue this later. |
Yes they should be equal, sometimes it is using the local reference of scope if the function was possibly intended to be outsourced as a module to be included . |
Digging appreciated. |
Hello guys, I think I got it! in the cloneModel is created/updated using This must somehow clone the object by reference. Replacing makes the markers behave the way it's supposed to. Plunker update to reflect the changes: 2015-06-08 22:24 GMT+02:00 nmccready notifications@github.com:
Quentin Lampin |
I dug a bit more and discovered a comment stating that you made the move from _.clone to _.extend to get rid of the dependency to lodash, which allows to depend on underscore instead.
It doesn't say if the copy is shallow or deep so it did a bit of testing : it appears that it's not a deep-copy, i.e. object properties are copied by reference. If it's really important to get rid of the lodash dep, one could replace
|
@nmccready @wrummler Pull-request created : #1356. |
👍 |
Hello there,
I'm trying to dynamically add and update markers positions according to a data model. Adding new 'markers' to the model works well, i.e. new markers are shown up on the map, but changing their coordinates does not work, markers stay at their original coordinates.
Here is a plunker of the issue : http://plnkr.co/edit/94GZ6QaCYrlonNzkMhe9?p=preview
I'm novice (2 weeks on JS, node, grunt, etc....... x/ ) so I'm certainly wrong but could it be that 'coords' are not $watched? Or is it by design, i.e. involving some sort of perf. trade-off? In that case, how would I implement this, and what kind of performance hit should I expect for, say, 50ish markers ?
I'm sorry if that question has already been answered or if the docs cover that point, I did my best solving this by myself but coffee and good will didn't suffice this time ;)
Regards,
Quentin
The text was updated successfully, but these errors were encountered: