diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index 8085039b02..f8ab8ceaec 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -161,8 +161,14 @@ void AddressManager::storeCurrentAddress() { // be loaded over http(s) // url.scheme() == URL_SCHEME_HTTP || // url.scheme() == URL_SCHEME_HTTPS || + bool isInErrorState = DependencyManager::get()->getDomainHandler().isInErrorState(); if (isConnected()) { - currentAddressHandle.set(url); + if (isInErrorState) { + // save the last address visited before the problem url. + currentAddressHandle.set(lastAddress()); + } else { + currentAddressHandle.set(url); + } } else { qCWarning(networking) << "Ignoring attempt to save current address because not connected to domain:" << url; } @@ -861,6 +867,10 @@ void AddressManager::goToUser(const QString& username, bool shouldMatchOrientati QByteArray(), nullptr, requestParams); } +bool AddressManager::canGoBack() const { + return (_backStack.size() > 0); +} + void AddressManager::refreshPreviousLookup() { // if we have a non-empty previous lookup, fire it again now (but don't re-store it in the history) if (!_previousAPILookup.isEmpty()) { diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h index 17041a5fd7..5318822cdc 100644 --- a/libraries/networking/src/AddressManager.h +++ b/libraries/networking/src/AddressManager.h @@ -254,6 +254,12 @@ public slots: */ void goToLastAddress() { handleUrl(_lastVisitedURL, LookupTrigger::AttemptedRefresh); } + /**jsdoc + * Returns if going back is possible. + * @function location.canGoBack + */ + bool canGoBack() const; + /**jsdoc * Refresh the current address, e.g., after connecting to a domain in order to position the user to the desired location. * @function location.refreshPreviousLookup diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index 5e798ed680..2e73526728 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -110,6 +110,8 @@ Script.include("/~/system/libraries/Xform.js"); this.reticleMinY = MARGIN; this.reticleMaxY; + this.ignoredEntities = []; + var ACTION_TTL = 15; // seconds var DISTANCE_HOLDING_RADIUS_FACTOR = 3.5; // multiplied by distance between hand and object @@ -314,6 +316,17 @@ Script.include("/~/system/libraries/Xform.js"); return point2d; }; + this.restoreIgnoredEntities = function() { + for (var i = 0; i < this.ignoredEntities; i++) { + var data = { + action: 'remove', + id: this.ignoredEntities[i] + }; + Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data)); + } + this.ignoredEntities = []; + }; + this.notPointingAtEntity = function(controllerData) { var intersection = controllerData.rayPicks[this.hand]; var entityProperty = Entities.getEntityProperties(intersection.objectID); @@ -323,6 +336,15 @@ Script.include("/~/system/libraries/Xform.js"); if ((intersection.type === Picks.INTERSECTED_ENTITY && entityType === "Web") || intersection.type === Picks.INTERSECTED_OVERLAY || Window.isPointOnDesktopWindow(point2d)) { return true; + } else if (intersection.type === Picks.INTERSECTED_ENTITY && !Window.isPhysicsEnabled()) { + // add to ignored items. + var data = { + action: 'add', + id: intersection.objectID + }; + Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data)); + this.ignoredEntities.push(intersection.objectID); + } return false; }; @@ -383,6 +405,7 @@ Script.include("/~/system/libraries/Xform.js"); this.isReady = function (controllerData) { if (HMD.active) { if (this.notPointingAtEntity(controllerData)) { + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } @@ -394,9 +417,11 @@ Script.include("/~/system/libraries/Xform.js"); return makeRunningValues(true, [], []); } else { this.destroyContextOverlay(); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); }; @@ -407,6 +432,7 @@ Script.include("/~/system/libraries/Xform.js"); Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", this.highlightedEntity); this.highlightedEntity = null; + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } this.intersectionDistance = controllerData.rayPicks[this.hand].distance; @@ -437,6 +463,7 @@ Script.include("/~/system/libraries/Xform.js"); if (nearGrabReadiness[k].active && (nearGrabReadiness[k].targets[0] === this.grabbedThingID || HMD.tabletID && nearGrabReadiness[k].targets[0] === HMD.tabletID)) { this.endFarGrabAction(); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } @@ -448,6 +475,7 @@ Script.include("/~/system/libraries/Xform.js"); for (var j = 0; j < nearGrabReadiness.length; j++) { if (nearGrabReadiness[j].active) { this.endFarGrabAction(); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } @@ -466,6 +494,7 @@ Script.include("/~/system/libraries/Xform.js"); ]); if (targetProps.href !== "") { AddressManager.handleLookupString(targetProps.href); + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } @@ -583,6 +612,7 @@ Script.include("/~/system/libraries/Xform.js"); Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", this.highlightedEntity); this.highlightedEntity = null; + this.restoreIgnoredEntities(); return makeRunningValues(false, [], []); } } diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index bd542b298d..39b4821192 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -475,7 +475,7 @@ if (textureMemSizeStabilityCount >= 15) { if (textureResourceGPUMemSize > 0) { - print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); + // print((texturePopulatedGPUMemSize / textureResourceGPUMemSize)); var gpuPercantage = (TOTAL_LOADING_PROGRESS * 0.6) * (texturePopulatedGPUMemSize / textureResourceGPUMemSize); var totalProgress = progress + gpuPercantage; if (totalProgress >= target) { diff --git a/scripts/system/redirectOverlays.js b/scripts/system/redirectOverlays.js index 49844db5b0..7f4193e4e9 100644 --- a/scripts/system/redirectOverlays.js +++ b/scripts/system/redirectOverlays.js @@ -195,7 +195,7 @@ } if (tryAgainImageHover === overlayID) { location.goToLastAddress(); - } else if (backImageHover === overlayID) { + } else if (backImageHover === overlayID && location.canGoBack()) { location.goBack(); } } @@ -216,7 +216,7 @@ Overlays.mouseReleaseOnOverlay.connect(clickedOnOverlay); Overlays.hoverEnterOverlay.connect(function(overlayID, event) { - if (overlayID === backImageNeutral) { + if (overlayID === backImageNeutral && location.canGoBack()) { Overlays.editOverlay(backImageNeutral, {visible: false}); Overlays.editOverlay(backImageHover, {visible: true}); }