aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/ui/property-control.reel/property-control.js8
-rwxr-xr-xjs/controllers/elements/shapes-controller.js15
-rw-r--r--js/data/panels-data.js8
-rwxr-xr-xjs/document/views/base.js3
-rwxr-xr-xjs/document/views/design.js29
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js1
-rwxr-xr-xjs/lib/drawing/world.js1
-rwxr-xr-xjs/lib/geom/circle.js20
-rwxr-xr-xjs/lib/geom/geom-obj.js25
-rwxr-xr-xjs/lib/geom/line.js13
-rwxr-xr-xjs/lib/geom/rectangle.js17
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js50
-rwxr-xr-xjs/lib/rdge/materials/material.js69
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js43
-rw-r--r--js/panels/Materials/materials-data.json5
-rwxr-xr-xjs/panels/Materials/materials-library-panel.reel/materials-library-panel.css18
-rwxr-xr-xjs/panels/Materials/materials-library-panel.reel/materials-library-panel.html25
-rwxr-xr-xjs/panels/Materials/materials-library-panel.reel/materials-library-panel.js111
-rwxr-xr-xjs/panels/Materials/materials-popup.reel/materials-popup.css44
-rwxr-xr-xjs/panels/Materials/materials-popup.reel/materials-popup.html26
-rwxr-xr-xjs/panels/Materials/materials-popup.reel/materials-popup.js440
-rwxr-xr-xjs/tools/LineTool.js6
-rwxr-xr-xjs/tools/OvalTool.js12
-rwxr-xr-xjs/tools/RectTool.js12
24 files changed, 641 insertions, 360 deletions
diff --git a/js/components/ui/property-control.reel/property-control.js b/js/components/ui/property-control.reel/property-control.js
index 6e0a3916..2f91491f 100755
--- a/js/components/ui/property-control.reel/property-control.js
+++ b/js/components/ui/property-control.reel/property-control.js
@@ -39,7 +39,8 @@ var Montage = require("montage/core/core").Montage,
39 TextField = require("js/components/TextField.reel").TextField, 39 TextField = require("js/components/TextField.reel").TextField,
40 ColorChip = require("js/components/ui/color-chip.reel").ColorChip, 40 ColorChip = require("js/components/ui/color-chip.reel").ColorChip,
41 FileInput = require("js/components/ui/file-input.reel").FileInput, 41 FileInput = require("js/components/ui/file-input.reel").FileInput,
42 InputGroup = require("js/components/ui/input-group.reel").InputGroup; 42 InputGroup = require("js/components/ui/input-group.reel").InputGroup,
43 GradientPicker = require("js/components/gradientpicker.reel").GradientPicker;
43 44
44var PropertyControl = exports.PropertyControl = Montage.create(Component, { 45var PropertyControl = exports.PropertyControl = Montage.create(Component, {
45 46
@@ -261,6 +262,11 @@ var PropertyControl = exports.PropertyControl = Montage.create(Component, {
261 this._control.addEventListener("changing", this, false); 262 this._control.addEventListener("changing", this, false);
262 this._prop = "value"; 263 this._prop = "value";
263 break; 264 break;
265 case "GradientPicker":
266 this._control = GradientPicker.create();
267 this._control.addEventListener("change", this, false);
268 this._prop = "value";
269 break;
264 default: 270 default:
265 break; 271 break;
266 } 272 }
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index a0d3c0d6..df6edeb0 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -882,15 +882,12 @@ exports.ShapesController = Montage.create(CanvasController, {
882 value: function(m) 882 value: function(m)
883 { 883 {
884 var css, 884 var css,
885 colorObj; 885 colorObj,
886 if(m === "Linear Gradient") 886 material;
887 { 887
888 css = "-webkit-gradient(linear, left top, right top, from(rgb(255, 0, 0)), color-stop(0.3, rgb(0, 255, 0)), color-stop(0.6, rgb(0, 0, 255)), to(rgb(0, 255, 255)))"; 888 material = MaterialsModel.getMaterial(m);
889 } 889
890 else if(m === "Radial Gradient") 890 css = material.getGradientData();
891 {
892 css = "-webkit-radial-gradient(50% 50%, ellipse cover, rgb(255, 0, 0) 0%, rgb(0, 255, 0) 30%, rgb(0, 0, 255) 60%, rgb(0, 255, 255) 100%)";
893 }
894 891
895 if(css) 892 if(css)
896 { 893 {
diff --git a/js/data/panels-data.js b/js/data/panels-data.js
index 0b178c84..ba6154c9 100644
--- a/js/data/panels-data.js
+++ b/js/data/panels-data.js
@@ -63,12 +63,12 @@ exports.PanelsData = Montage.create(Montage, {
63 { 63 {
64 name: "Materials", 64 name: "Materials",
65 groups: ["default"], 65 groups: ["default"],
66 minHeight: 100, 66 minHeight: 270,
67 height: 100, 67 height: 270,
68 maxHeight: null, 68 maxHeight: null,
69 flexible: true, 69 flexible: false,
70 collapsed: true, 70 collapsed: true,
71 scrollable: true, 71 scrollable: false,
72 open: true, 72 open: true,
73 modulePath: "js/panels/Materials/materials-library-panel.reel", 73 modulePath: "js/panels/Materials/materials-library-panel.reel",
74 moduleName: "MaterialsLibraryPanel" 74 moduleName: "MaterialsLibraryPanel"
diff --git a/js/document/views/base.js b/js/document/views/base.js
index e771702d..18676d1f 100755
--- a/js/document/views/base.js
+++ b/js/document/views/base.js
@@ -64,6 +64,7 @@ exports.BaseDocumentView = Montage.create(Component, {
64 if (this.iframe) { 64 if (this.iframe) {
65 this.iframe.style.display = 'block'; 65 this.iframe.style.display = 'block';
66 this.iframe.style.opacity = 1; 66 this.iframe.style.opacity = 1;
67 this.toggleWebGlAnimation(true);
67 } else { 68 } else {
68 console.log('Error: View has no iframe to show!'); 69 console.log('Error: View has no iframe to show!');
69 } 70 }
@@ -78,6 +79,8 @@ exports.BaseDocumentView = Montage.create(Component, {
78 if (this.iframe) { 79 if (this.iframe) {
79 this.iframe.style.display = 'none'; 80 this.iframe.style.display = 'none';
80 this.iframe.style.opacity = 0; 81 this.iframe.style.opacity = 0;
82 this.pauseVideos();
83 this.toggleWebGlAnimation(false);
81 } else { 84 } else {
82 console.log('Error: View has no iframe to hide!'); 85 console.log('Error: View has no iframe to hide!');
83 } 86 }
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 44ed2c65..ed98b660 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -537,9 +537,11 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
537 // 537 //
538 pauseVideos:{ 538 pauseVideos:{
539 value:function(){ 539 value:function(){
540 var i, videos = this.document.getElementsByTagName("video"); 540 if(this.document) {
541 for(i = 0; i < videos.length; i++){ 541 var i, videos = this.document.getElementsByTagName("video");
542 if(!videos[i].paused) videos[i].pause(); 542 for(i = 0; i < videos.length; i++){
543 if(!videos[i].paused) videos[i].pause();
544 }
543 } 545 }
544 } 546 }
545 }, 547 },
@@ -563,9 +565,28 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
563 videos[i].src = ""; 565 videos[i].src = "";
564 } 566 }
565 } 567 }
566 } 568 },
567 //////////////////////////////////////////////////////////////////// 569 ////////////////////////////////////////////////////////////////////
568 //////////////////////////////////////////////////////////////////// 570 ////////////////////////////////////////////////////////////////////
571 toggleWebGlAnimation: {
572 value: function(show) {
573 if(this.document) {
574 var glCanvases = this.document.querySelectorAll('[data-RDGE-id]'),
575 glShapeModel;
576 if(glCanvases) {
577 for(var i = 0, len = glCanvases.length; i<len; i++) {
578 glShapeModel = glCanvases[i].elementModel.shapeModel;
579 if(show) {
580 glShapeModel.GLWorld.restartRenderLoop();
581 } else {
582 glShapeModel.GLWorld.stop();
583 }
584 }
585
586 }
587 }
588 }
589 }
569}); 590});
570//////////////////////////////////////////////////////////////////////// 591////////////////////////////////////////////////////////////////////////
571//////////////////////////////////////////////////////////////////////// 592////////////////////////////////////////////////////////////////////////
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 235b381e..617b61ef 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -829,6 +829,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
829 var obj = this._stateArray.pop(); 829 var obj = this._stateArray.pop();
830 this._lineColor = obj._lineColor; 830 this._lineColor = obj._lineColor;
831 this._drawingContext.lineWidth = obj._lineWidth; 831 this._drawingContext.lineWidth = obj._lineWidth;
832 this._drawingContext.strokeStyle = obj._lineColor;
832 } 833 }
833 }, 834 },
834 835
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index fb70d18c..26f33a64 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -647,6 +647,7 @@ World.prototype.clearTree = function()
647 647
648 if (this._useWebGL) 648 if (this._useWebGL)
649 { 649 {
650 this.stop();
650 var root = this._rootNode; 651 var root = this._rootNode;
651 root.children = new Array(); 652 root.children = new Array();
652 RDGE.globals.engine.unregisterCanvas( this._canvas.rdgeid ); 653 RDGE.globals.engine.unregisterCanvas( this._canvas.rdgeid );
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index 39cde514..12781ab8 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -85,14 +85,28 @@ exports.Circle = Object.create(GeomObj, {
85 } else { 85 } else {
86 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); 86 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
87 } 87 }
88 if (strokeColor && this._strokeMaterial.hasProperty( "color" )) this._strokeMaterial.setProperty( "color", this._strokeColor ); 88
89 if(strokeColor) {
90 if(this._strokeMaterial.hasProperty("color")) {
91 this._strokeMaterial.setProperty( "color", this._strokeColor );
92 } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) {
93 this._strokeMaterial.setGradientData(this._strokeColor.color);
94