diff options
author | Valerio Virgillito | 2012-04-26 17:10:03 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-26 17:10:03 -0700 |
commit | 6c1aa27b7753bc9007514859b42160fae265740d (patch) | |
tree | f9a01321bafbc8baf91b0d8b0f6c43ddf5453c5d | |
parent | 7968f3a9cf56392c914d6bd44cc90145b6d807a3 (diff) | |
parent | a0ba2437965f486667d07bba60c031a11d778e6a (diff) | |
download | ninja-6c1aa27b7753bc9007514859b42160fae265740d.tar.gz |
Merge branch 'stage-document-architecture' of https://github.com/mencio/ninja-internal into serialization
-rwxr-xr-x | js/components/layout/bread-crumb.reel/bread-crumb.js | 1 | ||||
-rwxr-xr-x | js/controllers/elements/body-controller.js | 44 | ||||
-rwxr-xr-x | js/controllers/elements/controller-factory.js | 5 | ||||
-rwxr-xr-x | js/data/pi/pi-data.js | 14 | ||||
-rwxr-xr-x | js/document/document-html.js | 46 | ||||
-rwxr-xr-x | js/document/html-document.js | 10 | ||||
-rwxr-xr-x | js/document/models/base.js | 8 | ||||
-rwxr-xr-x | js/document/templates/montage-web/default_html.css | 2 | ||||
-rwxr-xr-x | js/document/templates/montage-web/index.html | 2 | ||||
-rwxr-xr-x | js/lib/NJUtils.js | 14 | ||||
-rwxr-xr-x | js/models/element-model.js | 35 | ||||
-rwxr-xr-x | js/models/properties-3d.js | 3 | ||||
-rwxr-xr-x | js/panels/properties.reel/properties.js | 1 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 87 | ||||
-rwxr-xr-x | js/tools/EyedropperTool.js | 2 | ||||
-rwxr-xr-x | js/tools/FillTool.js | 2 | ||||
-rwxr-xr-x | js/tools/InkBottleTool.js | 2 | ||||
-rwxr-xr-x | js/tools/ShapeTool.js | 2 | ||||
-rwxr-xr-x | js/tools/ToolBase.js | 4 | ||||
-rwxr-xr-x | js/tools/TranslateObject3DTool.js | 2 | ||||
-rwxr-xr-x | js/tools/modifier-tool-base.js | 2 |
21 files changed, 199 insertions, 89 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index 597577f1..cf7b0685 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -81,7 +81,6 @@ exports.Breadcrumb = Montage.create(Component, { | |||
81 | 81 | ||
82 | // This is always the top container which is now hardcoded to body | 82 | // This is always the top container which is now hardcoded to body |
83 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | 83 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); |
84 | console.log("this works!"); | ||
85 | } | 84 | } |
86 | 85 | ||
87 | } | 86 | } |
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js new file mode 100755 index 00000000..fbbb7c6e --- /dev/null +++ b/js/controllers/elements/body-controller.js | |||
@@ -0,0 +1,44 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | ElementController = require("js/controllers/elements/element-controller").ElementController; | ||
9 | |||
10 | exports.BodyController = Montage.create(ElementController, { | ||
11 | |||
12 | // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat" | ||
13 | set3DProperties: { | ||
14 | value: function(el, props, update3DModel) { | ||
15 | } | ||
16 | }, | ||
17 | |||
18 | getProperty: { | ||
19 | value: function(el, p) { | ||
20 | } | ||
21 | }, | ||
22 | |||
23 | setProperty: { | ||
24 | value: function(el, p, value) { | ||
25 | } | ||
26 | }, | ||
27 | |||
28 | setAttribute: { | ||
29 | value: function(el, att, value) { | ||
30 | } | ||
31 | }, | ||
32 | |||
33 | getPerspectiveDist: { | ||
34 | value: function(el) { | ||
35 | if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { | ||
36 | return el.elementModel.props3D.perspectiveDist; | ||
37 | } else { | ||
38 | var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); | ||
39 | el.elementModel.props3D.perspectiveDist = dist; | ||
40 | return dist; | ||
41 | } | ||
42 | } | ||
43 | } | ||
44 | }); | ||
diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js index a772eb16..1bbbbce0 100755 --- a/js/controllers/elements/controller-factory.js +++ b/js/controllers/elements/controller-factory.js | |||
@@ -6,7 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage; | 7 | var Montage = require("montage/core/core").Montage; |
8 | 8 | ||
9 | var BlockController = require("js/controllers/elements/block-controller").BlockController, | 9 | var BodyController = require("js/controllers/elements/body-controller").BodyController, |
10 | BlockController = require("js/controllers/elements/block-controller").BlockController, | ||
10 | StageController = require("js/controllers/elements/stage-controller").StageController, | 11 | StageController = require("js/controllers/elements/stage-controller").StageController, |
11 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, | 12 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, |
12 | ImageController = require("js/controllers/elements/image-controller").ImageController, | 13 | ImageController = require("js/controllers/elements/image-controller").ImageController, |
@@ -27,6 +28,8 @@ exports.ControllerFactory = Montage.create(Montage, { | |||
27 | return BlockController; | 28 | return BlockController; |
28 | } else if(value.indexOf("stage") !== -1) { | 29 | } else if(value.indexOf("stage") !== -1) { |
29 | return StageController; | 30 | return StageController; |
31 | } else if(value.indexOf("body") !== -1) { | ||
32 | return BodyController; | ||
30 | } else if(value.indexOf("shape") !== -1) { | 33 | } else if(value.indexOf("shape") !== -1) { |
31 | return ShapesController; | 34 | return ShapesController; |
32 | } else if(value.indexOf("canvas") !== -1) { | 35 | } else if(value.indexOf("canvas") !== -1) { |
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js index 157c54ec..65161b4f 100755 --- a/js/data/pi/pi-data.js +++ b/js/data/pi/pi-data.js | |||
@@ -9,6 +9,20 @@ var Montage = require("montage/core/core").Montage, | |||
9 | 9 | ||
10 | exports.PiData = Montage.create( Montage, { | 10 | exports.PiData = Montage.create( Montage, { |
11 | 11 | ||
12 | bodyPi: { | ||
13 | value: [ | ||
14 | { | ||
15 | label: "Style", | ||
16 | |||
17 | Section: [ | ||
18 | [ | ||
19 | |||
20 | ] | ||
21 | ] | ||
22 | } | ||
23 | ] | ||
24 | }, | ||
25 | |||
12 | stagePi: { | 26 | stagePi: { |
13 | value: [ | 27 | value: [ |
14 | { | 28 | { |
diff --git a/js/document/document-html.js b/js/document/document-html.js index 8cb88516..89717dd6 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -31,6 +31,10 @@ exports.HtmlDocument = Montage.create(Component, { | |||
31 | value: null | 31 | value: null |
32 | }, | 32 | }, |
33 | 33 | ||
34 | exclusionList: { | ||
35 | value: ["HTML", "BODY"] | ||
36 | }, | ||
37 | |||
34 | // Getters for the model. | 38 | // Getters for the model. |
35 | // TODO: Change how these properties are accessed through Ninja | 39 | // TODO: Change how these properties are accessed through Ninja |
36 | name: { | 40 | name: { |
@@ -42,6 +46,24 @@ exports.HtmlDocument = Montage.create(Component, { | |||
42 | } | 46 | } |
43 | }, | 47 | }, |
44 | 48 | ||
49 | isActive: { | ||
50 | get: function() { | ||
51 | return this.model._isActive; | ||
52 | }, | ||
53 | set: function(value) { | ||
54 | this.model._isActive = value; | ||
55 | } | ||
56 | }, | ||
57 | |||
58 | needsSave: { | ||
59 | get: function() { | ||
60 | return this.model._needsSave; | ||
61 | }, | ||
62 | set: function(value) { | ||
63 | this.model._needsSave = value; | ||
64 | } | ||
65 | }, | ||
66 | |||
45 | // View Properties | 67 | // View Properties |
46 | // TODO: Move those into a view object - for now dump it here | 68 | // TODO: Move those into a view object - for now dump it here |
47 | iframe: { | 69 | iframe: { |
@@ -53,6 +75,10 @@ exports.HtmlDocument = Montage.create(Component, { | |||
53 | return this._uuid; | 75 | return this._uuid; |
54 | } | 76 | } |
55 | }, | 77 | }, |
78 | |||
79 | currentView: { | ||
80 | value: "design" | ||
81 | }, | ||
56 | //////////////////////////////////////////////////////////////////// | 82 | //////////////////////////////////////////////////////////////////// |
57 | //////////////////////////////////////////////////////////////////// | 83 | //////////////////////////////////////////////////////////////////// |
58 | init: { | 84 | init: { |
@@ -270,7 +296,8 @@ exports.HtmlDocument = Montage.create(Component, { | |||
270 | 296 | ||
271 | //TODO Finish this implementation once we start caching Core Elements | 297 | //TODO Finish this implementation once we start caching Core Elements |
272 | // Assign a model to the UserContent and add the ViewPort reference to it. | 298 | // Assign a model to the UserContent and add the ViewPort reference to it. |
273 | document.application.njUtils.makeElementModel(this.documentRoot, "Stage", "stage"); | 299 | document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); |
300 | // this.documentRoot.elementModel.props3D.init(this.documentRoot, true); | ||
274 | 301 | ||
275 | for(i = 0; i < this._stylesheets.length; i++) { | 302 | for(i = 0; i < this._stylesheets.length; i++) { |
276 | if(this._stylesheets[i].ownerNode.id === "nj-stage-stylesheet") { | 303 | if(this._stylesheets[i].ownerNode.id === "nj-stage-stylesheet") { |
@@ -309,6 +336,23 @@ exports.HtmlDocument = Montage.create(Component, { | |||
309 | } | 336 | } |
310 | }, | 337 | }, |
311 | 338 | ||
339 | GetElementFromPoint: { | ||
340 | value: function(x, y) { | ||
341 | return this._window.getElement(x,y); | ||
342 | } | ||
343 | }, | ||
344 | |||
345 | inExclusion: { | ||
346 | value: function(element) { | ||
347 | if(this.exclusionList.indexOf(element.nodeName) === -1) { | ||
348 | return -1; | ||
349 | } | ||
350 | |||
351 | return 1; | ||
352 | |||
353 | } | ||
< |