Allow review panel to be toggled

This commit is contained in:
James Allen 2016-10-13 14:22:23 +01:00
parent 42ab2e8165
commit 7a4bebd785
3 changed files with 33 additions and 17 deletions

View file

@ -8,7 +8,7 @@ div.full-size(
initial-size-east="'50%'"
minimum-restore-size-east="300"
)
.ui-layout-center(ng-controller="ReviewPanelController")
.ui-layout-center(ng-controller="ReviewPanelController", ng-class="{'has-review-panel': ui.reviewPanelOpen}")
.loading-panel(ng-show="!editor.sharejs_doc || editor.opening")
span(ng-show="editor.open_doc_id")
i.fa.fa-spin.fa-refresh
@ -17,7 +17,7 @@ div.full-size(
i.fa.fa-arrow-left
|   #{translate("open_a_file_on_the_left")}
#editor.has-review-panel(
#editor(
ace-editor="editor",
ng-show="!!editor.sharejs_doc && !editor.opening"
theme="settings.theme",
@ -32,7 +32,7 @@ div.full-size(
last-updated="editor.last_updated",
cursor-position="editor.cursorPosition",
goto-line="editor.gotoLine",
resize-on="layout:main:resize,layout:pdf:resize,layout:review:resize",
resize-on="layout:main:resize,layout:pdf:resize,layout:review:resize,reviewPanel:toggle",
annotations="pdf.logEntryAnnotations[editor.open_doc_id]",
read-only="!permissions.write",
on-ctrl-enter="recompileViaKey",

View file

@ -2,7 +2,7 @@ define [
"base",
"utils/EventEmitter"
], (App, EventEmitter) ->
App.controller "ReviewPanelController", ($scope, $element) ->
App.controller "ReviewPanelController", ($scope, $element, ide) ->
$scope.reviewPanel =
entries: {}
@ -31,9 +31,17 @@ define [
else
ignoreNextAceEvent = true
$scope.scrollEvents.emit "scroll", e.target.scrollTop
scroller.on "scroll", scrollAce
$scope.onScroll = scrollPanel # Passed into the editor directive for it to call
$scope.$watch "ui.reviewPanelOpen", (reviewPanelOpen) ->
return if !reviewPanelOpen?
setTimeout () ->
$scope.$broadcast "reviewPanel:toggle"
if reviewPanelOpen
scroller.on "scroll", scrollAce
$scope.onScroll = scrollPanel # Passed into the editor directive for it to call
else
scroller.off "scroll"
$scope.onScroll = null
# If we listen for scroll events in the review panel natively, then with a Mac trackpad
# the scroll is very smooth (natively done I'd guess), but we don't get polled regularly

View file

@ -1,11 +1,14 @@
@review-panel-width: 230px;
#review-panel {
position: absolute;
width: 160px;
width: @review-panel-width;
top: 0px;
bottom: 0px;
right: 0px;
background-color: #eee;
overflow: hidden;
display: none;
}
.review-panel-scroller {
@ -19,7 +22,7 @@
.review-entry-list {
position: relative;
width: 160px;
width: @review-panel-width;;
}
.review-entry {
@ -33,14 +36,19 @@
word-wrap: break-word;
}
#editor.has-review-panel {
right: 160px;
left: 0px;
width: auto;
.ace-editor-body {
overflow: visible;
.ace_scrollbar-v {
right: -160px;
.has-review-panel {
#editor {
right: @review-panel-width;;
left: 0px;
width: auto;
.ace-editor-body {
overflow: visible;
.ace_scrollbar-v {
right: -@review-panel-width;;
}
}
}
#review-panel {
display: block;
}
}