From 29ad6355ef60cfb3b3fc7f780504f3ed30845883 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Mon, 7 May 2012 14:30:47 -0700 Subject: More implementation of moving color chips to the individual subtools. Removed the tool color bar Added new icons for inkbottle Removed Pencil tool Removed Inkbottle tool Added chips to the pen, brush and tag tools Aligned controls in several subtools --- js/controllers/color-controller.js | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index c6d664cf..d4737aad 100755 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js @@ -9,7 +9,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, ColorModel = require("js/models/color-model").ColorModel, - ColorToolbar = require("js/panels/Color/colortoolbar.reel").ColorToolbar, ColorPanelBase = require("js/panels/Color/colorpanelbase.reel").ColorPanelBase, ElementsMediator = require("js/mediators/element-mediator").ElementMediator, ColorPopupManager = require("js/panels/Color/colorpopup-manager").ColorPopupManager, @@ -368,20 +367,5 @@ exports.ColorController = Montage.create(Component, { //Must be a valid CSS or null will be returned return color; } - }, - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - //TODO: Remove, add via toolbar repetition - createToolbar: { - enumerable: true, - value: function () { - this.colorToolbar = ColorToolbar.create(); - this.colorToolbar.element = document.getElementById("colortoolbar"); - this.colorToolbar.needsDraw = true; - } } - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// }); \ No newline at end of file -- cgit v1.2.3 From 919a0d0ed35c24b1047281723ddde2ac98fc9a3e Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 15 May 2012 22:36:44 -0700 Subject: document close handler. initial working draft Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 66 ++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 24 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 48ceb21b..51791a11 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -33,6 +33,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, value: false }, + _hackInitialStyles: { + value: true + }, + _activeDocument: { value: null }, _iframeCounter: { value: 1, enumerable: false }, _iframeHolder: { value: null, enumerable: false }, @@ -44,8 +48,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, return this._activeDocument; }, set: function(doc) { - if(!!this._activeDocument){ this._activeDocument.isActive = false;} +// if(!!this._activeDocument){ this._activeDocument.isActive = false;} + this._activeDocument = doc; + if(!!this._activeDocument){ if(this._documents.indexOf(doc) === -1) this._documents.push(doc); this._activeDocument.isActive = true; @@ -213,13 +219,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component, handleExecuteFileClose:{ value: function(event) { if (this.activeDocument) { - this.activeDocument.closeDocument(); +// this.activeDocument.closeDocument(); + this.closeFile(this.activeDocument); } - /* -if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ - this.closeDocument(this.activeDocument.uuid); - } -*/ } }, //////////////////////////////////////////////////////////////////// @@ -448,7 +450,32 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ */ } - }, + }, + + closeFile: { + value: function(document) { + document.closeDocument(this, this.onCloseFile); + } + }, + + onCloseFile: { + value: function(doc) { + + this._documents.splice(this._documents.indexOf(doc), 1); + + this.activeDocument = null; + + this.application.ninja.stage.stageView.hideRulers(); + +// document.getElementById("iframeContainer").style.display="block"; + + this.application.ninja.stage.hideCanvas(true); + + + NJevent("closeDocument", doc.model.file.uri); + //TODO: Delete object here + } + }, closeDocument: { value: function(id) { @@ -468,15 +495,7 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ if(typeof doc.stopVideos !== "undefined"){doc.stopVideos();} this._removeDocumentView(doc.container); }else if(this._documents.length === 0){ - if(typeof this.activeDocument.pauseAndStopVideos !== "undefined"){ - this.activeDocument.pauseAndStopVideos(); - } - this.activeDocument = null; - this._removeDocumentView(doc.container); - this.application.ninja.stage.stageView.hideRulers(); - document.getElementById("iframeContainer").style.display="block"; - - this.application.ninja.stage.hideCanvas(true); + // See above }else{//closing inactive document tab - just clear DOM if(typeof doc.pauseAndStopVideos !== "undefined"){ doc.pauseAndStopVideos(); @@ -515,6 +534,9 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ this.application.ninja.stage.stageView.showCodeViewBar(false); this.application.ninja.stage.stageView.restoreAllPanels(); + + // Flag to stop stylesheet dirty event + this._hackInitialStyles = false; } }, @@ -552,12 +574,6 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ /** * VIEW Related Methods */ - // PUBLIC - ShowActiveDocument: { - value: function() { - this.activeDocument.iframe.style.opacity = 1.0; - } - }, // PRIVATE _findDocumentByUUID: { @@ -656,7 +672,9 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ handleStyleSheetDirty:{ value:function(){ -// this.activeDocument.model.needsSave = true; + if(!this._hackInitialStyles) { + this.activeDocument.model.needsSave = true; + } } }, -- cgit v1.2.3 From 0eaa0be8e030a6bac5ab70af3c1044682d973366 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 15 May 2012 23:33:44 -0700 Subject: fixed some binding warnings Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 51791a11..fba9fad5 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -463,7 +463,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this._documents.splice(this._documents.indexOf(doc), 1); - this.activeDocument = null; + this._activeDocument = null; this.application.ninja.stage.stageView.hideRulers(); -- cgit v1.2.3 From f9f8fdc3000042ba5b4504d91870dc9a32ef25eb Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 01:00:22 -0700 Subject: Squashed master into dom-architecture Signed-off-by: Valerio Virgillito --- js/controllers/styles-controller.js | 4 +- js/controllers/tree-controller.js | 185 ------------------------------------ 2 files changed, 3 insertions(+), 186 deletions(-) delete mode 100644 js/controllers/tree-controller.js (limited to 'js/controllers') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 7707a826..26485508 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -795,7 +795,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// method to apply/test the new value dec.setProperty(property, value, priority); - this.styleSheetModified(rule.parentStyleSheet); + if(rule.parentStyleSheet) { + this.styleSheetModified(rule.parentStyleSheet); + } ///// Return browser value for value we just set return dec.getPropertyValue(property); diff --git a/js/controllers/tree-controller.js b/js/controllers/tree-controller.js deleted file mode 100644 index 2b2e910c..00000000 --- a/js/controllers/tree-controller.js +++ /dev/null @@ -1,185 +0,0 @@ -/* - This file contains proprietary software owned by Motorola Mobility, Inc.
- No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
- (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ -/** - @module montage/ui/controller/tree-controller - @requires montage/core/core - @requires montage/ui/controller/object-controller - @requires montage/core/event/mutable-event - */ -var Montage = require("montage").Montage, - ObjectController = require("montage/ui/controller/object-controller").ObjectController, - ArrayController = require("montage/ui/controller/array-controller").ArrayController, - MutableEvent = require("montage/core/event/mutable-event").MutableEvent; -/** - TODO: Write description like the array controllers: The ArrayController helps with organizing a hierarchical - collection of objects, and managing user selection within that collection. - You can assign a TreeController instance as the contentProvider property for a TreeView object. - @class module:montage/ui/controller/tree-controller.TreeController - @classdesc - @extends module:montage/ui/controller/object-controller.ObjectController -*/ -var TreeController = exports.TreeController = Montage.create(ObjectController, /** @lends module:montage/ui/controller/tree-controller.TreeController# */ { - - rootKey : { - value: null - }, - - branchKey : { - value: 'children' - }, - - _root : { - value : null - }, - root : { - get: function() { - return this._root; - }, - set: function(value) { - this._root = value; - - this.initArrayControllers(); - } - }, - - rootController: { - value: null - }, - - initArrayControllers : { - value: function() { - var self = this; - - ///// Recursive function that finds all branch nodes and initializes - ///// sets the tree node type to "branch" or "leaf" - - function walk(node, init, depth) { - var branch = node[self.branchKey]; - - if(branch) { - branch.forEach(function(node) { - walk(node, init, ++depth); - }); - - node['treeNodeType'] = 'branch'; - } else { - node['treeNodeType'] = 'leaf'; - } - } - - walk(this._root, 0); - - } - }, - - /** - @private - */ - _selectedIndexes: { - value: null, - enumerable: false - }, - - /** - Description TODO - @type {Function} - @default null - */ - selectedIndexes: { - get: function() { - - }, - set: function(value) { - - } - }, - - branchControllers: { - value: [] - }, - - addBranchController : { - value: function(controller) { - if(this.delegate) { - controller.delegate = this.delegate; - } - - this.branchControllers.push(controller); - } - }, - - /** - @private - */ - _content: { - enumerable: false, - value: null - }, - /** - The content managed by the TreeController. - @type {Function} - @default {String} null - */ - content: { - get: function() { - return this._content; - }, - set: function(value) { - if (this._content === value) { - return; - } - - this._content = value; - - this.selectedObjects = null; - - if (this.rootKey) { - if (value[this.rootKey]) { - this.root = value[this.rootKey]; - } else { - console.log('No root key found in content data'); - } - } else { - this.root = value; - } - - } - }, - - addObjects : { - value: function() { - - var objects = Array.prototype.slice.call(arguments), - i, - objectCount = objects.length, - selectedContentIndexes, firstIndex; - - for (i = 0; i < objectCount; i++) { - this.content.push(objects[i]); - } - - if (this.selectObjectsOnAddition) { - selectedContentIndexes = []; - firstIndex = this.content.length-objectCount; - for (i = 0; i < objectCount; i++) { - selectedContentIndexes[i] = firstIndex++; - } - this.selectedContentIndexes = selectedContentIndexes; - this.selectedObjects = objects; - } - - if (this.clearFilterFunctionOnAddition) { - this.filterFunction = null; - } - - if (this.automaticallyOrganizeObjects) { - this.organizeObjects(); - } - - } - } - -}); -- cgit v1.2.3 From 0ebb822b0535bf1bb100b3f3cb396c8b6d3383f1 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 11:23:12 -0700 Subject: fixing some of the document bindings. Signed-off-by: Valerio Virgillito --- js/controllers/styles-controller.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 26485508..ae504f0e 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -53,11 +53,11 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Bind app's activeDocument property to ///// styles controller's _activeDocument property - Object.defineBinding(this, "activeDocument", { - boundObject: this.application.ninja, - boundObjectPropertyPath: "currentDocument", - oneway: true - }); +// Object.defineBinding(this, "activeDocument", { +// boundObject: this.application.ninja, +// boundObjectPropertyPath: "currentDocument", +// oneway: true +// }); } }, @@ -79,7 +79,6 @@ var stylesController = exports.StylesController = Montage.create(Component, { return this._activeDocument; }, set : function(document) { - ///// If the document is null set default stylesheets to null if(!document) { -- cgit v1.2.3 From 99f16ae08fbb0a6dfe6008c9833f2253b18c19e5 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 14:13:28 -0700 Subject: removing first draw on the component event Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index fba9fad5..1e894f02 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -76,24 +76,13 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.eventManager.addEventListener("styleSheetDirty", this, false); - this.eventManager.addEventListener("addComponentFirstDraw", this, false); - // Temporary add listeners for the new stage templates this.eventManager.addEventListener("executeWebpageOpen", this, false); this.eventManager.addEventListener("executeNewWebpage", this, false); } }, - handleAddComponentFirstDraw: { - value: function (e) { - //TODO: Add logic to reparse the document for dynamically added styles - //console.log(e); - } - }, - - - - + //TODO: Ensure these APIs are not needed //////////////////////////////////////////////////////////////////// // -- cgit v1.2.3 From b1e5ef1949eeddc39a1e9570a65612879cbdadef Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 20:49:40 -0700 Subject: clearing the needs save flag on save. Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 1e894f02..ecb988ff 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -177,6 +177,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component, testCallback: { value: function (value) { console.log(value); + //TODO: Move this to the model.save() + this.activeDocument.model.needsSave = false; } }, //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From c26de5fa7b909a53b103b72027b5cbe7c3e1c49f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 22:48:39 -0700 Subject: code cleanup and refactoring of the document controller and stage view Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 194 ++++++++++------------------------ 1 file changed, 56 insertions(+), 138 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index ecb988ff..1796f9b5 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -21,10 +21,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, value: false }, - webTemplate: { - value: false - }, - _documents: { value: [] }, @@ -75,10 +71,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.eventManager.addEventListener("executeFileCloseAll", this, false); this.eventManager.addEventListener("styleSheetDirty", this, false); - - // Temporary add listeners for the new stage templates - this.eventManager.addEventListener("executeWebpageOpen", this, false); - this.eventManager.addEventListener("executeNewWebpage", this, false); } }, @@ -138,20 +130,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, } }, - handleExecuteWebpageOpen: { - value: function(event) { - this.webTemplate = true; - this.handleExecuteFileOpen(event); - } - }, - - handleExecuteNewWebpage: { - value: function(event) { - this.webTemplate = true; - this.handleExecuteNewFile(event); - } - }, - handleExecuteNewFile: { value: function(event) { var newFileSettings = event._event.settings || {}; @@ -304,12 +282,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.isNewFilePath = false;//reset path identifier flag //Sending full response object - // TODO: Unify those 2 methods. Using if/else for the new template - if(this.webTemplate) { - this.openWebDocument(response); - } else { - this.openDocument(response); - } + this.openDocument(response); + } else if (!!response && (response.status === 404)){ alert("Unable to open file.\n [Error: File does not exist]"); } else if (!!response && (response.status === 500)){ @@ -345,30 +319,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, }, //////////////////////////////////////////////////////////////////// - openDocument: { - value: function(doc) { - - // - this.documentHackReference = doc; - // - switch (doc.extension) { - case 'html': - //Open in designer view - Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this)); - break; - default: - //Open in code view - var code = Montage.create(TextDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; - textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid); - code.initialize(doc, docuuid, textArea, textArea.parentNode); - //code.init(doc.name, doc.uri, doc.extension, null, docuuid); - code.textArea.value = doc.content; - this.application.ninja.stage.stageView.createTextView(code); - break; - } - } - }, - openWebDocument: { + openDocument: { value: function(doc) { var template, dimensions; if (doc.content.body.indexOf('Ninja-Banner Dimensions@@@') !== -1) { @@ -484,14 +435,14 @@ var DocumentController = exports.DocumentController = Montage.create(Component, } this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); if(typeof doc.stopVideos !== "undefined"){doc.stopVideos();} - this._removeDocumentView(doc.container); + doc.container.parentNode.removeChild(doc.container); }else if(this._documents.length === 0){ // See above }else{//closing inactive document tab - just clear DOM if(typeof doc.pauseAndStopVideos !== "undefined"){ doc.pauseAndStopVideos(); } - this._removeDocumentView(doc.container); + doc.container.parentNode.removeChild(doc.container); } NJevent("closeDocument", doc.uri); @@ -500,41 +451,65 @@ var DocumentController = exports.DocumentController = Montage.create(Component, } }, - // Document has been loaded into the Iframe. Dispatch the event. - // Event Detail: Contains the current ActiveDocument + // Open document callback _onOpenDocument: { value: function(doc){ - this.application.ninja.currentDocument = doc; - this._hideCurrentDocument(); - this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); - this.application.ninja.stage.hideCanvas(false); + if(this.activeDocument) { + // There is a document currently opened - this.activeDocument = doc; +// this.application.ninja.stage.stageView.showCodeViewBar(false); +// this.application.ninja.stage.stageView.restoreAllPanels(); - if(!this.webTemplate) { - this._showCurrentDocument(); + // + /* + if(this.activeDocument.currentView === "design"){ + this.activeDocument.saveAppState(); + this.activeDocument.container.parentNode.style["display"] = "none"; + this.application.ninja.stage.hideCanvas(true); + this.application.ninja.stage.stageView.hideRulers(); + } + + this.activeDocument.container.style["display"] = "none"; + */ + // hide current document } else { - this.application.ninja.stage.stageView.showRulers(); - } + // There is no document opened - this.webTemplate = false; + // Set the active document + this.activeDocument = doc; - this._initializeBodyStyles(); - NJevent("onOpenDocument", doc); + // Show the canvas + this.application.ninja.stage.hideCanvas(false); + + // Show the rulers + // TODO: Move this indo design view + this.application.ninja.stage.stageView.showRulers(); - this.application.ninja.stage.stageView.showCodeViewBar(false); - this.application.ninja.stage.stageView.restoreAllPanels(); + // Initialize the documentRoot styles + this.initializeRootStyles(doc.documentRoot); + // Flag to stop stylesheet dirty event + this._hackInitialStyles = false; - // Flag to stop stylesheet dirty event - this._hackInitialStyles = false; + NJevent("onOpenDocument", doc); + } } }, _onOpenTextDocument: { value: function(doc) { - this._hideCurrentDocument(); + if(this.activeDocument) { + if(this.activeDocument.currentView === "design"){ + this.activeDocument.saveAppState(); + this.activeDocument.container.parentNode.style["display"] = "none"; + this.application.ninja.stage.hideCanvas(true); + this.application.ninja.stage.stageView.hideRulers(); + } + + this.activeDocument.container.style["display"] = "none"; + } + this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe this.activeDocument = doc; @@ -589,21 +564,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, } }, - _hideCurrentDocument: { - value: function() { - if(this.activeDocument) { - if(this.activeDocument.currentView === "design"){ - this.activeDocument.saveAppState(); - this.activeDocument.container.parentNode.style["display"] = "none"; - this.application.ninja.stage.hideCanvas(true); - this.application.ninja.stage.stageView.hideRulers(); - } - - this.activeDocument.container.style["display"] = "none"; - } - } - }, - _showCurrentDocument: { value: function() { if(this.activeDocument) { @@ -611,8 +571,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, if(this.activeDocument.currentView === "design"){ this.activeDocument.container.parentNode.style["display"] = "block"; this.activeDocument.restoreAppState(); - this.application.ninja.stage.hideCanvas(false); - this.application.ninja.stage.stageView.showRulers(); }else{ //hide the iframe when switching to code view document.getElementById("iframeContainer").style.display = "none"; @@ -621,46 +579,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, } }, - _removeDocumentView: { - value: function(node) { - node.parentNode.removeChild(node); - } - }, - - reloadDocumentContent: { - value: function() { - this.activeDocument._window.location.reload(); - } - }, - - /** - * Creates a new iFrame element using a new unique ID for it. Returns the iframe ID. - */ - _createIframeElement: { - value: function() { - var e = document.createElement("iframe"); - e.id = this._createIframeID(); - e.style.border = "none"; - e.style.opacity = 0; - e.height = 1000; - e.width = 2000; - e.src = ""; - - if(!this._iframeHolder) this._iframeHolder = document.getElementById("iframeContainer"); - - this._iframeHolder.appendChild(e); - - return e; - } - }, - - - _createIframeID: { - value: function() { - return "userDocument_" + (this._iframeCounter++); - } - }, - handleStyleSheetDirty:{ value:function(){ if(!this._hackInitialStyles) { @@ -669,27 +587,27 @@ var DocumentController = exports.DocumentController = Montage.create(Component, } }, - _initializeBodyStyles: { - value: function() { + // TODO: Move this into the design views + initializeRootStyles: { + value: function(documentRoot) { var sc = this.application.ninja.stylesController, - docRoot = this.application.ninja.currentDocument.documentRoot, styles = {}, needsRule = false, rule; - if(sc.getElementStyle(docRoot, "width", false, false) == null) { + if(sc.getElementStyle(documentRoot, "width", false, false) == null) { styles['width'] = '100%'; needsRule = true; } - if(sc.getElementStyle(docRoot, "height", false, false) == null) { + if(sc.getElementStyle(documentRoot, "height", false, false) == null) { styles['height'] = '100%'; needsRule = true; } - if(sc.getElementStyle(docRoot, "-webkit-transform", false, false) == null) { + if(sc.getElementStyle(documentRoot, "-webkit-transform", false, false) == null) { styles['-webkit-transform'] = 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)'; needsRule = true; } - if(sc.getElementStyle(docRoot, "-webkit-transform-style", false, false) == null) { + if(sc.getElementStyle(documentRoot, "-webkit-transform-style", false, false) == null) { styles['-webkit-transform-style'] = 'preserve-3d'; needsRule = true; } @@ -697,7 +615,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, if(needsRule) { rule = sc.addRule('.ninja-body{}'); sc.setStyles(rule, styles); - sc.addClass(docRoot, "ninja-body"); + sc.addClass(documentRoot, "ninja-body"); } } } -- cgit v1.2.3 From 402a369c7bf164c3c6686be3a33f5e36f25e4130 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 23:19:32 -0700 Subject: document controller and stage view code cleanup Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 1796f9b5..cf46e73e 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -458,8 +458,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, if(this.activeDocument) { // There is a document currently opened -// this.application.ninja.stage.stageView.showCodeViewBar(false); -// this.application.ninja.stage.stageView.restoreAllPanels(); + + + //this.application.ninja.stage.stageView.showCodeViewBar(false); + //this.application.ninja.stage.stageView.restoreAllPanels(); // /* @@ -472,6 +474,18 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.activeDocument.container.style["display"] = "none"; */ + + /* + this.activeDocument.container.style["display"] = "block"; + if(this.activeDocument.currentView === "design"){ + this.activeDocument.container.parentNode.style["display"] = "block"; + this.activeDocument.restoreAppState(); + }else{ + //hide the iframe when switching to code view + document.getElementById("iframeContainer").style.display = "none"; + } + + */ // hide current document } else { // There is no document opened @@ -564,21 +578,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, } }, - _showCurrentDocument: { - value: function() { - if(this.activeDocument) { - this.activeDocument.container.style["display"] = "block"; - if(this.activeDocument.currentView === "design"){ - this.activeDocument.container.parentNode.style["display"] = "block"; - this.activeDocument.restoreAppState(); - }else{ - //hide the iframe when switching to code view - document.getElementById("iframeContainer").style.display = "none"; - } - } - } - }, - handleStyleSheetDirty:{ value:function(){ if(!this._hackInitialStyles) { -- cgit v1.2.3