diff options
author | Ananya Sen | 2012-06-08 17:09:55 -0700 |
---|---|---|
committer | Ananya Sen | 2012-06-08 17:09:55 -0700 |
commit | 19d9da2ae655f0b531aa0e348a15bcf9d673a776 (patch) | |
tree | 4ec453ac47c77b9d5872e0b78a1b17971a95ce3d /js | |
parent | 113ed223e9848d9838e574c67720d524653e704c (diff) | |
parent | bad5a44824ba35cbc7f4f4d245e32b90208f00c1 (diff) | |
download | ninja-19d9da2ae655f0b531aa0e348a15bcf9d673a776.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into cut-copy-paste
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/elements/body-controller.js | 5 | ||||
-rwxr-xr-x | js/controllers/elements/controller-factory.js | 4 | ||||
-rwxr-xr-x | js/controllers/styles-controller.js | 4 | ||||
-rwxr-xr-x | js/data/pi/pi-data.js | 10 | ||||
-rwxr-xr-x | js/document/mediators/template.js | 100 | ||||
-rwxr-xr-x | js/document/models/base.js | 41 | ||||
-rwxr-xr-x | js/document/models/html.js | 2 | ||||
-rwxr-xr-x | js/document/views/design.js | 14 | ||||
-rwxr-xr-x | js/lib/geom/brush-stroke.js | 1423 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 10 | ||||
-rwxr-xr-x | js/models/element-model.js | 6 | ||||
-rwxr-xr-x | js/panels/properties.reel/properties.js | 4 | ||||
-rwxr-xr-x | js/panels/properties.reel/sections/custom.reel/custom.js | 2 | ||||
-rw-r--r-- | js/panels/resize-composer.js | 5 | ||||
-rw-r--r-- | js/tools/BrushTool.js | 2 |
15 files changed, 899 insertions, 733 deletions
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js index 9c427c62..0dc11b82 100755 --- a/js/controllers/elements/body-controller.js +++ b/js/controllers/elements/body-controller.js | |||
@@ -30,7 +30,8 @@ exports.BodyController = Montage.create(ElementController, { | |||
30 | value: function(el, p) { | 30 | value: function(el, p) { |
31 | switch(p) { | 31 | switch(p) { |
32 | case "background" : | 32 | case "background" : |
33 | return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color", false, true)); | 33 | case "background-color": |
34 | return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color")); | ||
34 | case "border": | 35 | case "border": |
35 | return 0; | 36 | return 0; |
36 | case "height": | 37 | case "height": |
@@ -47,8 +48,8 @@ exports.BodyController = Montage.create(ElementController, { | |||
47 | setProperty: { | 48 | setProperty: { |
48 | value: function(el, p, value) { | 49 | value: function(el, p, value) { |
49 | switch(p) { | 50 | switch(p) { |
50 | case "body-background": | ||
51 | case "background": | 51 | case "background": |
52 | case "background-color": | ||
52 | this.application.ninja.stylesController.setElementStyle(el, "background-color", value); | 53 | this.application.ninja.stylesController.setElementStyle(el, "background-color", value); |
53 | break; | 54 | break; |
54 | case "overflow": | 55 | case "overflow": |
diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js index 3ac3fe14..2d2a5cd1 100755 --- a/js/controllers/elements/controller-factory.js +++ b/js/controllers/elements/controller-factory.js | |||
@@ -8,7 +8,6 @@ var Montage = require("montage/core/core").Montage; | |||
8 | 8 | ||
9 | var BodyController = require("js/controllers/elements/body-controller").BodyController, | 9 | var BodyController = require("js/controllers/elements/body-controller").BodyController, |
10 | BlockController = require("js/controllers/elements/block-controller").BlockController, | 10 | BlockController = require("js/controllers/elements/block-controller").BlockController, |
11 | StageController = require("js/controllers/elements/stage-controller").StageController, | ||
12 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, | 11 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, |
13 | ImageController = require("js/controllers/elements/image-controller").ImageController, | 12 | ImageController = require("js/controllers/elements/image-controller").ImageController, |
14 | VideoController = require("js/controllers/elements/video-controller").VideoController, | 13 | VideoController = require("js/controllers/elements/video-controller").VideoController, |
@@ -27,7 +26,8 @@ exports.ControllerFactory = Montage.create(Montage, { | |||
27 | if(value.indexOf("block") !== -1) { | 26 | if(value.indexOf("block") !== -1) { |
28 | return BlockController; | 27 | return BlockController; |
29 | } else if(value.indexOf("stage") !== -1) { | 28 | } else if(value.indexOf("stage") !== -1) { |
30 | return StageController; | 29 | // return StageController; |
30 | alert("Calling the stage controller. Should not be calling this object"); | ||
31 | } else if(value.indexOf("body") !== -1) { | 31 | } else if(value.indexOf("body") !== -1) { |
32 | return BodyController; | 32 | return BodyController; |
33 | } else if(value.indexOf("shape") !== -1) { | 33 | } else if(value.indexOf("shape") !== -1) { |
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 83722184..a25a05df 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -154,6 +154,10 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
154 | styles['-webkit-transform-style'] = 'preserve-3d'; | 154 | styles['-webkit-transform-style'] = 'preserve-3d'; |
155 | needsRule = true; | 155 | needsRule = true; |
156 | } | 156 | } |
157 | if(this.getElementStyle(this.currentDocument.model.documentRoot, "background-color", false, false) == null) { | ||
158 | styles['background-color'] = "transparent"; | ||
159 | needsRule = true; | ||
160 | } | ||
157 | 161 | ||
158 | if(needsRule) { | 162 | if(needsRule) { |
159 | rule = this.addRule('.ninja-body{}'); | 163 | rule = this.addRule('.ninja-body{}'); |
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js index 157cbc64..92d70141 100755 --- a/js/data/pi/pi-data.js +++ b/js/data/pi/pi-data.js | |||
@@ -703,13 +703,14 @@ exports.PiData = Montage.create( Montage, { | |||
703 | { | 703 | { |
704 | type : "color", | 704 | type : "color", |
705 | prop: "border", | 705 | prop: "border", |
706 | id : "stroke" | 706 | id : "stroke", |
707 | visible: false | ||
707 | }, | 708 | }, |
708 | { | 709 | { |
709 | type : "color", | 710 | type : "color", |
710 | id : "fill", | 711 | id : "fill", |
711 | prop: "background", | 712 | prop: "background", |
712 | visible : false, | 713 | visible : true, |
713 | divider : true | 714 | divider : true |
714 | } | 715 | } |
715 | ], | 716 | ], |
@@ -761,7 +762,9 @@ exports.PiData = Montage.create( Montage, { | |||
761 | valueMutator: parseFloat, | 762 | valueMutator: parseFloat, |
762 | min : 0, | 763 | min : 0, |
763 | max : 100, | 764 | max : 100, |
764 | value : 0 | 765 | value : 0, |
766 | acceptableUnits: [" "], | ||
767 | unit: " " | ||
765 | } | 768 | } |
766 | ] | 769 | ] |
767 | ] | 770 | ] |
@@ -788,6 +791,7 @@ exports.PiData = Montage.create( Montage, { | |||
788 | min : -90, | 791 | min : -90, |
789 | max : 90, | 792 | max : 90, |
790 | value : 0, | 793 | value : 0, |
794 | acceptableUnits: ["deg."], | ||
791 | unit : "deg." | 795 | unit : "deg." |
792 | } | 796 | } |
793 | ] | 797 | ] |
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js index 068a1f48..4c72314a 100755 --- a/js/document/mediators/template.js +++ b/js/document/mediators/template.js | |||
@@ -8,7 +8,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
8 | // | 8 | // |
9 | var Montage = require("montage/core/core").Montage, | 9 | var Montage = require("montage/core/core").Montage, |
10 | Component = require("montage/ui/component").Component, | 10 | Component = require("montage/ui/component").Component, |
11 | TemplateCreator = require("node_modules/tools/template/template-creator").TemplateCreator; | 11 | TemplateCreator = require("node_modules/tools/template/template-creator").TemplateCreator, |
12 | ClassUuid = require("js/components/core/class-uuid").ClassUuid; | ||
12 | //////////////////////////////////////////////////////////////////////// | 13 | //////////////////////////////////////////////////////////////////////// |
13 | // | 14 | // |
14 | exports.TemplateDocumentMediator = Montage.create(Component, { | 15 | exports.TemplateDocumentMediator = Montage.create(Component, { |
@@ -83,9 +84,24 @@ exports.TemplateDocumentMediator = Montage.create(Component, { | |||
83 | parseHtmlToNinjaTemplate: { | 84 | parseHtmlToNinjaTemplate: { |
84 | value: function (html) { | 85 | value: function (html) { |
85 | //Creating temp object to mimic HTML | 86 | //Creating temp object to mimic HTML |
86 | var doc = window.document.implementation.createHTMLDocument(), template; | 87 | var doc = window.document.implementation.createHTMLDocument(), template, docHtmlTag, |
88 | hackHtml = document.createElement('html'), hackTag; | ||
87 | //Setting content to temp | 89 | //Setting content to temp |
88 | doc.getElementsByTagName('html')[0].innerHTML = html; | 90 | doc.getElementsByTagName('html')[0].innerHTML = html; |
91 | //TODO: Improve this, very bad way of copying attributes (in a pinch to get it working) | ||
92 | hackHtml.innerHTML = html.replace(/html/gi, 'ninjahtmlhack'); | ||
93 | hackTag = hackHtml.getElementsByTagName('ninjahtmlhack')[0]; | ||
94 | docHtmlTag = doc.getElementsByTagName('html')[0]; | ||
95 | //Looping through the attributes to copy them | ||
96 | if (hackTag) { | ||
97 | for (var m in hackTag.attributes) { | ||
98 | if (hackTag.attributes[m].value) { | ||
99 | docHtmlTag.setAttribute(hackTag.attributes[m].name.replace(/ninjahtmlhack/gi, 'html'), hackTag.attributes[m].value.replace(/ninjahtmlhack/gi, 'html')); | ||
100 | } | ||
101 | } | ||
102 | } | ||
103 | //Garbage collection | ||
104 | hackHtml = hackTag = null; | ||
89 | //Creating return object | 105 | //Creating return object |
90 | return {head: doc.head.innerHTML, body: doc.body.innerHTML, document: doc}; | 106 | return {head: doc.head.innerHTML, body: doc.body.innerHTML, document: doc}; |
91 | } | 107 | } |
@@ -93,7 +109,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, { | |||
93 | //////////////////////////////////////////////////////////////////// | 109 | //////////////////////////////////////////////////////////////////// |
94 | //TODO: Expand to allow more templates, clean up variables | 110 | //TODO: Expand to allow more templates, clean up variables |
95 | parseNinjaTemplateToHtml: { | 111 | parseNinjaTemplateToHtml: { |
96 | value: function (template, ninjaWrapper, libCopyCallback) { | 112 | value: function (saveExternalData, template, ninjaWrapper, libCopyCallback) { |
97 | //TODO: Improve reference for rootUrl | 113 | //TODO: Improve reference for rootUrl |
98 | var regexRootUrl, | 114 | var regexRootUrl, |
99 | rootUrl = this.application.ninja.coreIoApi.rootUrl + escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])), | 115 | rootUrl = this.application.ninja.coreIoApi.rootUrl + escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])), |
@@ -116,20 +132,36 @@ exports.TemplateDocumentMediator = Montage.create(Component, { | |||
116 | template.file.content.document.head.innerHTML = template.head.innerHTML.replace(regexRootUrl, ''); | 132 | template.file.content.document.head.innerHTML = template.head.innerHTML.replace(regexRootUrl, ''); |
117 | template.file.content.document.body.innerHTML = template.body.innerHTML.replace(regexRootUrl, ''); | 133 | template.file.content.document.body.innerHTML = template.body.innerHTML.replace(regexRootUrl, ''); |
118 | } | 134 | } |
135 | //Removes all attributes from node | ||
136 | function wipeAttributes (node) { | ||
137 | for (var f in node.attributes) { | ||
138 | node.removeAttribute(node.attributes[f].name); | ||
139 | } | ||
140 | } | ||
119 | //Copying attributes to maintain same properties as the <body> | 141 | //Copying attributes to maintain same properties as the <body> |
142 | wipeAttributes(template.file.content.document.body); | ||
120 | for (var n in template.body.attributes) { | 143 | for (var n in template.body.attributes) { |
121 | if (template.body.attributes[n].value) { | 144 | if (template.body.attributes[n].value) { |
122 | // | ||
123 | template.file.content.document.body.setAttribute(template.body.attributes[n].name, template.body.attributes[n].value); | 145 | template.file.content.document.body.setAttribute(template.body.attributes[n].name, template.body.attributes[n].value); |
124 | } | 146 | } |
125 | } | 147 | } |