mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Improve scrolling
We now replace native scrollbar by custom ones on the list card (which is required by the new ergonomics in the parent commit), but the "scrolling engine", is still native, we just hide the scrollbar and draw our own in HTML/CSS using the perfect-scrollbar package (from bower). This commit also implements component scrolling when certain actions are performed, eg scroll to the bottom when the new card composer is opened.
This commit is contained in:
parent
781577db04
commit
9a45f3752f
22 changed files with 162 additions and 182 deletions
37
client/components/mixins/infiniteScrolling.js
Normal file
37
client/components/mixins/infiniteScrolling.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
var peakAnticipation = 200;
|
||||
|
||||
Mixins.InfiniteScrolling = BlazeComponent.extendComponent({
|
||||
onCreated: function() {
|
||||
this._nextPeak = Infinity;
|
||||
},
|
||||
|
||||
setNextPeak: function(v) {
|
||||
this._nextPeak = v;
|
||||
},
|
||||
|
||||
getNextPeak: function() {
|
||||
return this._nextPeak;
|
||||
},
|
||||
|
||||
resetNextPeak: function() {
|
||||
this._nextPeak = Infinity;
|
||||
},
|
||||
|
||||
// To be overwritten by consumers of this mixin
|
||||
reachNextPeak: function() {
|
||||
|
||||
},
|
||||
|
||||
events: function() {
|
||||
return [{
|
||||
scroll: function(evt) {
|
||||
var domElement = evt.currentTarget;
|
||||
var altitude = domElement.scrollTop + domElement.offsetHeight;
|
||||
altitude += peakAnticipation;
|
||||
if (altitude >= this.callFirstWith(null, 'getNextPeak')) {
|
||||
this.callFirstWith(null, 'reachNextPeak');
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue