mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 01:07:56 +01:00
Big changes to order and placement of JS files:
- grunt file updated to include automatic production of doodle3d-client.js and doodle3d-client.min.js - all individual JS files moved to outside scope of 'www' dir to reflect these changes
This commit is contained in:
parent
90e00913ab
commit
f0f97198ec
57
Gruntfile.js
57
Gruntfile.js
@ -16,21 +16,22 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
dist: {
|
dist: {
|
||||||
src: [
|
src: [
|
||||||
'www/js/SettingsWindow.js',
|
'js_src/SettingsWindow.js',
|
||||||
'www/js/d3dServerInterfacing.js',
|
'js_src/UpdatePanel.js',
|
||||||
'www/js/verticalShapes.js',
|
'js_src/d3dServerInterfacing.js',
|
||||||
'www/js/buttonbehaviors.js',
|
'js_src/verticalShapes.js',
|
||||||
'www/js/canvasDrawing.js',
|
'js_src/buttonbehaviors.js',
|
||||||
'www/js/previewRendering.js',
|
'js_src/canvasDrawing.js',
|
||||||
'www/js/gcodeGenerating.js',
|
'js_src/previewRendering.js',
|
||||||
'www/js/init_layout.js',
|
'js_src/gcodeGenerating.js',
|
||||||
'www/js/Printer.js',
|
'js_src/init_layout.js',
|
||||||
'www/js/Progressbar.js',
|
'js_src/Printer.js',
|
||||||
'www/js/Thermometer.js',
|
'js_src/Progressbar.js',
|
||||||
'www/js/utils.js',
|
'js_src/Thermometer.js',
|
||||||
'www/js/sidebar.js',
|
'js_src/utils.js',
|
||||||
'www/js/message.js',
|
'js_src/sidebar.js',
|
||||||
'www/js/main.js'
|
'js_src/Message.js',
|
||||||
|
'js_src/main.js'
|
||||||
],
|
],
|
||||||
dest: 'www/js/<%= pkg.name %>.js'
|
dest: 'www/js/<%= pkg.name %>.js'
|
||||||
}
|
}
|
||||||
@ -38,15 +39,21 @@ module.exports = function(grunt) {
|
|||||||
uglify: {
|
uglify: {
|
||||||
options: {
|
options: {
|
||||||
// banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
|
// banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
|
||||||
mangle: false,
|
mangle: true,
|
||||||
beautify: false,
|
beautify: false,
|
||||||
compress: {},
|
compress: {},
|
||||||
report: 'min',
|
report: 'min',
|
||||||
preserveComments: 'false'
|
preserveComments: 'false'
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
src: ['www/js/*.js', '!www/js/<%= pkg.name %>.min.js'],
|
files: {
|
||||||
dest: 'www/js/<%= pkg.name %>.min.js'
|
// 'www/js/<%= pkg.name %>.min.js' : ['www/js/*.js', '!www/js/<%= pkg.name %>.min.js', '!www/js/<%= pkg.name %>.js']
|
||||||
|
'www/js/<%= pkg.name %>.min.js' : ['www/js/<%= pkg.name %>.js']
|
||||||
|
}
|
||||||
|
// src: 'www/js/*.js',
|
||||||
|
// dest: 'www/js/min/blabla.js'
|
||||||
|
// src: ['www/js/*.js', '!www/js/<%= pkg.name %>.min.js'],
|
||||||
|
// dest: 'www/js/<%= pkg.name %>.min.js'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
jshint: {
|
jshint: {
|
||||||
@ -85,11 +92,11 @@ module.exports = function(grunt) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// javascript: {
|
javascript: {
|
||||||
// files: ["www/js/*", '!www/js/*.min.js'],
|
files: ["js_src/*", '!www/js/<%= pkg.name %>.min.js', '!www/js/<%= pkg.name %>.js'],
|
||||||
// // tasks: ["less", "css_prefix"]
|
tasks: ["concat", "uglify"]
|
||||||
// tasks: ["uglify"]
|
// tasks: ["jshint", "concat", "uglify"]
|
||||||
// },
|
},
|
||||||
styles: {
|
styles: {
|
||||||
files: ["less/*"],
|
files: ["less/*"],
|
||||||
tasks: ["less", "autoprefixer", "cssmin"]
|
tasks: ["less", "autoprefixer", "cssmin"]
|
||||||
@ -133,8 +140,8 @@ module.exports = function(grunt) {
|
|||||||
'less',
|
'less',
|
||||||
'autoprefixer',
|
'autoprefixer',
|
||||||
'cssmin',
|
'cssmin',
|
||||||
// 'concat',
|
'concat',
|
||||||
// 'uglify',
|
'uglify',
|
||||||
// 'jshint',
|
// 'jshint',
|
||||||
'watch'
|
'watch'
|
||||||
]);
|
]);
|
||||||
|
62
js_src/init_layout.js
Normal file
62
js_src/init_layout.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// TODO refactor this stuff, there's much to wipe
|
||||||
|
var drawAreaContainerMinHeight = 300;
|
||||||
|
var drawAreaContainerMaxHeight = 450;
|
||||||
|
|
||||||
|
function doOnResize() {
|
||||||
|
// console.log("doOnResize() >> " + new Date().getTime());
|
||||||
|
canvas.width = $canvas.width();
|
||||||
|
canvas.height = $canvas.height(); // canvas.clientHeight;
|
||||||
|
|
||||||
|
preview.width = $preview.width();
|
||||||
|
preview.height = $drawAreaContainer.height();
|
||||||
|
|
||||||
|
canvasWidth = canvas.width;
|
||||||
|
canvasHeight = canvas.height;
|
||||||
|
|
||||||
|
console.log(" preview.width: " + preview.width + ", $preview.width(): " + $preview.width());
|
||||||
|
|
||||||
|
calcPreviewCanvasProperties();
|
||||||
|
|
||||||
|
drawCanvasTopLeftCoords[0] = drawCanvas.offset().left;
|
||||||
|
drawCanvasTopLeftCoords[1] = drawCanvas.offset().top;
|
||||||
|
|
||||||
|
redrawDoodle();
|
||||||
|
redrawPreview();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function initLayouting() {
|
||||||
|
console.log("f:initLayouting()");
|
||||||
|
|
||||||
|
$drawAreaContainer = $(".drawareacontainer");
|
||||||
|
|
||||||
|
canvas.width = $canvas.width();
|
||||||
|
canvas.height = $canvas.height(); // canvas.clientHeight;
|
||||||
|
|
||||||
|
preview.width = $preview.width();
|
||||||
|
preview.height = $drawAreaContainer.height();
|
||||||
|
|
||||||
|
canvasWidth = canvas.width;
|
||||||
|
canvasHeight = canvas.height;
|
||||||
|
|
||||||
|
$drawAreaContainer.show();
|
||||||
|
|
||||||
|
// window.innerHeight
|
||||||
|
console.log("window.innerHeight: " + window.innerHeight);
|
||||||
|
console.log("window.innerWidth: " + window.innerWidth);
|
||||||
|
console.log("$drawAreaContainer.innerHeight(): " + $drawAreaContainer.innerHeight());
|
||||||
|
console.log("$drawAreaContainer.offset().top: " + $drawAreaContainer.offset().top);
|
||||||
|
|
||||||
|
// timeout because it SEEMS to be beneficial for initting the layout
|
||||||
|
// 2013-09-18 seems beneficial since when?
|
||||||
|
setTimeout(_startOrientationAndChangeEventListening, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _startOrientationAndChangeEventListening() {
|
||||||
|
// Initial execution if needed
|
||||||
|
|
||||||
|
$(window).on('resize', doOnResize);
|
||||||
|
|
||||||
|
// is it necessary to call these? Aren't they called by the above eventhandlers?
|
||||||
|
doOnResize();
|
||||||
|
}
|
@ -17,6 +17,9 @@ var wifiboxCGIBinURL; // CGI-bin, for some network stuff, where it needs to rest
|
|||||||
|
|
||||||
var $drawAreaContainer, $doodleCanvas, doodleCanvas, doodleCanvasContext, $previewContainer;
|
var $drawAreaContainer, $doodleCanvas, doodleCanvas, doodleCanvasContext, $previewContainer;
|
||||||
|
|
||||||
|
var showhideInterval;
|
||||||
|
var showOrHide = false;
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
console.log("ready");
|
console.log("ready");
|
||||||
|
|
||||||
@ -103,9 +106,6 @@ $(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var showhideInterval;
|
|
||||||
var showOrHide = false;
|
|
||||||
|
|
||||||
function showOrHideThermo() {
|
function showOrHideThermo() {
|
||||||
console.log("f:showOrHideThermo()");
|
console.log("f:showOrHideThermo()");
|
||||||
if (showOrHide) {
|
if (showOrHide) {
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "doodle3dclient",
|
"name": "doodle3d-client",
|
||||||
"version": "0.9.0",
|
"version": "0.9.0",
|
||||||
"description": "Doodle3D client app",
|
"description": "Doodle3D client app",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -130,22 +130,24 @@
|
|||||||
<img class="vertImage" src="img/bg_vertical.png"/>
|
<img class="vertImage" src="img/bg_vertical.png"/>
|
||||||
</div>
|
</div>
|
||||||
<script src="js/libs/jquery-1.8.3.min.js"></script>
|
<script src="js/libs/jquery-1.8.3.min.js"></script>
|
||||||
<script src="js/SettingsWindow.js"></script>
|
<script src="js/doodle3d-client.js"></script>
|
||||||
<script src="js/UpdatePanel.js"></script>
|
<!--<script src="js/doodle3d-client.min.js"></script>-->
|
||||||
<script src="js/d3dServerInterfacing.js"></script>
|
<!--<script src="js/SettingsWindow.js"></script>-->
|
||||||
<script src="js/verticalShapes.js"></script>
|
<!--<script src="js/UpdatePanel.js"></script>-->
|
||||||
<script src="js/buttonbehaviors.js"></script>
|
<!--<script src="js/d3dServerInterfacing.js"></script>-->
|
||||||
<script src="js/canvasDrawing.js"></script>
|
<!--<script src="js/verticalShapes.js"></script>-->
|
||||||
<script src="js/previewRendering.js"></script>
|
<!--<script src="js/buttonbehaviors.js"></script>-->
|
||||||
<script src="js/gcodeGenerating.js"></script>
|
<!--<script src="js/canvasDrawing.js"></script>-->
|
||||||
<script src="js/init_layout.js"></script>
|
<!--<script src="js/previewRendering.js"></script>-->
|
||||||
<script src="js/Printer.js"></script>
|
<!--<script src="js/gcodeGenerating.js"></script>-->
|
||||||
<script src="js/Progressbar.js"></script>
|
<!--<script src="js/init_layout.js"></script>-->
|
||||||
<script src="js/Thermometer.js"></script>
|
<!--<script src="js/Printer.js"></script>-->
|
||||||
<script src="js/utils.js"></script>
|
<!--<script src="js/Progressbar.js"></script>-->
|
||||||
<script src="js/sidebar.js"></script>
|
<!--<script src="js/Thermometer.js"></script>-->
|
||||||
<script src="js/Message.js"></script>
|
<!--<script src="js/utils.js"></script>-->
|
||||||
<script src="js/main.js"></script>
|
<!--<script src="js/sidebar.js"></script>-->
|
||||||
|
<!--<script src="js/Message.js"></script>-->
|
||||||
|
<!--<script src="js/main.js"></script>-->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
3392
www/js/doodle3d-client.js
Normal file
3392
www/js/doodle3d-client.js
Normal file
File diff suppressed because it is too large
Load Diff
2
www/js/doodle3d-client.min.js
vendored
Normal file
2
www/js/doodle3d-client.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,140 +0,0 @@
|
|||||||
// TODO refactor this stuff, there's much to wipe
|
|
||||||
var drawAreaContainerMinHeight = 300;
|
|
||||||
var drawAreaContainerMaxHeight = 450;
|
|
||||||
|
|
||||||
function doOnResize() {
|
|
||||||
// console.log("doOnResize() >> " + new Date().getTime());
|
|
||||||
// $(".container").css("height", window.innerHeight);
|
|
||||||
|
|
||||||
/* 2013-10-09 commented out -> no more need with new layouting
|
|
||||||
$drawAreaContainer.css("marginLeft", -$drawAreaContainer.width()/2);
|
|
||||||
$drawAreaContainer.css("marginTop", -$drawAreaContainer.height() *.45);
|
|
||||||
// $drawAreaContainer.css("marginTop", -parseInt($drawAreaContainer.css("height")) * 0.45);
|
|
||||||
//*/
|
|
||||||
|
|
||||||
// canvas.width = $drawAreaContainer.width() - preview.width; // canvas.clientWidth;
|
|
||||||
// canvas.width = $("#mycanvasContainer").width();
|
|
||||||
canvas.width = $canvas.width();
|
|
||||||
canvas.height = $canvas.height(); // canvas.clientHeight;
|
|
||||||
// canvas.height = $drawAreaContainer.height(); // canvas.clientHeight;
|
|
||||||
|
|
||||||
preview.width = $preview.width();
|
|
||||||
preview.height = $drawAreaContainer.height();
|
|
||||||
|
|
||||||
canvasWidth = canvas.width;
|
|
||||||
canvasHeight = canvas.height;
|
|
||||||
|
|
||||||
console.log(" preview.width: " + preview.width + ", $preview.width(): " + $preview.width());
|
|
||||||
|
|
||||||
calcPreviewCanvasProperties();
|
|
||||||
|
|
||||||
// layerOffsetY = preview.height - 1.75 * layerCY;
|
|
||||||
// yStep = preview.height / 150;
|
|
||||||
// preview.width = parseInt($preview.css("width"), 10);
|
|
||||||
// preview.height = parseInt($preview.css("height"), 10);
|
|
||||||
|
|
||||||
// canvasWidth = canvas.width;
|
|
||||||
// canvasHeight = canvas.height;
|
|
||||||
|
|
||||||
drawCanvasTopLeftCoords[0] = drawCanvas.offset().left;
|
|
||||||
drawCanvasTopLeftCoords[1] = drawCanvas.offset().top;
|
|
||||||
// drawCanvasTopLeftCoords[0] = drawCanvas[0].offsetParent.offsetLeft;
|
|
||||||
// drawCanvasTopLeftCoords[1] = drawCanvas[0].offsetParent.offsetTop;
|
|
||||||
|
|
||||||
// preview.height = $("#previewContainer").height();
|
|
||||||
// console.log("f:doOnResize() >> preview.height: " + preview.height);
|
|
||||||
|
|
||||||
redrawDoodle();
|
|
||||||
redrawPreview();
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
// doClientAndOrientationStuff() // <-- is this necessary in this method?
|
|
||||||
|
|
||||||
// console.log("f:doOnResize() >> $('#canvascontainer').innerHeight: " + window.innerHeight);
|
|
||||||
if (window.innerHeight < 768) {
|
|
||||||
// $('#drawAreaContainer').innerHeight(window.innerHeight - $("#drawAreaContainer").offset().top - 70);
|
|
||||||
var newVal = window.innerHeight - $("#drawAreaContainer").offset().top - 100; // what's the 70 ??
|
|
||||||
newVal = Math.max(newVal, drawAreaContainerMinHeight);
|
|
||||||
newVal = Math.min(newVal, drawAreaContainerMaxHeight);
|
|
||||||
|
|
||||||
$('#drawAreaContainer').innerHeight(newVal);
|
|
||||||
|
|
||||||
// canvas drawing area
|
|
||||||
$canvas.css("height", newVal);
|
|
||||||
canvas.height = newVal;
|
|
||||||
canvasWidth = canvas.width;
|
|
||||||
canvasHeight = canvas.height;
|
|
||||||
|
|
||||||
// preview area
|
|
||||||
$preview.css("height", newVal);
|
|
||||||
preview.height = newVal;
|
|
||||||
layerOffsetY = preview.height - 1.75 * layerCY;
|
|
||||||
yStep = preview.height / 150;
|
|
||||||
|
|
||||||
redrawDoodle();
|
|
||||||
redrawPreview();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initLayouting() {
|
|
||||||
console.log("f:initLayouting()");
|
|
||||||
|
|
||||||
// first set the css width/height and actual width/height of the drawing area
|
|
||||||
<!--div drawAreaContainer 650,450-->
|
|
||||||
<!--canvas mycanvas 500, 450-->
|
|
||||||
<!--canvas preview 150, 450-->
|
|
||||||
|
|
||||||
// $doodleCanvas = $("#mycanvas");
|
|
||||||
// doodleCanvas = $("#mycanvas")[0];
|
|
||||||
// doodleCanvasContext = doodleCanvas.getContext('2d');
|
|
||||||
|
|
||||||
$drawAreaContainer = $(".drawareacontainer");
|
|
||||||
/* 2013-10-09 commented out -> no more need with new layouting
|
|
||||||
$drawAreaContainer.css("margin", 0);
|
|
||||||
$drawAreaContainer.css("marginLeft", -$drawAreaContainer.width()/2);
|
|
||||||
$drawAreaContainer.css("marginTop", -$drawAreaContainer.height() *.45);
|
|
||||||
//*/
|
|
||||||
|
|
||||||
// console.log(" preview.width: " + preview.width + ", $preview.width(): " + $preview.width());
|
|
||||||
// canvas.width = $drawAreaContainer.width() - preview.width; // canvas.clientWidth;
|
|
||||||
// canvas.width = $("#mycanvasContainer").width();
|
|
||||||
canvas.width = $canvas.width();
|
|
||||||
canvas.height = $canvas.height(); // canvas.clientHeight;
|
|
||||||
// canvas.height = $drawAreaContainer.height(); // canvas.clientHeight;
|
|
||||||
|
|
||||||
preview.width = $preview.width();
|
|
||||||
preview.height = $drawAreaContainer.height();
|
|
||||||
|
|
||||||
canvasWidth = canvas.width;
|
|
||||||
canvasHeight = canvas.height;
|
|
||||||
|
|
||||||
$drawAreaContainer.show();
|
|
||||||
|
|
||||||
// window.innerHeight
|
|
||||||
console.log("window.innerHeight: " + window.innerHeight);
|
|
||||||
console.log("window.innerWidth: " + window.innerWidth);
|
|
||||||
console.log("$drawAreaContainer.innerHeight(): " + $drawAreaContainer.innerHeight());
|
|
||||||
console.log("$drawAreaContainer.offset().top: " + $drawAreaContainer.offset().top);
|
|
||||||
|
|
||||||
|
|
||||||
/* 2013-07-26 not doing this resizing stuff now, it's not working well yet
|
|
||||||
if (window.innerHeight < 768) {
|
|
||||||
$('#drawAreaContainer').innerHeight(window.innerHeight - $("#drawAreaContainer").offset().top - 70);
|
|
||||||
}
|
|
||||||
//*/
|
|
||||||
|
|
||||||
// timeout because it SEEMS to be beneficial for initting the layout
|
|
||||||
// 2013-09-18 seems beneficial since when?
|
|
||||||
setTimeout(_startOrientationAndChangeEventListening, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _startOrientationAndChangeEventListening() {
|
|
||||||
// Initial execution if needed
|
|
||||||
|
|
||||||
$(window).on('resize', doOnResize);
|
|
||||||
|
|
||||||
// is it necessary to call these? Aren't they called by the above eventhandlers?
|
|
||||||
// doClientAndOrientationStuff();
|
|
||||||
doOnResize();
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user