mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Added timer/statistics for rendering
This commit is contained in:
@@ -13,18 +13,28 @@
|
||||
|
||||
new html2canvas(this.get(0), {
|
||||
logging: true,
|
||||
ready: function(canvas) {
|
||||
ready: function(renderer) {
|
||||
|
||||
var finishTime = new Date();
|
||||
// console.log((finishTime.getTime()-timer)/1000);
|
||||
|
||||
|
||||
document.body.appendChild(renderer.canvas);
|
||||
|
||||
document.body.appendChild(canvas);
|
||||
var canvas = $(canvas);
|
||||
|
||||
|
||||
var canvas = $(renderer.canvas);
|
||||
canvas.css('position','absolute')
|
||||
.css('left',0).css('top',0);
|
||||
|
||||
|
||||
|
||||
// $('body').append(canvas);
|
||||
$(canvas).siblings().toggle();
|
||||
|
||||
throwMessage('Screenshot created in '+ ((finishTime.getTime()-timer)/1000) + " seconds<br />Total of "+renderer.numDraws+" draws performed",4000);
|
||||
|
||||
|
||||
$(window).click(function(){
|
||||
if (!canvas.is(':visible')){
|
||||
$(canvas).toggle().siblings().toggle();
|
||||
@@ -42,15 +52,16 @@
|
||||
});
|
||||
|
||||
|
||||
function throwMessage(msg){
|
||||
function throwMessage(msg,duration){
|
||||
|
||||
window.clearTimeout(timeoutTimer);
|
||||
timeoutTimer = window.setTimeout(function(){
|
||||
message.fadeOut(function(){
|
||||
message.remove();
|
||||
});
|
||||
},2000);
|
||||
},duration || 2000);
|
||||
$(message).remove();
|
||||
message = $('<div />').text(msg).css({
|
||||
message = $('<div />').html(msg).css({
|
||||
margin:0,
|
||||
padding:10,
|
||||
background: "#000",
|
||||
@@ -64,6 +75,7 @@
|
||||
borderRadius:12,
|
||||
width:'auto',
|
||||
height:'auto',
|
||||
textAlign:'center',
|
||||
textDecoration:'none'
|
||||
}).hide().fadeIn().appendTo('body');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user