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

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

      2. <legend id='ur0I7'><style id='ur0I7'><dir id='ur0I7'><q id='ur0I7'></q></dir></style></legend>
      3. 传单绘制删除按钮删除“全部清除"行动

        时间:2023-08-08

        <tfoot id='fGUfO'></tfoot>

        • <small id='fGUfO'></small><noframes id='fGUfO'>

            • <legend id='fGUfO'><style id='fGUfO'><dir id='fGUfO'><q id='fGUfO'></q></dir></style></legend>
              <i id='fGUfO'><tr id='fGUfO'><dt id='fGUfO'><q id='fGUfO'><span id='fGUfO'><b id='fGUfO'><form id='fGUfO'><ins id='fGUfO'></ins><ul id='fGUfO'></ul><sub id='fGUfO'></sub></form><legend id='fGUfO'></legend><bdo id='fGUfO'><pre id='fGUfO'><center id='fGUfO'></center></pre></bdo></b><th id='fGUfO'></th></span></q></dt></tr></i><div id='fGUfO'><tfoot id='fGUfO'></tfoot><dl id='fGUfO'><fieldset id='fGUfO'></fieldset></dl></div>
                <tbody id='fGUfO'></tbody>

                • <bdo id='fGUfO'></bdo><ul id='fGUfO'></ul>

                • 本文介绍了传单绘制删除按钮删除“全部清除"行动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  如何从 leaflet-draw 编辑工具栏?

                  How can I remove the "clear all" action from the delete button in the leaflet-draw edit toolbar?

                  我知道您可以删除整个 删除 按钮,但仍需要删除单个项目.基本上是在寻找一种方法来防止用户从地图中删除每个项目.

                  I know you can remove the whole delete button but still need to remove individual items. Basically looking for a way to prevent the user from deleting every item from the map.

                  推荐答案

                  编辑工具栏测试按钮处理程序上是否存在 removeAllLayers 成员.因此,禁用清除所有操作的一种简单但可能很笨拙的方法是在 L.EditToolbar.Delete 模块上使用 removeAllLayers:

                  The edit toolbar tests the existence of a removeAllLayers member on the button handler. So, a simple but probably heavy handed way to disable the clear all action is to nuke removeAllLayers on the L.EditToolbar.Delete module:

                  L.EditToolbar.Delete.include({
                      removeAllLayers: false
                  });
                  
                  new L.Control.Draw({
                      edit: {
                          featureGroup: drawnItems
                      },
                      draw: {
                      }
                  }).addTo(map);
                  

                  还有一个演示

                  var map = L.map(document.getElementById('map'), {zoomControl: false}).setView([48.8583736, 2.2922926], 15);
                  
                  L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
                      attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
                  }).addTo(map);
                  
                  var drawnItems = new L.geoJson().addTo(map);
                  
                  map.on(L.Draw.Event.CREATED, function (event) {
                      var layer = event.layer;
                      drawnItems.addLayer(layer);
                  });
                  
                  
                  
                  L.EditToolbar.Delete.include({
                      removeAllLayers: false
                  });
                  
                  new L.Control.Draw({
                      edit: {
                          featureGroup: drawnItems
                      },
                      draw: {
                          polygon: false,
                          rectangle: false,
                          circlemarker: false
                      }
                  }).addTo(map);

                  html, body {
                    height: 100%;
                    margin: 0;
                  }
                  #map {
                    width: 100%;
                    height: 100%;
                  }

                  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css" integrity="sha512-M2wvCLH6DSRazYeZRIm1JnYyh22purTM+FDB5CsyxtQJYeKq83arPe5wgbNmcFXGqiSH2XR8dT/fJISVA1r/zQ==" crossorigin=""/>
                      <script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js" integrity="sha512-lInM/apFSqyy1o6s89K4iQUKg6ppXEgsVxT35HbzUupEVRh2Eu9Wdl4tHj7dZO0s1uvplcYGmt3498TtHq+log==" crossorigin=""></script>
                      
                  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.12/leaflet.draw.css" />
                  <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.12/leaflet.draw.js"></script>
                  
                  <div id='map'></div>

                  这篇关于传单绘制删除按钮删除“全部清除"行动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何包含“leaflet.css"在带有 webpack 的 React 应 下一篇:Leaflet JS - 实现手势处理以强制 2 手指滚动

                  相关文章

                  最新文章

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

                    <tfoot id='72CmJ'></tfoot>
                  1. <legend id='72CmJ'><style id='72CmJ'><dir id='72CmJ'><q id='72CmJ'></q></dir></style></legend>

                      <small id='72CmJ'></small><noframes id='72CmJ'>

                        <bdo id='72CmJ'></bdo><ul id='72CmJ'></ul>