ignoring entities in interstitial/saving address on 404 error

This commit is contained in:
Wayne Chen 2018-10-03 17:40:42 -07:00
parent f875bfd0d8
commit d6af09ca62
5 changed files with 50 additions and 4 deletions

View file

@ -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<NodeList>()->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()) {

View file

@ -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

View file

@ -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, [], []);
}
}

View file

@ -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) {

View file

@ -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});
}