blinking icons on position update
I don't know if anyone has this experience so this is more like a question, than an issue.
I have a interval in angular that is requesting the positions to the API, on every update, the icons blink or flicker.. any suggestions?
regards, Ricardo
Thanks for using this and reporting it.
If you maintain markers using ng-repeat, the markers will flick because ng-repeat will re-create html elements, and the marker are synced to them.
That means when you update scope variable that are used in ng-repeat, the
If you want to avoid this,
- You can maintain markers manually without using
ng-repeatlike this example - Or, you can change the code not to remove it when they are the same, and send me a pull request.
Allen
Hi Allen, Thanks for the support.
I'm not using ng-repeat, because when I first tried it, it left a trace when changing position so I used the other example of yours of dynamic markers, I'll have to analyse your suggestion closer.
Thank you so much. Ricardo
FYI, for your information, ng-repeat does not leave a trace of previous marker any more. I have made a fix for that.
If you simplify your problem and can create a single page example, I will be glad to help with it.
@rmjoia when you have icons that represent something that changes its position all the time, make sure you use the "trackBy" statement in the ngRepeat to prevent DOM insertion/deletion when you refresh the markers, thus preventing the flash.
@michaelwsk, I did not know track by can control DOM re-creation. It's good to learn from the community. @rmjoia did say that he does not use ng-repeat though. He might have some other issues which I do not know.
@michaelwsk thanks, I'm not using ng-repeat because it had that issue that @allenhwkim told it's been solved, yet, the trail of the positions was a nice feature to implement, because it could be used to track something in real time with tail.
I'll be revising all of that soon to optimize the app, @michaelwsk can you provide-me some reference of the "trackBy" statement, example or something so I can study it? Thanks in advance.
@allenhwkim I know that, to use the google maps api you have to create an app id and all, and that's limited to a number of hits, I did not find any "simple" way to change that, are we using your id? shouldn't it be something that anyone should use their own? Is this wrong?
thank you both. Ricardo
@rmjoia, I think you are talking about api key and usage limit.
As mentioned on the google page, I don't generate that much large volume of hits although I wish, so I do not worry about api key at this time.
Adding api key is as simple as adding another query string.
<script src="https://maps.googleapis.com/maps/api/js?key=API_KEY"></script>
@rmjoia look for ng repeat's documentation on repeat_expression for more information on track by.
Closing, @rmjoia if you still did not solve the problem, please re-open it with an example in plnkr.
trackBy resolved my flickering problem as well.