Merge branch 'interstitialIgnoreFix' of https://github.com/wayne-chen/hifi into mergedInterstitialBugFixes

This commit is contained in:
Wayne Chen 2018-10-22 10:28:12 -07:00
commit e2b90aac9d

View file

@ -298,7 +298,7 @@ Script.include("/~/system/libraries/controllers.js");
}; };
this.restoreIgnoredEntities = function() { this.restoreIgnoredEntities = function() {
for (var i = 0; i < this.ignoredEntities; i++) { for (var i = 0; i < this.ignoredEntities.length; i++) {
var data = { var data = {
action: 'remove', action: 'remove',
id: this.ignoredEntities[i] id: this.ignoredEntities[i]
@ -317,15 +317,6 @@ Script.include("/~/system/libraries/controllers.js");
if ((intersection.type === Picks.INTERSECTED_ENTITY && entityType === "Web") || if ((intersection.type === Picks.INTERSECTED_ENTITY && entityType === "Web") ||
intersection.type === Picks.INTERSECTED_OVERLAY || Window.isPointOnDesktopWindow(point2d)) { intersection.type === Picks.INTERSECTED_OVERLAY || Window.isPointOnDesktopWindow(point2d)) {
return true; 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; return false;
}; };
@ -386,7 +377,6 @@ Script.include("/~/system/libraries/controllers.js");
this.isReady = function (controllerData) { this.isReady = function (controllerData) {
if (HMD.active) { if (HMD.active) {
if (this.notPointingAtEntity(controllerData)) { if (this.notPointingAtEntity(controllerData)) {
this.restoreIgnoredEntities();
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }
@ -398,17 +388,28 @@ Script.include("/~/system/libraries/controllers.js");
return makeRunningValues(true, [], []); return makeRunningValues(true, [], []);
} else { } else {
this.destroyContextOverlay(); this.destroyContextOverlay();
this.restoreIgnoredEntities();
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }
} }
this.restoreIgnoredEntities();
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
}; };
this.run = function (controllerData) { this.run = function (controllerData) {
var intersection = controllerData.rayPicks[this.hand];
if (intersection.type === Picks.INTERSECTED_ENTITY && !Window.isPhysicsEnabled()) {
// add to ignored items.
if (this.ignoredEntities.indexOf(intersection.objectID) === -1) {
var data = {
action: 'add',
id: intersection.objectID
};
Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data));
this.ignoredEntities.push(intersection.objectID);
}
}
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE || if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
this.notPointingAtEntity(controllerData) || this.targetIsNull()) { (this.notPointingAtEntity(controllerData) && Window.isPhysicsEnabled()) || this.targetIsNull()) {
this.endFarGrabAction(); this.endFarGrabAction();
Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity",
this.highlightedEntity); this.highlightedEntity);