aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorEric Guzman2012-07-20 11:24:19 -0700
committerEric Guzman2012-07-20 11:24:19 -0700
commit3cc29231852440508bdeec1964e40ce59f979f99 (patch)
tree2faaf3d49337437e4a84818fe24dc64a60f8c611 /js/controllers
parent8fdf2fc8aefee68aec4c7b5891e0375f704cbf26 (diff)
parent9053e2037821a5c8405fabb74db9635deacfe8d5 (diff)
downloadninja-3cc29231852440508bdeec1964e40ce59f979f99.tar.gz
Merge branch 'refs/heads/master' into fixes_7.1
Diffstat (limited to 'js/controllers')
-rw-r--r--js/controllers/clipboard-controller.js23
-rwxr-xr-xjs/controllers/styles-controller.js51
2 files changed, 65 insertions, 9 deletions
diff --git a/js/controllers/clipboard-controller.js b/js/controllers/clipboard-controller.js
index d2173e31..c3543c95 100644
--- a/js/controllers/clipboard-controller.js
+++ b/js/controllers/clipboard-controller.js
@@ -80,8 +80,15 @@ var ClipboardController = exports.ClipboardController = Montage.create(Component
80 return; 80 return;
81 }//for design view only 81 }//for design view only
82 82
83 // Don't do anything if an input or other control is focused 83 // Don't do anything if an input or other control is focused except the copy menu button
84 if(document.activeElement.nodeName !== "BODY") { 84 if(document.activeElement.nodeName !== "BODY") {
85 if(!document.activeElement.getAttribute("data-montage-id") === "menuItemButton") {
86 return;
87 }
88 }
89
90 //perform clipboard operations only if selection tool is selected
91 if(this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.selectionToolIndex].selected === false){
85 return; 92 return;
86 } 93 }
87 94
@@ -99,6 +106,13 @@ var ClipboardController = exports.ClipboardController = Montage.create(Component
99 106
100 // Don't do anything if an input or other control is focused 107 // Don't do anything if an input or other control is focused
101 if(document.activeElement.nodeName !== "BODY") { 108 if(document.activeElement.nodeName !== "BODY") {
109 if(!document.activeElement.getAttribute("data-montage-id") === "menuItemButton") {
110 return;
111 }
112 }
113
114 //perform clipboard operations only if selection tool is selected
115 if(this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.selectionToolIndex].selected === false){
102 return; 116 return;
103 } 117 }
104 118
@@ -123,6 +137,13 @@ var ClipboardController = exports.ClipboardController = Montage.create(Component
123 137
124 // Don't do anything if an input or other control is focused 138 // Don't do anything if an input or other control is focused
125 if(document.activeElement.nodeName !== "BODY") { 139 if(document.activeElement.nodeName !== "BODY") {
140 if(!document.activeElement.getAttribute("data-montage-id") === "menuItemButton") {
141 return;
142 }
143 }
144
145 //perform clipboard operations only if selection tool is selected
146 if(this.application.ninja.toolsData.defaultToolsData[this.application.ninja.toolsData.selectionToolIndex].selected === false){
126 return; 147 return;
127 } 148 }
128 149
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 703d61f4..11d53ac0 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -1329,33 +1329,68 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1329 1329
1330 ///// Get Matrix From Element 1330 ///// Get Matrix From Element
1331 ///// Returns the matrix from an element's -webkit-transform 1331 ///// Returns the matrix from an element's -webkit-transform
1332 //// TODO - This routine should eventually check for other transform styles, i.e., rotateX, translateZ, etc.
1333 1332
1334 getMatrixFromElement : { 1333 getMatrixFromElement : {
1335 value: function(element, isStage) { 1334 value: function(element, isStage) {
1336 isStage = false; 1335 isStage = false;
1337 var xformStr = this.getElementStyle(element, "-webkit-transform", true, isStage), 1336 var xformStr = this.getElementStyle(element, "-webkit-transform", true, isStage),
1338 mat; 1337 mat,
1338 index1,
1339 index2,
1340 substr,
1341 numArray,
1342 nNums,
1343 i;
1339 1344
1340 if (xformStr) { 1345 if (xformStr) {
1341 var index1 = xformStr.indexOf( "matrix3d("); 1346 // Check for 3d matrix
1347 index1 = xformStr.indexOf( "matrix3d(");
1348 // If style does not contain 'matrix3d', try computed matrix/matrix3d from rotateY, translateZ, etc.
1349 if((index1 === -1) && element.ownerDocument.defaultView) {
1350 xformStr = element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue("-webkit-transform");
1351 index1 = xformStr.indexOf( "matrix3d(");
1352 }
1342 if (index1 >= 0) { 1353 if (index1 >= 0) {
1343 index1 += 9; // do not include 'matrix3d(' 1354 index1 += 9; // do not include 'matrix3d('
1344 var index2 = xformStr.indexOf( ")", index1 ); 1355 index2 = xformStr.indexOf( ")", index1 );
1345 if (index2 >= 0) { 1356 if (index2 >= 0) {
1346 var substr = xformStr.substr( index1, (index2-index1)); 1357 substr = xformStr.substr( index1, (index2-index1));
1347 if (substr && (substr.length > 0)) { 1358 if (substr && (substr.length > 0)) {
1348 var numArray = substr.split(','); 1359 numArray = substr.split(',');
1349 var nNums = numArray.length; 1360 nNums = numArray.length;
1350 if (nNums == 16) { 1361 if (nNums == 16) {
1351 // gl-matrix wants row order 1362 // gl-matrix wants row order
1352 mat = numArray; 1363 mat = numArray;
1353 for (var i=0; i<16; i++) { 1364 for (i=0; i<16; i++) {
1354 mat[i] = Number( mat[i] ); 1365 mat[i] = Number( mat[i] );
1355 } 1366 }
1356 } 1367 }
1357 } 1368 }
1358 } 1369 }
1370 } else {
1371 // Check for 2d matrix
1372 index1 = xformStr.indexOf( "matrix(");
1373 if (index1 >= 0) {
1374 index1 += 7; // do not include 'matrix('
1375 index2 = xformStr.indexOf( ")", index1 );
1376 if (index2 >= 0) {
1377 substr = xformStr.substr( index1, (index2-index1));
1378 if (substr && (substr.length > 0)) {
1379 numArray = substr.split(',');
1380 nNums = numArray.length;
1381 if (nNums === 6) {
1382 // gl-matrix wants row order
1383 mat = Matrix.I(4);
1384 mat[0] = Number(numArray[0]);
1385 mat[1] = Number(numArray[1]);
1386 mat[4] = Number(numArray[2]);
1387 mat[5] = Number(numArray[3]);
1388 mat[12] = Number(numArray[4]);
1389 mat[13] = Number(numArray[5]);
1390 }
1391 }
1392 }
1393 }
1359 } 1394 }
1360 } 1395 }
1361 return mat; 1396 return mat;