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

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

<legend id='Vd9GD'><style id='Vd9GD'><dir id='Vd9GD'><q id='Vd9GD'></q></dir></style></legend>

    <tfoot id='Vd9GD'></tfoot>

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

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

        html2canvas 捕獲除內部畫布內容之外的所有內容

        html2canvas captures everything except the content of an inner canvas(html2canvas 捕獲除內部畫布內容之外的所有內容)

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

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

                  <legend id='PKwWA'><style id='PKwWA'><dir id='PKwWA'><q id='PKwWA'></q></dir></style></legend>
                  本文介紹了html2canvas 捕獲除內部畫布內容之外的所有內容的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一張通過leaflet 渲染的地圖.

                  I've got a map rendered by means of leaflet.

                  我需要使用 html2canvas 對該地圖進行截圖.

                  I need to make a screenshot of that map by using html2canvas.

                  要使用html2canvas,我需要提供一個要捕獲的DOM 元素(elementToCapture)和一個可選配置(??html2canvasConfiguration).

                  To make use of html2canvas, I need to provide a DOM element to capture (elementToCapture) and an optional configuration (html2canvasConfiguration).

                  var html2canvasConfiguration = {
                      useCORS: true,
                      width: map._size.x,
                      height: map._size.y,
                      backgroundColor: null,
                      logging: true,
                      imageTimeout: 0
                  };
                  
                  var elementToCapture = map._container.getElementsByClassName('leaflet-pane leaflet-map-pane')[0];
                  html2canvas(elementToCapture, html2canvasConfiguration).then(function (canvas) {
                      var link = document.createElement('a');
                      link.download = 'test.png';
                      link.href = canvas.toDataURL();
                      link.click();
                      link.remove();
                  })
                  

                  我通過 leaflet-pane leaflet-map-pane 類提取了一個元素,它基本上代表了整個地圖,包括控件(放大/縮小按鈕、比例等)、自定義標記、工具提示、疊加層、彈出窗口.

                  I extract an element by the leaflet-pane leaflet-map-pane class, which basically represents the whole map including controls (zoom in/out buttons, scale, etc), custom markers, tooltips, overlays, popups.

                  整個 DOM 看起來像

                  The entire DOM looks like

                  <div class="leaflet-pane leaflet-map-pane">
                      <div class="leaflet-pane leaflet-tile-pane">
                          <div class="leaflet-gl-layer mapboxgl-map">
                              <div class="mapboxgl-canvas-container">
                                  <canvas class="mapboxgl-canvas leaflet-image-layer leaflet-zoom-animated"></canvas>
                              </div>
                              <div class="mapboxgl-control-container"></div>
                          </div>
                      </div>
                      <div class="leaflet-pane leaflet-shadow-pane"></div>
                      <div class="leaflet-pane leaflet-overlay-pane"></div>
                      <div class="leaflet-pane leaflet-marker-pane"></div>
                      <div class="leaflet-pane leaflet-tooltip-pane"></div>
                      <div class="leaflet-pane leaflet-popup-pane"></div>
                  <div class="leaflet-control-container"></div>
                  

                  我遇到的問題是 leaflet-pane leaflet-tile-pane 元素(尤其是內部 canvas 的內容)沒有被 <捕獲代碼>html2canvas.簡而言之,我在地圖上看到的所有內容,但我看不到地圖本身.

                  The problem I've faced is the leaflet-pane leaflet-tile-pane element (particularly the content of the inner canvas) doesn't get captured by html2canvas. To put it simply, I see everything on the map, but I don't see the map itself.

                  更新 1:

                  我目前使用的版本是1.0.0-rc.1(最新的).

                  The version I am currently using is 1.0.0-rc.1 (the latest one).

                  更新 2:

                  畫布的本質是webgl.可能是問題嗎?根據 this,他們確實支持 webgl 畫布.

                  The nature of the canvas is webgl. Might it be the issue? According to this, they do support webgl canvases.

                  更新 3:

                  我嘗試以編程方式獲取畫布并在其上調用 toDataURL.即使使用 preserveDrawingBuffer hack,它也會導致屏幕截圖為空.

                  I tried to obtain the canvas programmatically and call toDataURL on it. It resulted in an empty screenshot, even with the preserveDrawingBuffer hack.

                  更新 4:

                  奇怪的是,它不僅僅捕捉某些畫布.我創建了一個 2d 畫布(通過將 preferCanvas 添加到地圖配置)并顯示出來了.

                  Oddly enough, it doesn't capture only certain canvases. I've created a 2d canvas (by adding preferCanvas to map configuration) and it got shown.

                  推薦答案

                  試試這個,將它添加到頁面頂部,在任何其他腳本之前

                  Try this, add this to the top of your page, before any other scripts

                  <script>
                  HTMLCanvasElement.prototype.getContext = function(origFn) {
                    return function(type, attribs) {
                      attribs = attribs || {};
                      attribs.preserveDrawingBuffer = true;
                      return origFn.call(this, type, attribs);
                    };
                  }(HTMLCanvasElement.prototype.getContext);
                  </script>
                  

                  有幫助嗎?

                  這篇關于html2canvas 捕獲除內部畫布內容之外的所有內容的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 圖層控件添加到側邊欄)

                  <small id='8RpUJ'></small><noframes id='8RpUJ'>

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

                      1. <legend id='8RpUJ'><style id='8RpUJ'><dir id='8RpUJ'><q id='8RpUJ'></q></dir></style></legend>
                        • <bdo id='8RpUJ'></bdo><ul id='8RpUJ'></ul>
                              <tbody id='8RpUJ'></tbody>
                            <tfoot id='8RpUJ'></tfoot>

                          • 主站蜘蛛池模板: 91电影在线播放 | 久久夜视频| 欧美日韩在线免费观看 | 成人午夜网站 | 精品国产一区二区三区四区在线 | 日韩影音 | 91在线精品秘密一区二区 | 成人欧美一区二区三区在线播放 | 亚洲性视频在线 | 91在线资源| 国产欧美日韩一区二区三区在线 | 国产美女一区二区 | 亚洲综合区| 国产精品亚洲综合 | 午夜视频在线观看网站 | 欧美一区免费 | 91在线看视频 | 国产精品 欧美精品 | 国产精品久久久久久久7电影 | 一本色道精品久久一区二区三区 | 久久久久久久久久久久久91 | 成人欧美一区二区三区视频xxx | 国产精品一区二区三区在线 | 亚洲精品久久久久久久久久久 | 日本不卡免费新一二三区 | 日韩小视频 | 中文字幕国产精品 | 激情欧美一区二区三区中文字幕 | 粉嫩av | 国产精品久久久久久久久久久免费看 | 亚洲国产高清在线观看 | 国产精品av久久久久久久久久 | 武道仙尊动漫在线观看 | 久久久免费电影 | 久久精品综合 | 欧美福利 | 日韩视频免费看 | 国产综合精品一区二区三区 | 欧美二三区 | 中文字幕在线一区二区三区 | 成人做爰69片免费观看 |