diff options
44 files changed, 630 insertions, 2767 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 33b9b79a..83450d0f 100755 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js | |||
@@ -12,20 +12,19 @@ exports.ComponentController = Montage.create(ElementController, { | |||
12 | getProperty: { | 12 | getProperty: { |
13 | value: function(el, prop) { | 13 | value: function(el, prop) { |
14 | switch(prop) { | 14 | switch(prop) { |
15 | case "label": | 15 | case "id": |
16 | return this.application.ninja.currentDocument.getComponentFromElement(el).label; | 16 | case "class": |
17 | break; | 17 | case "left": |
18 | case "enabled": | 18 | case "top": |
19 | return this.application.ninja.currentDocument.getComponentFromElement(el).enabled; | 19 | case "width": |
20 | break; | 20 | case "height": |
21 | case "disabled": | 21 | if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { |
22 | return this.application.ninja.currentDocument.getComponentFromElement(el).disabled; | 22 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; |
23 | break; | 23 | } else { |
24 | case "value": | 24 | return ElementController.getProperty(el, prop, true); |
25 | return this.application.ninja.currentDocument.getComponentFromElement(el).value; | 25 | } |
26 | break; | ||
27 | default: | 26 | default: |
28 | return ElementController.getProperty(el, prop, true); | 27 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; |
29 | } | 28 | } |
30 | } | 29 | } |
31 | }, | 30 | }, |
@@ -33,20 +32,24 @@ exports.ComponentController = Montage.create(ElementController, { | |||
33 | setProperty: { | 32 | setProperty: { |
34 | value: function(el, p, value) { | 33 | value: function(el, p, value) { |
35 | switch(p) { | 34 | switch(p) { |
36 | case "label": | 35 | case "id": |
37 | this.application.ninja.currentDocument.getComponentFromElement(el).label = value; | 36 | case "class": |
38 | break; | 37 | case "left": |
39 | case "enabled": | 38 | case "top": |
40 | this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value; | 39 | case "width": |
41 | break; | 40 | case "height": |
42 | case "disabled": | 41 | if(el.nodeName === "IMG" && (p === "width" || p === "height")) { |
43 | this.application.ninja.currentDocument.getComponentFromElement(el).disabled = value; | 42 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; |
44 | break; | 43 | } else { |
45 | case "value": | 44 | ElementController.setProperty(el, p, value); |
46 | this.application.ninja.currentDocument.getComponentFromElement(el).value = value; | 45 | } |
47 | break; | 46 | break; |
48 | default: | 47 | default: |
49 | ElementController.setProperty(el, p, value); | 48 | if(p === "min" || p === "max") value = parseFloat(value); |
49 | |||
50 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | ||
51 | break; | ||
52 | |||
50 | } | 53 | } |
51 | } | 54 | } |
52 | } | 55 | } |
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 640119c4..15a18a51 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/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js index 86871fd3..567f481c 100644 --- a/js/document/templates/montage-html/main.reel/main.js +++ b/js/document/templates/montage-html/main.reel/main.js | |||
@@ -6,8 +6,6 @@ | |||
6 | var Montage = require("montage/core/core").Montage, | 6 | var Montage = require("montage/core/core").Montage, |
7 | Component = require("montage/ui/component").Component; | 7 | Component = require("montage/ui/component").Component; |
8 | 8 | ||
9 | //var Button = ("montage/ui/button.reel").Button; | ||
10 | |||
11 | exports.Main = Montage.create(Component, { | 9 | exports.Main = Montage.create(Component, { |
12 | 10 | ||
13 | hasTemplate: { | 11 | hasTemplate: { |
@@ -31,6 +29,7 @@ exports.Main = Montage.create(Component, { | |||
31 | } | 29 | } |
32 | }, | 30 | }, |
33 | 31 | ||
32 | // Adding components to the user document by using a async require. | ||
34 | addComponentToUserDocument:{ | 33 | addComponentToUserDocument:{ |
35 | value:function(element, data, callback){ | 34 | value:function(element, data, callback){ |
36 | 35 | ||
@@ -42,7 +41,7 @@ exports.Main = Montage.create(Component, { | |||
42 | var componentInstance = componentRequire.create(); | 41 | var componentInstance = componentRequire.create(); |
43 | 42 | ||
44 | componentInstance.element = element; | 43 | componentInstance.element = element; |
45 | componentInstance.deserializedFromTemplate(); | 44 | //componentInstance.deserializedFromTemplate(); |
46 | componentInstance.needsDraw = true; | 45 | componentInstance.needsDraw = true; |
47 | 46 | ||
48 | callback(componentInstance, element); | 47 | callback(componentInstance, element); |
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index 8daafa42..887743c5 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js | |||
@@ -5,6 +5,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Uuid = require("montage/core/uuid").Uuid, | ||
8 | ElementModel = require("js/models/element-model").ElementModel, | 9 | ElementModel = require("js/models/element-model").ElementModel, |
9 | Properties3D = require("js/models/properties-3d").Properties3D, | 10 | Properties3D = require("js/models/properties-3d").Properties3D, |
10 | ShapeModel = require("js/models/shape-model").ShapeModel, | 11 | ShapeModel = require("js/models/shape-model").ShapeModel, |
@@ -56,13 +57,18 @@ exports.NJUtils = Object.create(Object.prototype, { | |||
56 |