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

Constant flicker during polygon hover #33

Open
MadDanimal opened this issue Aug 31, 2020 · 1 comment
Open

Constant flicker during polygon hover #33

MadDanimal opened this issue Aug 31, 2020 · 1 comment

Comments

@MadDanimal
Copy link

MadDanimal commented Aug 31, 2020

Getting a constant flicker during polygon hover because the mouseenter and mouseleave events start firing constantly. It also happens in the demo but not as reliably. Fixed by adding conditionals to the mouseenter and mouseleave events:

                    this.$el.on("mouseenter", "svg polygon", function(o) {
                        var i = t(o.target).data()
                          , a = e.mapHoverType
                          , s = e.hoverText;
                        if (!e.target || e.target.dataset && (n.$el.find(".hover-text p").text() != e.target.dataset.timezone + ' (' + e.target.dataset.zonename + ')')) {
                            t(a ? ".timezone-map polygon[data-" + a + '="' + i[a] + '"]' : o.currentTarget),
                            n.$el.find(".hover-text p").addClass("active").text(s && s instanceof Function ? s(o, i) : i.timezone + " (" + i.zonename + ")");
                        }
                    }),
                    this.$el.on("mouseleave", "svg polygon", function(e) {
                        if (!e.target || e.target.dataset && (n.$el.find(".hover-text p").text() != e.target.dataset.timezone + ' (' + e.target.dataset.zonename + ')')) {
                            n.$el.find(".hover-text p").removeClass("active").text("")
                        }
                    }),
@kevalbhatt
Copy link
Owner

kevalbhatt commented Aug 31, 2020 via email

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

No branches or pull requests

2 participants