From c4b413f68bd621806e8c27cdbf45e5655994eecf Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Mon, 26 Oct 2015 19:05:33 -0400 Subject: [PATCH] console js --- css/main.css | 8 +++++- js/menus/MenuWrapperView.js | 2 -- js/menus/otherUI/Console.js | 40 +++++++++++++++++++++++++++-- js/menus/templates/NavViewMenu.html | 2 +- js/models/AppState.js | 2 +- 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/css/main.css b/css/main.css index b77f81b6..44df274c 100644 --- a/css/main.css +++ b/css/main.css @@ -570,6 +570,7 @@ label { width: 100%; position: absolute; background-color: clear; + display:none; } #console>div{ @@ -580,7 +581,12 @@ label { border-radius: 0; } #consoleOutput{ - min-height:30px; + min-height:35px; background-color: #ddd; opacity: 0.9; + border: 2px solid #bdc3c7; + border-bottom-width: 0; + border-top-width: 0; + overflow: auto; + resize: vertical; } \ No newline at end of file diff --git a/js/menus/MenuWrapperView.js b/js/menus/MenuWrapperView.js index cae227bf..06f82336 100644 --- a/js/menus/MenuWrapperView.js +++ b/js/menus/MenuWrapperView.js @@ -359,13 +359,11 @@ define(['jquery', 'underscore', 'plist', 'backbone', 'lattice', 'appState', 'tex _hide: function(callback, suppressModelUpdate){ this.$el.animate({right: "-430"}, {done: callback}); - $("#console").animate({"padding-right":"0"}); if (!suppressModelUpdate) this.model.set("menuIsVisible", false); }, _show: function(){ this.$el.animate({right: "0"}); - $("#console").animate({"padding-right":"430px"}); this.model.set("menuIsVisible", true); }, diff --git a/js/menus/otherUI/Console.js b/js/menus/otherUI/Console.js index c7ee225e..dfe2f7ca 100644 --- a/js/menus/otherUI/Console.js +++ b/js/menus/otherUI/Console.js @@ -3,9 +3,45 @@ */ -define(['jquery'], function($){ +define(['jquery', 'underscore', 'backbone', 'appState'], function($, _, Backbone, appState){ -// $( ".selector" ).resizable({ handles: "n, e, s, w" }); + var Console = Backbone.View.extend({ + el: "#console", + + events: { + + }, + + initialize: function(){ + + this.listenTo(appState, "change:consoleIsVisible", this._setVisibility); + this._setWidth(); + this._setVisibility(); + }, + + _setWidth: function(immediately){ + var padding = "0"; + if (appState.get("menuIsVisible")) padding = "430px"; + if (immediately) this.$el.css({"padding-right":padding}); + else this.$el.animate({"padding-right":padding}); + }, + + _setVisibility: function(){ + if (appState.get("consoleIsVisible")) this.show(); + else this.hide(); + }, + + show: function(){ + this.$el.fadeIn(); + }, + + hide: function(){ + this.$el.fadeOut(); + } + + }); + + return new Console(); }); \ No newline at end of file diff --git a/js/menus/templates/NavViewMenu.html b/js/menus/templates/NavViewMenu.html index af4595dd..0569b3d1 100644 --- a/js/menus/templates/NavViewMenu.html +++ b/js/menus/templates/NavViewMenu.html @@ -3,7 +3,7 @@ <ul class="dropdown-menu"> <li><a class="appState boolProperty" data-property="menuIsVisible" href="#">Menu</a></li> <li><a class="appState boolProperty" data-property="scriptIsVisible" href="#">Script</a></li> - <!--<li><a class="appState boolProperty" data-property="consoleIsVisible" href="#">Console</a></li>--> + <li><a class="appState boolProperty" data-property="consoleIsVisible" href="#">Console</a></li> <li><a class="appState boolProperty" data-property="ribbonIsVisible" href="#">Ribbon</a></li> </ul> </li> diff --git a/js/models/AppState.js b/js/models/AppState.js index 83806596..400314e8 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -19,7 +19,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], menuIsVisible: true, scriptIsVisible: false, - consoleIsVisible: false, + consoleIsVisible: true, ribbonIsVisible: true, turnOffRendering: false, -- GitLab