fix-another-highlighting-issue

This commit is contained in:
Dante Ruiz 2018-05-04 14:20:17 -07:00
parent d44882e6dc
commit 0e92bb41bf
2 changed files with 11 additions and 1 deletions

View file

@ -56,6 +56,12 @@
return canGrabEntity;
};
this.clearAll = function() {
this.highlightedEntities.forEach(function(entity) {
dispatcherUtils.unhighlightTargetEntity(entity);
});
};
this.hasHyperLink = function(props) {
return (props.href !== "" && props.href !== undefined);
};
@ -121,7 +127,6 @@
if (channel === 'Hifi-unhighlight-entity') {
try {
data = JSON.parse(message);
var hand = data.hand;
if (hand === dispatcherUtils.LEFT_HAND) {
leftHighlightNearbyEntities.removeEntityFromHighlightList(data.entityID);
@ -131,6 +136,9 @@
} catch (e) {
print("Failed to parse message");
}
} else if (channel === 'Hifi-unhighlight-all') {
leftHighlightNearbyEntities.clearAll();
rightHighlightNearbyEntities.clearAll();
}
}
};
@ -145,6 +153,7 @@
dispatcherUtils.disableDispatcherModule("RightHighlightNearbyEntities");
}
Messages.subscribe('Hifi-unhighlight-entity');
Messages.subscribe('Hifi-unhighlight-all');
Messages.messageReceived.connect(handleMessage);
Script.scriptEnding.connect(cleanup);
}());

View file

@ -78,6 +78,7 @@ Script.include("/~/system/libraries/utils.js");
if (controllerData.triggerValues[this.hand] < TRIGGER_ON_VALUE) {
this.triggerClicked = false;
}
Messages.sendLocalMessage('Hifi-unhighlight-all', '');
return makeRunningValues(true, [], []);
}
this.triggerClicked = false;