aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage-deps.js56
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js9
-rwxr-xr-xjs/stage/stage.reel/stage.js10
3 files changed, 50 insertions, 25 deletions
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js
index 316a5bb0..16f2c652 100755
--- a/js/stage/stage-deps.js
+++ b/js/stage/stage-deps.js
@@ -123,30 +123,56 @@ exports.StageDeps = Montage.create(Component, {
123 }, 123 },
124 124
125 handleOpenDocument: { 125 handleOpenDocument: {
126 value: function() { 126 value: function() {
127 127
128 workingPlane = Vector.create( [0,0,1,0] ); 128 workingPlane = Vector.create( [0,0,1,0] );
129 129
130 snapManager.setCurrentStage(this.currentStage); 130 snapManager.setCurrentStage(this.currentStage);
131 131
132 viewUtils.setCurrentDocument(this.currentDocument); 132 viewUtils.setCurrentDocument(this.currentDocument);
133 viewUtils.setRootElement(this.currentStage.parentNode); 133 viewUtils.setRootElement(this.currentStage.parentNode);
134 viewUtils.setStageElement(this.currentStage); 134 viewUtils.setStageElement(this.currentStage);
135 135
136 drawUtils.viewUtils = viewUtils; 136 drawUtils.viewUtils = viewUtils;
137 drawUtils.snapManager = snapManager; 137 drawUtils.snapManager = snapManager;
138 drawUtils.ElementPlanes = ElementPlanes; 138 drawUtils.ElementPlanes = ElementPlanes;
139 139
140 snapManager._isCacheInvalid=true; 140 snapManager._isCacheInvalid=true;
141 141
142 snapManager.setupDragPlaneFromPlane ( workingPlane ); 142 snapManager.setupDragPlaneFromPlane ( workingPlane );
143 143
144 DrawingToolBase.stage = this.currentStage; 144 DrawingToolBase.stage = this.currentStage;
145 DrawingToolBase.stageComponent = this.stage; 145 DrawingToolBase.stageComponent = this.stage;
146 146
147 drawUtils.initializeFromDocument(); 147 drawUtils.initializeFromDocument();
148 } 148 }
149 },
150
151 reinitializeForSwitchDocument: {
152 value: function() {
153
154 workingPlane = Vector.create( [0,0,1,0] );
155
156 snapManager.setCurrentStage(this.currentStage);
157
158 viewUtils.setCurrentDocument(this.currentDocument);
159 viewUtils.setRootElement(this.currentStage.parentNode);
160 viewUtils.setStageElement(this.currentStage);
161
162 drawUtils.viewUtils = viewUtils;
163 drawUtils.snapManager = snapManager;
164 drawUtils.ElementPlanes = ElementPlanes;
165
166 snapManager._isCacheInvalid=true;
167
168 snapManager.setupDragPlaneFromPlane ( workingPlane );
169
170 DrawingToolBase.stage = this.currentStage;
171 DrawingToolBase.stageComponent = this.stage;
172
173 drawUtils.initializeFromDocument();
149 } 174 }
175 }
150 176
151 177
152 178
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index 0b688c75..ab02661d 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -118,8 +118,7 @@ exports.StageView = Montage.create(Component, {
118 } 118 }
119 }, 119 },
120 120
121 121 //called for switching between html documents
122
123 switchDocument:{ 122 switchDocument:{
124 value: function(doc){ 123 value: function(doc){
125 this.application.ninja.documentController._hideCurrentDocument(); 124 this.application.ninja.documentController._hideCurrentDocument();
@@ -138,8 +137,10 @@ exports.StageView = Montage.create(Component, {
138 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe 137 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe
139 this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; 138 this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument;
140 139
141 this.application.ninja.stage.snapManager._isCacheInvalid=true; 140 //reinitialize draw-util, snapmanager and view-util
142 this.application.ninja.stage.drawUtils.initializeFromDocument(); 141 this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument();
142
143 //this.application.ninja.stage.layout.reinitializeForSwitchDocument();
143 144
144 // TODO dispatch event here 145 // TODO dispatch event here
145 // appDelegateModule.MyAppDelegate.onSetActiveDocument(); 146 // appDelegateModule.MyAppDelegate.onSetActiveDocument();
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 755c7ff1..9784f14d 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -148,12 +148,12 @@ exports.Stage = Montage.create(Component, {
148 148
149 userContentLeft: { 149 userContentLeft: {
150 get: function() { return this._userContentLeft; }, 150 get: function() { return this._userContentLeft; },
151 set: function(value) { this._userContentLeft = value; } 151 set: function(value) { this._userContentLeft = value;}
152 }, 152 },
153 153
154 userContentTop: { 154 userContentTop: {
155 get: function() { return this._userContentTop; }, 155 get: function() { return this._userContentTop; },
156 set: function(value) { this._userContentTop = value; } 156 set: function(value) { this._userContentTop = value;}
157 }, 157 },
158 158
159 userContentBorder: { 159 userContentBorder: {
@@ -439,12 +439,11 @@ exports.Stage = Montage.create(Component, {
439 */ 439 */
440 handleScroll: { 440 handleScroll: {
441 value: function() { 441 value: function() {
442
443 this._scrollLeft = this._iframeContainer.scrollLeft; 442 this._scrollLeft = this._iframeContainer.scrollLeft;
444 this._scrollTop = this._iframeContainer.scrollTop; 443 this._scrollTop = this._iframeContainer.scrollTop;
445 444
446 this._userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; 445 this.userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder;
447 this._userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; 446 this.userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder;
448 447
449 // Need to clear the snap cache and set up the drag plane 448 // Need to clear the snap cache and set up the drag plane
450 //snapManager.setupDragPlaneFromPlane( workingPlane ); 449 //snapManager.setupDragPlaneFromPlane( workingPlane );
@@ -452,7 +451,6 @@ exports.Stage = Montage.create(Component, {
452 451
453 this.needsDraw = true; 452 this.needsDraw = true;
454 this.layout.draw(); 453 this.layout.draw();
455
456 //this._toolsList.action("DrawHandles"); 454 //this._toolsList.action("DrawHandles");
457 455
458 } 456 }