久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='Rb0jX'></small><noframes id='Rb0jX'>

<tfoot id='Rb0jX'></tfoot>
    <i id='Rb0jX'><tr id='Rb0jX'><dt id='Rb0jX'><q id='Rb0jX'><span id='Rb0jX'><b id='Rb0jX'><form id='Rb0jX'><ins id='Rb0jX'></ins><ul id='Rb0jX'></ul><sub id='Rb0jX'></sub></form><legend id='Rb0jX'></legend><bdo id='Rb0jX'><pre id='Rb0jX'><center id='Rb0jX'></center></pre></bdo></b><th id='Rb0jX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Rb0jX'><tfoot id='Rb0jX'></tfoot><dl id='Rb0jX'><fieldset id='Rb0jX'></fieldset></dl></div>

        • <bdo id='Rb0jX'></bdo><ul id='Rb0jX'></ul>
      1. <legend id='Rb0jX'><style id='Rb0jX'><dir id='Rb0jX'><q id='Rb0jX'></q></dir></style></legend>

      2. 如何將 map.locate 與 Polymer 1.0/leaflet-map 1.0 一起使用

        how to use map.locate with Polymer 1.0 / leaflet-map 1.0(如何將 map.locate 與 Polymer 1.0/leaflet-map 1.0 一起使用)
        <tfoot id='BBzSX'></tfoot>
          <bdo id='BBzSX'></bdo><ul id='BBzSX'></ul>
          <i id='BBzSX'><tr id='BBzSX'><dt id='BBzSX'><q id='BBzSX'><span id='BBzSX'><b id='BBzSX'><form id='BBzSX'><ins id='BBzSX'></ins><ul id='BBzSX'></ul><sub id='BBzSX'></sub></form><legend id='BBzSX'></legend><bdo id='BBzSX'><pre id='BBzSX'><center id='BBzSX'></center></pre></bdo></b><th id='BBzSX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BBzSX'><tfoot id='BBzSX'></tfoot><dl id='BBzSX'><fieldset id='BBzSX'></fieldset></dl></div>

                <small id='BBzSX'></small><noframes id='BBzSX'>

                  <tbody id='BBzSX'></tbody>

                1. <legend id='BBzSX'><style id='BBzSX'><dir id='BBzSX'><q id='BBzSX'></q></dir></style></legend>

                  本文介紹了如何將 map.locate 與 Polymer 1.0/leaflet-map 1.0 一起使用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我對 Polymer 和 Leaflet 的 web 組件都是新手.

                  I am new to both Polymer and Leaflet's web component.

                  我想要一個按鈕來切換 Leaflet 提供的地理定位功能.在 Javascript/HTML/css 應用程序中使用 Leaflet 我會知道如何做到這一點,但我無法使用 Polymer 1.0 讓它工作.

                  I would like to have a button that toggles the geolocation function given by Leaflet. Using Leaflet in a Javascript/HTML/css application I would know how to do this but I can't get it to work using Polymer 1.0.

                  這是我的地圖元素.我調用 map.locate 的嘗試在元素注冊中被注釋掉了:

                  Here is my map element. My attempt to call map.locate is commented out in the element registration:

                  <dom-module id="my-maps">
                   <style>
                     ...
                   </style>
                    <template>
                      <leaflet-map id="thismap" latitude="{{latitude}}" longitude="{{longitude}}" zoom="14"> 
                        <leaflet-geolocation enable-high-accuracy latitude="{{latitude}}" longitude="{{longitude}}" watch="true">
                        </leaflet-geolocation>     
                        <template is="dom-if" if="{{latitude}}">
                          <leaflet-marker latitude="{{latitude}}" longitude="{{longitude}}">                 
                          </leaflet-marker>
                        </template>
                      </leaflet-map>
                    </template>
                    <script>
                       Polymer({
                        is: "my-maps",
                        ready: function () {
                             L.Icon.Default.imagePath="../../bower_components/leaflet/dist/images";      
                             // **this.$.thismap.locate({setView: true}); // not working**
                         } 
                  
                     });
                    </script>
                  </dom-module>
                  

                  對于這個例子,我得到這個錯誤:無法讀取未定義的屬性thismap"

                  For this example I get this error: Cannot read property 'thismap' of undefined

                  如果我直接引用'this'(this.locate()),返回的錯誤是:this.locate 不是函數

                  If I refer to 'this' directly (this.locate()), the error returned is: this.locate is not a function

                  (此片段只是一個測試;理想情況下,定位函數將由來自 'geoButton' 元素的點擊事件調用):

                  (this snippet is just a test; ideally the locate function would be called by a click event from the 'geoButton' element) :

                        <div flex>
                             <ir-maps id="mymap" class="basemap" flex></ir-maps> 
                             <ir-geoButton class="geoButton" ></ir-geoButton>
                        </div>
                  

                  推薦答案

                  我的解決方案沒有明確使用 map.locate.這不是必需的,因為 map.locate 是通過添加 leaflet-geolocation 元素啟用的.

                  My solution does not use map.locate explicitly. This was not needed, as map.locate is enabled by adding the leaflet-geolocation element.

                  我從小冊子地圖元素中刪除了緯度和經度屬性(并添加了一些其他參數):

                  I removed the latitude and longitude property from the leaflet-map element (and added a few other parameters):

                          <leaflet-map 
                  
                          id="nycmap" zoom="14" 
                          min-zoom="14" 
                          max-zoom="18" 
                          nozoomControl="true"
                          noattributionControl:="false">
                  

                  然后我在leaflet-map元素(leaflet-core.html)的注冊中添加了一個一次性監聽器,這樣如果啟用了地理定位,地圖就會縮放到那個位置,如果沒有,它會縮放到那個位置縮放到默認中心點.'geoB' 是一個切換地理定位功能的按鈕:

                  Then I added a one-time listener to the registration of the leaflet-map element (leaflet-core.html), so that if geolocation is enabled, the map will zoom to that location, and if it is not it will zoom to a default center point. 'geoB' is a button that toggles the geolocation function:

                              map.addOneTimeEventListener('locationfound', function (e){
                  
                              console.log("get to located found?");           
                              map.setView(L.latLng(e.latitude, e.longitude), 14);
                              var geo = document.getElementById('geoB');
                              var state = geo.classList.toggle('toggleState');
                          }, this);
                  
                  
                  
                          map.on('locationerror', function(e){
                              console.log("get to located error?");
                              map.setView(L.latLng(40.6889, -73.9444), 14);
                              map.stopLocate();
                          }, this);
                  

                  我向 Leaflet-map 元素添加了另一個功能,以便我可以將當??前緯度和經度傳遞給元素并縮放到該點,點擊地理定位按鈕:

                  I added another function to the leaflet-map element so that I can pass the current latitude and longitude to the element and zoom to that point, on the click on the geolocation button:

                      setToPoint: function(newLat, newLong){
                          if (this.map && !this._ignoreViewChange) {
                              this.async(function() {
                                 this.map.setView(L.latLng(newLat, newLong), this.zoom, {pan: {animate: true}});
                                 this.map.invalidateSize();
                             });
                  
                          }
                  
                      },
                  

                  最后,這個函數在 geoButton 元素的事件監聽器中被調用,它引用了 leaflet-geolocation 元素:

                  Finally, this function is called in an event listener in the geoButton element, which references the leaflet-geolocation element:

                  nycmap.setToPoint(locator.latitude, locator.longitude);
                  

                  這篇關于如何將 map.locate 與 Polymer 1.0/leaflet-map 1.0 一起使用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  Trigger click on leaflet marker(觸發點擊傳單標記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                  <tfoot id='vChxT'></tfoot>
                    <bdo id='vChxT'></bdo><ul id='vChxT'></ul>

                      • <legend id='vChxT'><style id='vChxT'><dir id='vChxT'><q id='vChxT'></q></dir></style></legend>

                        1. <small id='vChxT'></small><noframes id='vChxT'>

                          <i id='vChxT'><tr id='vChxT'><dt id='vChxT'><q id='vChxT'><span id='vChxT'><b id='vChxT'><form id='vChxT'><ins id='vChxT'></ins><ul id='vChxT'></ul><sub id='vChxT'></sub></form><legend id='vChxT'></legend><bdo id='vChxT'><pre id='vChxT'><center id='vChxT'></center></pre></bdo></b><th id='vChxT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='vChxT'><tfoot id='vChxT'></tfoot><dl id='vChxT'><fieldset id='vChxT'></fieldset></dl></div>
                            <tbody id='vChxT'></tbody>

                            主站蜘蛛池模板: 久久久国产一区二区三区 | 国产1区2区 | 欧美日韩在线观看一区 | 亚洲欧美日韩高清 | 国产福利小视频 | 亚洲区视频| 九九久久免费视频 | 五月婷婷中文 | 国产一区二区在线免费 | 日韩欧美在线观看一区 | 日韩成人免费在线视频 | 请别相信他免费喜剧电影在线观看 | 国产一区二区三区在线视频 | 国产精品欧美一区二区三区不卡 | 九九热精品视频 | 亚洲成人第一页 | 午夜一区二区三区在线观看 | 国产精品毛片无码 | 欧美精品影院 | 久久这里有精品 | 999久久久久久久久6666 | 日韩国产欧美一区 | 久久精品国产久精国产 | 久久精品国产一区二区电影 | 国产91丝袜在线熟 | av一区二区在线观看 | 久久国产激情视频 | 成人三级网址 | 久久久免费在线观看 | 免费国产视频 | 日本中文在线视频 | 免费在线a视频 | 亚洲视频二区 | 亚洲福利一区二区 | 成人在线视频观看 | 久久久一二三区 | 亚洲欧洲激情 | 国产视频一区二区 | 欧美综合久久久 | 天天综合干 | 国产欧美在线观看 |