diff --git a/services/web/app/views/project/editor/pdf.pug b/services/web/app/views/project/editor/pdf.pug index 44410a44a8..f0d1a11666 100644 --- a/services/web/app/views/project/editor/pdf.pug +++ b/services/web/app/views/project/editor/pdf.pug @@ -106,7 +106,7 @@ div.full-size.pdf(ng-controller="PdfController") | #{translate("code_check_failed")} a( href, - ng-click="switchToFlatLayout()" + ng-click="switchToFlatLayout('pdf')" ng-show="ui.pdfLayout == 'sideBySide'" tooltip=translate('full_screen') tooltip-placement="bottom" @@ -116,7 +116,7 @@ div.full-size.pdf(ng-controller="PdfController") i.full-screen a( href, - ng-click="switchToSideBySideLayout()" + ng-click="switchToSideBySideLayout('editor')" ng-show="ui.pdfLayout == 'flat'" tooltip=translate('split_screen') tooltip-placement="bottom" diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index 1b9eda57d6..12f6dba2ce 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -190,6 +190,23 @@ define [ ide.localStorage = localStorage ide.browserIsSafari = false + + $scope.switchToFlatLayout = (view) -> + $scope.ui.pdfLayout = 'flat' + $scope.ui.view = view + ide.localStorage "pdf.layout", "flat" + + $scope.switchToSideBySideLayout = (view) -> + $scope.ui.pdfLayout = 'sideBySide' + $scope.ui.view = view + localStorage "pdf.layout", "split" + + if pdfLayout = localStorage("pdf.layout") + $scope.switchToSideBySideLayout() if pdfLayout == "split" + $scope.switchToFlatLayout() if pdfLayout == "flat" + else + $scope.switchToSideBySideLayout() + try userAgent = navigator.userAgent ide.browserIsSafari = ( diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 040d536b48..52295809d5 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -591,22 +591,6 @@ define [ {doc, line} = data ide.editorManager.openDoc(doc, gotoLine: line) - $scope.switchToFlatLayout = () -> - $scope.ui.pdfLayout = 'flat' - $scope.ui.view = 'pdf' - ide.localStorage "pdf.layout", "flat" - - $scope.switchToSideBySideLayout = () -> - $scope.ui.pdfLayout = 'sideBySide' - $scope.ui.view = 'editor' - localStorage "pdf.layout", "split" - - if pdfLayout = localStorage("pdf.layout") - $scope.switchToSideBySideLayout() if pdfLayout == "split" - $scope.switchToFlatLayout() if pdfLayout == "flat" - else - $scope.switchToSideBySideLayout() - App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) -> # enable per-user containers by default perUserCompile = true