Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra methods to facilitate icons refresh #564

Merged
merged 11 commits into from
Oct 13, 2015
Merged

Conversation

ghybs
Copy link
Contributor

@ghybs ghybs commented Oct 1, 2015

Additional methods to facilitate marker icons update and propagate to their parent clusters in real-time. For issues #563, #561, #555, #535 and #498.

The 2 private methods could also be re-used in addLayers and removeLayers.

As I am quite new to Git, I am not sure this is the correct way to proceed. I also tried to find a suitable place for this piece of code, but feel free to place it somewhere else more appropriate.

Anyway, this is mainly an attempt to propose some code in a better way than posting it in comments, as pointed out by @IvanSanchez.

@danzel
Copy link
Member

danzel commented Oct 2, 2015

I like the idea of this.
Could you please have a go at adding some tests to the spec dir to cover this behaviour?
You should also update the build script to include this by default.

Thanks!

@ghybs
Copy link
Contributor Author

ghybs commented Oct 5, 2015

Hi,

Thanks for your feedback.
Sure, will do as soon as I have time.
I will also update the readme accordingly.

@ghybs
Copy link
Contributor Author

ghybs commented Oct 6, 2015

Hi,

Excuse me I have some doubts about how I should proceed here:

  • Should I update the dist files as well, so that everyone can benefit from the new API right away? Or should I leave those unchanged, and let you do that once you consider the src files stable enough? In particular, updating the dist files would include all previous merges that are not part of the current dist files.
  • Should I bump up the minor version in bower and package.json files? Because there is a new API, that is backward compatible (it does not break anything, at least for the methods I introduce).
  • Should I update the README file to communicate about the new methods?

I apologize for these stupid questions, I am quite new to GitHub and I am not so aware of how an open source community runs…

@danzel
Copy link
Member

danzel commented Oct 6, 2015

No worries, most projects run differently :)

Don't update the dist files (so please revert that commit)
Don't update the version number (that is done when we do a release).

Do update the README to detail this new method :)

@ghybs
Copy link
Contributor Author

ghybs commented Oct 7, 2015 via email

@danzel
Copy link
Member

danzel commented Oct 7, 2015

I still see the dist changes in your commits.

I'll update dist after merging.

@ghybs
Copy link
Contributor Author

ghybs commented Oct 8, 2015 via email

@ghybs
Copy link
Contributor Author

ghybs commented Oct 8, 2015

Ok it should be good now.
I actually just copied back the original dist files, I hope this trick is
enough?

Please let me know should I need to perform any extra step or correct any
mistake.

On 8 October 2015 at 14:55, ghybs 1 [email protected] wrote:

Hi,

Sorry for the delay.

I am not sure how to revert a commit…
I will try rebuilding the fork.

@danzel
Copy link
Member

danzel commented Oct 8, 2015

That looks good, will take a read through next week.

@ghybs ghybs mentioned this pull request Oct 9, 2015
* markers' icon options and refreshing their icon and their parent clusters
* accordingly (case where their iconCreateFunction uses data of childMarkers
* to make up the cluster icon).
* Should cover issues #563, #561, #555, #535 and #498.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trash this line please, we have git history and github to track this :)

danzel added a commit that referenced this pull request Oct 13, 2015
Extra methods to facilitate icons refresh
@danzel danzel merged commit 63ed884 into Leaflet:master Oct 13, 2015
@danzel
Copy link
Member

danzel commented Oct 13, 2015

Merged, can trash the line myself

@ghybs
Copy link
Contributor Author

ghybs commented Oct 14, 2015

Hi,

Well it looks like the test spec messes up…
Quite often it hangs the test process, even though when it succeeds, everything passes.

@danzel
Copy link
Member

danzel commented Oct 15, 2015

Dumb, this happens in some of the current tests already too.

@ghybs
Copy link
Contributor Author

ghybs commented Oct 15, 2015

It seems that avoiding beforeEach and afterEach and trying to re-use objects whenever possible makes the test process much more reliable (even though still not 100% perfect in my tests).

It could be related to PhantomJS bad garbage collection / memory leak, even though we are still on a very low number of tests and I do not see any peak in memory...

I will push an update for the test I created at least.

@ghybs
Copy link
Contributor Author

ghybs commented Oct 15, 2015

See PR #577.
It fixes the issue on my machine at least.

Maybe re-engineering the other test suites could help for the similar cases you sound to have encountered?

@danzel
Copy link
Member

danzel commented Oct 15, 2015

sweet, next time I see any others crap out I'll have a go.

@ayozebarrera
Copy link

Can't find refreshClusters() method anywhere. What is the state of this at the moment? I need to update some markers every few seconds

@ghybs
Copy link
Contributor Author

ghybs commented Feb 3, 2016

Hi,

It should be included in the dist file.
Which branch / Leaflet version are you using?

For Leaflet stable (0.7.7), use marker cluster branch "leaflet-0.7", refreshClusters is there.

For Leaflet 1.0 beta2, use marker cluster tag "1.0.0-beta.2.0", refreshClusters is there.

Hope this helps.

@ayozebarrera
Copy link

Nice, it helps.

I'm using leaflet 0.7.7 but I'm using default branch of marker cluster. How I switch branch?

Thanks for the quick reply :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants