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

Issues with Dom-repeat and Map Markers #356

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

msamitahir
Copy link

@msamitahir msamitahir commented Mar 6, 2017

I was unable to get the data binding to work when using google-map-markers inside dom-repeat template.
Made 2 changes to the code to enable dynamic updating of google map markers and their contents.
The following code now works well to render markers on google map when bound to an items array.

<google-map map="{{map}}" api-key=xxxx latitude="[[lat]]" longitude="[[lon]]">
        <template is="dom-repeat" items="[[array]]">
          <google-map-marker map="[[map]]" latitude="[[item.lat]]" longitude="[[item.lon]]" title="[[item.title]]" >[[item.content]]</google-map-marker>
        </template>
</google-map>

Possible issues resolved #299 #319 #297 #288 #263

The current version is not able to handle changes to array of markers added via dom-repeat template.

Updated the listener to observe 'iron-items-changed' event at line 534.
The listener is now able to update all the markers when there is a change in items array.
Please note that this code does not update the info window content.
The following code now works correctly.

google-map map="{{map}}" api-key=xxxx latitude="[[lat]]" longitude="[[lon]]">
        <template is="dom-repeat" items="[[array]]">
          <google-map-marker map="[[map]]" latitude="[[item.lat]]" longitude="[[item.lon]]" title="[[item.title]]" ></google-map-marker>
        </template>
      </google-map>
Currently when using dom-repeat template, the info windows are not updated when the item array is updated.
This change to mutation observer allows the info window content to update automatically.
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@jparish3
Copy link

jparish3 commented Mar 8, 2017

I am having the same issue with the infowindow. I tested your update to infowindows and it fixed the issue. I am now getting a side effect where opening the info window on one marker will trigger opening other markers and sometimes close the clicked marker

@msamitahir
Copy link
Author

Hi jparish3,

  • Have you applied all 3 changes that I made ?
  • Do these issues appear on first rendering or after subsequent updates are made ?

I had tested it out with 4 markers and text only content in infoWindow and did not notice this unusual behavior.

You can also check what are the versions of your dependencies using bower list.
I am currently using the following versions of the google map dependencies:
├─┬ google-map#1.2.0
│ ├─┬ google-apis#1.1.7
│ │ ├─┬ iron-jsonp-library#1.0.4
│ │ │ └── polymer#1.8.0
│ │ └── polymer#1.8.0
│ ├── iron-resizable-behavior#1.0.5
│ ├── iron-selector#1.5.2
│ └── polymer#1.8.0

Thanks,

@msamitahir
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mutation observer does not pick up changes with native shadow DOM
3 participants