aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-06 14:37:04 -0700
committerValerio Virgillito2012-06-06 14:37:04 -0700
commitbc7ca741f8c8adcb5c5919af6f808a20c37ea5d7 (patch)
tree0e4cf90f47937e7d718d82da1a0d0dab5ac5f136 /js
parentfb684fb27c2cef04251655d86e55eceed9da3132 (diff)
parente14ce28b5c8858af75fbf2003c8f1b854daa7e35 (diff)
downloadninja-bc7ca741f8c8adcb5c5919af6f808a20c37ea5d7.tar.gz
Merge branch 'refs/heads/master' into element-model-fixes
Conflicts: js/document/models/html.js js/document/views/design.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/tools-properties/pen-properties.reel/pen-properties.js27
-rwxr-xr-xjs/data/tools-data.js4
-rwxr-xr-xjs/document/document-html.js4
-rwxr-xr-xjs/document/models/base.js37
-rwxr-xr-xjs/document/models/html.js25
-rwxr-xr-xjs/document/views/design.js58
-rwxr-xr-xjs/helper-classes/3D/math-utils.js11
-rw-r--r--js/io/system/ninjalibrary.json2
-rwxr-xr-xjs/lib/geom/brush-stroke.js93
-rwxr-xr-xjs/lib/geom/sub-path.js331
-rwxr-xr-xjs/mediators/keyboard-mediator.js7
-rwxr-xr-xjs/stage/stage.reel/stage.js3
-rw-r--r--js/tools/BrushTool.js14
-rwxr-xr-xjs/tools/PenTool.js444
14 files changed, 748 insertions, 312 deletions
diff --git a/js/components/tools-properties/pen-properties.reel/pen-properties.js b/js/components/tools-properties/pen-properties.reel/pen-properties.js
index cd205e07..c37359e1 100755
--- a/js/components/tools-properties/pen-properties.reel/pen-properties.js
+++ b/js/components/tools-properties/pen-properties.reel/pen-properties.js
@@ -9,6 +9,17 @@ var ToolProperties = require("js/components/tools-properties/tool-properties").T
9 9
10var PenProperties = exports.PenProperties = Montage.create(ToolProperties, { 10var PenProperties = exports.PenProperties = Montage.create(ToolProperties, {
11 addedColorChips: { value: false }, 11 addedColorChips: { value: false },
12 _penToolRadio: { value: null, enumerable: false },
13 _penPlusRadio: { value: null, enumerable: false },
14 _penMinusRadio: { value: null, enumerable: false },
15
16 _subPrepare: {
17 value: function() {
18 this._penToolRadio.addEventListener("click", this, false);
19 this._penPlusRadio.addEventListener("click", this, false);
20 this._penMinusRadio.addEventListener("click", this, false);
21 }
22 },
12 23
13 _fill: { 24 _fill: {
14 enumerable: false, 25 enumerable: false,
@@ -50,6 +61,22 @@ var PenProperties = exports.PenProperties = Montage.create(ToolProperties, {
50 } 61 }
51 }, 62 },
52 63
64 _selectedSubtool: {
65 value: "pen", enumerable: false
66 },
67
68 selectedSubtool: {
69 get: function() { return this._selectedSubtool;},
70 set: function(value) { this._selectedSubtool = value; }
71 },
72
73 handleClick: {
74 value: function(event) {
75 this._selectedSubtool = event._event.target.value;
76 NJevent("penSubToolChange");
77 }
78 },
79
53 draw: { 80 draw: {
54 enumerable: false, 81 enumerable: false,
55 value: function () { 82 value: function () {
diff --git a/js/data/tools-data.js b/js/data/tools-data.js
index 05455efe..138f9f4d 100755
--- a/js/data/tools-data.js
+++ b/js/data/tools-data.js
@@ -104,7 +104,7 @@ exports.ToolsData = Montage.create(Montage, {
104 "properties": "penProperties", 104 "properties": "penProperties",
105 "spriteSheet": true, 105 "spriteSheet": true,
106 "action": "PenTool", 106 "action": "PenTool",
107 "toolTip": "Pen Tool", 107 "toolTip": "Pen Tool (P)",
108 "cursor": "auto", 108 "cursor": "auto",
109 "lastInGroup": false, 109 "lastInGroup": false,
110 "container": false, 110 "container": false,
@@ -165,7 +165,7 @@ exports.ToolsData = Montage.create(Montage, {
165 "properties": "brushProperties", 165 "properties": "brushProperties",
166 "spriteSheet": true, 166 "spriteSheet": true,
167 "action": "BrushTool", 167 "action": "BrushTool",
168 "toolTip": "Brush Tool", 168 "toolTip": "Brush Tool (B)",
169 "cursor": "url('images/tools/brush_down.png') 9 17, default", 169 "cursor": "url('images/tools/brush_down.png') 9 17, default",
170 "lastInGroup": false, 170 "lastInGroup": false,
171 "container": false, 171 "container": false,
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 4a8d5d41..04565753 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -68,6 +68,8 @@ exports.HtmlDocument = Montage.create(Component, {
68 if (this.model.views.design.initialize(this.model.parentContainer)) { 68 if (this.model.views.design.initialize(this.model.parentContainer)) {
69 //Hiding iFrame, just initiliazing 69 //Hiding iFrame, just initiliazing
70 this.model.views.design.hide(); 70 this.model.views.design.hide();
71 //Setting the iFrame property for reference in helper class
72 this.model.webGlHelper.iframe = this.model.views.design.iframe;
71 } else { 73 } else {
72 //ERROR: Design View not initialized 74 //ERROR: Design View not initialized
73 } 75 }
@@ -82,7 +84,7 @@ exports.HtmlDocument = Montage.create(Component, {
82 this.model.views.design.iframe.style.opacity = 0; 84 this.model.views.design.iframe.style.opacity = 0;
83 this.model.views.design.content = this.model.file.content; 85 this.model.views.design.content = this.model.file.content;
84 //TODO: Improve reference (probably through binding values) 86 //TODO: Improve reference (probably through binding values)
85 this.model.views.design.model = this.model; 87 this.model.views.design._webGlHelper = this.model.webGlHelper;
86 //Rendering design view, using observers to know when template is ready 88 //Rendering design view, using observers to know when template is ready
87 this.model.views.design.render(function () { 89 this.model.views.design.render(function () {
88 //Adding observer to know when template is ready 90 //Adding observer to know when template is ready
diff --git a/js/document/models/base.js b/js/document/models/base.js
index 0957145a..a3644815 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -65,7 +65,8 @@ exports.BaseDocumentModel = Montage.create(Component, {
65 _selection: { 65 _selection: {
66 value: [] 66 value: []
67 }, 67 },
68 68 ////////////////////////////////////////////////////////////////////
69 //
69 selection: { 70 selection: {
70 get: function() { 71 get: function() {
71 return this._selection; 72 return this._selection;
@@ -134,20 +135,22 @@ exports.BaseDocumentModel = Montage.create(Component, {
134 } 135 }
135 }, 136 },
136 //////////////////////////////////////////////////////////////////// 137 ////////////////////////////////////////////////////////////////////
137 // 138 //Gets all stylesheets in document
138 getStyleSheets: { 139 getStyleSheets: {
139 value: function () { 140 value: function () {
140 // 141 //Array to store styles (style and link tags)
141 var styles = []; 142 var styles = [];
142 // 143 //Looping through document sytles
143 for (var k in this.views.design.iframe.contentWindow.document.styleSheets) { 144 for (var k in this.views.design.iframe.contentWindow.document.styleSheets) {
145 //Check for styles to has proper propeties
144 if (this.views.design.iframe.contentWindow.document.styleSheets[k].ownerNode && this.views.design.iframe.contentWindow.document.styleSheets[k].ownerNode.getAttribute) { 146 if (this.views.design.iframe.contentWindow.document.styleSheets[k].ownerNode && this.views.design.iframe.contentWindow.document.styleSheets[k].ownerNode.getAttribute) {
147 //Check for ninja-template styles, if so, exclude
145 if (this.views.design.iframe.contentWindow.document.styleSheets[k].ownerNode.getAttribute('data-ninja-template') === null) { 148 if (this.views.design.iframe.contentWindow.document.styleSheets[k].ownerNode.getAttribute('data-ninja-template') === null) {
146 styles.push(this.views.design.iframe.contentWindow.document.styleSheets[k]); 149 styles.push(this.views.design.iframe.contentWindow.document.styleSheets[k]);
147 } 150 }
148 } 151 }
149 } 152 }
150 // 153 //Returning filtered results
151 return styles; 154 return styles;
152 } 155 }
153 }, 156 },
@@ -155,7 +158,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
155 // 158 //
156 save: { 159 save: {
157 value: function (callback, libCopyCallback) { 160 value: function (callback, libCopyCallback) {
158 // 161 //TODO: Implement on demand logic
159 if (this.needsSave) { 162 if (this.needsSave) {
160 //Save 163 //Save
161 } else { 164 } else {
@@ -184,7 +187,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
184 // 187 //
185 saveAll: { 188 saveAll: {
186 value: function (callback, libCopyCallback) { 189 value: function (callback, libCopyCallback) {
187 // 190 //TODO: Implement on demand logic
188 if (this.needsSave) { 191 if (this.needsSave) {
189 //Save 192 //Save
190 } else { 193 } else {
@@ -214,47 +217,49 @@ exports.BaseDocumentModel = Montage.create(Component, {
214 // 217 //
215 saveAs: { 218 saveAs: {
216 value: function (callback) { 219 value: function (callback) {
217 // 220 //TODO: Implement on demand logic
218 if (this.needsSave) { 221 if (this.needsSave) {
219 //Save current file on memory 222 //Save current file on memory
220 } else { 223 } else {
221 //Copy file from disk 224 //Copy file from disk
222 } 225 }
226 //TODO: Add functionality
223 } 227 }
224 }, 228 },
225 //////////////////////////////////////////////////////////////////// 229 ////////////////////////////////////////////////////////////////////
226 // 230 //
227 handleSaved: { 231 handleSaved: {
228 value: function (result) { 232 value: function (result) {
229 // 233 //Checking for success code in save
230 if (result.status === 204) { 234 if (result.status === 204) {
235 //Clearing flag with successful save
231 this.model.needsSave = false; 236 this.model.needsSave = false;
232 } 237 }
233 //