Skip to content
This repository has been archived by the owner on Jan 6, 2021. It is now read-only.

Commit

Permalink
Use downloadjs.
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Nov 20, 2017
1 parent fc82f01 commit caa46e5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -20,6 +20,7 @@
"budo": "^10.0.4"
},
"dependencies": {
"downloadjs": "^1.4.7",
"three": "^0.88.0",
"three-vignette-background": "^1.0.3"
}
Expand Down
8 changes: 2 additions & 6 deletions src/index.js
Expand Up @@ -4,6 +4,7 @@ const Tree = require('../lib/proctree');
const dat = require('../lib/dat.gui.min');
const DEFAULT_CONFIG = require('./config');
const Viewer = require('./viewer');
const download = require('downloadjs');

class App {
constructor (el) {
Expand Down Expand Up @@ -119,12 +120,7 @@ class App {
exporter.parse(this.viewer.getTree(), (buffer) => {

const blob = new Blob([buffer], {type: 'application/octet-stream'});
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'tree.glb';
link.click();

setTimeout(() => URL.revokeObjectURL(link.href), 1000);
download(blob, 'tree.glb', {type: 'application/octet-stream'});

}, {binary: true});
}
Expand Down
2 changes: 2 additions & 0 deletions src/viewer.js
Expand Up @@ -28,6 +28,8 @@ class Viewer {
this.controls.autoRotate = true;
this.controls.autoRotateSpeed = -5;
this.controls.enablePan = false;
this.controls.minDistance = 1;
this.controls.maxDistance = 90;

this.background = createVignetteBackground({
aspect: this.camera.aspect,
Expand Down
4 changes: 3 additions & 1 deletion style.css
@@ -1,4 +1,6 @@
html {
html,
body {
overflow: hidden;
font-family: Raleway, Helvetica, sans-serif;
font-weight: 300;
}
Expand Down

0 comments on commit caa46e5

Please sign in to comment.