Add google maps test

This commit is contained in:
Niklas von Hertzen 2014-09-27 20:20:08 +03:00
parent fa659ad1df
commit 1e19832171
5 changed files with 52 additions and 7 deletions

4
dist/html2canvas.js vendored
View File

@ -1001,8 +1001,8 @@ ImageLoader.prototype.fetch = function(nodes) {
this.images.forEach(function(image, index) {
image.promise.then(function() {
log("Succesfully loaded image #"+ (index+1));
}, function() {
log("Failed loading image #"+ (index+1));
}, function(e) {
log("Failed loading image #"+ (index+1), e);
});
});
this.ready = Promise.all(this.images.map(this.getPromise));

File diff suppressed because one or more lines are too long

View File

@ -114,8 +114,8 @@ ImageLoader.prototype.fetch = function(nodes) {
this.images.forEach(function(image, index) {
image.promise.then(function() {
log("Succesfully loaded image #"+ (index+1));
}, function() {
log("Failed loading image #"+ (index+1));
}, function(e) {
log("Failed loading image #"+ (index+1), e);
});
});
this.ready = Promise.all(this.images.map(this.getPromise));

View 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>

View File

@ -115,13 +115,17 @@ var h2cSelector, h2cOptions;
window.setUp();
}
setTimeout(function() {
window.run = function() {
$(h2cSelector).html2canvas($.extend({
logging: true,
profile: true,
proxy: "http://localhost:8082",
useCORS: false
}, h2cOptions));
}, 100);
};
if (typeof(dontRun) === "undefined") {
setTimeout(window.run, 100);
}
};
}(document, window));