aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js2
-rwxr-xr-xjs/controllers/selection-controller.js6
-rwxr-xr-xjs/controllers/styles-controller.js36
3 files changed, 22 insertions, 22 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 4edcff48..f84e4da5 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -475,7 +475,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
475 this.activeDocument = doc; 475 this.activeDocument = doc;
476 476
477 // Initialize the documentRoot styles 477 // Initialize the documentRoot styles
478 this.initializeRootStyles(doc.documentRoot); 478 this.initializeRootStyles(doc.model.documentRoot);
479 // Flag to stop stylesheet dirty event 479 // Flag to stop stylesheet dirty event
480 this._hackInitialStyles = false; 480 this._hackInitialStyles = false;
481 481
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 1092615a..7bef0db8 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -114,7 +114,7 @@ exports.SelectionController = Montage.create(Component, {
114 value: function(event) { 114 value: function(event) {
115 var selected = [], childNodes = [], self = this; 115 var selected = [], childNodes = [], self = this;
116 116
117 childNodes = this.application.ninja.currentDocument.documentRoot.childNodes; 117 childNodes = this.application.ninja.currentDocument.model.documentRoot.childNodes;
118 childNodes = Array.prototype.slice.call(childNodes, 0); 118 childNodes = Array.prototype.slice.call(childNodes, 0);
119 childNodes.forEach(function(item) { 119 childNodes.forEach(function(item) {
120 if(self.isNodeTraversable(item)) { 120 if(self.isNodeTraversable(item)) {
@@ -256,10 +256,10 @@ exports.SelectionController = Montage.create(Component, {
256 256
257 for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) { 257 for(var i=0, uuid; this.application.ninja.selectedElements[i];i++) {
258 // Check for multiple selection and excluding inner elements 258 // Check for multiple selection and excluding inner elements
259 if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.documentRoot) { 259 if(item.parentNode && item.parentNode !== this.application.ninja.currentDocument.model.documentRoot) {
260 var outerElement = item.parentNode; 260 var outerElement = item.parentNode;
261 261
262 while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.documentRoot) { 262 while(outerElement.parentNode && outerElement.parentNode !== this.application.ninja.currentDocument.model.documentRoot) {
263 outerElement = outerElement.parentNode; 263 outerElement = outerElement.parentNode;
264 } 264 }
265 265
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index dcbe0eaf..04e87ba7 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -99,7 +99,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
99 // Setter will handle null case 99 // Setter will handle null case
100 this.defaultStylesheet = this.getSheetFromElement(this.CONST.DEFAULT_SHEET_ID); 100 this.defaultStylesheet = this.getSheetFromElement(this.CONST.DEFAULT_SHEET_ID);
101 101
102 this.userStyleSheets = nj.toArray(document._document.styleSheets).filter(function(sheet) { 102 this.userStyleSheets = nj.toArray(document.model.views.design.document.styleSheets).filter(function(sheet) {
103 return sheet !== this._stageStylesheet; 103 return sheet !== this._stageStylesheet;
104 }, this); 104 }, this);
105 105
@@ -132,7 +132,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
132 else if(this._activeDocument.model && this._activeDocument.model.views && this._activeDocument.model.views.design){ 132 else if(this._activeDocument.model && this._activeDocument.model.views && this._activeDocument.model.views.design){
133 ///// Use the last stylesheet in the document as the default 133 ///// Use the last stylesheet in the document as the default
134 134
135 var sheets = this._activeDocument._document.styleSheets, 135 var sheets = this._activeDocument.model.views.design.document.styleSheets,
136 lastIndex = sheets.length-1; 136 lastIndex = sheets.length-1;
137 137
138 ///// If the only sheet is the stage stylesheet, this will be true 138 ///// If the only sheet is the stage stylesheet, this will be true
@@ -887,7 +887,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
887 887
888 getAnimationRuleWithName : { 888 getAnimationRuleWithName : {
889 value: function(name, document) { 889 value: function(name, document) {
890 var doc = document || this._activeDocument._document, 890 var doc = document || this._activeDocument.model.views.design.document,
891 animRules = this.getDocumentAnimationRules(doc), 891 animRules = this.getDocumentAnimationRules(doc),
892 rule, i; 892 rule, i;
893 893
@@ -909,7 +909,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
909 909
910 getDocumentAnimationRules : { 910 getDocumentAnimationRules : {
911 value: function(document) { 911 value: function(document) {
912 var sheets = (document) ? document.styleSheets : this._activeDocument._document.styleSheets, 912 var sheets = (document) ? document.styleSheets : this._activeDocument.model.views.design.document.styleSheets,
913 rules = []; 913 rules = [];
914 914
915 nj.toArray(sheets).forEach(function(sheet) { 915 nj.toArray(sheets).forEach(function(sheet) {
@@ -1272,7 +1272,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1272 1272
1273 createStylesheet : { 1273 createStylesheet : {
1274 value: function(id, document) { 1274 value: function(id, document) {
1275 var doc = document || this._activeDocument._document, 1275 var doc = document || this._activeDocument.model.views.design.document,
1276 sheetElement, sheet; 1276 sheetElement, sheet;
1277 1277
1278 sheetElement = nj.make('style', { 1278 sheetElement = nj.make('style', {
@@ -1329,7 +1329,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1329 1329
1330 getSheetFromElement : { 1330 getSheetFromElement : {
1331 value : function(element, context) { 1331 value : function(element, context) {
1332 var doc = context || this._activeDocument._document, 1332 var doc = context || this._activeDocument.model.views.design.document,
1333 el = (typeof element === 'string') ? nj.$(element, doc) : element; 1333 el = (typeof element === 'string') ? nj.$(element, doc) : element;
1334 1334
1335 if(el && el.sheet) { 1335 if(el && el.sheet) {
@@ -1572,7 +1572,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1572 getStyleTest : function() { 1572 getStyleTest : function() {
1573 var properties = ['background-position', 'width', 'height']; 1573 var properties = ['background-position', 'width', 'height'];
1574 1574
1575 var el = stylesController.activeDocument._document.getElementById('Div_1'); 1575 var el = stylesController.activeDocument.model.views.design.document.getElementById('Div_1');
1576 1576
1577 properties.forEach(function(prop) { 1577 properties.forEach(function(prop) {
1578 console.log('Getting value for "' + prop + '": ' + stylesController.getElementStyle(el, prop, true)); 1578 console.log('Getting value for "' + prop + '": ' + stylesController.getElementStyle(el, prop, true));
@@ -1591,7 +1591,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1591 }); 1591 });
1592 }, 1592 },
1593 getMatchingRulesTest : function() { 1593 getMatchingRulesTest : function() {
1594 var el = stylesController.activeDocument._document.getElementById('Div_1'), 1594 var el = stylesController.activeDocument.model.views.design.document.getElementById('Div_1'),
1595 mRules; 1595 mRules;
1596 1596
1597 this.addRulesTest(); 1597 this.addRulesTest();
@@ -1606,7 +1606,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1606 ///// apply a new style using setElementStyle, and print out the new 1606 ///// apply a new style using setElementStyle, and print out the new
1607 ///// value. 1607 ///// value.
1608 1608
1609 var el = stylesController.activeDocument._document.getElementById('Div_1'), 1609 var el = stylesController.activeDocument.model.views.design.document.getElementById('Div_1'),
1610 bg; 1610 bg;
1611 1611
1612 console.log('----- Set Element Style Test -----'); 1612 console.log('----- Set Element Style Test -----');
@@ -1631,14 +1631,14 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1631 var rules = ['#UserContent div { background-color: blue }']; 1631 var rules = ['#UserContent div { background-color: blue }'];
1632 rules.forEach(function(rule) { stylesController.addRule(rule); }); 1632 rules.forEach(function(rule) { stylesController.addRule(rule); });
1633 1633
1634 var el = stylesController.activeDocument._document.getElementById('Div_1'); 1634 var el = stylesController.activeDocument.model.views.design.document.getElementById('Div_1');
1635 stylesController.setElementStyle(el, 'color', 'red'); 1635 stylesController.setElementStyle(el, 'color', 'red');
1636 1636
1637 ///// the #Div_1 rule created by tag tool should have the color style 1637 ///// the #Div_1 rule created by tag tool should have the color style
1638 }, 1638 },
1639 setElementStyle3Test : function() { 1639 setElementStyle3Test : function() {
1640 ///// First, draw a div onto the stage 1640 ///// First, draw a div onto the stage
1641 var el = stylesController.activeDocument._document.getElementById('Div_1'); 1641 var el = stylesController.activeDocument.model.views.design.document.getElementById('Div_1');
1642 1642
1643 //// now add a multi-target rule overriding the bg color 1643 //// now add a multi-target rule overriding the bg color
1644 var rules = [ 1644 var rules = [
@@ -1655,14 +1655,14 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1655 }, 1655 },
1656 setGroupStyleTest : function() { 1656 setGroupStyleTest : function() {
1657 ///// draw 2 divs on stage 1657 ///// draw 2 divs on stage
1658 var el1 = stylesController.activeDocument._document.getElementById('Div_1'); 1658 var el1 = stylesController.activeDocument.model.views.design.document.getElementById('Div_1');
1659 var el2 = stylesController.activeDocument._document.getElementById('Div_2'); 1659 var el2 = stylesController.activeDocument.model.views.design.document.getElementById('Div_2');
1660 1660
1661 var dominantRule = stylesController.getDominantRuleForGroup([el1, el2], 'color'); 1661 var dominantRule = stylesController.getDominantRuleForGroup([el1, el2], 'color');
1662 }, 1662 },
1663 setElementStylesTest : function() { 1663 setElementStylesTest : function() {
1664 ///// draw a div on stage 1664 ///// draw a div on stage
1665 var el = stylesController.activeDocument._document.getElementById('Div_1'); 1665 var el = stylesController.activeDocument.model.views.design.document.getElementById('Div_1');
1666 1666
1667 mRules = stylesController.getMatchingRules(el, true); 1667 mRules = stylesController.getMatchingRules(el, true);
1668 mRules.forEach(function(rule) { 1668 mRules.forEach(function(rule) {
@@ -1681,7 +1681,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1681 1681
1682 console.log('----- Create Override Rule Test -----'); 1682 console.log('----- Create Override Rule Test -----');
1683 1683
1684 var el = stylesController.activeDocument._document.getElementById('Div_1'), 1684 var el = stylesController.activeDocument.model.views.design.document.getElementById('Div_1'),
1685 rule = stylesController.addRule('#UserContent div { background-color: blue }'), 1685 rule = stylesController.addRule('#UserContent div { background-color: blue }'),
1686 override; 1686 override;
1687 1687
@@ -1693,7 +1693,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1693 }, 1693 },
1694 deleteRulesTest : function() { 1694 deleteRulesTest : function() {
1695 // drag one div on stage 1695 // drag one div on stage
1696