From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.html | 80 +++++++++++++++++++++++++++++------------------- js/ninja.reel/ninja.js | 50 ++++++++++++++++++++++++++---- 2 files changed, 93 insertions(+), 37 deletions(-) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 51d74cb2..f2b0a281 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -118,7 +118,7 @@ ] }, - "Resizer": { + "resizer3": { "prototype": "js/panels/resize-composer", "properties": { "element": {"#": "pasteboardResizer"}, @@ -150,45 +150,48 @@ "element": {"#": "stageMode"} }, "bindings" : { - "livePreview": { - "boundObject": {"@": "appModel"}, - "boundObjectPropertyPath": "livePreview", - "oneway": false - } + "livePreview": {"<<->": "@appModel.livePreview"} } }, - "toolsList1": { + "toolsList": { "prototype": "js/components/layout/tools-list.reel", "properties": { "element": {"#": "toolsList"}, "toolsData": {"@": "toolsData1"} + }, + "bindings": { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, - "toolsProperties1": { + "toolsProperties": { "prototype": "js/components/layout/tools-properties.reel", "properties": { "element": {"#": "toolsProperties"}, "toolsData": {"@": "toolsData1"} + }, + "bindings": { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, "documentsTab": { "prototype": "js/components/layout/documents-tab.reel", "properties": { - "element": {"#": "openDocumentsTabComponent"} + "element": {"#": "openDocumentsTabComponent"}, + "contentController": {"@": "documentList"} } }, - "stage1": { + "stage": { "prototype": "js/stage/stage.reel", "properties": { "element": {"#": "stageAndScenesContainer"}, "appModel": {"@": "appModel"} }, "bindings": { - "activeDocument": {"<-": "@documentController1.activeDocument"} + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, @@ -196,6 +199,9 @@ "prototype": "js/components/layout/document-bar.reel", "properties": { "element": {"#": "documentBar"} + }, + "bindings": { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, @@ -212,6 +218,9 @@ "element": {"#": "rightPanelContent"}, "panelSplitter": {"@": "splitter3"}, "appModel": {"@": "appModel"} + }, + "bindings" : { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, @@ -221,19 +230,16 @@ "element":{"#" : "breadCrumbComponent"} }, "bindings" : { - "container": { - "boundObject": {"@": "owner"}, - "boundObjectPropertyPath": "currentSelectedContainer", - "oneway": false - } + "container": {"<<->": "@owner.currentSelectedContainer"}, + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } - }, + }, "timeline": { - "prototype": "js/panels/Timeline/TimelinePanel.reel", - "properties": { - "element": {"#": "timelinePanelComponent"} - } + "prototype": "js/panels/Timeline/TimelinePanel.reel", + "properties": { + "element": {"#": "timelinePanelComponent"} + } }, "mouseMediator": { @@ -263,17 +269,28 @@ "prototype": "js/controllers/undo-controller" }, - "selectionController1": { + "selectionController": { "prototype": "js/controllers/selection-controller", "bindings" : { - "selectionContainer": {"<-": "@owner.currentSelectedContainer"} + "selectionContainer": {"<-": "@owner.currentSelectedContainer"}, + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, - "documentController1": { + "documentController": { "prototype": "js/controllers/document-controller" }, + "documentList": { + "prototype": "montage/ui/controller/array-controller", + "properties": { + "selectObjectsOnAddition": true + }, + "bindings": { + "content": {"<<->": "@documentController.documents"} + } + }, + "popupManager1": { "prototype": "js/components/popup-manager.reel", "properties": { @@ -288,7 +305,7 @@ "stylesController": { "prototype": "js/controllers/styles-controller", "bindings": { - "activeDocument": {"<-": "@documentController1.activeDocument"} + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, @@ -331,14 +348,14 @@ "rulerLeft": {"#": "rulerLeft"}, "appModel": {"@": "appModel"}, "toolsData": {"@": "toolsData1"}, - "toolsList": {"@": "toolsList1"}, - "toolsProperties": {"@": "toolsProperties1"}, - "stage": {"@": "stage1"}, + "toolsList": {"@": "toolsList"}, + "toolsProperties": {"@": "toolsProperties"}, + "stage": {"@": "stage"}, "elementMediator": {"@": "elementMediator"}, "dragDropMediator": {"@": "dragDropMediator"}, "undocontroller": {"@": "undocontroller1"}, - "selectionController": {"@": "selectionController1"}, - "documentController": {"@": "documentController1"}, + "selectionController": {"@": "selectionController"}, + "documentController": {"@": "documentController"}, "popupManager": {"@": "popupManager1"}, "colorController": {"@": "colorController1"}, "stylesController": {"@": "stylesController"}, @@ -356,7 +373,8 @@ "panelSplitter": {"@": "splitter3"}, "timelineSplitter": {"@": "splitter4"}, "toolsSplitter": {"@": "splitter2"}, - "optionsSplitter": {"@": "splitter1"} + "optionsSplitter": {"@": "splitter1"}, + "documentList": {"@": "documentList"} } } } diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index d0eb1557..0b4fd14d 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -18,12 +18,33 @@ exports.Ninja = Montage.create(Component, { value: null }, - toolsData: { value: null }, - appData: { value: AppData }, + toolsData: { + value: null + }, + + appData: { + value: AppData + }, + /* currentDocument: { value: null }, + */ + + documentList: { + value: null + }, + + currentDocument: { + get: function() { + if(this.documentList.selectedObjects) { + return this.documentList.selectedObjects[0]; + } else { + return null; + } + } + }, _isResizing: { value: null @@ -55,9 +76,10 @@ exports.Ninja = Montage.create(Component, { } }, - _resizedWidth : { + _resizedWidth: { value: 0 }, + _width: { value: null }, @@ -174,7 +196,6 @@ exports.Ninja = Montage.create(Component, { this.eventManager.addEventListener("selectTool", this, false); this.eventManager.addEventListener("selectSubTool", this, false); - this.eventManager.addEventListener("onOpenDocument", this, false); this.eventManager.addEventListener("onSwitchDocument", this, false); this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); @@ -190,7 +211,7 @@ exports.Ninja = Montage.create(Component, { //TODO: Expand method to allow other browsers for preview executeChromePreview: { value: function () { - this.application.ninja.documentController.activeDocument.model.browserPreview('chrome'); + this.currentDocument.model.browserPreview('chrome'); } }, //////////////////////////////////////////////////////////////////// @@ -276,7 +297,22 @@ exports.Ninja = Montage.create(Component, { }, handleOnOpenDocument: { - value: function(event) { + value: function(doc) { + + + + this.documentList.content.push(doc); + // This is not needed with the latest 0.10 montage. + // TODO: Remove this when integrating the next montage + this.documentList.selectedObjects = [doc]; + + // TODO: Find a better place for this + doc.model.currentView.show(); + + // TODO: Bind directly to the model of the document in components instead of this property + this.currentSelectedContainer = doc.model.documentRoot; + + /* this.currentDocument = event.detail; if(this.currentDocument.model.documentRoot) { @@ -288,6 +324,8 @@ exports.Ninja = Montage.create(Component, { this.appModel.show3dGrid = this.currentDocument.draw3DGrid; NJevent("openDocument"); + */ + } }, -- cgit v1.2.3 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 --- js/ninja.reel/ninja.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'js/ninja.reel') 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"} } }, -- cgit v1.2.3 From 5d7dff15e1e603e3b37057b9843e4b1eef1b2dca Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 15:32:47 -0700 Subject: cleanup and handling the document views in the document controller for now. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.html | 5 ++++- js/ninja.reel/ninja.js | 25 +++++++++---------------- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 51d6ed89..a62ce458 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -277,7 +277,10 @@ }, "documentController": { - "prototype": "js/controllers/document-controller" + "prototype": "js/controllers/document-controller", + "bindings": { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} + } }, "documentList": { diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 0b4fd14d..3659f1f8 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -296,7 +296,7 @@ exports.Ninja = Montage.create(Component, { } }, - handleOnOpenDocument: { + openDocument: { value: function(doc) { @@ -306,25 +306,18 @@ exports.Ninja = Montage.create(Component, { // TODO: Remove this when integrating the next montage this.documentList.selectedObjects = [doc]; - // TODO: Find a better place for this - doc.model.currentView.show(); - // TODO: Bind directly to the model of the document in components instead of this property this.currentSelectedContainer = doc.model.documentRoot; - /* - this.currentDocument = event.detail; - - if(this.currentDocument.model.documentRoot) { - this.currentSelectedContainer = this.currentDocument.model.documentRoot; - } else { - alert("The current document has not loaded yet"); - return; - } +// if(this.currentDocument.model.documentRoot) { +// this.currentSelectedContainer = this.currentDocument.model.documentRoot; +// } else { +// alert("The current document has not loaded yet"); +// return; +// } - this.appModel.show3dGrid = this.currentDocument.draw3DGrid; - NJevent("openDocument"); - */ +// this.appModel.show3dGrid = this.currentDocument.draw3DGrid; +// NJevent("openDocument"); } }, -- cgit v1.2.3 From d8840eda0d3b3e31fb5a72306fe66608f4f99c2b Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 23:52:59 -0700 Subject: fixing the menu bindings and some cleanup of the stage Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.html | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index a62ce458..b341b14a 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -36,6 +36,9 @@ "prototype": "js/components/menu/menu.reel", "properties": { "element": {"#": "mainMenuBar"} + }, + "bindings": { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, -- cgit v1.2.3 From 31b094ee21102f99a4021d505bc3a28527c9e23d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 01:33:20 -0700 Subject: Fixing the close document. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 3659f1f8..987c32fd 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -322,6 +322,14 @@ exports.Ninja = Montage.create(Component, { } }, + closeFile: { + value: function(document) { + var doc = this.documentList.content[this.documentList.content.indexOf(document)]; + + this.documentList.removeObjects(doc); + } + }, + handleOnSwitchDocument: { value: function() { this.currentDocument = this.documentController.activeDocument; -- cgit v1.2.3 From 501221d0bbf776ce71bc7ae0f482c931f6651659 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 14:51:25 -0700 Subject: fixing the timeline current document bindings Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.html | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index b341b14a..ab4eed84 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -242,6 +242,9 @@ "prototype": "js/panels/Timeline/TimelinePanel.reel", "properties": { "element": {"#": "timelinePanelComponent"} + }, + "bindings": { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, -- cgit v1.2.3 From 0a769756547acb93346d8e1b4126931a78845255 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 17:45:38 -0700 Subject: opening code view documents Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.html | 5 ++++- js/ninja.reel/ninja.js | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index ab4eed84..d9bebc36 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -345,7 +345,10 @@ }, "codeEditorController": { - "prototype": "js/controllers/code-editor-controller" + "prototype": "js/controllers/code-editor-controller", + "bindings": { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} + } }, "owner": { diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 987c32fd..3c60bb41 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -306,8 +306,10 @@ exports.Ninja = Montage.create(Component, { // TODO: Remove this when integrating the next montage this.documentList.selectedObjects = [doc]; - // TODO: Bind directly to the model of the document in components instead of this property - this.currentSelectedContainer = doc.model.documentRoot; + if(doc.currentView === "design") { + // TODO: Bind directly to the model of the document in components instead of this property + this.currentSelectedContainer = doc.model.documentRoot; + } // if(this.currentDocument.model.documentRoot) { // this.currentSelectedContainer = this.currentDocument.model.documentRoot; -- cgit v1.2.3 From e1fe603a7c002073f8ac13623f8cc8dc43efb59d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 31 May 2012 10:27:46 -0700 Subject: fixing selection when switching documents Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.html | 4 +++- js/ninja.reel/ninja.js | 22 +--------------------- 2 files changed, 4 insertions(+), 22 deletions(-) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index d9bebc36..031d68e9 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -278,7 +278,9 @@ "selectionController": { "prototype": "js/controllers/selection-controller", "bindings" : { - "selectionContainer": {"<-": "@owner.currentSelectedContainer"} + "selectionContainer": {"<-": "@owner.currentSelectedContainer"}, + "currentDocument": {"<-": "@documentList.selectedObjects.0"}, + "selectedElements": {"<-": "@documentList.selectedObjects.0.model.selection"} } }, diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 3c60bb41..4c1efff4 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -151,7 +151,6 @@ exports.Ninja = Montage.create(Component, { } }, - selectedElements: { value: [] }, @@ -196,7 +195,6 @@ exports.Ninja = Montage.create(Component, { this.eventManager.addEventListener("selectTool", this, false); this.eventManager.addEventListener("selectSubTool", this, false); - this.eventManager.addEventListener("onSwitchDocument", this, false); this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); @@ -311,15 +309,9 @@ exports.Ninja = Montage.create(Component, { this.currentSelectedContainer = doc.model.documentRoot; } -// if(this.currentDocument.model.documentRoot) { -// this.currentSelectedContainer = this.currentDocument.model.documentRoot; -// } else { -// alert("The current document has not loaded yet"); -// return; -// } // this.appModel.show3dGrid = this.currentDocument.draw3DGrid; -// NJevent("openDocument"); + } }, @@ -332,18 +324,6 @@ exports.Ninja = Montage.create(Component, { } }, - handleOnSwitchDocument: { - value: function() { - this.currentDocument = this.documentController.activeDocument; - - if(this.currentDocument.model.documentRoot) { - this._currentSelectedContainer = this.selectionController._selectionContainer = this.currentDocument.model.documentRoot; - } - - NJevent("switchDocument"); - } - }, - executeLivePreview: { value: function() { var background, overflow, transitionStopRule; -- cgit v1.2.3 From 3a3a2351ea2d816bf953cbf76622772f7d64aa8b Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 00:16:31 -0700 Subject: fixing the code editor, closing documents and cleanup of the stage Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.html | 10 +++++++--- js/ninja.reel/ninja.js | 12 +++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 031d68e9..a6422f6e 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -212,6 +212,9 @@ "prototype": "js/code-editor/ui/code-editor-view-options.reel", "properties": { "element": {"#": "editorViewOptions"} + }, + "bindings" : { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, @@ -349,7 +352,8 @@ "codeEditorController": { "prototype": "js/controllers/code-editor-controller", "bindings": { - "currentDocument": {"<-": "@documentList.selectedObjects.0"} + "currentDocument": {"<-": "@documentList.selectedObjects.0"}, + "automaticCodeComplete": {"<-": "@editorViewOptions.codeCompleteCheck.disabled"} } }, @@ -443,8 +447,8 @@
- - +
+
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 4c1efff4..e9e1e31c 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -318,9 +318,19 @@ exports.Ninja = Montage.create(Component, { closeFile: { value: function(document) { - var doc = this.documentList.content[this.documentList.content.indexOf(document)]; + var doc = this.documentList.content[this.documentList.content.indexOf(document)], activeDocument; + + if(this.documentList.selectedObjects[0] === doc) { + activeDocument = this.documentList.content[0]; + } else { + activeDocument = this.documentList.selectedObjects[0]; + } this.documentList.removeObjects(doc); + + if(this.documentList.content.length) { + this.documentList.selectedObjects = [activeDocument]; + } } }, -- cgit v1.2.3 From 7fcb10270f9e19415f8452c261c2d0c86916a29a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 00:54:02 -0700 Subject: fixed the 3d grid when switching documents and some cleanup Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.html | 5 ++++- js/ninja.reel/ninja.js | 8 -------- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index a6422f6e..0c0944e7 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -25,7 +25,10 @@ }, "appModel": { - "prototype": "js/models/app-model" + "prototype": "js/models/app-model", + "bindings": { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} + } }, "materialsModel": { diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index e9e1e31c..9593973e 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -296,9 +296,6 @@ exports.Ninja = Montage.create(Component, { openDocument: { value: function(doc) { - - - this.documentList.content.push(doc); // This is not needed with the latest 0.10 montage. // TODO: Remove this when integrating the next montage @@ -308,11 +305,6 @@ exports.Ninja = Montage.create(Component, { // TODO: Bind directly to the model of the document in components instead of this property this.currentSelectedContainer = doc.model.documentRoot; } - - -// this.appModel.show3dGrid = this.currentDocument.draw3DGrid; - - } }, -- cgit v1.2.3 From 2085c783cf3a75d2b8f0370a6f54f62dd513161c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 11:15:26 -0700 Subject: fixing the document closing when the first document is closed. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 9593973e..ac883923 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -26,12 +26,6 @@ exports.Ninja = Montage.create(Component, { value: AppData }, - /* - currentDocument: { - value: null - }, - */ - documentList: { value: null }, @@ -46,9 +40,6 @@ exports.Ninja = Montage.create(Component, { } }, - _isResizing: { - value: null - }, _resizedHeight : { value: 0 }, @@ -199,8 +190,6 @@ exports.Ninja = Montage.create(Component, { this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); this.addPropertyChangeListener("appModel.debug", this.toggleDebug, false); - - NJevent("appLoading"); } }, @@ -312,16 +301,20 @@ exports.Ninja = Montage.create(Component, { value: function(document) { var doc = this.documentList.content[this.documentList.content.indexOf(document)], activeDocument; - if(this.documentList.selectedObjects[0] === doc) { - activeDocument = this.documentList.content[0]; - } else { + if(this.documentList.selectedObjects[0] !== doc) { activeDocument = this.documentList.selectedObjects[0]; + } else { + activeDocument = null; } this.documentList.removeObjects(doc); - if(this.documentList.content.length) { + if(activeDocument) { this.documentList.selectedObjects = [activeDocument]; + } else { + if(this.documentList.content.length) { + this.documentList.selectedObjects = this.documentList.content[0]; + } } } }, @@ -383,16 +376,6 @@ exports.Ninja = Montage.create(Component, { } }, - getCurrentToolInstance: { - value: function() { - if(this.toolsData.selectedTool.container) { - return this.toolsList[this.toolsData.selectedSubTool.action]; - } else { - return this.toolsList[this.toolsData.selectedTool.action]; - } - } - }, - setupGlobalHelpers: { value: function() { -- cgit v1.2.3 From fd264c58bfc5f53f57d9ddfd06114124b14bac04 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 1 Jun 2012 14:54:19 -0700 Subject: Moving styles controller higher in ninja's serialization so its bindings will get triggered before stage's bindings. This should fix the stage's styles not getting initialized correctly. Signed-off-by: Nivesh Rajbhandari --- js/ninja.reel/ninja.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 0c0944e7..33c3080f 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -150,6 +150,13 @@ ] }, + "stylesController": { + "prototype": "js/controllers/styles-controller", + "bindings": { + "currentDocument": {"<-": "@documentList.selectedObjects.0"} + } + }, + "stageMode": { "prototype": "js/components/layout/stage-mode.reel", "properties": { @@ -318,13 +325,6 @@ "prototype": "js/controllers/color-controller" }, - "stylesController": { - "prototype": "js/controllers/styles-controller", - "bindings": { - "currentDocument": {"<-": "@documentList.selectedObjects.0"} - } - }, - "presetsController": { "prototype": "js/controllers/presets-controller" }, -- cgit v1.2.3 From 75fc82ce49d6f1eb05dc950b46292d42b5856005 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 16:19:04 -0700 Subject: fixing some selection container changes and the breadcrumb not drawing initially Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.html | 2 +- js/ninja.reel/ninja.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'js/ninja.reel') diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 33c3080f..a98fca60 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -246,7 +246,7 @@ "element":{"#" : "breadCrumbComponent"} }, "bindings" : { - "container": {"<<->": "@owner.currentSelectedContainer"}, + "container": {"<-": "@owner.currentSelectedContainer"}, "currentDocument": {"<-": "@documentList.selectedObjects.0"} } }, diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index ac883923..a12270a0 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -292,6 +292,7 @@ exports.Ninja = Montage.create(Component, { if(doc.currentView === "design") { // TODO: Bind directly to the model of the document in components instead of this property + this._currentSelectedContainer = null; this.currentSelectedContainer = doc.model.documentRoot; } } -- cgit v1.2.3