From 98bc071dd305fe240018c43030e48e19f5bcba39 Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Fri, 20 Jul 2018 16:56:15 +0200 Subject: [PATCH] - fixed a bug where "map change" (click on tab) does not switch map --- js/app/map/util.js | 70 ++++++++++++++++++++------------ public/js/v1.4.0/app/map/util.js | 70 ++++++++++++++++++++------------ 2 files changed, 88 insertions(+), 52 deletions(-) diff --git a/js/app/map/util.js b/js/app/map/util.js index 18b07ecf..8eb49835 100644 --- a/js/app/map/util.js +++ b/js/app/map/util.js @@ -1009,19 +1009,28 @@ define([ display: 'auto' }); - mapElements.velocity({ - translateY: [ 0, -20], - opacity: [ 1, 0 ] - }, { - duration: 150, - easing: 'easeOut', - complete: function(){ - resolve({ - action: 'visualizeMap', - data: false - }); - } - }); + if(mapElements.length){ + mapElements.velocity({ + translateY: [ 0, -20], + opacity: [ 1, 0 ] + }, { + duration: 150, + easing: 'easeOut', + complete: function(){ + resolve({ + action: 'visualizeMap', + data: false + }); + } + }); + }else{ + // "complete" callback is not fired if no elements were animated + resolve({ + action: 'visualizeMap', + data: false + }); + } + }else if(show === 'hide'){ overlayElements.velocity('transition.fadeOut', { @@ -1029,19 +1038,28 @@ define([ display: 'auto' }); - mapElements.velocity({ - translateY: [ -20, 0 ], - opacity: [ 0, 1 ] - }, { - duration: 150, - easing: 'easeOut', - complete: function(){ - resolve({ - action: 'visualizeMap', - data: false - }); - } - }); + if(mapElements.length){ + mapElements.velocity({ + translateY: [ -20, 0 ], + opacity: [ 0, 1 ] + }, { + duration: 150, + easing: 'easeOut', + complete: function(){ + resolve({ + action: 'visualizeMap', + data: false + }); + } + }); + }else{ + // "complete" callback is not fired if no elements were animated + resolve({ + action: 'visualizeMap', + data: false + }); + } + } }; diff --git a/public/js/v1.4.0/app/map/util.js b/public/js/v1.4.0/app/map/util.js index 18b07ecf..8eb49835 100644 --- a/public/js/v1.4.0/app/map/util.js +++ b/public/js/v1.4.0/app/map/util.js @@ -1009,19 +1009,28 @@ define([ display: 'auto' }); - mapElements.velocity({ - translateY: [ 0, -20], - opacity: [ 1, 0 ] - }, { - duration: 150, - easing: 'easeOut', - complete: function(){ - resolve({ - action: 'visualizeMap', - data: false - }); - } - }); + if(mapElements.length){ + mapElements.velocity({ + translateY: [ 0, -20], + opacity: [ 1, 0 ] + }, { + duration: 150, + easing: 'easeOut', + complete: function(){ + resolve({ + action: 'visualizeMap', + data: false + }); + } + }); + }else{ + // "complete" callback is not fired if no elements were animated + resolve({ + action: 'visualizeMap', + data: false + }); + } + }else if(show === 'hide'){ overlayElements.velocity('transition.fadeOut', { @@ -1029,19 +1038,28 @@ define([ display: 'auto' }); - mapElements.velocity({ - translateY: [ -20, 0 ], - opacity: [ 0, 1 ] - }, { - duration: 150, - easing: 'easeOut', - complete: function(){ - resolve({ - action: 'visualizeMap', - data: false - }); - } - }); + if(mapElements.length){ + mapElements.velocity({ + translateY: [ -20, 0 ], + opacity: [ 0, 1 ] + }, { + duration: 150, + easing: 'easeOut', + complete: function(){ + resolve({ + action: 'visualizeMap', + data: false + }); + } + }); + }else{ + // "complete" callback is not fired if no elements were animated + resolve({ + action: 'visualizeMap', + data: false + }); + } + } };