Googleマップに検索ボックスを追加しています。ドキュメント(https://developers.google.com/maps/documentation/javascript/examples/places-searchbox)から:
// Create the search box and link it to the UI element.
var input = document.getElementById('pac-input');
var searchBox = new google.maps.places.SearchBox(input);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
私はこれが低レベルでどのように機能するかを正確に理解しようとしています。最後の行は何をしますか?コメントにあるように、検索ボックスをUI要素にリンクする場合、これはどのように行われますか?
https://developers.google.com/maps/documentation/javascript/controls#CustomExampleで説明されているように
// Add the control to the map at a designated control position
// by pushing it on the position's array. This code will
// implicitly add the control to the DOM, through the Map
// object. You should not attach the control manually.
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(controlDiv);
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加