From 4fa08fe2ce439a5f5c248c568f72d3828ee11b36 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 11:43:55 -0700 Subject: fix for the document tab close button and rulers on initial document Signed-off-by: Valerio Virgillito --- .../layout/document-entry.reel/close_button.gif | Bin 139 -> 0 bytes .../layout/document-entry.reel/document-entry.css | 8 ++--- .../layout/document-entry.reel/document-entry.html | 15 +++++--- .../layout/document-entry.reel/document-entry.js | 37 ++++--------------- js/controllers/selection-controller.js | 40 +-------------------- js/ninja.reel/ninja.html | 3 +- js/stage/stage.reel/stage.js | 6 ++-- 7 files changed, 24 insertions(+), 85 deletions(-) delete mode 100755 js/components/layout/document-entry.reel/close_button.gif diff --git a/js/components/layout/document-entry.reel/close_button.gif b/js/components/layout/document-entry.reel/close_button.gif deleted file mode 100755 index 00b5904b..00000000 Binary files a/js/components/layout/document-entry.reel/close_button.gif and /dev/null differ diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css index 010e1da7..6a2900be 100755 --- a/js/components/layout/document-entry.reel/document-entry.css +++ b/js/components/layout/document-entry.reel/document-entry.css @@ -19,17 +19,13 @@ min-width:0px; } -.mybutton { +.documentCloseButton { display: inline; -webkit-appearance: none; outline: none; - - font-size: 9px; cursor: pointer; border: 0px; - background-color: #474747; - background-image: -webkit-linear-gradient(top, #505050 0%, #3c3c3c 100%); - + background: #474747 url(../../../../images/documentsTab/close_button.gif) center center no-repeat; } .documentEntry button { diff --git a/js/components/layout/document-entry.reel/document-entry.html b/js/components/layout/document-entry.reel/document-entry.html index bd8c25cb..e68d17c5 100755 --- a/js/components/layout/document-entry.reel/document-entry.html +++ b/js/components/layout/document-entry.reel/document-entry.html @@ -22,8 +22,16 @@ "closeButton": { "prototype": "montage/ui/button.reel", "properties": { - "element": {"#": "close-btn"} - } + "element": {"#": "close-btn"}, + "identifier": "closeButton" + }, + "listeners": [ + { + "type": "action", + "listener": {"@": "owner"}, + "capture": false + } + ] } } @@ -31,8 +39,7 @@
  • - - +
  • \ No newline at end of file diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 2e66c7cd..34e307cb 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -9,15 +9,11 @@ var Component = require("montage/ui/component").Component; exports.DocumentEntry = Montage.create(Component, { - dirty: { value: null }, - _uuid: { - value: null, - enumerable: false + value: null }, _document: { - enumerable: false, value: null }, @@ -40,7 +36,9 @@ exports.DocumentEntry = Montage.create(Component, { } }, - _name: { value: null }, + _name: { + value: null + }, name: { enumerable: false, @@ -74,22 +72,11 @@ exports.DocumentEntry = Montage.create(Component, { } }, - prepareForDraw: { - enumerable: false, - value: function() { -// this.element.addEventListener("click", this, false); -// this.closeBtn.addEventListener("click", this, true); - } - }, - - draw: { enumerable: false, value: function() { this.label.innerText = this._name ? this._name : ""; -// this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); - if(this.saveFlag) { this.label.classList.add("dirty"); } else { @@ -98,19 +85,9 @@ exports.DocumentEntry = Montage.create(Component, { } }, - captureClick: { - value: function(event) { - console.log("clicked on the X"); - event.preventDefault(); - event.stopImmediatePropagation(); - event.stopPropagation(); -// if(event._event.target.nodeName === "IMG") { -// this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); -// } else { -// if(!this.active) { -// this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); -// } -// } + handleCloseButtonAction: { + value: function() { + //this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); } } diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index db8bdf51..0d34ff25 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -20,44 +20,7 @@ exports.SelectionController = Montage.create(Component, { } }, - _currentDocument: { - value : null, - enumerable : false - }, - - currentDocument : { - get : function() { - return this._currentDocument; - }, - set : function(value) { - if (value === this._currentDocument) { - return; - } - - this._currentDocument = value; - - if(this._currentDocument.currentView === "design") { - - /* - this._isDocument = true; - - if(currentSelectionArray) { - this.application.ninja.selectedElements = currentSelectionArray; - if(currentSelectionArray.length) { - this._isDocument = false; - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); - } - } - - this._selectionContainer = this.application.ninja.currentSelectedContainer; - */ - } - } - }, - - /* - * Bound property to the ninja currentSelectedContainer - */ + // Bound property to the ninja currentSelectedContainer _selectionContainer: { value: null }, @@ -77,7 +40,6 @@ exports.SelectionController = Montage.create(Component, { deserializedFromTemplate: { value: function() { - this.eventManager.addEventListener("openDocument", this, false); this.eventManager.addEventListener("elementAdded", this, false); this.eventManager.addEventListener("elementsRemoved", this, false); this.eventManager.addEventListener("elementReplaced", this, false); diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index f2b0a281..51d6ed89 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -272,8 +272,7 @@ "selectionController": { "prototype": "js/controllers/selection-controller", "bindings" : { - "selectionContainer": {"<-": "@owner.currentSelectedContainer"}, - "currentDocument": {"<-": "@documentList.selectedObjects.0"} + "selectionContainer": {"<-": "@owner.currentSelectedContainer"} } }, diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index e00d2b54..a6e7c24f 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -171,10 +171,8 @@ exports.Stage = Montage.create(Component, { return; } - if(!value) { - // Show the rulers + if(!this._currentDocument) { this.showRulers(); - // Show the canvas this.hideCanvas(false); } @@ -186,7 +184,7 @@ exports.Stage = Montage.create(Component, { this.initWithDocument(false); } - if(!this._currentDocument) { + if(!value) { this.hideRulers(); this.hideCanvas(true); } -- cgit v1.2.3