Commit 904addb8 authored by Randall Leeds's avatar Randall Leeds

Fire annotation(Editor|Viewer)Shown events

parent 9ab4a6e0
...@@ -97,14 +97,15 @@ class App ...@@ -97,14 +97,15 @@ class App
$scope.reloadAnnotations() $scope.reloadAnnotations()
$scope.$watch 'frame.visible', (newValue, oldValue) -> $scope.$watch 'frame.visible', (newValue, oldValue) ->
routeName = $location.path().replace /^\//, ''
if newValue if newValue
annotator.show() annotator.show()
annotator.host.notify method: 'showFrame' annotator.host.notify method: 'showFrame', params: routeName
$element.find('.topbar').find('.tri').attr('draggable', true) $element.find('.topbar').find('.tri').attr('draggable', true)
else if oldValue else if oldValue
$scope.sheet.collapsed = true $scope.sheet.collapsed = true
annotator.hide() annotator.hide()
annotator.host.notify method: 'hideFrame' annotator.host.notify method: 'hideFrame', params: routeName
for p in annotator.providers for p in annotator.providers
p.channel.notify method: 'setActiveHighlights' p.channel.notify method: 'setActiveHighlights'
$element.find('.topbar').find('.tri').attr('draggable', false) $element.find('.topbar').find('.tri').attr('draggable', false)
......
...@@ -45,17 +45,29 @@ class Annotator.Host extends Annotator.Guest ...@@ -45,17 +45,29 @@ class Annotator.Host extends Annotator.Guest
channel channel
.bind('showFrame', => .bind('showFrame', (ctx, routeName) =>
unless @drag.enabled unless @drag.enabled
@frame.css 'margin-left': "#{-1 * @frame.width()}px" @frame.css 'margin-left': "#{-1 * @frame.width()}px"
@frame.removeClass 'annotator-no-transition' @frame.removeClass 'annotator-no-transition'
@frame.removeClass 'annotator-collapsed' @frame.removeClass 'annotator-collapsed'
switch routeName
when 'editor'
this.publish 'annotationEditorShown'
when 'viewer'
this.publish 'annotationViewerShown'
) )
.bind('hideFrame', => .bind('hideFrame', (ctx, routeName) =>
@frame.css 'margin-left': '' @frame.css 'margin-left': ''
@frame.removeClass 'annotator-no-transition' @frame.removeClass 'annotator-no-transition'
@frame.addClass 'annotator-collapsed' @frame.addClass 'annotator-collapsed'
switch routeName
when 'editor'
this.publish 'annotationEditorHidden'
when 'viewer'
this.publish 'annotationViewerHidden'
) )
.bind('dragFrame', (ctx, screenX) => this._dragUpdate screenX) .bind('dragFrame', (ctx, screenX) => this._dragUpdate screenX)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment