Commit 3a6b806c authored by Robert Hodan's avatar Robert Hodan Committed by Juan Corona

Allow Host to call setVisibleHighlights for all Guests

parent ea8294e9
...@@ -471,9 +471,7 @@ module.exports = class Guest extends Delegator ...@@ -471,9 +471,7 @@ module.exports = class Guest extends Delegator
# Pass true to show the highlights in the frame or false to disable. # Pass true to show the highlights in the frame or false to disable.
setVisibleHighlights: (shouldShowHighlights) -> setVisibleHighlights: (shouldShowHighlights) ->
@crossframe?.call('setVisibleHighlights', shouldShowHighlights)
this.toggleHighlightClass(shouldShowHighlights) this.toggleHighlightClass(shouldShowHighlights)
this.publish 'setVisibleHighlights', shouldShowHighlights
toggleHighlightClass: (shouldShowHighlights) -> toggleHighlightClass: (shouldShowHighlights) ->
if shouldShowHighlights if shouldShowHighlights
......
...@@ -64,3 +64,9 @@ module.exports = class Host extends Guest ...@@ -64,3 +64,9 @@ module.exports = class Host extends Guest
destroy: -> destroy: ->
@frame.remove() @frame.remove()
super super
setAllVisibleHighlights: (shouldShowHighlights) ->
@crossframe.call('setVisibleHighlights', shouldShowHighlights)
# Let the Toolbar know about this event
this.publish 'setVisibleHighlights', shouldShowHighlights
...@@ -49,7 +49,7 @@ module.exports = class Toolbar extends Plugin ...@@ -49,7 +49,7 @@ module.exports = class Toolbar extends Plugin
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
state = not @annotator.visibleHighlights state = not @annotator.visibleHighlights
@annotator.setVisibleHighlights state @annotator.setAllVisibleHighlights state
, ,
"title": "New Page Note" "title": "New Page Note"
"class": "h-icon-note" "class": "h-icon-note"
......
...@@ -150,14 +150,17 @@ function FrameSync($rootScope, $window, Discovery, annotationUI, bridge) { ...@@ -150,14 +150,17 @@ function FrameSync($rootScope, $window, Discovery, annotationUI, bridge) {
$rootScope.$broadcast('sidebarOpened'); $rootScope.$broadcast('sidebarOpened');
}); });
// These merely relay calls // These invoke the matching methods by name on the Guests
bridge.on('showSidebar', function () { bridge.on('showSidebar', function () {
bridge.call('showSidebar'); bridge.call('showSidebar');
}); });
bridge.on('hideSidebar', function () { bridge.on('hideSidebar', function () {
bridge.call('hideSidebar'); bridge.call('hideSidebar');
}); });
bridge.on('setVisibleHighlights', function (state) {
bridge.call('setVisibleHighlights', state);
});
} }
/** /**
......
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