From 4b5cc9cf1f01552f61c08b9299b6e99366432e03 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 24 Apr 2012 15:36:03 -0700 Subject: Added a body controller Signed-off-by: Valerio Virgillito --- js/controllers/elements/body-controller.js | 44 ++++++++++++++++++++++ js/controllers/elements/controller-factory.js | 5 ++- js/data/pi/pi-data.js | 14 +++++++ js/document/document-html.js | 3 +- js/document/templates/montage-web/default_html.css | 2 +- js/document/templates/montage-web/index.html | 2 +- js/models/properties-3d.js | 3 +- 7 files changed, 67 insertions(+), 6 deletions(-) create mode 100755 js/controllers/elements/body-controller.js 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 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage, + ElementController = require("js/controllers/elements/element-controller").ElementController; + +exports.BodyController = Montage.create(ElementController, { + + // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat" + set3DProperties: { + value: function(el, props, update3DModel) { + } + }, + + getProperty: { + value: function(el, p) { + } + }, + + setProperty: { + value: function(el, p, value) { + } + }, + + setAttribute: { + value: function(el, att, value) { + } + }, + + getPerspectiveDist: { + value: function(el) { + if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { + return el.elementModel.props3D.perspectiveDist; + } else { + var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); + el.elementModel.props3D.perspectiveDist = dist; + return dist; + } + } + } +}); 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 var Montage = require("montage/core/core").Montage; -var BlockController = require("js/controllers/elements/block-controller").BlockController, +var BodyController = require("js/controllers/elements/body-controller").BodyController, + BlockController = require("js/controllers/elements/block-controller").BlockController, StageController = require("js/controllers/elements/stage-controller").StageController, ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, ImageController = require("js/controllers/elements/image-controller").ImageController, @@ -27,6 +28,8 @@ exports.ControllerFactory = Montage.create(Montage, { return BlockController; } else if(value.indexOf("stage") !== -1) { return StageController; + } else if(value.indexOf("body") !== -1) { + return BodyController; } else if(value.indexOf("shape") !== -1) { return ShapesController; } 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, exports.PiData = Montage.create( Montage, { + bodyPi: { + value: [ + { + label: "Style", + + Section: [ + [ + + ] + ] + } + ] + }, + stagePi: { value: [ { diff --git a/js/document/document-html.js b/js/document/document-html.js index 8cb88516..b19ca0d0 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -270,7 +270,8 @@ exports.HtmlDocument = Montage.create(Component, { //TODO Finish this implementation once we start caching Core Elements // Assign a model to the UserContent and add the ViewPort reference to it. - document.application.njUtils.makeElementModel(this.documentRoot, "Stage", "stage"); + document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); +// this.documentRoot.elementModel.props3D.init(this.documentRoot, true); for(i = 0; i < this._stylesheets.length; i++) { if(this._stylesheets[i].ownerNode.id === "nj-stage-stylesheet") { diff --git a/js/document/templates/montage-web/default_html.css b/js/document/templates/montage-web/default_html.css index db069d4e..08e39f22 100755 --- a/js/document/templates/montage-web/default_html.css +++ b/js/document/templates/montage-web/default_html.css @@ -11,7 +11,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot } .active-element-outline { - outline: #adff2f solid 2px; + outline: #adff2f solid 2px; } .nj-preset-transition { diff --git a/js/document/templates/montage-web/index.html b/js/document/templates/montage-web/index.html index 90b0f7fd..c52a5394 100755 --- a/js/document/templates/montage-web/index.html +++ b/js/document/templates/montage-web/index.html @@ -42,7 +42,7 @@ -
IPSUM
+ diff --git a/js/models/properties-3d.js b/js/models/properties-3d.js index c1270c3b..e571e505 100755 --- a/js/models/properties-3d.js +++ b/js/models/properties-3d.js @@ -5,8 +5,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot */ var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component, - NJUtils = require("js/lib/NJUtils").NJUtils; + Component = require("montage/ui/component").Component; exports.Properties3D = Montage.create(Component, { -- cgit v1.2.3