From c9a268aa5dbe9d9e1ace2e55f7e2f79d792553b4 Mon Sep 17 00:00:00 2001 From: OleksandrLavrynenko Date: Tue, 14 Jun 2022 11:19:14 +0300 Subject: [PATCH 1/5] [Fix] Fixed touchmove slider to agenda --- js/layout-javascript/agenda-code.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/layout-javascript/agenda-code.js b/js/layout-javascript/agenda-code.js index e2139127..1dfc56dd 100644 --- a/js/layout-javascript/agenda-code.js +++ b/js/layout-javascript/agenda-code.js @@ -2398,7 +2398,7 @@ DynamicList.prototype.bindTouchEvents = function() { touchAction: 'pan-y' }); - _this.hammer.on('panright panleft', function(e) { + _this.hammer.on('panright panleft panup pandown', function(e) { if (!_this.isPanningHorizontal(e)) { return; } @@ -2408,7 +2408,7 @@ DynamicList.prototype.bindTouchEvents = function() { _this.activeSlideIndex = _this.$container.find('.agenda-list-day-holder').index(_this.$container.find('.agenda-list-day-holder.active')); _this.$container.find('.agenda-date-selector, .agenda-date-selector ul').addClass('is-panning'); _this.scrollValue = -1 * e.deltaX; - _this.$container.find('.agenda-cards-wrapper').scrollLeft(_this.copyOfScrollValue + _this.scrollValue); + _this.$container.find('.agenda-cards-wrapper').scrollLeft(parseInt(_this.copyOfScrollValue + _this.scrollValue, 10)); }); _this.hammer.on('panend', function(e) { From 503ffd997d84d418682f1f4ac96b5c95f9e814af Mon Sep 17 00:00:00 2001 From: OleksandrLavrynenko Date: Tue, 14 Jun 2022 15:44:07 +0300 Subject: [PATCH 2/5] [Fix] fix scroll position --- js/layout-javascript/agenda-code.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/layout-javascript/agenda-code.js b/js/layout-javascript/agenda-code.js index 1dfc56dd..9675aef0 100644 --- a/js/layout-javascript/agenda-code.js +++ b/js/layout-javascript/agenda-code.js @@ -1835,7 +1835,7 @@ DynamicList.prototype.moveForwardDate = function(index, difference) { _this.animatingForward = true; var nextDateElementWidth = Math.floor(nextDateElement.outerWidth() * difference); - var nextAgendaElementWidth = Math.floor(nextAgendaElement.outerWidth() * difference); + var scrollValue = nextAgendaElement.outerWidth() * index - _this.$container.find('.agenda-cards-wrapper').scrollLeft(); if (!_this.isPanning) { _this.scrollValue = 0; @@ -1843,7 +1843,7 @@ DynamicList.prototype.moveForwardDate = function(index, difference) { Promise.all([ _this.animateDateForward(nextDateElement, nextDateElementWidth), - _this.animateAgendaForward(nextAgendaElement, nextAgendaElementWidth - _this.scrollValue) + _this.animateAgendaForward(nextAgendaElement, parseInt(scrollValue, 10)) ]).then(function() { _this.isPanning = false; _this.animatingForward = false; @@ -1867,7 +1867,8 @@ DynamicList.prototype.moveBackDate = function(index, difference) { _this.animatingBack = true; var prevDateElementWidth = Math.floor(prevDateElement.outerWidth() * positiveDifference); - var prevAgendaElementWidth = Math.floor(prevAgendaElement.outerWidth() * positiveDifference); + + var scrollValue = _this.$container.find('.agenda-cards-wrapper').scrollLeft() - prevAgendaElement.outerWidth() * index; if (!_this.isPanning) { _this.scrollValue = 0; @@ -1875,7 +1876,7 @@ DynamicList.prototype.moveBackDate = function(index, difference) { Promise.all([ _this.animateDateBack(prevDateElement, prevDateElementWidth), - _this.animateAgendaBack(prevAgendaElement, prevAgendaElementWidth + _this.scrollValue) + _this.animateAgendaBack(prevAgendaElement, parseInt(scrollValue, 10)) ]).then(function() { _this.isPanning = false; _this.animatingBack = false; @@ -2398,7 +2399,7 @@ DynamicList.prototype.bindTouchEvents = function() { touchAction: 'pan-y' }); - _this.hammer.on('panright panleft panup pandown', function(e) { + _this.hammer.on('panright panleft', function(e) { if (!_this.isPanningHorizontal(e)) { return; } @@ -2418,9 +2419,9 @@ DynamicList.prototype.bindTouchEvents = function() { return; } - if ( _this.scrollValue > 0 ) { + if ( _this.scrollValue > 0) { _this.sliderGoTo( _this.activeSlideIndex + 1 ); - } else if ( _this.scrollValue < 0 ) { + } else if ( _this.scrollValue < 0) { _this.sliderGoTo( _this.activeSlideIndex - 1 ); } }); From 6bd91b865854e9eaaf86591ff833173710000bf4 Mon Sep 17 00:00:00 2001 From: OleksandrLavrynenko Date: Tue, 14 Jun 2022 15:48:44 +0300 Subject: [PATCH 3/5] [CleanUp] --- js/layout-javascript/agenda-code.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/layout-javascript/agenda-code.js b/js/layout-javascript/agenda-code.js index f61d2a2c..40f57a3f 100644 --- a/js/layout-javascript/agenda-code.js +++ b/js/layout-javascript/agenda-code.js @@ -2419,9 +2419,9 @@ DynamicList.prototype.bindTouchEvents = function() { return; } - if ( _this.scrollValue > 0) { + if ( _this.scrollValue > 0 ) { _this.sliderGoTo( _this.activeSlideIndex + 1 ); - } else if ( _this.scrollValue < 0) { + } else if ( _this.scrollValue < 0 ) { _this.sliderGoTo( _this.activeSlideIndex - 1 ); } }); From 44e814d7e3e0df61a95ba39b2b3069177b09f7cc Mon Sep 17 00:00:00 2001 From: OleksandrLavrynenko Date: Tue, 14 Jun 2022 15:50:40 +0300 Subject: [PATCH 4/5] [CleanUp] --- js/layout-javascript/agenda-code.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/layout-javascript/agenda-code.js b/js/layout-javascript/agenda-code.js index 40f57a3f..2b8f3d6e 100644 --- a/js/layout-javascript/agenda-code.js +++ b/js/layout-javascript/agenda-code.js @@ -1835,7 +1835,7 @@ DynamicList.prototype.moveForwardDate = function(index, difference) { _this.animatingForward = true; var nextDateElementWidth = Math.floor(nextDateElement.outerWidth() * difference); - var scrollValue = nextAgendaElement.outerWidth() * index - _this.$container.find('.agenda-cards-wrapper').scrollLeft(); + var scrollValue = parseInt(nextAgendaElement.outerWidth() * index - _this.$container.find('.agenda-cards-wrapper').scrollLeft(), 10); if (!_this.isPanning) { _this.scrollValue = 0; @@ -1843,7 +1843,7 @@ DynamicList.prototype.moveForwardDate = function(index, difference) { Promise.all([ _this.animateDateForward(nextDateElement, nextDateElementWidth), - _this.animateAgendaForward(nextAgendaElement, parseInt(scrollValue, 10)) + _this.animateAgendaForward(nextAgendaElement, scrollValue) ]).then(function() { _this.isPanning = false; _this.animatingForward = false; @@ -1868,7 +1868,7 @@ DynamicList.prototype.moveBackDate = function(index, difference) { var prevDateElementWidth = Math.floor(prevDateElement.outerWidth() * positiveDifference); - var scrollValue = _this.$container.find('.agenda-cards-wrapper').scrollLeft() - prevAgendaElement.outerWidth() * index; + var scrollValue = parseInt(_this.$container.find('.agenda-cards-wrapper').scrollLeft() - prevAgendaElement.outerWidth() * index, 10); if (!_this.isPanning) { _this.scrollValue = 0; @@ -1876,7 +1876,7 @@ DynamicList.prototype.moveBackDate = function(index, difference) { Promise.all([ _this.animateDateBack(prevDateElement, prevDateElementWidth), - _this.animateAgendaBack(prevAgendaElement, parseInt(scrollValue, 10)) + _this.animateAgendaBack(prevAgendaElement, scrollValue) ]).then(function() { _this.isPanning = false; _this.animatingBack = false; From 81fea77f36da2a0815682cb31f6aac0e7bb253b3 Mon Sep 17 00:00:00 2001 From: OleksandrLavrynenko Date: Tue, 14 Jun 2022 15:51:46 +0300 Subject: [PATCH 5/5] [CleanUp] --- js/layout-javascript/agenda-code.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/layout-javascript/agenda-code.js b/js/layout-javascript/agenda-code.js index 2b8f3d6e..09c1e7a7 100644 --- a/js/layout-javascript/agenda-code.js +++ b/js/layout-javascript/agenda-code.js @@ -1867,7 +1867,6 @@ DynamicList.prototype.moveBackDate = function(index, difference) { _this.animatingBack = true; var prevDateElementWidth = Math.floor(prevDateElement.outerWidth() * positiveDifference); - var scrollValue = parseInt(_this.$container.find('.agenda-cards-wrapper').scrollLeft() - prevAgendaElement.outerWidth() * index, 10); if (!_this.isPanning) {