Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcoder committed May 6, 2020
2 parents aaac975 + f206940 commit 6e1474c
Show file tree
Hide file tree
Showing 5 changed files with 607 additions and 725 deletions.
8 changes: 8 additions & 0 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,19 @@ function initDemo() {
evt.stopPropagation()
evt.preventDefault()
evt.dataTransfer.dropEffect = 'copy'
document.body.className = "dragging";
});

preview.canvas.addEventListener('dragleave', function(evt) {
evt.stopPropagation()
evt.preventDefault()
document.body.className = "";
});

preview.canvas.addEventListener('drop', function(evt) {
evt.stopPropagation()
evt.preventDefault()
document.body.className = "";
const files = evt.dataTransfer.files
const file = files[0]
loadGCode(file);
Expand Down
32 changes: 24 additions & 8 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
<head>
<title>GCode Preview 2.0 -- Written by Remco Veldkamp</title>
<title>GCode Preview 2.0 -- Preview a 3d print from a gcode file</title>
<link rel="stylesheet" href="style.css" />
</head>

<body>
<div class="dnd">☝️ Drop a gcode file here to view it</div>
<div class="version-box"><a href="https://www.npmjs.com/package/gcode-preview">
<img src="http://img.shields.io/npm/v/gcode-preview.svg?style=flat"/>
</a></div>
<div class="sidebar">
<div>
<h1>GCode Preview 2.0</h1>
<h1>GCode Preview</h1>
<h2 class="description">Preview a 3d print from a gcode file</h2>
<br>
<section>
<a id="file-name"></a>

file <a id="file-name">loading..</a>
<div id="layer-count"></div>
<div id="file-size"></div>
</section>
Expand All @@ -33,20 +40,29 @@ <h1>GCode Preview 2.0</h1>
</div>
<div>
<section>
<br>
<div>
<a href="https://github.com/remcoder/gcode-preview">Github</a>

</div>
<div>
<a href="https://github.com/remcoder/gcode-preview">Github repo</a>
</div>
<br>
<div>
<a
href="https://github.com/remcoder/gcode-preview/archive/master.zip"
>Download</a
>
>Download stable</a>
</div>
<div>
<a
href="https://github.com/remcoder/gcode-preview/archive/develop.zip"
>Download latest</a>
</div>
</section>
<section>
<div>MIT License</div>
<div>Copyright 2019</div>
<div><a href="http://twitter.com/remcoder">Remco Veldkamp</a></div>
<div>Copyright 2020</div>
<div><a href="http://github.com/remcoder">Remco Veldkamp</a></div>
</section>
</div>
</div>
Expand Down
52 changes: 51 additions & 1 deletion demo/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,54 @@ body {
display: flex;
flex-direction: column;
justify-content: space-between;
transform: translateZ(0);
}

.description {
font-size: 100%;
font-weight: normal;
margin: 0;
}

.dnd {
position: absolute;
bottom: 10px;
right: 15px;
padding: 10px;
color: #808080;

animation: slideInUp .3s ease-out;
animation-delay: 2s;
animation-fill-mode: backwards;
}

@keyframes slideInUp {
from {
transform: translate3d(0, 100%, 0);
visibility: visible;
}

to {
transform: translate3d(0, 0, 0);
}
}

.version-box {
position: absolute;
top: 0;
right: 0;
padding: 10px;
color: #808080;
transform: translateZ(0);
filter: grayscale(1);
}

.version-box a {
color: #808080;
text-decoration: none;
}


.controls {
display: flex;
justify-content: space-between;
Expand All @@ -29,7 +75,7 @@ body {
}

h1 {
font-size: 120%;
font-size: 160%;
margin: 0 0 20px 0;
font-weight: normal;
}
Expand All @@ -55,3 +101,7 @@ a {
width: 100%;
height: 100%;
}

.dragging #renderer canvas {
opacity: 0.7;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gcode-preview",
"version": "2.0.5",
"description": "Render a 3d print model from a gcode file",
"description": "Preview a 3d print from a gcode file",
"author": "[email protected]",
"license": "MIT",
"repository": {
Expand Down
Loading

0 comments on commit 6e1474c

Please sign in to comment.