Commit c31208fd authored by IBBoard's avatar IBBoard

When the size allocation changes, check whether whether the view

isn't scrollable but has more books that could be loaded. If there
are then increase the offset controller's offset to load more.

This works whether the window is large when it opens or the user
expands the window (either by dragging or maximising)

Fixes #20 (copied from gnome-books#7 fix)
parent 501e21de
Pipeline #77719 passed with stage
in 15 minutes and 1 second
......@@ -776,6 +776,9 @@ const ViewContainer = new Lang.Class({
Lang.bind(this, this._onViewSelectionChanged));
this.view.connect('notify::view-type',
Lang.bind(this, this._onViewTypeChanged));
this.view.connect('size_allocate',
Lang.bind(this, this._onSizeAllocate));
this._selectionModeAction = overview.getAction('selection-mode');
this._selectionModeAction.connect('notify::state', Lang.bind(this, this._onSelectionModeChanged));
......@@ -811,6 +814,19 @@ const ViewContainer = new Lang.Class({
this._addListRenderers();
},
_onSizeAllocate: function() {
let vadjustment = this.view.get_vadjustment();
let viewHeight = this.view.get_generic_view().get_allocation().height;
let scrollIsAtTop = vadjustment.value == 0;
let scrollMaxIsHeight = vadjustment.upper <= viewHeight;
let hasMoreDocuments = this._offsetController.getRemainingDocs() > 0;
if (scrollIsAtTop && scrollMaxIsHeight && hasMoreDocuments)
{
this._offsetController.increaseOffset();
}
},
_getFirstDocument: function() {
let doc = null;
......
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