GoogleWebComponents / google-map

Google Maps web components

Home Page:https://elements.polymer-project.org/elements/google-map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I need to do double click to refresh a search

juanmendez92 opened this issue · comments

Hi, and I'm sorry for my english. I have this problem with the google-map-search component. This is my HTML code

<template is="dom-bind" id="app>
<div class="fit horizontal layout">
    <geo-location latitude="@{{lat}}" longitude="@{{lng}}"></geo-location>
    <google-map-search global-search="true" map="[[map]]" results="@{{results}}"></google-map-search>
    <google-map fit-to-markers map="@{{map}}" latitude="[[lat]]" longitude="[[lng]]" zoom="16">
        <template is="dom-repeat" items="@{{results}}">
            <google-map-marker draggable="true"
                latitude="@{{item.latitude}}" longitude="@{{item.longitude}}">
                <h2>@{{item.name}}</h2>
                <span>@{{item.formatted_address}}</span>
            </google-map-marker>
        </template>
    </google-map>   
    <paper-card heading="Card title" image="" elevation="1" animated-shadow="false">
      <div class="card-content">
        <paper-input id="query" label="Dirección"></paper-input>
      </div>
      <div class="card-actions">
        <paper-button raised on-tap="buscar">Buscar</paper-button>
      </div>
    </paper-card>
</div>
</template>

and the script:

<script>
var app = document.querySelector('#app');
app.buscar = function(){
    var map = document.querySelector('google-map');

    var query = document.querySelector('#query').value;
    var search = document.querySelector('google-map-search');
    search.query = query;
    map.resize();
}
</script>

When I do a search, the map show me all markers, but when I do a new search, the map not lead me to the new position, until I do a new click to the button search. Only in the console I can use the resize method of google-map

What version of the component are you using?

Can you verify _updateMarkers is being called when you click the button?
https://github.com/GoogleWebComponents/google-map/blob/master/google-map.html#L469

and that the code reaches https://github.com/GoogleWebComponents/google-map/blob/master/google-map.html#L494.

If you can post a jsbin using http://polygit.org/ I can help debug.