Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions octoprint_prettygcode/static/js/prettygcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ $(function () {
var terminalGcodeProxy;//todo remove(prob not used anymore). used to display gcode actualy sent to printer.
var cubeCamera;//todo make reflections optional.
var nozzleModel;
var highlightMaterial;

var clock;
var dimensionsGroup;
Expand Down Expand Up @@ -910,9 +911,7 @@ $(function () {
//color: new THREE.Color(curColorHex),// rainbow.getColor(layers.length % 64).getHex()
vertexColors: THREE.VertexColors,
});
//todo. handle window resize
// curMaterial.resolution.set(gcodeWid, gcodeHei);
curMaterial.resolution.set(500, 500);
curMaterial.resolution.set(gcodeWid, gcodeHei);

//for plain lines
var curLineBasicMaterial = new THREE.LineBasicMaterial( {
Expand Down Expand Up @@ -942,9 +941,12 @@ $(function () {
if(gcodeGroup){
for (var i = gcodeGroup.children.length - 1; i >= 0; i--) {
gcodeGroup.remove(gcodeGroup.children[i]);
}
}
}
}
this.setResolution = function(w, h) {
curMaterial.resolution.set(w, h);
}
easeOutBounce= function (t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
Expand Down Expand Up @@ -1112,7 +1114,7 @@ $(function () {
if (child.name.startsWith("layer#")) {
var filePositions=child.userData.filePositions;
var fpMin=filePositions[0];
var fpMax = filePositions[filePositions.length];
var fpMax = filePositions[filePositions.length - 1];
if (fpMax<filePosition) { //way before.
child.visible = true;

Expand Down Expand Up @@ -1661,7 +1663,9 @@ $(function () {
gcodeWid = width;
gcodeHei = height;
cameraControls.setViewport(0, 0, width, height);
return true;//update needed.
if(gcodeProxy) gcodeProxy.setResolution(width, height);
if(highlightMaterial) highlightMaterial.resolution.set(width, height);
return true;//update needed.
}
return false;//no update needed
}
Expand Down Expand Up @@ -1742,18 +1746,13 @@ $(function () {
var firstFrame=true; /*possible bug fix. this might not be needed.*/

//material for fatline highlighter
var highlightMaterial = undefined;

if(pgSettings.fatLines)
{
highlightMaterial=new THREE.LineMaterial({
linewidth: 4, // in pixels
//transparent: true,
//opacity: 0.5,
//color: new THREE.Color(curColorHex),// rainbow.getColor(layers.length % 64).getHex()
vertexColors: THREE.VertexColors,
});
highlightMaterial.resolution.set(500, 500);
highlightMaterial.resolution.set(gcodeWid, gcodeHei);
}else{
//highlightMaterial=
}
Expand Down
10 changes: 2 additions & 8 deletions octoprint_prettygcode/templates/prettygcode_navbar.jinja2
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@


<!--<a id="injector_link" href="#">PrettyGCode 0.1</a>
<script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="https://code.jquery.com/ui/1.11.1/jquery-ui.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>-->


{% autoescape true %}
{% endautoescape %}
5 changes: 3 additions & 2 deletions octoprint_prettygcode/templates/prettygcode_tab.jinja2
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% autoescape true %}
<div id="sexygcode" style="height:800px">
<div class='gwin' id='gwin' style=''>
<canvas id='mycanvas' style='width:100%;height:100%'></canvas>
Expand Down Expand Up @@ -90,7 +91,7 @@ Additional CSS:</h5><button class="btn btn-primary" data-bind="click: updateCss"
Discussion:</h4>
<a id="fs_link" href="https://community.octoprint.org/t/wip-prettygcode-viewer/">PrettyGCode discussion on OctoPrint forums</a>

</div>

</div>

{% endautoescape %}