diff options
author | Armen Kesablyan | 2012-02-22 16:26:41 -0800 |
---|---|---|
committer | Armen Kesablyan | 2012-02-22 16:26:41 -0800 |
commit | 0bd1cefea2ab350fad1a891bdc926053b799aafc (patch) | |
tree | 962f559fcc02a3dfeb297d59907e40fa153453f3 /js/controllers/elements | |
parent | 695bc5082f48dddf66ce31480a4faefc067b38bd (diff) | |
parent | 2d2b1af8b5c0d506fe6a1cf65614101fec145970 (diff) | |
download | ninja-0bd1cefea2ab350fad1a891bdc926053b799aafc.tar.gz |
Merge branch 'refs/heads/master' into new-tool-icons
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/block-controller.js | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/canvas-controller.js | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/component-controller.js | 44 | ||||
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/controller-factory.js | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/element-controller.js | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/image-controller.js | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/shapes-controller.js | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/stage-controller.js | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | js/controllers/elements/video-controller.js | 0 |
9 files changed, 52 insertions, 0 deletions
diff --git a/js/controllers/elements/block-controller.js b/js/controllers/elements/block-controller.js index 395a1a4d..395a1a4d 100644..100755 --- a/js/controllers/elements/block-controller.js +++ b/js/controllers/elements/block-controller.js | |||
diff --git a/js/controllers/elements/canvas-controller.js b/js/controllers/elements/canvas-controller.js index b5df3911..b5df3911 100644..100755 --- a/js/controllers/elements/canvas-controller.js +++ b/js/controllers/elements/canvas-controller.js | |||
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 458e6b46..83450d0f 100644..100755 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js | |||
@@ -9,4 +9,48 @@ var Montage = require("montage/core/core").Montage, | |||
9 | 9 | ||
10 | exports.ComponentController = Montage.create(ElementController, { | 10 | exports.ComponentController = Montage.create(ElementController, { |
11 | 11 | ||
12 | getProperty: { | ||
13 | value: function(el, prop) { | ||
14 | switch(prop) { | ||
15 | case "id": | ||
16 | case "class": | ||
17 | case "left": | ||
18 | case "top": | ||
19 | case "width": | ||
20 | case "height": | ||
21 | if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { | ||
22 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; | ||
23 | } else { | ||
24 | return ElementController.getProperty(el, prop, true); | ||
25 | } | ||
26 | default: | ||
27 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; | ||
28 | } | ||
29 | } | ||
30 | }, | ||
31 | |||
32 | setProperty: { | ||
33 | value: function(el, p, value) { | ||
34 | switch(p) { | ||
35 | case "id": | ||
36 | case "class": | ||
37 | case "left": | ||
38 | case "top": | ||
39 | case "width": | ||
40 | case "height": | ||
41 | if(el.nodeName === "IMG" && (p === "width" || p === "height")) { | ||
42 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | ||
43 | } else { | ||
44 | ElementController.setProperty(el, p, value); | ||
45 | } | ||
46 | break; | ||
47 | default: | ||
48 | if(p === "min" || p === "max") value = parseFloat(value); | ||
49 | |||
50 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | ||
51 | break; | ||
52 | |||
53 | } | ||
54 | } | ||
55 | } | ||
12 | }); | 56 | }); |
diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js index a772eb16..a772eb16 100644..100755 --- a/js/controllers/elements/controller-factory.js +++ b/js/controllers/elements/controller-factory.js | |||
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 65d26bdd..ac14def4 100644..100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -12,6 +12,9 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
12 | addElement: { | 12 | addElement: { |
13 | value: function(el, styles) { | 13 | value: function(el, styles) { |
14 | this.application.ninja.currentDocument.documentRoot.appendChild(el); | 14 | this.application.ninja.currentDocument.documentRoot.appendChild(el); |
15 | // Nested elements - | ||
16 | // TODO make sure the CSS is correct before nesting elements | ||
17 | // this.application.ninja.currentSelectedContainer.appendChild(el); | ||
15 | this.application.ninja.stylesController.setElementStyles(el, styles); | 18 | this.application.ninja.stylesController.setElementStyles(el, styles); |
16 | } | 19 | } |
17 | }, | 20 | }, |
diff --git a/js/controllers/elements/image-controller.js b/js/controllers/elements/image-controller.js index 5abce13e..5abce13e 100644..100755 --- a/js/controllers/elements/image-controller.js +++ b/js/controllers/elements/image-controller.js | |||
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 640119c4..15a18a51 100644..100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -59,6 +59,7 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
59 | break; | 59 | break; |
60 | case "useWebGl": | 60 | case "useWebGl": |
61 | var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); | 61 | var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); |
62 | canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom()); | ||
62 | canvas.width = el.width; | 63 | canvas.width = el.width; |
63 | canvas.height = el.height; | 64 | canvas.height = el.height; |
64 | this.application.ninja.elementMediator.replaceElement(el, canvas); | 65 | this.application.ninja.elementMediator.replaceElement(el, canvas); |
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js index af7c4858..a8546662 100644..100755 --- a/js/controllers/elements/stage-controller.js +++ b/js/controllers/elements/stage-controller.js | |||
@@ -92,7 +92,11 @@ exports.StageController = Montage.create(ElementController, { | |||
92 | 92 | ||
93 | setProperty: { | 93 | setProperty: { |
94 | value: function(el, p, value) { | 94 | value: function(el, p, value) { |
95 | |||
95 | switch(p) { | 96 | switch(p) { |
97 | case "body-background": | ||
98 | el.elementModel.body.style.setProperty("background", value); | ||
99 | break; | ||
96 | case "background": | 100 | case "background": |
97 | el.elementModel.stageBackground.style.setProperty(p, value); | 101 | el.elementModel.stageBackground.style.setProperty(p, value); |
98 | break; | 102 | break; |
diff --git a/js/controllers/elements/video-controller.js b/js/controllers/elements/video-controller.js index c36752f5..c36752f5 100644..100755 --- a/js/controllers/elements/video-controller.js +++ b/js/controllers/elements/video-controller.js | |||