From efeb598495335918561bb8637096d41c0ae33b1d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 3 Oct 2018 10:12:07 -0700 Subject: [PATCH] fixing bug with hover overlay --- scripts/system/interstitialPage.js | 38 ++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 869c47bd2a..bd542b298d 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -356,6 +356,26 @@ } } + function onEnterOverlay(overlayID, event) { + if (currentDomain === "no domain") { + return; + } + if (overlayID === loadingToTheSpotID) { + Overlays.editOverlay(loadingToTheSpotID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true}); + } + } + + function onLeaveOverlay(overlayID, event) { + if (currentDomain === "no domain") { + return; + } + if (overlayID === loadingToTheSpotHoverID) { + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); + Overlays.editOverlay(loadingToTheSpotID, {visible: true}); + } + } + var currentProgress = 0.1; function updateOverlays(physicsEnabled) { @@ -482,6 +502,8 @@ if (errorConnectingToDomain) { updateOverlays(errorConnectingToDomain); + // setting hover id to invisible + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); endAudio(); currentDomain = "no domain"; timer = null; @@ -496,6 +518,8 @@ return; } else if ((physicsEnabled && (currentProgress >= (TOTAL_LOADING_PROGRESS - EPSILON)))) { updateOverlays((physicsEnabled || connectionToDomainFailed)); + // setting hover id to invisible + Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); endAudio(); currentDomain = "no domain"; timer = null; @@ -506,19 +530,9 @@ var whiteColor = {red: 255, green: 255, blue: 255}; var greyColor = {red: 125, green: 125, blue: 125}; Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); - Overlays.hoverEnterOverlay.connect(function(overlayID, event) { - if (overlayID === loadingToTheSpotID) { - Overlays.editOverlay(loadingToTheSpotID, {visible: false}); - Overlays.editOverlay(loadingToTheSpotHoverID, {visible: true}); - } - }); + Overlays.hoverEnterOverlay.connect(onEnterOverlay); - Overlays.hoverLeaveOverlay.connect(function(overlayID, event) { - if (overlayID === loadingToTheSpotHoverID) { - Overlays.editOverlay(loadingToTheSpotHoverID, {visible: false}); - Overlays.editOverlay(loadingToTheSpotID, {visible: true}); - } - }); + Overlays.hoverLeaveOverlay.connect(onLeaveOverlay); location.hostChanged.connect(domainChanged); location.lookupResultsFinished.connect(function() {