aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/styles-controller.js
diff options
context:
space:
mode:
authorhwc4872012-04-13 11:52:13 -0700
committerhwc4872012-04-13 11:52:13 -0700
commit4f2fb5764703cab4ce3ada719b1395ed1e2f3b7c (patch)
tree3dc2e3c5a041179eed38eab1a00f851554e50005 /js/controllers/styles-controller.js
parent521df0ed9242efff45715998837068c87aca7efd (diff)
parent4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff)
downloadninja-4f2fb5764703cab4ce3ada719b1395ed1e2f3b7c.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Snapping_II
Conflicts: js/helper-classes/3D/view-utils.js js/panels/presets/animations-presets.reel/animations-presets.js js/panels/presets/style-presets.reel/style-presets.js js/panels/presets/transitions-presets.reel/transitions-presets.js js/tools/Translate3DToolBase.js
Diffstat (limited to 'js/controllers/styles-controller.js')
-rwxr-xr-xjs/controllers/styles-controller.js69
1 files changed, 68 insertions, 1 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index addfc24e..ec4314f9 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -836,7 +836,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
836 ///// For a given CSSKeyframesRule, we may add styles to the keyframe at 836 ///// For a given CSSKeyframesRule, we may add styles to the keyframe at
837 ///// given index. 837 ///// given index.
838 838
839 setKeyframeStyle : { 839 setKeyframeStyles : {
840 value : function(rule, keyframeIndex, property, value, useImportant) { 840 value : function(rule, keyframeIndex, property, value, useImportant) {
841 return this.setStyles(rule.cssRules[keyframeIndex], property, value, useImportant); 841 return this.setStyles(rule.cssRules[keyframeIndex], property, value, useImportant);
842 } 842 }
@@ -1124,6 +1124,73 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1124 } 1124 }
1125 }, 1125 },
1126 1126
1127 ///// Get Matrix From Element
1128 ///// Returns the matrix from an element's -webkit-transform
1129 //// TODO - This routine should eventually check for other transform styles, i.e., rotateX, translateZ, etc.
1130
1131 getMatrixFromElement : {
1132 value: function(element, isStage) {
1133 var xformStr = this.getElementStyle(element, "-webkit-transform", true, isStage),
1134 mat;
1135
1136 if (xformStr) {
1137 var index1 = xformStr.indexOf( "matrix3d(");
1138 if (index1 >= 0) {
1139 index1 += 9; // do not include 'matrix3d('
1140 var index2 = xformStr.indexOf( ")", index1 );
1141 if (index2 >= 0) {
1142 var substr = xformStr.substr( index1, (index2-index1));
1143 if (substr && (substr.length > 0)) {
1144 var numArray = substr.split(',');
1145 var nNums = numArray.length;
1146 if (nNums == 16) {
1147 // gl-matrix wants row order
1148 mat = numArray;
1149 for (var i=0; i<16; i++) {
1150 mat[i] = Number( mat[i] );
1151 }
1152 }
1153 }
1154 }
1155 }
1156 }
1157 return mat;
1158 }
1159 },
1160
1161 ///// Get Perspective Distance From Element
1162 ///// Returns the perspective from an element's -webkit-transform
1163
1164 getPerspectiveDistFromElement : {
1165 value: function(element, isStage) {
1166 var xformStr = this.getElementStyle(element, "-webkit-perspective", false, isStage),
1167 dist;
1168
1169 if(xformStr) {
1170 dist = parseInt(xformStr);
1171 } else {
1172 xformStr = this.getElementStyle(element, "-webkit-transform", true, isStage);
1173 if (xformStr) {
1174 var index1 = xformStr.indexOf( "perspective(");
1175 if (index1 >= 0) {
1176 index1 += 12; // do not include 'perspective('
1177 var index2 = xformStr.indexOf( ")", index1 );
1178 if (index2 >= 0) {
1179 var substr = xformStr.substr( index1, (index2-index1));
1180 if (substr && (substr.length > 0)) {
1181 dist = parseInt( substr );
1182 }
1183 }
1184 }
1185 }
1186 }
1187 if(isNaN(dist)) {
1188 dist = null;
1189 }
1190 return dist;
1191 }
1192 },
1193
1127 ///// Create Rule From Inline Style 1194 ///// Create Rule From Inline Style
1128 ///// Creates a rule for an inline style with a specified, or partially random selector. 1195 ///// Creates a rule for an inline style with a specified, or partially random selector.
1129 1196