fix home-button on tablet

This commit is contained in:
Seth Alves 2017-02-17 11:47:37 -08:00
parent 2b02998fae
commit 47cdade1e9
2 changed files with 5 additions and 10 deletions

View file

@ -30,7 +30,7 @@ class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Depen
Q_PROPERTY(bool mounted READ isMounted)
Q_PROPERTY(bool showTablet READ getShouldShowTablet)
Q_PROPERTY(QUuid tabletID READ getCurrentTableUIID WRITE setCurrentTabletUIID)
Q_PROPERTY(unsigned int homeButtonID READ getCurrentHomeButtonUUID WRITE setCurrentHomeButtonUUID)
Q_PROPERTY(QUuid homeButtonID READ getCurrentHomeButtonUUID WRITE setCurrentHomeButtonUUID)
public:
@ -93,13 +93,13 @@ public:
void setCurrentTabletUIID(QUuid tabletID) { _tabletUIID = tabletID; }
QUuid getCurrentTableUIID() const { return _tabletUIID; }
void setCurrentHomeButtonUUID(unsigned int homeButtonID) { _homeButtonID = homeButtonID; }
unsigned int getCurrentHomeButtonUUID() const { return _homeButtonID; }
void setCurrentHomeButtonUUID(QUuid homeButtonID) { _homeButtonID = homeButtonID; }
QUuid getCurrentHomeButtonUUID() const { return _homeButtonID; }
private:
bool _showTablet { false };
QUuid _tabletUIID; // this is the entityID of the WebEntity which is part of (a child of) the tablet-ui.
unsigned int _homeButtonID;
QUuid _homeButtonID;
QUuid _tabletEntityID;
// Get the position of the HMD

View file

@ -159,7 +159,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly) {
});
this.receive = function (channel, senderID, senderUUID, localOnly) {
if (_this.homeButtonEntity === parseInt(senderID)) {
if (_this.homeButtonEntity == senderID) {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var onHomeScreen = tablet.onHomeScreen();
if (onHomeScreen) {
@ -219,7 +219,6 @@ WebTablet = function (url, width, dpi, hand, clientOnly) {
};
WebTablet.prototype.setHomeButtonTexture = function() {
print(this.homeButtonEntity);
Entities.editEntity(this.tabletEntityID, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})});
};
@ -385,14 +384,10 @@ WebTablet.prototype.register = function() {
WebTablet.prototype.cleanUpOldTabletsOnJoint = function(jointIndex) {
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, jointIndex);
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, jointIndex));
print("cleanup " + children);
children.forEach(function(childID) {
var props = Entities.getEntityProperties(childID, ["name"]);
if (props.name === "WebTablet Tablet") {
print("cleaning up " + props.name);
Entities.deleteEntity(childID);
} else {
print("not cleaning up " + props.name);
}
});
};