diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-08-31 23:14:31 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-08-31 23:27:31 +0200 |
commit | 0ce381aa0a64de9a2165843dfe6ee493940f8c26 (patch) | |
tree | a8c48e79c58f1e651b45f74614be25477979de8c /client/components/boards/boardBody.js | |
parent | 549f8fee3aee3675ae2c04fa14b88f4a783df2c6 (diff) | |
download | wekan-0ce381aa0a64de9a2165843dfe6ee493940f8c26.tar.gz wekan-0ce381aa0a64de9a2165843dfe6ee493940f8c26.tar.bz2 wekan-0ce381aa0a64de9a2165843dfe6ee493940f8c26.zip |
Fix the horizontal canvas scrolling on card opening
Diffstat (limited to 'client/components/boards/boardBody.js')
-rw-r--r-- | client/components/boards/boardBody.js | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index aa9d630d..fd9ee6bc 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -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 = { |