mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Fix the horizontal canvas scrolling on card opening
This commit is contained in:
parent
549f8fee3a
commit
0ce381aa0a
3 changed files with 45 additions and 31 deletions
|
|
@ -44,20 +44,10 @@ BlazeComponent.extendComponent({
|
|||
this.draggingActive.set(bool);
|
||||
},
|
||||
|
||||
scrollLeft: function(position) {
|
||||
position = position || 0;
|
||||
var $container = $(this.listsDom);
|
||||
var containerWidth = $container.width();
|
||||
var currentScrollPosition = $container.scrollLeft();
|
||||
if (position < currentScrollPosition) {
|
||||
$container.animate({
|
||||
scrollLeft: position
|
||||
});
|
||||
} else if (position > currentScrollPosition + containerWidth) {
|
||||
$container.animate({
|
||||
scrollLeft: Math.max(0, position - containerWidth)
|
||||
});
|
||||
}
|
||||
scrollLeft: function(position = 0) {
|
||||
this.$('.js-lists').animate({
|
||||
scrollLeft: position
|
||||
});
|
||||
},
|
||||
|
||||
currentCardIsInThisList: function() {
|
||||
|
|
@ -109,10 +99,12 @@ BlazeComponent.extendComponent({
|
|||
Template.boardBody.onRendered(function() {
|
||||
var self = BlazeComponent.getComponentForElement(this.firstNode);
|
||||
|
||||
self.scrollLeft();
|
||||
|
||||
self.listsDom = this.find('.js-lists');
|
||||
|
||||
if (! Session.get('currentCard')) {
|
||||
self.scrollLeft();
|
||||
}
|
||||
|
||||
// We want to animate the card details window closing. We rely on CSS
|
||||
// transition for the actual animation.
|
||||
self.listsDom._uihooks = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue