aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-04-04 10:39:32 -0700
committerNivesh Rajbhandari2012-04-04 10:39:32 -0700
commitb9032fb0f656a6c029ef0c71c490bb5d5cd10d94 (patch)
tree0faee331bf5d28877bdafd46ea26a269abaa91b2 /js
parentdf0389e6a191ebbff4e4b5d6625007873c0737bd (diff)
parentdc9650af5760b1f93d6e93a383eabceacfdc0ad8 (diff)
downloadninja-b9032fb0f656a6c029ef0c71c490bb5d5cd10d94.tar.gz
Merge branch 'refs/heads/EricSnapping' into WebGLFileIO
Diffstat (limited to 'js')
-rwxr-xr-xjs/lib/geom/line.js70
-rwxr-xr-xjs/panels/Splitter.js2
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css4
-rw-r--r--js/panels/presets/animations-presets.reel/animations-presets.js47
-rw-r--r--js/panels/presets/default-animation-presets.js2
-rw-r--r--js/panels/presets/default-style-presets.js11
-rw-r--r--js/panels/presets/default-transition-presets.js8
-rw-r--r--js/panels/presets/style-presets.reel/style-presets.js49
-rw-r--r--js/panels/presets/transitions-presets.reel/transitions-presets.js20
-rw-r--r--js/panels/resize-composer.js34
-rwxr-xr-xjs/tools/Translate3DToolBase.js21
-rwxr-xr-xjs/tools/TranslateObject3DTool.js21
-rwxr-xr-xjs/tools/modifier-tool-base.js14
13 files changed, 179 insertions, 124 deletions
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index f3806fac..1e98855e 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -148,76 +148,6 @@ var Line = function GLLine( world, xOffset, yOffset, width, height, slope, strok
148 this.importMaterialsJSON( jObj.materials ); 148 this.importMaterialsJSON( jObj.materials );
149 }; 149 };
150 150
151 this.export = function() {
152 var rtnStr = "type: " + this.geomType() + "\n";
153
154 rtnStr += "xoff: " + this._xOffset + "\n";
155 rtnStr += "yoff: " + this._yOffset + "\n";
156 rtnStr += "width: " + this._width + "\n";
157 rtnStr += "height: " + this._height + "\n";
158 rtnStr += "xAdj: " + this._xAdj + "\n";
159 rtnStr += "yAdj: " + this._yAdj + "\n";
160 rtnStr += "strokeWidth: " + this._strokeWidth + "\n";
161
162 if(this._strokeColor.gradientMode) {
163 rtnStr += "strokeGradientMode: " + this._strokeColor.gradientMode + "\n";
164 rtnStr += "strokeColor: " + this.gradientToString(this._strokeColor.color) + "\n";
165 } else {
166 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n";
167 }
168
169 rtnStr += "strokeStyle: " + this._strokeStyle + "\n";
170 rtnStr += "slope: " + String(this._slope) + "\n";
171
172 rtnStr += "strokeMat: ";
173 if (this._strokeMaterial) {
174 rtnStr += this._strokeMaterial.getName();
175 } else {
176 rtnStr += MaterialsModel.getDefaultMaterialName();
177 }
178
179 rtnStr += "\n";
180 return rtnStr;
181 };
182
183 this.import = function( importStr ) {
184 this._xOffset = Number( this.getPropertyFromString( "xoff: ", importStr ) );
185 this._yOffset = Number( this.getPropertyFromString( "yoff: ", importStr ) );
186 this._width = Number( this.getPropertyFromString( "width: ", importStr ) );
187 this._height = Number( this.getPropertyFromString( "height: ", importStr ) );
188 this._xAdj = Number( this.getPropertyFromString( "xAdj: ", importStr ) );
189 this._yAdj = Number( this.getPropertyFromString( "yAdj: ", importStr ) );
190 this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) );
191 var slope = this.getPropertyFromString( "slope: ", importStr );
192
193 if(isNaN(Number(slope))) {
194 this._slope = slope;
195 } else {
196 this._slope = Number(slope);
197 }
198
199 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr );
200 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr );
201
202 if(importStr.indexOf("strokeGradientMode: ") < 0)
203 {
204 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" );
205 } else {
206 this._strokeColor = {};
207 this._strokeColor.gradientMode = this.getPropertyFromString( "strokeGradientMode: ", importStr );
208 this._strokeColor.color = this.stringToGradient(this.getPropertyFromString( "strokeColor: ", importStr ));
209 }
210
211 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName );
212 if (!strokeMat) {
213 console.log( "object material not found in library: " + strokeMaterialName );
214 strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() );
215 }
216
217 this._strokeMaterial = strokeMat;
218
219 };
220
221 /////////////////////////////////////////////////////////////////////// 151 ///////////////////////////////////////////////////////////////////////
222 // Methods 152 // Methods
223 /////////////////////////////////////////////////////////////////////// 153 ///////////////////////////////////////////////////////////////////////
diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js
index 6791e0d5..e92cb2dd 100755
--- a/js/panels/Splitter.js
+++ b/js/panels/Splitter.js
@@ -55,7 +55,7 @@ exports.Splitter = Montage.create(Component, {
55 }, 55 },
56 set: function(value) { 56 set: function(value) {
57 this._collapsed = value; 57 this._collapsed = value;
58 this.needsDraw = true; 58
59 this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value}); 59 this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value});
60 } 60 }
61 }, 61 },
diff --git a/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css b/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css
index 067285ae..129b9771 100644
--- a/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css
+++ b/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css
@@ -10,12 +10,12 @@
10 height: 100%; 10 height: 100%;
11} 11}
12.maintimeline{ 12.maintimeline{
13 border-style: double;
13 -webkit-box-flex: 1; 14 -webkit-box-flex: 1;
14 display: -webkit-box; 15 display: -webkit-box;
15 -webkit-box-orient: horizontal; 16 -webkit-box-orient: horizontal
16 height : 100%; 17 height : 100%;
17 position: relative; 18 position: relative;
18 margin-top:1px;
19} 19}
20.leftinside{ 20.leftinside{
21 height: 100%; 21 height: 100%;
diff --git a/js/panels/presets/animations-presets.reel/animations-presets.js b/js/panels/presets/animations-presets.reel/animations-presets.js
index 6a16da54..ab200212 100644
--- a/js/panels/presets/animations-presets.reel/animations-presets.js
+++ b/js/panels/presets/animations-presets.reel/animations-presets.js
@@ -22,7 +22,52 @@ exports.AnimationsLibrary = Montage.create(Component, {
22 }, 22 },
23 handleNodeActivation: { 23 handleNodeActivation: {
24 value: function(presetData) { 24 value: function(presetData) {
25 this.application.ninja.presetsController.applyPreset(presetData); 25 //debugger;
26 var selection = this.application.ninja.selectedElements,
27 stylesController = this.application.ninja.stylesController,
28 selectorBase = presetData.selectorBase,
29 self = this;
30
31 if(!selection || !selection.length || selection.length === 0) {
32 return false;
33 }
34
35 selectorBase = stylesController.generateClassName(selectorBase);
36
37 presetData.rules.forEach(function(rule) {
38 if(rule.isKeyFrameRule) {
39 this.application.ninja.stylesController.addRule(
40 '@-webkit-keyframes ' + presetData.selectorBase,
41 this.stringifyKeys(rule.keys)
42 );
43 } else {
44 this.application.ninja.stylesController.addRule('.' + selectorBase + rule.selectorSuffix, rule.styles);
45 }
46
47 }, this);
48
49 selection.forEach(function(el) {
50 el._element.classList.add(selectorBase);
51 }, this);
52
53 }
54 },
55
56 stringifyKeys : {
57 value: function(keysArray) {
58 var keysString = '';
59
60 keysArray.forEach(function(key) {
61 var styles = '', style;
62
63 for(style in key.styles) {
64 styles += style + ':' + key.styles[style] + '; ';
65 }
66
67 keysString += key.keyText + ' {' + styles + ' }';
68 });
69
70 return keysString;
26 } 71 }
27 } 72 }
28}); 73});
diff --git a/js/panels/presets/default-animation-presets.js b/js/panels/presets/default-animation-presets.js
index b12a94b2..64f91ea6 100644
--- a/js/panels/presets/default-animation-presets.js
+++ b/js/panels/presets/default-animation-presets.js
@@ -13,6 +13,7 @@ exports.animationPresets = {
13 "text": "Border Morph", 13 "text": "Border Morph",
14 "selectorBase" : "border-morph", 14 "selectorBase" : "border-morph",
15 "rules" : [{ 15 "rules" : [{
16 "selectorSuffix" : "",
16 "styles" : { 17 "styles" : {
17 "-webkit-animation": "border-morph 2s infinite" 18 "-webkit-animation": "border-morph 2s infinite"
18 } 19 }
@@ -90,6 +91,7 @@ exports.animationPresets = {
90 "text": "Rotater", 91 "text": "Rotater",
91 "selectorBase" : "rotate-with-alpha-keyframes", 92 "selectorBase" : "rotate-with-alpha-keyframes",
92 "rules" : [{ 93 "rules" : [{
94 "selectorSuffix" : "",
93 "styles" : { 95 "styles" : {
94 "-webkit-animation-name": "rotate-with-alpha-keyframes", 96 "-webkit-animation-name": "rotate-with-alpha-keyframes",
95 "-webkit-animation-duration": "5s", 97