This commit is contained in:
peteruithoven 2014-01-17 16:27:15 +01:00
parent 74b9149175
commit cb857ae6fe
3 changed files with 0 additions and 133 deletions

View File

@ -1,42 +0,0 @@
/*
* This file is part of the Doodle3D project (http://doodle3d.com).
*
* Copyright (c) 2013, Doodle3D
* This software is licensed under the terms of the GNU GPL v2 or later.
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
*/
var keyboardShortcutsEnabled = true;
function initKeyboard() {
$(document).keypress(function(event) {
if (!keyboardShortcutsEnabled) return;
var ch = String.fromCharCode(event.which);
switch (ch) {
case 'c': clearDoodle(); break;
case 'n': clearDoodle(); break;
case 'p': print(); break;
case 'u': oopsUndo(); break;
case 'e': settingsWindow.downloadGcode(); break;
case 'q': stopPrint(); break;
case ',': openSettingsWindow(); break;
case 'C': drawCircle(250,180,80,64); break; //x,y,r,res
case 'T': drawCircle(250,180,80,3); break; //triangle
case 'X': drawCircle(250,180,80,6); break; //hexagon
case 'h': previewUp(true); break;
case 'H': previewDown(true); break;
case 's': saveSketch(); break;
case 'L': nextDoodle(); break;
case 'l': prevDoodle(); break;
case '[': previewTwistLeft(); break;
case ']': previewTwistRight(); break;
case '\'': resetTwist(); break;
default: console.log("Key: '" + ch + "' (" + event.which + ")");
}
})
}

View File

@ -1,42 +0,0 @@
/*
* This file is part of the Doodle3D project (http://doodle3d.com).
*
* Copyright (c) 2013, Doodle3D
* This software is licensed under the terms of the GNU GPL v2 or later.
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
*/
function drawCircle(x0,y0,r,res) {
if (res==undefined) res = 50; //circle resolution
beginShape();
var step=Math.PI * 2.0 / res;
for (var a=0; a<=Math.PI*2; a+=step) {
var x = Math.sin(a) * r + x0;
var y = Math.cos(a) * r + y0;
if (a==0) shapeMoveTo(x,y);
else shapeLineTo(x,y);
}
endShape();
}
function beginShape(x,y) {
setSketchModified(true);
}
function shapeMoveTo(x,y) {
_points.push([x, y, true]);
adjustBounds(x, y)
adjustPreviewTransformation();
draw(x, y, .5);
}
function shapeLineTo(x,y) {
_points.push([x, y, false]);
adjustBounds(x, y)
adjustPreviewTransformation();
draw(x, y);
}
function endShape() {
renderToImageDataPreview();
}

View File

@ -1,49 +0,0 @@
/*
* This file is part of the Doodle3D project (http://doodle3d.com).
*
* Copyright (c) 2013, Doodle3D
* This software is licensed under the terms of the GNU GPL v2 or later.
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
*/
var VERTICALSHAPE;
var verticalShapes = {
"NONE": 'none',
"DIVERGING": 'diverging',
"CONVERGING": 'converging',
"SINUS": 'sinus'
};
function initVerticalShapes() {
// TODO give these vertical shapes a better spot
VERTICALSHAPE = verticalShapes.NONE;
$(".verticalShapes, .straight").on('mouseup touchend', function(e) {
e.preventDefault();
console.log("diverging");
VERTICALSHAPE = verticalShapes.NONE;
redrawRenderedPreview();
})
$(".verticalShapes, .diverging").on('mouseup touchend', function(e) {
e.preventDefault();
console.log("diverging");
VERTICALSHAPE = verticalShapes.DIVERGING;
redrawRenderedPreview();
})
$(".verticalShapes, .converging").on('mouseup touchend', function(e) {
e.preventDefault();
console.log("converging");
VERTICALSHAPE = verticalShapes.CONVERGING;
redrawRenderedPreview();
})
$(".verticalShapes, .sinus").on('mouseup touchend', function(e) {
e.preventDefault();
console.log("sinus");
VERTICALSHAPE = verticalShapes.SINUS;
redrawRenderedPreview();
})
}
function resetVerticalShapes() {
VERTICALSHAPE = verticalShapes.NONE;
}