Skip to content

Commit

Permalink
#441 - Don't process pull events when main menu is opened.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed Nov 26, 2022
1 parent 7862d01 commit 59e3411
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Money.Blazor.Host/wwwroot/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ window.PullToRefresh = {
const container = document.body;
const listenerOptions = { passive: true };

const preRequisities = () => !document.querySelector(".modal.fade.show");
const prerequisities = () => !document.querySelector(".modal.fade.show") && document.querySelector("nav.navbar-dark .navbar-collapse.collapse");

refreshClosure = (() => {
const treshold = 200;
Expand All @@ -123,7 +123,7 @@ window.PullToRefresh = {
_lastDeltaX = 0;
_lastDeltaY = 0;

if (document.scrollingElement.scrollTop === 0 && preRequisities()) {
if (document.scrollingElement.scrollTop === 0 && prerequisities()) {
_startX = Math.floor(e.touches[0].pageX);
_startY = Math.floor(e.touches[0].pageY);
_isActive = true;
Expand All @@ -135,15 +135,15 @@ window.PullToRefresh = {
const move = e => {
_lastDeltaX = Math.floor(Math.floor(e.touches[0].pageX) - _startX);
_lastDeltaY = Math.floor(Math.floor(e.touches[0].pageY) - _startY);
if (_isActive && _lastDeltaY > treshold && _lastDeltaX < (treshold / 2) && preRequisities()) {
if (_isActive && _lastDeltaY > treshold && _lastDeltaX < (treshold / 2) && prerequisities()) {
$ui.addClass("visible");
} else {
$ui.removeClass("visible");
}
};

const end = () => {
if (_isActive && _lastDeltaY > treshold && _lastDeltaX < (treshold / 2) && preRequisities()) {
if (_isActive && _lastDeltaY > treshold && _lastDeltaX < (treshold / 2) && prerequisities()) {
interop.invokeMethodAsync("PullToRefresh.Pulled");
}

Expand Down Expand Up @@ -186,7 +186,7 @@ window.PullToRefresh = {
_lastDeltaX = 0;
_lastDeltaY = 0;

if (preRequisities()) {
if (prerequisities()) {
_startX = Math.floor(e.touches[0].pageX);
_startY = Math.floor(e.touches[0].pageY);
if (_startX < (treshold / 2)) {
Expand All @@ -213,7 +213,7 @@ window.PullToRefresh = {
$rightUi.css("margin-right", Math.min(_lastDeltaX, treshold * 2));
}

if (_isActive && _lastDeltaX > treshold && _lastDeltaY < (treshold * 2) && preRequisities()) {
if (_isActive && _lastDeltaX > treshold && _lastDeltaY < (treshold * 2) && prerequisities()) {
if (_isActive === 1) {
swapLeftIcon(true);
} else if (_isActive === 2) {
Expand All @@ -231,7 +231,7 @@ window.PullToRefresh = {
$leftUi.css("margin-left", 0);
$rightUi.css("margin-right", 0);

if (_isActive && _lastDeltaX > treshold && _lastDeltaY < (treshold * 2) && preRequisities()) {
if (_isActive && _lastDeltaX > treshold && _lastDeltaY < (treshold * 2) && prerequisities()) {
if (_isActive === 1) {
interop.invokeMethodAsync("Swiped.Left");
}
Expand Down

0 comments on commit 59e3411

Please sign in to comment.