Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ghemingway/cad.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ghemingway committed Mar 6, 2014
2 parents bcc06c8 + 6641744 commit 7c659b4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 10 deletions.
68 changes: 58 additions & 10 deletions public/javascript/cad.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ define(["jquery", "jstree", "data_loader", "viewer"], function($, jstree, DataLo
this._$downloadsContainer = $( '#' + config.downloadsContainerId );

this._isCompact = undefined;
this._isFullScreen = undefined;
this._wasCompactBeforeFullscreen = false;

this._loader = undefined;
this._parts = [];
this._viewer = undefined;
this._theme = undefined;

this._compactTheme = undefined;

if ( config.isCompact !== undefined ) {
this.setCompactMode( config.isCompact );
} else {
Expand All @@ -67,27 +68,49 @@ define(["jquery", "jstree", "data_loader", "viewer"], function($, jstree, DataLo

CADjs.prototype.setupPage = function() {
// Create the viewer
var canvasClearColor = 0x000000,
var self = this,
canvasClearColor = 0x000000,
$resizer = $('#resizer'),
$expander = $('#resizer>.expander'),
$minimizer = $('#resizer>.minimizer');
$minimizer = $('#resizer>.minimizer'),
minimizeMe, expandMe;


if (BigScreen.enabled && this._isCompact === true) {

minimizeMe = function() {
BigScreen.toggle();
};

expandMe = function() {
BigScreen.toggle();
};

$resizer.show();
$minimizer.hide();
$expander.show();

$expander.click(function() {
BigScreen.toggle();
$minimizer.toggle();
$expander.toggle();
expandMe();
});

$minimizer.click(function() {
BigScreen.toggle();
minimizeMe();
});


BigScreen.onenter = function() {
$minimizer.toggle();
$expander.toggle();
});
self.setFullScreenMode(true);
};

BigScreen.onexit = function() {
$minimizer.toggle();
$expander.toggle();
self.setFullScreenMode(false);
};

} else {
$resizer.hide();
}
Expand All @@ -108,7 +131,7 @@ define(["jquery", "jstree", "data_loader", "viewer"], function($, jstree, DataLo
$('body').removeClass('non-initialized');
};

CADjs.prototype.setCompactMode = function( isCompact ) {
CADjs.prototype.setCompactMode = function(isCompact) {

var $body = $( 'body' );

Expand All @@ -129,6 +152,31 @@ define(["jquery", "jstree", "data_loader", "viewer"], function($, jstree, DataLo
}
};

CADjs.prototype.setFullScreenMode = function(fullScreenMode) {

var $body = $('body');

if (this._isFullScreen !== fullScreenMode) {

if (this._isFullScreen !== true && this._isCompact === true) {
this._wasCompactBeforeFullscreen = true;
this.setCompactMode(false);
} else if ( this._isFullScreen === true && this._wasCompactBeforeFullscreen === true ) {
this._wasCompactBeforeFullscreen = false;
this.setCompactMode(true);
}

this._isFullScreen = fullScreenMode;

if (this._isFullScreen) {
$body.addClass('fullscreen');
} else {
$body.removeClass('fullscreen');
}

}
};

CADjs.prototype.setTheme = function(theme) {

var $body = $( 'body' );
Expand Down
2 changes: 2 additions & 0 deletions public/stylesheets/stepview.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ body {
font-size: 8px;
width: 250px;
position: absolute;
top: 0;
left: 0;
max-height: 100%;
overflow: auto;
background-color: #222;
Expand Down

0 comments on commit 7c659b4

Please sign in to comment.