aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/components/converter/string-units-converter.js2
-rw-r--r--js/components/converter/string-value-converter.js2
-rwxr-xr-xjs/controllers/elements/body-controller.js4
-rwxr-xr-xjs/controllers/elements/element-controller.js8
-rwxr-xr-xjs/controllers/elements/shapes-controller.js2
-rwxr-xr-xjs/data/menu-data.js12
-rwxr-xr-xjs/document/document-html.js10
-rwxr-xr-xjs/document/helpers/webgl-helper.js14
-rwxr-xr-xjs/document/models/html.js23
-rwxr-xr-xjs/document/templates/banner/index.html24
-rwxr-xr-xjs/document/templates/html/index.html27
-rwxr-xr-xjs/document/views/design.js28
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js4
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js14
-rwxr-xr-xjs/lib/NJUtils.js120
-rwxr-xr-xjs/mediators/drag-drop-mediator.js2
-rwxr-xr-xjs/mediators/element-mediator.js35
-rwxr-xr-xjs/models/element-model.js94
-rwxr-xr-xjs/panels/components-panel.reel/components-panel.js22
-rw-r--r--js/tools/BrushTool.js1
-rwxr-xr-xjs/tools/EyedropperTool.js1
-rwxr-xr-xjs/tools/LineTool.js1
-rwxr-xr-xjs/tools/PenTool.js1
-rwxr-xr-xjs/tools/ShapeTool.js1
-rwxr-xr-xjs/tools/TagTool.js3
25 files changed, 198 insertions, 257 deletions
diff --git a/js/components/converter/string-units-converter.js b/js/components/converter/string-units-converter.js
index 6b97d5c5..9f6e4112 100644
--- a/js/components/converter/string-units-converter.js
+++ b/js/components/converter/string-units-converter.js
@@ -9,7 +9,6 @@ var Montage = require("montage").Montage,
9 9
10exports.StringUnitsConverter = Montage.create(Converter, { 10exports.StringUnitsConverter = Montage.create(Converter, {
11 11
12 // convert fahrenheit to celsius (showing our non-metric heritage here)
13 convert: { 12 convert: {
14 value: function(value) { 13 value: function(value) {
15 if(value) { 14 if(value) {
@@ -20,7 +19,6 @@ exports.StringUnitsConverter = Montage.create(Converter, {
20 } 19 }
21 }, 20 },
22 21
23 // revert celsius to fahrenheit
24 revert: { 22 revert: {
25 value: function(value) { 23 value: function(value) {
26 console.log("revert string to unit ", value); 24 console.log("revert string to unit ", value);
diff --git a/js/components/converter/string-value-converter.js b/js/components/converter/string-value-converter.js
index 28d7dd29..f397f731 100644
--- a/js/components/converter/string-value-converter.js
+++ b/js/components/converter/string-value-converter.js
@@ -9,7 +9,6 @@ var Montage = require("montage").Montage,
9 9
10exports.StringValueConverter = Montage.create(Converter, { 10exports.StringValueConverter = Montage.create(Converter, {
11 11
12 // convert fahrenheit to celsius (showing our non-metric heritage here)
13 convert: { 12 convert: {
14 value: function(value) { 13 value: function(value) {
15 console.log(value); 14 console.log(value);
@@ -18,7 +17,6 @@ exports.StringValueConverter = Montage.create(Converter, {
18 } 17 }
19 }, 18 },
20 19
21 // revert celsius to fahrenheit
22 revert: { 20 revert: {
23 value: function(value) { 21 value: function(value) {
24 console.log("revert string to value ", value); 22 console.log("revert string to value ", value);
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index 7a3a66f5..9c427c62 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -71,7 +71,7 @@ exports.BodyController = Montage.create(ElementController, {
71 71
72 getPerspectiveDist: { 72 getPerspectiveDist: {
73 value: function(el) { 73 value: function(el) {
74 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { 74 if(el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) {
75 return el.elementModel.props3D.perspectiveDist; 75 return el.elementModel.props3D.perspectiveDist;
76 } else { 76 } else {
77 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); 77 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true);
@@ -83,7 +83,7 @@ exports.BodyController = Montage.create(ElementController, {
83 83
84 getMatrix: { 84 getMatrix: {
85 value: function(el) { 85 value: function(el) {
86 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) 86 if(el.elementModel.props3D && el.elementModel.props3D.matrix3d)
87 { 87 {
88 return el.elementModel.props3D.matrix3d.slice(0); 88 return el.elementModel.props3D.matrix3d.slice(0);
89 } 89 }
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 941e05ba..4a02e9a3 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -37,7 +37,7 @@ exports.ElementController = Montage.create(Component, {
37 // Remove the element from the DOM and clear the GLWord. 37 // Remove the element from the DOM and clear the GLWord.
38 removeElement: { 38 removeElement: {
39 value: function(el) { 39 value: function(el) {
40 if(el.elementModel && el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) { 40 if(el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) {
41 el.elementModel.shapeModel.GLWorld.clearTree(); 41 el.elementModel.shapeModel.GLWorld.clearTree();
42 } 42 }
43 el.parentNode.removeChild(el); 43 el.parentNode.removeChild(el);
@@ -277,7 +277,7 @@ exports.ElementController = Montage.create(Component, {
277 // Routines to get/set 3D properties 277 // Routines to get/set 3D properties
278 get3DProperty: { 278 get3DProperty: {
279 value: function(el, prop) { 279 value: function(el, prop) {
280 if(el.elementModel && el.elementModel.props3D) { 280 if(el.elementModel.props3D) {
281 return el.elementModel.props3D[prop]; 281 return el.elementModel.props3D[prop];
282 } 282 }
283 } 283 }
@@ -285,7 +285,7 @@ exports.ElementController = Montage.create(Component, {
285 285
286 getMatrix: { 286 getMatrix: {
287 value: function(el) { 287 value: function(el) {
288 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) { 288 if(el.elementModel.props3D && el.elementModel.props3D.matrix3d) {
289 return el.elementModel.props3D.matrix3d.slice(0); 289 return el.elementModel.props3D.matrix3d.slice(0);
290 } else { 290 } else {
291 var mat; 291 var mat;
@@ -305,7 +305,7 @@ exports.ElementController = Montage.create(Component, {
305 305
306 getPerspectiveDist: { 306 getPerspectiveDist: {
307 value: function(el) { 307 value: function(el) {
308 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { 308 if(el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) {
309 return el.elementModel.props3D.perspectiveDist; 309 return el.elementModel.props3D.perspectiveDist;
310 } else { 310 } else {
311 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false); 311 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false);
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 845e7dc2..9fc9b576 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -133,7 +133,7 @@ exports.ShapesController = Montage.create(CanvasController, {
133 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom()); 133 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom());
134 canvas.width = el.width; 134 canvas.width = el.width;
135 canvas.height = el.height; 135 canvas.height = el.height;
136 canvas.elementModel = el.elementModel; 136 canvas._model = el.elementModel;
137 this.toggleWebGlMode(canvas, value); 137 this.toggleWebGlMode(canvas, value);
138 this.application.ninja.elementMediator.replaceElement(canvas, el); 138 this.application.ninja.elementMediator.replaceElement(canvas, el);
139 break; 139 break;
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index 6c597542..b6350893 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -24,9 +24,15 @@ exports.MenuData = Montage.create(Component, {
24 24
25 this._currentDocument = value; 25 this._currentDocument = value;
26 26
27 this.documentEnabledIndices.forEach(function(index) { 27 if(!this._currentDocument) {
28 index.enabled = true; 28 this.documentEnabledIndices.forEach(function(index) {
29 }); 29 index.enabled = false;
30 });
31 } else {
32 this.documentEnabledIndices.forEach(function(index) {
33 index.enabled = true;
34 });
35 }
30 36
31 } 37 }
32 }, 38 },
diff --git a/js/document/document-html.js b/js/document/document-html.js
index c9acd2e0..04565753 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -90,7 +90,7 @@ exports.HtmlDocument = Montage.create(Component, {
90 //Adding observer to know when template is ready 90 //Adding observer to know when template is ready
91 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); 91 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this));
92 this._observer.observe(this.model.views.design.document.head, {childList: true}); 92 this._observer.observe(this.model.views.design.document.head, {childList: true});
93 }.bind(this), template); 93 }.bind(this), template, {viewCallback: this.handleViewReady, context: this});
94 } else { 94 } else {
95 //TODO: Identify default view (probably code) 95 //TODO: Identify default view (probably code)
96 } 96 }
@@ -103,10 +103,14 @@ exports.HtmlDocument = Montage.create(Component, {
103 //Removing observer, only needed on initial load 103 //Removing observer, only needed on initial load
104 this._observer.disconnect(); 104 this._observer.disconnect();
105 this._observer = null; 105 this._observer = null;
106 //Making callback after view is loaded
107 this.loaded.callback.call(this.loaded.context, this);
108 } 106 }
109 }, 107 },
108