保存从包含多边形的Google地图创建的画布时,正在裁剪多边形的位置 - Example。
多边形线和折线正在被剪裁,这个问题在地图中看不到,只是在通过html2canvas保存图像时。
// Setup vars
var $this = $(this),
$mapContainer = $('#area-map .gm-style div:first'),
$input = $('input[name="map_image_data"]')
// Run HTML2Canvas to convert map to data image
html2canvas($mapContainer, {
proxy : 'html2canvasproxy.php',
useCORS : false,
logging : true,
onrendered: function(canvas) {
var dataURL = canvas.toDataURL();
$input.val(dataURL);
}
});
html2canvas日志输出:
html2canvas: Preload starts: finding background-images
html2canvas: Preload: Finding images
html2canvas: Preload: Done.
html2canvas: start: images: 1 / 9 (failed: 0)
html2canvas: start: images: 2 / 9 (failed: 0)
html2canvas: start: images: 3 / 9 (failed: 0)
html2canvas: start: images: 4 / 9 (failed: 0)
html2canvas: start: images: 5 / 9 (failed: 0)
html2canvas: start: images: 6 / 9 (failed: 0)
html2canvas: start: images: 7 / 9 (failed: 0)
html2canvas: start: images: 8 / 9 (failed: 0)
html2canvas: start: images: 9 / 9 (failed: 0)
Finished loading images: # 9 (failed: 0)
html2canvas: Renderer: Canvas renderer done - returning canvas obj
我一直试图将多边形移动到另一个地图窗格,但没有任何运气。