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