aboutsummaryrefslogtreecommitdiff
path: root/js/models
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-02 15:34:49 -0700
committerValerio Virgillito2012-05-02 15:34:49 -0700
commitd2a5fcbaed6b3c3377edecbc27e6a2818b79be40 (patch)
tree75e443147645e70272e89cfe0ec11318fdcf6adf /js/models
parent5a74b74e8ec76d60cadf623cabaa0b667f1c4058 (diff)
downloadninja-d2a5fcbaed6b3c3377edecbc27e6a2818b79be40.tar.gz
Nesting absolute element in the Tag tool. Refactoring element creation and element models
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/models')
-rwxr-xr-xjs/models/element-model.js61
1 files changed, 46 insertions, 15 deletions
diff --git a/js/models/element-model.js b/js/models/element-model.js
index 0e199a67..72d61806 100755
--- a/js/models/element-model.js
+++ b/js/models/element-model.js
@@ -4,10 +4,11 @@ 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, 8 Properties3D = require("js/models/properties-3d").Properties3D,
9 ShapeModel = require("js/models/shape-model").ShapeModel, 9 ShapeModel = require("js/models/shape-model").ShapeModel,
10 ControllerFactory = require("js/controllers/elements/controller-factory").ControllerFactory; 10 ControllerFactory = require("js/controllers/elements/controller-factory").ControllerFactory,
11 PiData = require("js/data/pi/pi-data").PiData;
11 12
12exports.ElementModel = Montage.create(Montage, { 13exports.ElementModel = Montage.create(Montage, {
13 key: { value: "_model_"}, 14 key: { value: "_model_"},
@@ -35,17 +36,47 @@ exports.ElementModel = Montage.create(Montage, {
35 stroke: { value: null }, 36 stroke: { value: null },
36 37
37 initialize: { 38 initialize: {
38 value: function(type, selection, controller, isShape) { 39 value: function(el, isShape) {
39 /* 40 var elementName, controller;
40 this.type = type; 41
41 this.selection = selection; 42 elementName = el.nodeName.toLowerCase();
42 43 controller = this.elementNameToController(elementName);
43 controller: { value: ControllerFactory.getController(controller)}, 44
44 pi: { value: pi}, 45 this.type = el.nodeName;
45 props3D: { value: p3d}, 46 this.selection = elementName;
46 shapeModel: { value: shapeProps}, 47 this.controller = ControllerFactory.getController(controller);
47 isShape: { value: isShape} 48 this.pi = this.elementNameToPi(elementName);
48 */ 49 this.props3D = Montage.create(Properties3D);
50
51 //shapeModel: { value: shapeProps},
52// isShape: { value: isShape}
53
54 return this;
55
56 }
57 },
58
59 elementNameToController: {
60 value: function(name) {
61 if(name === "div" || name === "custom") {
62 return "block";
63 } else if(name === "img") {
64 return "image";
65 } else {
66 return name;
67 }
68 }
69 },
70
71 elementNameToPi: {
72 value: function(name) {
73 var piString = name + "Pi";
74
75 if(!PiData.hasOwnProperty(piString)) {
76 piString = "blockPi";
77 }
78
79 return piString;
49 } 80 }
50 }, 81 },
51 82