mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Add google maps test
This commit is contained in:
parent
6d01d29b27
commit
998bfb496e
4
dist/html2canvas.js
vendored
4
dist/html2canvas.js
vendored
@ -1001,8 +1001,8 @@ ImageLoader.prototype.fetch = function(nodes) {
|
|||||||
this.images.forEach(function(image, index) {
|
this.images.forEach(function(image, index) {
|
||||||
image.promise.then(function() {
|
image.promise.then(function() {
|
||||||
log("Succesfully loaded image #"+ (index+1));
|
log("Succesfully loaded image #"+ (index+1));
|
||||||
}, function() {
|
}, function(e) {
|
||||||
log("Failed loading image #"+ (index+1));
|
log("Failed loading image #"+ (index+1), e);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.ready = Promise.all(this.images.map(this.getPromise));
|
this.ready = Promise.all(this.images.map(this.getPromise));
|
||||||
|
2
dist/html2canvas.min.js
vendored
2
dist/html2canvas.min.js
vendored
File diff suppressed because one or more lines are too long
@ -114,8 +114,8 @@ ImageLoader.prototype.fetch = function(nodes) {
|
|||||||
this.images.forEach(function(image, index) {
|
this.images.forEach(function(image, index) {
|
||||||
image.promise.then(function() {
|
image.promise.then(function() {
|
||||||
log("Succesfully loaded image #"+ (index+1));
|
log("Succesfully loaded image #"+ (index+1));
|
||||||
}, function() {
|
}, function(e) {
|
||||||
log("Failed loading image #"+ (index+1));
|
log("Failed loading image #"+ (index+1), e);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.ready = Promise.all(this.images.map(this.getPromise));
|
this.ready = Promise.all(this.images.map(this.getPromise));
|
||||||
|
41
tests/cases/google-maps.html
Normal file
41
tests/cases/google-maps.html
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head lang="en">
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>google maps</title>
|
||||||
|
<script>
|
||||||
|
var dontRun = true;
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript" src="../test.js"></script>
|
||||||
|
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
|
||||||
|
<style>
|
||||||
|
#map {
|
||||||
|
width: 100%;
|
||||||
|
height: 500px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
body, html {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h2>Google maps</h2>
|
||||||
|
<div id="map"></div>
|
||||||
|
<script>
|
||||||
|
var mapOptions = { zoom: 13, center: new google.maps.LatLng(60.1656623, 24.9477731) };
|
||||||
|
var map = new google.maps.Map(document.querySelector('#map'), mapOptions);
|
||||||
|
google.maps.event.addListenerOnce(map, 'idle', function(){
|
||||||
|
if (typeof(window.run) === "function") {
|
||||||
|
window.run();
|
||||||
|
} else {
|
||||||
|
dontRun = undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -115,13 +115,17 @@ var h2cSelector, h2cOptions;
|
|||||||
window.setUp();
|
window.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
window.run = function() {
|
||||||
$(h2cSelector).html2canvas($.extend({
|
$(h2cSelector).html2canvas($.extend({
|
||||||
logging: true,
|
logging: true,
|
||||||
profile: true,
|
profile: true,
|
||||||
proxy: "http://localhost:8082",
|
proxy: "http://localhost:8082",
|
||||||
useCORS: false
|
useCORS: false
|
||||||
}, h2cOptions));
|
}, h2cOptions));
|
||||||
}, 100);
|
};
|
||||||
|
|
||||||
|
if (typeof(dontRun) === "undefined") {
|
||||||
|
setTimeout(window.run, 100);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}(document, window));
|
}(document, window));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user