aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/document/document-html.js6
-rwxr-xr-xjs/document/html-document.js10
-rwxr-xr-xjs/lib/NJUtils.js14
-rwxr-xr-xjs/models/element-model.js35
-rwxr-xr-xjs/panels/properties.reel/properties.js1
5 files changed, 39 insertions, 27 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index b19ca0d0..24eb4f47 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -310,6 +310,12 @@ exports.HtmlDocument = Montage.create(Component, {
310 } 310 }
311 }, 311 },
312 312
313 GetElementFromPoint: {
314 value: function(x, y) {
315 return this._window.getElement(x,y);
316 }
317 },
318
313 // Handler for user content main reel. Gets called once the main reel of the template 319 // Handler for user content main reel. Gets called once the main reel of the template
314 // gets deserialized. 320 // gets deserialized.
315 // Setting up the currentSelectedContainer to the document body. 321 // Setting up the currentSelectedContainer to the document body.
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 3876670c..3dbf96ce 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -759,10 +759,14 @@ exports.HTMLDocument = Montage.create(TextDocument, {
759 //TODO Finish this implementation once we start caching Core Elements 759 //TODO Finish this implementation once we start caching Core Elements
760 // Assign a model to the UserContent and add the ViewPort reference to it. 760 // Assign a model to the UserContent and add the ViewPort reference to it.
761 NJUtils.makeElementModel(this.documentRoot, "Stage", "stage"); 761 NJUtils.makeElementModel(this.documentRoot, "Stage", "stage");
762 //this.documentRoot.elementModel.viewPort = this.iframe.contentWindow.document.getElementById("Viewport"); 762 NJUtils.makeElementModel(this.stageBG, "Stage", "stage");
763 NJUtils.makeElementModel(this.stageBG, "Stage", "stage");
764 NJUtils.makeElementModel(this.iframe.contentWindow.document.getElementById("Viewport"), "Stage", "stage"); 763 NJUtils.makeElementModel(this.iframe.contentWindow.document.getElementById("Viewport"), "Stage", "stage");
765 764
765 // Initialize the 3D properties
766 this.documentRoot.elementModel.props3D.init(this.documentRoot, true);
767 this.stageBG.elementModel.props3D.init(this.stageBG, true);
768 this.iframe.contentWindow.document.getElementById("Viewport").elementModel.props3D.init(this.iframe.contentWindow.document.getElementById("Viewport"), true);
769
766 for(i = 0; i < this._stylesheets.length; i++) { 770 for(i = 0; i < this._stylesheets.length; i++) {
767 if(this._stylesheets[i].ownerNode.id === this._stageStyleSheetId) { 771 if(this._stylesheets[i].ownerNode.id === this._stageStyleSheetId) {
768 this.documentRoot.elementModel.defaultRule = this._stylesheets[i]; 772 this.documentRoot.elementModel.defaultRule = this._stylesheets[i];
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js
index 67bb59c4..dae128e4 100755
--- a/js/lib/NJUtils.js
+++ b/js/lib/NJUtils.js
@@ -94,10 +94,10 @@ exports.NJUtils = Object.create(Object.prototype, {
94 ///// TODO: find a different place for this function 94 ///// TODO: find a different place for this function
95 makeElementModel: { 95 makeElementModel: {
96 value: function(el, selection, controller, isShape) { 96 value: function(el, selection, controller, isShape) {
97 //el.elementModel = Montage.create(ElementModel).initialize(el.nodeName, selection, controller, isShape);
98
97 var p3d = Montage.create(Properties3D); 99 var p3d = Montage.create(Properties3D);
98 if(selection === "Stage") { 100
99 p3d.init(el, true);
100 }
101 var shapeProps = null; 101 var shapeProps = null;
102 var pi = controller + "Pi"; 102 var pi = controller + "Pi";
103 103
@@ -143,6 +143,7 @@ exports.NJUtils = Object.create(Object.prototype, {
143 isShape: { value: isShape} 143 isShape: { value: isShape}
144 }); 144 });
145 145
146
146 } 147 }
147 }, 148 },
148 149
@@ -167,15 +168,12 @@ exports.NJUtils = Object.create(Object.prototype, {
167 break; 168 break;
168 case "canvas": 169 case "canvas":
169 isShape = el.getAttribute("data-RDGE-id"); 170 isShape = el.getAttribute("data-RDGE-id");
170 if(isShape) 171 if(isShape) {
171 {
172 // TODO - Need more info about the shape 172 // TODO - Need more info about the shape
173 selection = "canvas"; 173 selection = "canvas";
174 controller = "shape"; 174 controller = "shape";
175 isShape = true; 175 isShape = true;
176 } 176 } else {
177 else
178 {
179 selection = "canvas"; 177 selection = "canvas";
180 controller = "canvas"; 178 controller = "canvas";
181 } 179 }
diff --git a/js/models/element-model.js b/js/models/element-model.js
index fa02fd38..0e199a67 100755
--- a/js/models/element-model.js
+++ b/js/models/element-model.js
@@ -4,7 +4,10 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage,
8 Properties3D = require("js/models/properties-3d").Properties3D,
9 ShapeModel = require("js/models/shape-model").ShapeModel,
10 ControllerFactory = require("js/controllers/elements/controller-factory").ControllerFactory;
8 11
9exports.ElementModel = Montage.create(Montage, { 12exports.ElementModel = Montage.create(Montage, {
10 key: { value: "_model_"}, 13 key: { value: "_model_"},
@@ -16,36 +19,36 @@ exports.ElementModel = Montage.create(Montage, {
16 19
17 id: { value: "" }, 20 id: { value: "" },
18 classList: { value: null }, 21 classList: { value: null },
19
20 defaultRule: { value: null }, 22 defaultRule: { value: null },
21 23
22 top: { value: null }, 24 top: { value: null },
23 left: { value: null }, 25 left: { value: null },
24 width: { value: null }, 26 width: { value: null },
25 height: { value: null }, 27 height: { value: null },
26
27 /**
28 * Properties 3D
29 */
30 props3D: { value: null }, 28 props3D: { value: null },
31 29
32 /**
33 * Shape Info
34 */
35 isShape: { value: false }, 30 isShape: { value: false },
36 shapeModel: { value: null }, 31 shapeModel: { value: null },
37
38 /**
39 * SnapManager 2d Snap Cache Info
40 */
41 isIn2DSnapCache : { value: false }, 32 isIn2DSnapCache : { value: false },
42 33
43 /**
44 * Color info
45 */
46 fill: { value: null }, 34 fill: { value: null },
47 stroke: { value: null }, 35 stroke: { value: null },
48 36
37 initialize: {
38 value: function(type, selection, controller, isShape) {
39 /*
40 this.type = type;
41 this.selection = selection;
42
43 controller: { value: ControllerFactory.getController(controller)},
44 pi: { value: pi},
45 props3D: { value: p3d},
46 shapeModel: { value: shapeProps},
47 isShape: { value: isShape}
48 */
49 }
50 },
51
49 getProperty: { 52 getProperty: {
50 value: function(property) { 53 value: function(property) {
51 var key = this.key + property; 54 var key = this.key + property;
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js
index b21014c1..ee90cd64 100755
--- a/js/panels/properties.reel/properties.js
+++ b/js/panels/properties.reel/properties.js
@@ -174,6 +174,7 @@ exports.Properties = Montage.create(Component, {
174 handleSelectionChange: { 174 handleSelectionChange: {
175 value: function(event) { 175 value: function(event) {
176 if(event.detail.isDocument) { 176 if(event.detail.isDocument) {
177 if(this.application.ninja.currentDocument.documentRoot.nodeName.toLowerCase() === "body") return;
177 this.displayStageProperties(); 178 this.displayStageProperties();
178 } else { 179 } else {
179 if(this.application.ninja.selectedElements.length === 1) { 180 if(this.application.ninja.selectedElements.length === 1) {