diff options
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/document-controller.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 17ae8cc3..682bd6a6 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -498,6 +498,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
498 | 498 | ||
499 | this.webTemplate = false; | 499 | this.webTemplate = false; |
500 | 500 | ||
501 | this._initializeBodyStyles(); | ||
501 | NJevent("onOpenDocument", doc); | 502 | NJevent("onOpenDocument", doc); |
502 | 503 | ||
503 | this.application.ninja.stage.stageView.showCodeViewBar(false); | 504 | this.application.ninja.stage.stageView.showCodeViewBar(false); |
@@ -645,5 +646,37 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
645 | value:function(){ | 646 | value:function(){ |
646 | this.activeDocument.needsSave = true; | 647 | this.activeDocument.needsSave = true; |
647 | } | 648 | } |
649 | }, | ||
650 | |||
651 | _initializeBodyStyles: { | ||
652 | value: function() { | ||
653 | var sc = this.application.ninja.stylesController, | ||
654 | docRoot = this.application.ninja.currentDocument.documentRoot, | ||
655 | styles = {}, | ||
656 | needsRule = false, | ||
657 | rule; | ||
658 | |||
659 | if(sc.getElementStyle(docRoot, "width", false, false) == null) { | ||
660 | styles['width'] = '100%'; | ||
661 | needsRule = true; | ||
662 | } | ||
663 | if(sc.getElementStyle(docRoot, "height", false, false) == null) { | ||
664 | styles['height'] = '100%'; | ||
665 | needsRule = true; | ||
666 | } | ||
667 | if(sc.getElementStyle(docRoot, "-webkit-transform", false, false) == null) { | ||
668 | styles['-webkit-transform'] = 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)'; | ||
669 | needsRule = true; | ||
670 | } | ||
671 | if(sc.getElementStyle(docRoot, "-webkit-transform-style", false, false) == null) { | ||
672 | styles['-webkit-transform-style'] = 'preserve-3d'; | ||
673 | needsRule = true; | ||
674 | } | ||
675 | |||
676 | if(needsRule) { | ||
677 | rule = sc.addRule('body{}'); | ||
678 | sc.setStyles(rule, styles); | ||
679 | } | ||
680 | } | ||
648 | } | 681 | } |
649 | }); | 682 | }); |