Skip to content

Commit

Permalink
Added screenshot function
Browse files Browse the repository at this point in the history
  • Loading branch information
kayecandy committed Aug 5, 2019
1 parent 80ba76a commit df5bbba
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cndce-configurator.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ $.fn.extend({
var $selectionsContainer = $('.cndce-selection-table tbody', $container);
var $selectionItemTemplate = $('.cndce-selection.cndce-template', $selectionsContainer);

var $screenshotLink = $('#cndce-screenshot-link', $container);


function downloadScreenshot(){
renderer.render(scene, camera);
$screenshotLink[0].href = canvas.toDataURL();
$screenshotLink[0].click();
}

function getTemplate($template){
var $clone = $template.clone(true);
Expand Down Expand Up @@ -377,6 +385,7 @@ $.fn.extend({
}

function onModelLoad(e){
$container.focus();
$container.addClass('model-loaded');
}

Expand Down Expand Up @@ -550,9 +559,18 @@ $.fn.extend({
});


// Screenshots
$container.keyup(function(e){
if(e.key == 'p'){
downloadScreenshot();
}
})



;(function init(){


// Param Set Defaults
params = getDefaults(params, defaults);

Expand All @@ -566,6 +584,8 @@ $.fn.extend({
initModel();
initOptions();



})();
}
})

0 comments on commit df5bbba

Please sign in to comment.