diff options
Diffstat (limited to 'js/stage/stage.reel/stage.js')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 5a1d7f78..4d9296a1 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -192,7 +192,6 @@ exports.Stage = Montage.create(Component, { | |||
192 | drawUtils._eltArray.length = 0; | 192 | drawUtils._eltArray.length = 0; |
193 | drawUtils._planesArray.length = 0; | 193 | drawUtils._planesArray.length = 0; |
194 | } else if(this._currentDocument.currentView === "design") { | 194 | } else if(this._currentDocument.currentView === "design") { |
195 | this.showCodeViewBar(false); | ||
196 | this.restoreAllPanels(); | 195 | this.restoreAllPanels(); |
197 | this.hideCanvas(false); | 196 | this.hideCanvas(false); |
198 | this.showRulers(); | 197 | this.showRulers(); |
@@ -200,13 +199,12 @@ exports.Stage = Montage.create(Component, { | |||
200 | this.clearAllCanvas(); | 199 | this.clearAllCanvas(); |
201 | this.initWithDocument(); | 200 | this.initWithDocument(); |
202 | } else { | 201 | } else { |
203 | this.showCodeViewBar(true); | ||
204 | this.collapseAllPanels(); | 202 | this.collapseAllPanels(); |
205 | this.hideCanvas(true); | 203 | this.hideCanvas(true); |
206 | this.hideRulers(); | 204 | this.hideRulers(); |
207 | } | 205 | } |
208 | } | 206 | } |
209 | }, | 207 | }, |
210 | 208 | ||
211 | _userPaddingLeft: { value: 0 }, | 209 | _userPaddingLeft: { value: 0 }, |
212 | _userPaddingTop: { value: 0 }, | 210 | _userPaddingTop: { value: 0 }, |
@@ -216,7 +214,7 @@ exports.Stage = Montage.create(Component, { | |||
216 | set: function(value) { | 214 | set: function(value) { |
217 | this._userPaddingLeft = value; | 215 | this._userPaddingLeft = value; |
218 | this._documentOffsetLeft = -value; | 216 | this._documentOffsetLeft = -value; |
219 | this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px"; | 217 | this.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px"; |
220 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; | 218 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; |
221 | this.updatedStage = true; | 219 | this.updatedStage = true; |
222 | } | 220 | } |
@@ -227,7 +225,7 @@ exports.Stage = Montage.create(Component, { | |||
227 | set: function(value) { | 225 | set: function(value) { |
228 | this._userPaddingTop = value; | 226 | this._userPaddingTop = value; |
229 | this._documentOffsetTop = -value; | 227 | this._documentOffsetTop = -value; |
230 | this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px"; | 228 | this.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px"; |
231 | this.userContentTop = this._documentOffsetTop - this._scrollTop; | 229 | this.userContentTop = this._documentOffsetTop - this._scrollTop; |
232 | this.updatedStage = true; | 230 | this.updatedStage = true; |
233 | } | 231 | } |
@@ -242,7 +240,7 @@ exports.Stage = Montage.create(Component, { | |||
242 | 240 | ||
243 | // Hack for now until a full component | 241 | // Hack for now until a full component |
244 | this.layout.draw(); | 242 | this.layout.draw(); |
245 | if(this.application.ninja.currentDocument) { | 243 | if(this.currentDocument) { |
246 | this.layout.draw3DInfo(true); | 244 | this.layout.draw3DInfo(true); |
247 | } | 245 | } |
248 | } else if(this.updatedStage) { | 246 | } else if(this.updatedStage) { |
@@ -347,8 +345,8 @@ exports.Stage = Montage.create(Component, { | |||
347 | } | 345 | } |
348 | 346 | ||
349 | if(didSwitch) { | 347 | if(didSwitch) { |
350 | this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft = this.currentDocument.model.scrollLeft; | 348 | this.currentDocument.model.views.design.document.body.scrollLeft = this.currentDocument.model.scrollLeft; |
351 | this.application.ninja.currentDocument.model.views.design.document.body.scrollTop = this.currentDocument.model.scrollTop; | 349 | this.currentDocument.model.views.design.document.body.scrollTop = this.currentDocument.model.scrollTop; |
352 | this.handleScroll(); | 350 | this.handleScroll(); |
353 | } else { | 351 | } else { |
354 | this.centerStage(); | 352 | this.centerStage(); |
@@ -462,9 +460,9 @@ exports.Stage = Montage.create(Component, { | |||
462 | handleMousewheel: { | 460 | handleMousewheel: { |
463 | value: function(event) { | 461 | value: function(event) { |
464 | if(event._event.wheelDelta > 0) { | 462 | if(event._event.wheelDelta > 0) { |
465 | this.application.ninja.currentDocument.model.views.design.document.body.scrollTop -= 20; | 463 | this.currentDocument.model.views.design.document.body.scrollTop -= 20; |
466 | } else { | 464 | } else { |
467 | this.application.ninja.currentDocument.model.views.design.document.body.scrollTop += 20; | 465 | this.currentDocument.model.views.design.document.body.scrollTop += 20; |
468 | } | 466 | } |
469 | } | 467 | } |
470 | }, | 468 | }, |
@@ -532,8 +530,8 @@ exports.Stage = Montage.create(Component, { | |||
532 | handleScroll: { | 530 | handleScroll: { |
533 | value: function() { | 531 | value: function() { |
534 | 532 | ||
535 | this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft; | 533 | this._scrollLeft = this.currentDocument.model.views.design.document.body.scrollLeft; |
536 | this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop; | 534 | this._scrollTop = this.currentDocument.model.views.design.document.body.scrollTop; |
537 | 535 | ||
538 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; | 536 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; |
539 | this.userContentTop = this._documentOffsetTop - this._scrollTop; | 537 | this.userContentTop = this._documentOffsetTop - this._scrollTop; |
@@ -571,7 +569,7 @@ exports.Stage = Montage.create(Component, { | |||
571 | */ | 569 | */ |
572 | centerStage: { | 570 | centerStage: { |
573 | value: function() { | 571 | value: function() { |
574 | var designView = this.application.ninja.currentDocument.model.views.design; | 572 | var designView = this.currentDocument.model.views.design; |
575 | if(designView._template) { | 573 | if(designView._template) { |
576 | designView.document.body.scrollLeft = this._documentOffsetLeft - parseInt((this.canvas.width - designView._template.size.width)/2); | 574 | designView.document.body.scrollLeft = this._documentOffsetLeft - parseInt((this.canvas.width - designView._template.size.width)/2); |
577 | designView.document.body.scrollTop = this._documentOffsetTop - parseInt((this.canvas.height - designView._template.size.height)/2); | 575 | designView.document.body.scrollTop = this._documentOffsetTop - parseInt((this.canvas.height - designView._template.size.height)/2); |
@@ -630,21 +628,21 @@ exports.Stage = Montage.create(Component, { | |||
630 | getElement: { | 628 | getElement: { |
631 | value: function(position, selectable) { | 629 | value: function(position, selectable) { |
632 | var point, element, | 630 | var point, element, |
633 | docView = this.application.ninja.currentDocument.model.views.design; | 631 | docView = this.currentDocument.model.views.design; |
634 | 632 | ||
635 | point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX - docView.iframe.contentWindow.pageXOffset + this.documentOffsetLeft, position.pageY - docView.iframe.contentWindow.pageYOffset + this.documentOffsetTop)); | 633 | point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX - docView.iframe.contentWindow.pageXOffset + this.documentOffsetLeft, position.pageY - docView.iframe.contentWindow.pageYOffset + this.documentOffsetTop)); |
636 | element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x - this.userContentLeft,point.y - this.userContentTop); | 634 | element = this.currentDocument.model.views.design.getElementFromPoint(point.x - this.userContentLeft,point.y - this.userContentTop); |
637 | 635 | ||
638 | if(!element) debugger; | 636 | if(!element) debugger; |
639 | // workaround Chrome 3d bug | 637 | // workaround Chrome 3d bug |
640 | if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(element) !== -1) { | 638 | if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.currentDocument.inExclusion(element) !== -1) { |
641 | point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY)); | 639 | point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY)); |
642 | element = this.getElementUsingSnapping(point); | 640 | element = this.getElementUsingSnapping(point); |
643 | } | 641 | } |
644 | 642 | ||
645 | if(selectable) { | 643 | if(selectable) { |
646 | 644 | ||
647 | if(this.application.ninja.currentDocument.inExclusion(element) !== -1) { | 645 | if(this.currentDocument.inExclusion(element) !== -1) { |
648 | return this.application.ninja.currentSelectedContainer; | 646 | return this.application.ninja.currentSelectedContainer; |
649 | } | 647 | } |
650 | 648 | ||
@@ -949,7 +947,7 @@ exports.Stage = Montage.create(Component, { | |||
949 | 947 | ||
950 | setStageAsViewport: { | 948 | setStageAsViewport: { |
951 | value: function() { | 949 | value: function() { |
952 | this.stageDeps.viewUtils.setViewportObj(this.application.ninja.currentDocument.model.documentRoot); | 950 | this.stageDeps.viewUtils.setViewportObj(this.currentDocument.model.documentRoot); |
953 | } | 951 | } |
954 | }, | 952 | }, |
955 | 953 | ||
@@ -957,7 +955,7 @@ exports.Stage = Montage.create(Component, { | |||
957 | value: function(value) { | 955 | value: function(value) { |
958 | if(!this._firstDraw) | 956 | if(!this._firstDraw) |
959 | { | 957 | { |
960 | var userContent = this.application.ninja.currentDocument.model.documentRoot; | 958 | var userContent = this.currentDocument.model.documentRoot; |
961 | if (userContent) | 959 | if (userContent) |
962 | { | 960 | { |
963 | var w = this._canvas.width, | 961 | var w = this._canvas.width, |
@@ -969,7 +967,7 @@ exports.Stage = Montage.create(Component, { | |||
969 | //TODO - Maybe move to mediator. | 967 | //TODO - Maybe move to mediator. |
970 | var newVal = value/100.0; | 968 | var newVal = value/100.0; |
971 | if (newVal >= 1) | 969 | if (newVal >= 1) |
972 | this.application.ninja.currentDocument.model.views.design.iframe.style.zoom = value/100; | 970 | this.currentDocument.model.views.design.iframe.style.zoom = value/100; |
973 | 971 | ||
974 | this.updatedStage = true; | 972 | this.updatedStage = true; |
975 | 973 | ||
@@ -988,12 +986,12 @@ exports.Stage = Montage.create(Component, { | |||
988 | { | 986 | { |
989 | case "top": | 987 | case "top": |
990 | plane = [0,1,0,0]; | 988 | plane = [0,1,0,0]; |
991 | plane[3] = this.application.ninja.currentDocument.model.documentRoot.offsetHeight / 2.0; | 989 | plane[3] = this.currentDocument.model.documentRoot.offsetHeight / 2.0; |
992 | break; | 990 | break; |
993 | 991 | ||
994 | case "side": | 992 | case "side": |
995 | plane = [1,0,0,0]; | 993 | plane = [1,0,0,0]; |
996 | plane[3] = this.application.ninja.currentDocument.model.documentRoot.offsetWidth / 2.0; | 994 | plane[3] = this.currentDocument.model.documentRoot.offsetWidth / 2.0; |
997 | break; | 995 | break; |
998 | 996 | ||
999 | case "front": | 997 | case "front": |
@@ -1012,7 +1010,7 @@ exports.Stage = Montage.create(Component, { | |||
1012 | setStageView: { | 1010 | setStageView: { |
1013 | value: function(side) { | 1011 | value: function(side) { |
1014 | var mat, | 1012 | var mat, |
1015 | currentDoc = this.application.ninja.currentDocument.model.documentRoot, | 1013 | currentDoc = this.currentDocument.model.documentRoot, |
1016 | isDrawingGrid = this.application.ninja.appModel.show3dGrid; | 1014 | isDrawingGrid = this.application.ninja.appModel.show3dGrid; |
1017 | // Stage 3d Props. | 1015 | // Stage 3d Props. |
1018 | currentDoc.elementModel.props3D.ResetTranslationValues(); | 1016 | currentDoc.elementModel.props3D.ResetTranslationValues(); |
@@ -1057,23 +1055,13 @@ exports.Stage = Montage.create(Component, { | |||
1057 | this.application.ninja.rulerLeft.style.display = "block"; | 1055 | this.application.ninja.rulerLeft.style.display = "block"; |
1058 | } | 1056 | } |
1059 | }, | 1057 | }, |
1058 | |||
1060 | hideRulers:{ | 1059 | hideRulers:{ |
1061 | value:function(){ | 1060 | value:function(){ |
1062 | this.application.ninja.rulerTop.style.display = "none"; | 1061 | this.application.ninja.rulerTop.style.display = "none"; |
1063 | this.application.ninja.rulerLeft.style.display = "none"; | 1062 | this.application.ninja.rulerLeft.style.display = "none"; |