aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js2
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js13
-rwxr-xr-xjs/helper-classes/3D/view-utils.js53
-rwxr-xr-xjs/stage/stage-deps.js61
-rwxr-xr-xjs/stage/stage.reel/stage.html3
-rwxr-xr-xjs/tools/drawing-tool-base.js39
6 files changed, 45 insertions, 126 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index a6d2d899..a8bc16ef 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -138,7 +138,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
138 l, 138 l,
139 t, 139 t,
140 plane, 140 plane,
141 elt 141 elt;
142 for(i=0; i<len; i++) { 142 for(i=0; i<len; i++) {
143 elt = documentRootChildren[i]; 143 elt = documentRootChildren[i];
144 plane = this.addElement(elt); 144 plane = this.addElement(elt);
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 2e8020d3..7194524e 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -21,7 +21,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
21 /////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////
22 // Instance variables 22 // Instance variables
23 /////////////////////////////////////////////////////////////////////// 23 ///////////////////////////////////////////////////////////////////////
24 currentStage: { value: null, writable: true },
25 drawingCanvas: { value: null, writable: true}, 24 drawingCanvas: { value: null, writable: true},
26 25
27 // we keep a stack of working planes to facilitate working on other planes temporarily 26 // we keep a stack of working planes to facilitate working on other planes temporarily
@@ -84,14 +83,14 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
84 popWorkingPlane : { value: function () { workingPlane = this._workingPlaneStack.pop(); return workingPlane; }}, 83 popWorkingPlane : { value: function () { workingPlane = this._workingPlaneStack.pop(); return workingPlane; }},
85 84
86 getStageWidth : { value: function () { 85 getStageWidth : { value: function () {
87 return parseInt(this.currentStage.offsetWidth); 86 return parseInt(this.application.ninja.currentDocument.documentRoot.offsetWidth);
88 }}, 87 }},
89 88
90 getStageHeight : { value: function () { 89 getStageHeight : { value: function () {
91 return parseInt(this.currentStage.offsetHeight); 90 return parseInt(this.application.ninja.currentDocument.documentRoot.offsetHeight);
92 }}, 91 }},
93 92
94 getStage : { value: function() { return this.currentStage; }}, 93 getStage : { value: function() { return this.application.ninja.currentDocument.documentRoot; }},
95 94
96 getGridVertexHitRad : { value: function() { return this._gridVertexHitRad; }}, 95 getGridVertexHitRad : { value: function() { return this._gridVertexHitRad; }},
97 getGridEdgeHitRad : { value: function() { return this._gridEdgeHitRad; }}, 96 getGridEdgeHitRad : { value: function() { return this._gridEdgeHitRad; }},
@@ -185,12 +184,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
185 } 184 }
186 }, 185 },
187 186
188 setCurrentStage: {
189 value: function(stage) {
190 this.currentStage = stage;
191 }
192 },
193
194 snap : { 187 snap : {
195 value: function (xScreen, yScreen, snap3D, quadPt) 188 value: function (xScreen, yScreen, snap3D, quadPt)
196 { 189 {
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index 8c338f84..20f61be1 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -18,18 +18,14 @@ exports.ViewUtils = Montage.create(Component, {
18 // Instance variables 18 // Instance variables
19 /////////////////////////////////////////////////////////////////////// 19 ///////////////////////////////////////////////////////////////////////
20 20
21 m_viewportObj : { value: null, writable: true}, 21 m_viewportObj : { value: null},
22 _perspectiveDist: { value: null, writable: true}, 22 _perspectiveDist: { value: null},
23 23
24 // keep a stack of viewport objects 24 // keep a stack of viewport objects
25 _viewportObjStack: { value: [], writable: true }, 25 _viewportObjStack: { value: []},
26 26
27 _currentDocument: { value: null , writable: true}, 27 _userContentLeft: { value: null},
28 _userContentLeft: { value: null , writable: true}, 28 _userContentTop: { value: null},
29 _userContentTop: { value: null , writable: true},
30
31 _rootElement: { value: null, writable: true},
32 _stageElement: { value: null, writable: true},
33 29
34 /////////////////////////////////////////////////////////////////////// 30 ///////////////////////////////////////////////////////////////////////
35 // Property accessors 31 // Property accessors
@@ -43,18 +39,9 @@ exports.ViewUtils = Montage.create(Component, {
43 }, 39 },
44 getViewportObj: { value: function() { return this.m_viewportObj; } }, 40 getViewportObj: { value: function() { return this.m_viewportObj; } },
45 41
46 setRootElement: { value: function( elt ) { this._rootElement = elt; } },
47 getRootElement: { value: function () { return this._rootElement; } },
48
49 setStageElement: { value: function( elt ) { this._stageElement = elt; } },
50 getStageElement: { value: function () { return this._stageElement; } },
51
52 setCurrentDocument: { value: function(value) { this._currentDocument = value; }},
53
54 setUserContentLeft: { value: function(value) { this._userContentLeft = value; }}, 42 setUserContentLeft: { value: function(value) { this._userContentLeft = value; }},
55 setUserContentTop: { value: function(value) { this._userContentTop = value; }}, 43 setUserContentTop: { value: function(value) { this._userContentTop = value; }},
56 44
57
58 getPerspectiveDistance: { value: function () { return this._perspectiveDist; } }, 45 getPerspectiveDistance: { value: function () { return this._perspectiveDist; } },
59 46
60 /////////////////////////////////////////////////////////////////////// 47 ///////////////////////////////////////////////////////////////////////
@@ -302,7 +289,7 @@ exports.ViewUtils = Montage.create(Component, {
302 // into stage world space. 289 // into stage world space.
303 postViewToStageWorld: { 290 postViewToStageWorld: {
304 value: function( localPt, elt ) { 291 value: function( localPt, elt ) {
305 if ((elt == null) || (elt === this._stageElement)) return localPt; 292 if ((elt == null) || (elt === this.application.ninja.currentDocument.documentRoot)) return localPt;
306 293
307 // get the 3D transformation and 2D offset from the element 294 // get the 3D transformation and 2D offset from the element
308 var pt = localPt.slice(0); 295 var pt = localPt.slice(0);
@@ -329,7 +316,7 @@ exports.ViewUtils = Montage.create(Component, {
329 this.popViewportObj(); 316 this.popViewportObj();
330 317
331 // check if we are done 318 // check if we are done
332 if (parent === this._stageElement) break; 319 if (parent === this.application.ninja.currentDocument.documentRoot) break;
333 320
334 if (this.elementHas3D( parent )) 321 if (this.elementHas3D( parent ))
335 { 322 {
@@ -358,13 +345,13 @@ exports.ViewUtils = Montage.create(Component, {
358 { 345 {
359 pt = this.childToParent( pt, child ); 346 pt = this.childToParent( pt, child );
360 347
361// if (child === this._stageElement) break; 348// if (child === this.application.ninja.currentDocument.documentRoot) break;
362// child = child.offsetParent; 349// child = child.offsetParent;
363 350
364 if (child === this._stageElement) break; 351 if (child === this.application.ninja.currentDocument.documentRoot) break;
365 if (child === this._rootElement) break; 352 if (child === this.application.ninja.currentDocument.documentRoot.parentNode) break;
366 child = child.offsetParent; 353 child = child.offsetParent;
367 if (child === this._rootElement) break; 354 if (child === this.application.ninja.currentDocument.documentRoot.parentNode) break;
368 } 355 }
369 356
370 ///////////////////////////////////////////////////////// 357 /////////////////////////////////////////////////////////
@@ -414,7 +401,7 @@ exports.ViewUtils = Montage.create(Component, {
414 { 401 {
415 // TODO - Commenting out flatten support until new perspective workflow is fully working 402 // TODO - Commenting out flatten support until new perspective workflow is fully working
416 // if (flatten) pt[2] = 0; 403 // if (flatten) pt[2] = 0;
417// var flatten = (parent !== this._rootElement) && (ElementsMediator.getProperty(parent, "-webkit-transform-style") !== "preserve-3d"); 404// var flatten = (parent !== this.application.ninja.currentDocument.documentRoot.parentNode) && (ElementsMediator.getProperty(parent, "-webkit-transform-style") !== "preserve-3d");
418// if(flatten) 405// if(flatten)
419// { 406// {
420// pt[2] = 0; 407// pt[2] = 0;
@@ -699,7 +686,7 @@ exports.ViewUtils = Montage.create(Component, {
699 // if (elt.__ninjaXOff) xOff = elt.__ninjaXOff; 686 // if (elt.__ninjaXOff) xOff = elt.__ninjaXOff;
700 // if (elt.__ninjaYOff) yOff = elt.__ninjaYOff; 687 // if (elt.__ninjaYOff) yOff = elt.__ninjaYOff;
701 var offset = [xOff, yOff]; 688 var offset = [xOff, yOff];
702 if(elt.offsetParent && (elt.offsetParent !== this._stageElement)) 689 if(elt.offsetParent && (elt.offsetParent !== this.application.ninja.currentDocument.documentRoot))
703 { 690 {
704 var pS = elt.ownerDocument.defaultView.getComputedStyle(elt.offsetParent); 691 var pS = elt.ownerDocument.defaultView.getComputedStyle(elt.offsetParent);
705 692
@@ -715,7 +702,7 @@ exports.ViewUtils = Montage.create(Component, {
715 } 702 }
716 } 703 }
717 704
718 if(elt === this._stageElement) 705 if(elt === this.application.ninja.currentDocument.documentRoot)
719 { 706 {
720 // TODO - Call a routine from the user document controller to get the offsets/margins 707 // TODO - Call a routine from the user document controller to get the offsets/margins
721 // Once we expose the document controller to ViewUtils 708 // Once we expose the document controller to ViewUtils
@@ -1006,7 +993,7 @@ exports.ViewUtils = Montage.create(Component, {
1006 glmat4.multiply( v2s, mat, mat ); 993 glmat4.multiply( v2s, mat, mat );
1007 994
1008 // TODO - Commenting out flatten support until new perspective workflow is fully working 995 // TODO - Commenting out flatten support until new perspective workflow is fully working
1009// var flatten = (elt !== this._rootElement) && (elt.parentElement !== this._rootElement) && (ElementsMediator.getProperty(elt.parentElement, "-webkit-transform-style") !== "preserve-3d"); 996// var flatten = (elt !== this.application.ninja.currentDocument.documentRoot.parentNode) && (elt.parentElement !== this.application.ninja.currentDocument.documentRoot.parentNode) && (ElementsMediator.getProperty(elt.parentElement, "-webkit-transform-style") !== "preserve-3d");
1010// if(flatten) 997// if(flatten)
1011// { 998// {
1012// glmat4.multiply( zMat, mat, mat ); 999// glmat4.multiply( zMat, mat, mat );
@@ -1020,10 +1007,10 @@ exports.ViewUtils = Montage.create(Component, {
1020 1007
1021 this.popViewportObj(); 1008 this.popViewportObj();
1022 1009</