diff options
author | Valerio Virgillito | 2012-02-16 23:38:48 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-16 23:38:48 -0800 |
commit | b5d41c64de2875e2f8b31ec11268cb9f2d30780a (patch) | |
tree | 9ff4f7182f6f4bccab8f278aa987936648cb8ddd /js/helper-classes | |
parent | e67d1f472dab28b4ff6afc9d9cc06b34756e26b5 (diff) | |
download | ninja-b5d41c64de2875e2f8b31ec11268cb9f2d30780a.tar.gz |
Fixing the getStageWorldToGlobalMatrix bug
removing the snapManager reference in viewUtils
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index c8e20def..a2fac34f 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js | |||
@@ -4,16 +4,16 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, | 7 | var Montage = require("montage/core/core").Montage, |
8 | snapManagerModule = require("js/helper-classes/3D/snap-manager"), | 8 | Component = require("montage/ui/component").Component, |
9 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, | ||
9 | Rectangle = require("js/helper-classes/3D/rectangle").Rectangle, | 10 | Rectangle = require("js/helper-classes/3D/rectangle").Rectangle, |
10 | ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | 11 | ElementsMediator = require("js/mediators/element-mediator").ElementMediator; |
11 | /////////////////////////////////////////////////////////////////////// | 12 | /////////////////////////////////////////////////////////////////////// |
12 | // Class ViewUtils | 13 | // Class ViewUtils |
13 | // Viewing Utility functions | 14 | // Viewing Utility functions |
14 | /////////////////////////////////////////////////////////////////////// | 15 | /////////////////////////////////////////////////////////////////////// |
15 | var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, | 16 | exports.ViewUtils = Montage.create(Component, { |
16 | { | ||
17 | /////////////////////////////////////////////////////////////////////// | 17 | /////////////////////////////////////////////////////////////////////// |
18 | // Instance variables | 18 | // Instance variables |
19 | /////////////////////////////////////////////////////////////////////// | 19 | /////////////////////////////////////////////////////////////////////// |
@@ -133,7 +133,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, | |||
133 | var xVec = [mat[0], mat[1], mat[2], mat[3]]; | 133 | var xVec = [mat[0], mat[1], mat[2], mat[3]]; |
134 | var yVec = [mat[4], mat[5], mat[6], mat[7]]; | 134 | var yVec = [mat[4], mat[5], mat[6], mat[7]]; |
135 | 135 | ||
136 | var stage = snapManagerModule.SnapManager.getStage(); | 136 | var stage = this.application.ninja.currentDocument.documentRoot; |
137 | var stageMat = this.getMatrixFromElement(stage); | 137 | var stageMat = this.getMatrixFromElement(stage); |
138 | var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]]; | 138 | var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]]; |
139 | 139 | ||
@@ -412,7 +412,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, | |||
412 | // get the four corners of the element in global space | 412 | // get the four corners of the element in global space |
413 | var bounds = this.getElementViewBounds3D( elt ); | 413 | var bounds = this.getElementViewBounds3D( elt ); |
414 | var bounds3D = new Array(); | 414 | var bounds3D = new Array(); |
415 | var stage = snapManagerModule.SnapManager.getStage(); | 415 | var stage = this.application.ninja.currentDocument.documentRoot; |
416 | for (var i=0; i<3; i++) | 416 | for (var i=0; i<3; i++) |
417 | { | 417 | { |
418 | var gPt = this.localToGlobal( bounds[i], elt ); | 418 | var gPt = this.localToGlobal( bounds[i], elt ); |
@@ -789,7 +789,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, | |||
789 | 789 | ||
790 | getStageWorldToGlobalMatrix: { | 790 | getStageWorldToGlobalMatrix: { |
791 | value: function() { | 791 | value: function() { |
792 | var stage = snapManagerModule.SnapManager.getStage(); | 792 | var stage = this.application.ninja.currentDocument.documentRoot; |
793 | this.pushViewportObj( stage ); | 793 | this.pushViewportObj( stage ); |
794 | 794 | ||
795 | // get the matrix to the parent | 795 | // get the matrix to the parent |
@@ -1190,12 +1190,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, | |||
1190 | // drawLayoutModule.drawLayout.redrawDocument() OR | 1190 | // drawLayoutModule.drawLayout.redrawDocument() OR |
1191 | // window.stageManager.drawSelectionRec(true) this.getStage().draw(); | 1191 | // window.stageManager.drawSelectionRec(true) this.getStage().draw(); |
1192 | // drawLayoutModule.drawLayout.redrawDocument(); | 1192 | // drawLayoutModule.drawLayout.redrawDocument(); |
1193 | // | 1193 | |
1194 | // SNAP MANAGER | ||
1195 | // snapManager: snapManagerModule.SnapManager | ||
1196 | // snapManagerModule: snapManagerModule = r_equire("js/helper-classes/3D/snap-manager") | ||
1197 | // stage stage = snapManagerModule.SnapManager.getStage(); | ||
1198 | // | ||
1199 | // SELECTION MANAGER | 1194 | // SELECTION MANAGER |
1200 | // selected elements: this.application.ninja.selectedElements | 1195 | // selected elements: this.application.ninja.selectedElements |
1201 | // selectionManager this.application.ninja.selectionController | 1196 | // selectionManager this.application.ninja.selectionController |
@@ -1213,10 +1208,10 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, | |||
1213 | 1208 | ||
1214 | clearStageTranslation: { | 1209 | clearStageTranslation: { |
1215 | value: function() { | 1210 | value: function() { |
1216 | if (snapManagerModule.SnapManager.application.ninja.currentDocument) | 1211 | if (this.application.ninja.currentDocument) |
1217 | { | 1212 | { |
1218 | // get the user content object | 1213 | // get the user content object |
1219 | var userContent = snapManagerModule.SnapManager.application.ninja.currentDocument.documentRoot; | 1214 | var userContent = this.application.ninja.currentDocument.documentRoot; |
1220 | if (!userContent) return; | 1215 | if (!userContent) return; |
1221 | this.setViewportObj( userContent ); | 1216 | this.setViewportObj( userContent ); |
1222 | 1217 | ||
@@ -1235,9 +1230,10 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, | |||
1235 | value:function( globalPt, zoomFactor ) { | 1230 | value:function( globalPt, zoomFactor ) { |
1236 | var localPt; | 1231 | var localPt; |
1237 | var tmp1, tmp2, tmp3; | 1232 | var tmp1, tmp2, tmp3; |
1238 | if (snapManagerModule.SnapManager.application.ninja.currentDocument) | 1233 | |
1234 | if (this.application.ninja.currentDocument) | ||
1239 | { | 1235 | { |
1240 | var userContent = snapManagerModule.SnapManager.application.ninja.currentDocument.documentRoot; | 1236 | var userContent = this.application.ninja.currentDocument.documentRoot; |
1241 | if (!userContent) return; | 1237 | if (!userContent) return; |
1242 | this.setViewportObj( userContent ); | 1238 | this.setViewportObj( userContent ); |
1243 | var userContentMat = this.getMatrixFromElement(userContent); | 1239 | var userContentMat = this.getMatrixFromElement(userContent); |
@@ -1285,7 +1281,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, | |||
1285 | tmp2 = this.localToGlobal( localPt, userContent ); // DEBUG - remove this line | 1281 | tmp2 = this.localToGlobal( localPt, userContent ); // DEBUG - remove this line |
1286 | 1282 | ||
1287 | // apply to the stage background | 1283 | // apply to the stage background |
1288 | // var stageBG = snapManagerModule.SnapManager.application.ninja.currentDocument.stageBG; | 1284 | // var stageBG = this.application.ninja.currentDocument.stageBG; |
1289 | // var stageBGMat = this.getMatrixFromElement(stageBG); | 1285 | // var stageBGMat = this.getMatrixFromElement(stageBG); |
1290 | // var newStageBGMat = glmat4.multiply( mat, stageBGMat, []); | 1286 | // var newStageBGMat = glmat4.multiply( mat, stageBGMat, []); |
1291 | // this.setMatrixForElement(stageBG, newStageBGMat ); | 1287 | // this.setMatrixForElement(stageBG, newStageBGMat ); |
@@ -1298,15 +1294,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, | |||
1298 | { | 1294 | { |
1299 | value: function() | 1295 | value: function() |
1300 | { | 1296 | { |
1301 | return this.getStage.canvas; | 1297 | return this.application.ninjs.stage.canvas; |
1302 | } | ||
1303 | }, | ||
1304 | |||
1305 | getSnapManager: | ||
1306 | { | ||
1307 | value: function() | ||
1308 | { | ||
1309 | return snapManagerModule.SnapManager; | ||
1310 | } | 1298 | } |
1311 | }, | 1299 | }, |
1312 | 1300 | ||