Commit b5376aab authored by Randall Leeds's avatar Randall Leeds

Add scrollables option to the BucketBar

parent dec29271
...@@ -31,13 +31,14 @@ require('./plugin/textselection'); ...@@ -31,13 +31,14 @@ require('./plugin/textselection');
var docs = 'https://h.readthedocs.org/en/latest/hacking/customized-embedding.html'; var docs = 'https://h.readthedocs.org/en/latest/hacking/customized-embedding.html';
var options = { var options = {
app: jQuery('link[type="application/annotator+html"]').attr('href'), app: jQuery('link[type="application/annotator+html"]').attr('href'),
BucketBar: {container: '.annotator-frame'}, BucketBar: {container: '.annotator-frame', scrollables: ['body']},
Toolbar: {container: '.annotator-frame'} Toolbar: {container: '.annotator-frame'}
}; };
// Document metadata plugins // Document metadata plugins
if (window.PDFViewerApplication) { if (window.PDFViewerApplication) {
require('./plugin/pdf') require('./plugin/pdf')
options['BucketBar']['scrollables'] = ['#viewerContainer']
options['PDF'] = {}; options['PDF'] = {};
} else { } else {
require('../vendor/annotator.document'); require('../vendor/annotator.document');
......
...@@ -60,6 +60,9 @@ class Annotator.Plugin.BucketBar extends Annotator.Plugin ...@@ -60,6 +60,9 @@ class Annotator.Plugin.BucketBar extends Annotator.Plugin
# then that annotation will not be merged into the bucket # then that annotation will not be merged into the bucket
gapSize: 60 gapSize: 60
# Selectors for the scrollable elements on the page
scrollables: null
# buckets of annotations that overlap # buckets of annotations that overlap
buckets: [] buckets: []
...@@ -86,7 +89,15 @@ class Annotator.Plugin.BucketBar extends Annotator.Plugin ...@@ -86,7 +89,15 @@ class Annotator.Plugin.BucketBar extends Annotator.Plugin
@annotator.subscribe event, this._scheduleUpdate @annotator.subscribe event, this._scheduleUpdate
$(window).on 'resize scroll', this._scheduleUpdate $(window).on 'resize scroll', this._scheduleUpdate
$(document.body).on 'resize scroll', '*', this._scheduleUpdate
for scrollable in @options.scrollables ? []
$(scrollable).on 'resize scroll', this._scheduleUpdate
destroy: ->
$(window).off 'resize scroll', this._scheduleUpdate
for scrollable in @options.scrollables ? []
$(scrollable).off 'resize scroll', this._scheduleUpdate
# Update sometime soon # Update sometime soon
_scheduleUpdate: => _scheduleUpdate: =>
......
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