aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/components/combobox.reel/combobox.js21
-rw-r--r--js/controllers/elements/shapes-controller.js69
-rw-r--r--js/data/pi/pi-data.js41
-rw-r--r--js/mediators/element-mediator.js7
-rw-r--r--js/models/shape-model.js1
-rw-r--r--js/panels/properties/sections/custom.reel/custom.js12
-rwxr-xr-xjs/preloader/Preloader.js1
-rw-r--r--js/tools/LineTool.js1
-rw-r--r--js/tools/OvalTool.js1
-rw-r--r--js/tools/RectTool.js1
10 files changed, 151 insertions, 4 deletions
diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index a68a7d6b..deef2a47 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -76,6 +76,26 @@ exports.Combobox = Montage.create(Component, {
76 } 76 }
77 }, 77 },
78 78
79 _enabled: {
80 enumerable: false,
81 value: true
82 },
83
84 enabled: {
85 enumerable: true,
86 serializable: true,
87 get: function() {
88 return this._enabled;
89 },
90 set: function(value) {
91 if(value !== this._enabled)
92 {
93 this._enabled = value;
94 this.needsDraw = true;
95 }
96 }
97 },
98
79 handleChange: 99 handleChange:
80 { 100 {
81 value:function(event) 101 value:function(event)
@@ -117,6 +137,7 @@ exports.Combobox = Montage.create(Component, {
117 } 137 }
118 this.element.appendChild(optionItem); 138 this.element.appendChild(optionItem);
119 } 139 }
140 this.element.disabled = !this._enabled;
120 } 141 }
121 } 142 }
122 }, 143 },
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 5efbccd0..3f1ccc3d 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -5,7 +5,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 CanvasController = require("js/controllers/elements/canvas-controller").CanvasController; 8 CanvasController = require("js/controllers/elements/canvas-controller").CanvasController,
9 njModule = require("js/lib/NJUtils");
9 10
10exports.ShapesController = Montage.create(CanvasController, { 11exports.ShapesController = Montage.create(CanvasController, {
11 12
@@ -56,6 +57,17 @@ exports.ShapesController = Montage.create(CanvasController, {
56 el.elementModel.shapeModel.GLWorld.setViewportFromCanvas(el); 57 el.elementModel.shapeModel.GLWorld.setViewportFromCanvas(el);
57 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 58 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
58 break; 59 break;
60 case "useWebGl":
61 var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true);
62 canvas.width = el.width;
63 canvas.height = el.height;
64 this.application.ninja.elementMediator.replaceElement(el, canvas);
65 NJevent("elementDeleted", el);
66 this.application.ninja.selectionController.selectElement(canvas);
67 el = canvas;
68 this.toggleWebGlMode(el, value);
69 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
70 break;
59 default: 71 default:
60 CanvasController.setProperty(el, p, value); 72 CanvasController.setProperty(el, p, value);
61 } 73 }
@@ -76,6 +88,7 @@ exports.ShapesController = Montage.create(CanvasController, {
76 case "fillMaterial": 88 case "fillMaterial":
77 case "border": 89 case "border":
78 case "background": 90 case "background":
91 case "useWebGl":
79 return this.getShapeProperty(el, p); 92 return this.getShapeProperty(el, p);
80 default: 93 default:
81 return CanvasController.getProperty(el, p); 94 return CanvasController.getProperty(el, p);
@@ -275,6 +288,60 @@ exports.ShapesController = Montage.create(CanvasController, {
275 { 288 {
276 return (el.elementModel && el.elementModel.isShape); 289 return (el.elementModel && el.elementModel.isShape);
277 } 290 }
291 },
292
293 toggleWebGlMode: {
294 value: function(el, useWebGl)
295 {
296 if(useWebGl)
297 {
298 this.convertToWebGlWorld(el);
299 }
300 else
301 {
302 this.convertTo2DWorld(el);
303 }
304 }
305 },
306
307 convertToWebGlWorld: {
308 value: function(el)
309 {
310 if(el.elementModel.shapeModel.useWebGl)
311 {
312 return;
313 }
314 var world,
315 worldData = el.elementModel.shapeModel.GLWorld.export();
316 if(worldData)
317 {
318 world = new GLWorld(el, true);
319 el.elementModel.shapeModel.GLWorld = world;
320 el.elementModel.shapeModel.useWebGl = true;
321 world.import(worldData);
322 }
323
324 }
325 },
326
327 convertTo2DWorld: {
328 value: function(el)
329 {
330 if(!el.elementModel.shapeModel.useWebGl)
331 {
332 return;
333 }
334 var world,
335 worldData = el.elementModel.shapeModel.GLWorld.export();
336 if(worldData)
337 {
338 world = new GLWorld(el, false);
339 el.elementModel.shapeModel.GLWorld = world;
340 el.elementModel.shapeModel.useWebGl = false;
341 world.import(worldData);
342 }
343
344 }
278 } 345 }
279 346
280}); 347});
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js
index dd75e255..901ca37f 100644
--- a/js/data/pi/pi-data.js
+++ b/js/data/pi/pi-data.js
@@ -369,12 +369,23 @@ exports.PiData = Montage.create( Montage, {
369 Section: [ 369 Section: [
370 [ 370 [
371 { 371 {
372 type: "checkbox",
373 id: "useWebGl",
374 prop: "useWebGl",
375 defaultValue: false,
376 value: "Use WebGL",
377 checked: false
378 }
379 ],
380 [
381 {
372 type: "dropdown", 382 type: "dropdown",
373 id: "strokeMaterial", 383 id: "strokeMaterial",
374 prop: "strokeMaterial", 384 prop: "strokeMaterial",
375 label: "Stroke", 385 label: "Stroke",
376 labelField: "_name", 386 labelField: "_name",
377 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, 387 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
388 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" },
378 divider : true 389 divider : true
379 } 390 }
380 ], 391 ],
@@ -385,7 +396,8 @@ exports.PiData = Montage.create( Montage, {
385 prop: "fillMaterial", 396 prop: "fillMaterial",
386 label: "Fill", 397 label: "Fill",
387 labelField: "_name", 398 labelField: "_name",
388 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" } 399 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
400 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
389 } 401 }
390 ] 402 ]
391 ] 403 ]
@@ -434,11 +446,22 @@ exports.PiData = Montage.create( Montage, {
434 Section: [ 446 Section: [
435 [ 447 [
436 { 448 {
449 type: "checkbox",
450 id: "useWebGl",
451 prop: "useWebGl",
452 defaultValue: false,
453 value: "Use WebGL",
454 checked: false
455 }
456 ],
457 [
458 {
437 type: "dropdown", 459 type: "dropdown",
438 id: "stroke", 460 id: "stroke",
439 label: "Stroke", 461 label: "Stroke",
440 labelField: "_name", 462 labelField: "_name",
441 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" } 463 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
464 enabled: { boundObject: "this.controls", boundPr