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

Google map poly mouse* events not working #242

Closed
astelmashenko opened this issue Dec 21, 2015 · 12 comments
Closed

Google map poly mouse* events not working #242

astelmashenko opened this issue Dec 21, 2015 · 12 comments

Comments

@astelmashenko
Copy link

Hi,

Thanks for developing this polymer element. I need mouse* events enabled but I could not get them working, I noticed that _mouseEventsChanged is not called and listeners are not added. If I call _mouseEventsChanged at the end of _createPoly function, mouse events become working.

    _createPoly: function() {
      // Build poly's path and register mutation listeners on first creation.
      ...  
      this._listeners = {};
      this._mouseEventsChanged();
    },

B.t.w. I've implemented google-map-circle, the same way as google-map-poly, and got the same issue there.

@ebidel
Copy link
Contributor

ebidel commented Dec 21, 2015

You should not need to call _mouseEventsChanged directly. It's an internal method. Can you provide a jsbin that repos the issue?

@astelmashenko
Copy link
Author

try this one http://jsbin.com/letani/edit?html,output and move mouse over the line,
open console and see no messages are shown.

Then try uncomment my version of google-map-poly import, comment out original and move mouse over polyline again, see messages in the console.

Seems like _mouseEventsChanged is called when this.poly is not defined yet.

@astelmashenko
Copy link
Author

@ebidel did you have a chance to look at jsbin added? Please let me know if I need to improve it somehow. Thanks

@ebidel
Copy link
Contributor

ebidel commented Dec 22, 2015

Probably won't have a chance until after the holidays.

On Tue, Dec 22, 2015, 5:19 PM Andrey Stelmashenko notifications@github.com
wrote:

@ebidel https://github.com/ebidel did you have a chance to look at
jsbin added? Please let me know if I need to improve it somehow. Thanks


Reply to this email directly or view it on GitHub
#242 (comment)
.

@volodymyrrudyi
Copy link
Contributor

I'm having exactly the same issue. Actually, it affects almost all properties in this component. The problem is property observers have an implicit dependency on the order they are being called. Observers of almost all properties assume that this.poly should be already created, while it's created in the _mapChanged observer.

@volodymyrrudyi
Copy link
Contributor

Most likely the simplest way to resolve the issue is to create polygon/polyline instance on the ready() event with all required properties

@volodymyrrudyi
Copy link
Contributor

Actually, because of the way map is set on the component, we anyway need to explicitly forward all required events in the _createPoly method or click-events, mouse-events and drag-events will be ignored when map is changed.

I created a PR with the change and a test: #248

@volodymyrrudyi
Copy link
Contributor

@ebidel can you take a look on this, please? in some cases (like two-way binding driven map objects population) workarounds become too cumbersome and difficult to maintain, while this looks like an obvious bug in the component

@ebidel
Copy link
Contributor

ebidel commented Jan 19, 2016

I haven't had a chance to look at your PR (#248). Does that address this bug?

@astelmashenko
Copy link
Author

Yes, it does.

@volodymyrrudyi
Copy link
Contributor

yep, it's the fix for this issue

@ebidel
Copy link
Contributor

ebidel commented Jan 25, 2016

@ebidel ebidel closed this as completed Jan 25, 2016
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

3 participants