2013-12-20 16:31:41 +01:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2013-10-22 12:04:46 +02:00
|
|
|
// 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;
|
|
|
|
|
2013-10-29 21:27:17 +01:00
|
|
|
// console.log(" preview.width: " + preview.width + ", $preview.width(): " + $preview.width());
|
2013-10-22 12:04:46 +02:00
|
|
|
|
|
|
|
calcPreviewCanvasProperties();
|
|
|
|
|
|
|
|
drawCanvasTopLeftCoords[0] = drawCanvas.offset().left;
|
|
|
|
drawCanvasTopLeftCoords[1] = drawCanvas.offset().top;
|
|
|
|
|
|
|
|
redrawDoodle();
|
|
|
|
redrawPreview();
|
|
|
|
}
|
|
|
|
|
|
|
|
function initLayouting() {
|
2014-02-04 12:51:31 +01:00
|
|
|
//console.log("f:initLayouting()");
|
2013-10-22 12:04:46 +02:00
|
|
|
|
2014-01-10 17:21:43 +01:00
|
|
|
$drawAreaContainer = $("#drawareacontainer");
|
2013-10-22 12:04:46 +02:00
|
|
|
|
|
|
|
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
|
2014-02-04 12:51:31 +01:00
|
|
|
//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-10-22 12:04:46 +02:00
|
|
|
|
|
|
|
// 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();
|
|
|
|
}
|