diff options
Diffstat (limited to 'js/lib')
31 files changed, 2793 insertions, 460 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index e16715a4..904aa41e 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js | |||
@@ -96,15 +96,45 @@ exports.NJUtils = Object.create(Object.prototype, { | |||
96 | value: function(el, selection, controller, isShape) { | 96 | value: function(el, selection, controller, isShape) { |
97 | var p3d = Montage.create(Properties3D).init(el); | 97 | var p3d = Montage.create(Properties3D).init(el); |
98 | var shapeProps = null; | 98 | var shapeProps = null; |
99 | var pi = controller + "Pi"; | ||
100 | |||
99 | if(isShape) { | 101 | if(isShape) { |
100 | shapeProps = Montage.create(ShapeModel); | 102 | shapeProps = Montage.create(ShapeModel); |
101 | } | 103 | } |
102 | 104 | ||
105 | if(el.controller) { | ||
106 | |||
107 | var componentInfo = Montage.getInfoForObject(el.controller); | ||
108 | var componentName = componentInfo.objectName.toLowerCase(); | ||
109 | |||
110 | controller = "component"; | ||
111 | isShape = false; | ||
112 | |||
113 | switch(componentName) { | ||
114 | case "feedreader": | ||
115 | selection = "Feed Reader"; | ||
116 | pi = "FeedReaderPi"; | ||
117 | break; | ||
118 | case "map": | ||
119 | selection = "Map"; | ||
120 | pi = "MapPi"; | ||
121 | break; | ||
122 | case "youtubechannel": | ||
123 | selection = "Youtube Channel"; | ||
124 | pi = "YoutubeChannelPi"; | ||
125 | break; | ||
126 | case "picasacarousel": | ||
127 | selection = "Picasa Carousel"; | ||
128 | pi = "PicasaCarouselPi"; | ||
129 | break; | ||
130 | } | ||
131 | } | ||
132 | |||
103 | el.elementModel = Montage.create(ElementModel, { | 133 | el.elementModel = Montage.create(ElementModel, { |
104 | type: { value: el.nodeName}, | 134 | type: { value: el.nodeName}, |
105 | selection: { value: selection}, | 135 | selection: { value: selection}, |
106 | controller: { value: ControllerFactory.getController(controller)}, | 136 | controller: { value: ControllerFactory.getController(controller)}, |
107 | pi: { value: controller + "Pi"}, | 137 | pi: { value: pi}, |
108 | props3D: { value: p3d}, | 138 | props3D: { value: p3d}, |
109 | shapeModel: { value: shapeProps} | 139 | shapeModel: { value: shapeProps} |
110 | }); | 140 | }); |
@@ -116,7 +146,39 @@ exports.NJUtils = Object.create(Object.prototype, { | |||
116 | ///// TODO: Selection and model should be based on the element type | 146 | ///// TODO: Selection and model should be based on the element type |
117 | makeModelFromElement: { | 147 | makeModelFromElement: { |
118 | value: function(el) { | 148 | value: function(el) { |
119 | this.makeElementModel(el, "Div", "block", false); | 149 | var selection = "div", |
150 | controller = "block", | ||
151 | isShape = false; | ||
152 | switch(el.nodeName.toLowerCase()) | ||
153 | { | ||
154 | case "div": | ||
155 | break; | ||
156 | case "img": | ||
157 | selection = "image"; | ||
158 | controller = "image"; | ||
159 | break; | ||
160 | case "video": | ||
161 | selection = "video"; | ||
162 | controller = "video"; | ||
163 | break; | ||
164 | case "canvas": | ||
165 | isShape = el.getAttribute("data-RDGE-id"); | ||
166 | if(isShape) | ||
167 | { | ||
168 | // TODO - Need more info about the shape | ||
169 | selection = "canvas"; | ||
170 | controller = "shape"; | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | selection = "canvas"; | ||
175 | controller = "canvas"; | ||
176 | } | ||
177 | break; | ||
178 | case "shape": | ||
179 | break; | ||
180 | } | ||
181 | this.makeElementModel(el, selection, controller, isShape); | ||
120 | } | 182 | } |
121 | }, | 183 | }, |
122 | 184 | ||
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 7c5fb136..436853bd 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -4,17 +4,6 @@ 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 | ||
7 | // Useless Global variables. | ||
8 | // TODO: Remove this as soon as QE test pass | ||
9 | /* | ||
10 | var shaderProgramArray = new Array; | ||
11 | var glContextArray = new Array; | ||
12 | var vertexShaderSource = ""; | ||
13 | var fragmentShaderSource = ""; | ||
14 | var rdgeStarted = false; | ||
15 | */ | ||
16 | |||
17 | var nodeCounter = 0; | ||
18 | 7 | ||
19 | var GeomObj = require("js/lib/geom/geom-obj").GeomObj; | 8 | var GeomObj = require("js/lib/geom/geom-obj").GeomObj; |
20 | var Line = require("js/lib/geom/line").Line; | 9 | var Line = require("js/lib/geom/line").Line; |
@@ -22,11 +11,13 @@ var Rectangle = require("js/lib/geom/rectangle").Rectangle; | |||
22 | var Circle = require("js/lib/geom/circle").Circle; | 11 | var Circle = require("js/lib/geom/circle").Circle; |
23 | var MaterialsModel = require("js/models/materials-model").MaterialsModel; | 12 | var MaterialsModel = require("js/models/materials-model").MaterialsModel; |
24 | 13 | ||
14 | var worldCounter = 0; | ||
15 | |||
25 | /////////////////////////////////////////////////////////////////////// | 16 | /////////////////////////////////////////////////////////////////////// |
26 | // Class GLWorld | 17 | // Class GLWorld |
27 | // Manages display in a canvas | 18 | // Manages display in a canvas |
28 | /////////////////////////////////////////////////////////////////////// | 19 | /////////////////////////////////////////////////////////////////////// |
29 | var World = function GLWorld( canvas, use3D ) { | 20 | var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { |
30 | /////////////////////////////////////////////////////////////////////// | 21 | /////////////////////////////////////////////////////////////////////// |
31 | // Instance variables | 22 | // Instance variables |
32 | /////////////////////////////////////////////////////////////////////// | 23 | /////////////////////////////////////////////////////////////////////// |
@@ -39,7 +30,11 @@ var World = function GLWorld( canvas, use3D ) { | |||
39 | 30 | ||
40 | this._canvas = canvas; | 31 | this._canvas = canvas; |
41 | if (this._useWebGL) { | 32 | if (this._useWebGL) { |
33 | if(preserveDrawingBuffer) { | ||
34 | this._glContext = canvas.getContext("experimental-webgl", {preserveDrawingBuffer: true}); | ||
35 | } else { | ||
42 | this._glContext = canvas.getContext("experimental-webgl"); | 36 | this._glContext = canvas.getContext("experimental-webgl"); |
37 | } | ||
43 | } else { | 38 | } else { |
44 | this._2DContext = canvas.getContext( "2d" ); | 39 | this._2DContext = canvas.getContext( "2d" ); |
45 | } | 40 | } |
@@ -76,6 +71,12 @@ var World = function GLWorld( canvas, use3D ) { | |||
76 | // no animated materials | 71 | // no animated materials |
77 | this._firstRender = true; | 72 | this._firstRender = true; |
78 | 73 | ||
74 | this._worldCount = worldCounter; | ||
75 | worldCounter++; | ||
76 | |||
77 | // keep a counter for generating node names | ||
78 | this._nodeCounter = 0; | ||
79 | |||
79 | /////////////////////////////////////////////////////////////////////// | 80 | /////////////////////////////////////////////////////////////////////// |
80 | // Property accessors | 81 | // Property accessors |
81 | /////////////////////////////////////////////////////////////////////// | 82 | /////////////////////////////////////////////////////////////////////// |
@@ -116,6 +117,8 @@ var World = function GLWorld( canvas, use3D ) { | |||
116 | 117 | ||
117 | this.getRenderer = function() { return this.renderer; }; | 118 | this.getRenderer = function() { return this.renderer; }; |
118 | 119 | ||
120 | // Flag to play/pause animation at authortime | ||
121 | this._previewAnimation = true; | ||
119 | //////////////////////////////////////////////////////////////////////////////////// | 122 | //////////////////////////////////////////////////////////////////////////////////// |
120 | // RDGE | 123 | // RDGE |
121 | // local variables | 124 | // local variables |
@@ -235,7 +238,7 @@ var World = function GLWorld( canvas, use3D ) { | |||
235 | if (this._canvas.task) { | 238 | if (this._canvas.task) { |
236 |