diff options
author | Armen Kesablyan | 2012-05-23 14:34:58 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-05-23 14:34:58 -0700 |
commit | c21db7f1e4a0582777bdb5366df5d023a915b779 (patch) | |
tree | c4d29cb4686101d4a480ae836d20187879cf5400 /js/stage/stage-deps.js | |
parent | 3ed95247e9ea4b0a7833401ed6809647b7c4acbf (diff) | |
parent | 1a7e347810401e6262d9d7bad1c3583e6773993b (diff) | |
download | ninja-c21db7f1e4a0582777bdb5366df5d023a915b779.tar.gz |
Merge branch 'refs/heads/dom-architecture' into binding
Conflicts:
js/data/panels-data.js
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/stage/stage-deps.js')
-rwxr-xr-x | js/stage/stage-deps.js | 73 |
1 files changed, 13 insertions, 60 deletions
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js index 1825eb06..0d53696b 100755 --- a/js/stage/stage-deps.js +++ b/js/stage/stage-deps.js | |||
@@ -11,8 +11,7 @@ var Montage = require("montage/core/core").Montage, | |||
11 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, | 11 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, |
12 | ElementPlanes = require("js/helper-classes/3D/element-planes").ElementPlanes, | 12 | ElementPlanes = require("js/helper-classes/3D/element-planes").ElementPlanes, |
13 | MathUtilsClass = require("js/helper-classes/3D/math-utils").MathUtilsClass, | 13 | MathUtilsClass = require("js/helper-classes/3D/math-utils").MathUtilsClass, |
14 | VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, | 14 | VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; |
15 | DrawingToolBase = require("js/tools/drawing-tool-base").DrawingToolBase; | ||
16 | 15 | ||
17 | exports.StageDeps = Montage.create(Component, { | 16 | exports.StageDeps = Montage.create(Component, { |
18 | viewUtils: { | 17 | viewUtils: { |
@@ -27,24 +26,6 @@ exports.StageDeps = Montage.create(Component, { | |||
27 | value: drawUtils | 26 | value: drawUtils |
28 | }, | 27 | }, |
29 | 28 | ||
30 | currentStage: { | ||
31 | value: null | ||
32 | }, | ||
33 | |||
34 | _currentDocument: { | ||
35 | value: null | ||
36 | }, | ||
37 | |||
38 | currentDocument: { | ||
39 | get: function() { return this._currentDocument; }, | ||
40 | set: function(value) { | ||
41 | if(value) { | ||
42 | this._currentDocument = value; | ||
43 | this.currentStage = value.documentRoot; | ||
44 | } | ||
45 | } | ||
46 | }, | ||
47 | |||
48 | _userContentLeft: { | 29 | _userContentLeft: { |
49 | value: null | 30 | value: null |
50 | }, | 31 | }, |
@@ -74,8 +55,9 @@ exports.StageDeps = Montage.create(Component, { | |||
74 | deserializedFromTemplate: { | 55 | deserializedFromTemplate: { |
75 | value: function() { | 56 | value: function() { |
76 | 57 | ||
77 | this.eventManager.addEventListener( "appLoaded", this, false); | 58 | this.eventManager.addEventListener("appLoaded", this, false); |
78 | this.eventManager.addEventListener( "openDocument", this, false); | 59 | this.eventManager.addEventListener("openDocument", this, false); |
60 | this.eventManager.addEventListener("switchDocument", this, false); | ||
79 | 61 | ||
80 | // Initialize Deps | 62 | // Initialize Deps |
81 | // HACK | 63 | // HACK |
@@ -112,7 +94,9 @@ exports.StageDeps = Montage.create(Component, { | |||
112 | // bind the snap properties to the snap manager | 94 | // bind the snap properties to the snap manager |
113 | snapManager.bindSnap(); | 95 | snapManager.bindSnap(); |
114 | 96 | ||
115 | 97 | drawUtils.viewUtils = viewUtils; | |
98 | drawUtils.snapManager = snapManager; | ||
99 | drawUtils.ElementPlanes = ElementPlanes; | ||
116 | } | 100 | } |
117 | }, | 101 | }, |
118 | 102 | ||
@@ -121,53 +105,22 @@ exports.StageDeps = Montage.create(Component, { | |||
121 | 105 | ||
122 | workingPlane = [0,0,1,0]; | 106 | workingPlane = [0,0,1,0]; |
123 | 107 | ||
124 | snapManager.setCurrentStage(this.currentStage); | 108 | snapManager.reload2DCache(); |
125 | 109 | snapManager.setupDragPlaneFromPlane (workingPlane); | |
126 | viewUtils.setCurrentDocument(this.currentDocument); | ||
127 | viewUtils.setRootElement(this.currentStage.parentNode); | ||
128 | viewUtils.setStageElement(this.currentStage); | ||
129 | |||
130 | drawUtils.viewUtils = viewUtils; | ||
131 | drawUtils.snapManager = snapManager; | ||
132 | drawUtils.ElementPlanes = ElementPlanes; | ||
133 | |||
134 | snapManager._isCacheInvalid=true; | ||
135 | |||
136 | snapManager.setupDragPlaneFromPlane ( workingPlane ); | ||
137 | |||
138 | DrawingToolBase.stage = this.currentStage; | ||
139 | DrawingToolBase.stageComponent = this.stage; | ||
140 | 110 | ||
141 | drawUtils.initializeFromDocument(); | 111 | drawUtils.initializeFromDocument(); |
142 | } | 112 | } |
143 | }, | 113 | }, |
144 | 114 | ||
145 | reinitializeForSwitchDocument: { | 115 | handleSwitchDocument: { |
146 | value: function() { | 116 | value: function(){ |
147 | |||
148 | workingPlane = [0,0,1,0]; | 117 | workingPlane = [0,0,1,0]; |
149 | 118 | ||
150 | snapManager.setCurrentStage(this.currentStage); | 119 | snapManager.setupDragPlaneFromPlane (workingPlane); |
120 | snapManager.reload2DCache(); | ||
151 | 121 | ||
152 | viewUtils.setCurrentDocument(this.currentDocument); | ||
153 | viewUtils.setRootElement(this.currentStage.parentNode); | ||
154 | viewUtils.setStageElement(this.currentStage); | ||
155 | |||
156 | drawUtils.viewUtils = viewUtils; | ||
157 | drawUtils.snapManager = snapManager; | ||
158 | drawUtils.ElementPlanes = ElementPlanes; | ||
159 | |||
160 | snapManager._isCacheInvalid=true; | ||
161 | |||
162 | snapManager.setupDragPlaneFromPlane ( workingPlane ); | ||
163 | |||
164 | DrawingToolBase.stage = this.currentStage; | ||
165 | DrawingToolBase.stageComponent = this.stage; | ||
166 | 122 | ||
167 | drawUtils.initializeFromDocument(); | 123 | drawUtils.initializeFromDocument(); |
168 | } | 124 | } |
169 | } | 125 | } |
170 | |||
171 | |||
172 | |||
173 | }); \ No newline at end of file | 126 | }); \ No newline at end of file |