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 mounted READ isMounted)
Q_PROPERTY(bool showTablet READ getShouldShowTablet) Q_PROPERTY(bool showTablet READ getShouldShowTablet)
Q_PROPERTY(QUuid tabletID READ getCurrentTableUIID WRITE setCurrentTabletUIID) 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: public:
@ -93,13 +93,13 @@ public:
void setCurrentTabletUIID(QUuid tabletID) { _tabletUIID = tabletID; } void setCurrentTabletUIID(QUuid tabletID) { _tabletUIID = tabletID; }
QUuid getCurrentTableUIID() const { return _tabletUIID; } QUuid getCurrentTableUIID() const { return _tabletUIID; }
void setCurrentHomeButtonUUID(unsigned int homeButtonID) { _homeButtonID = homeButtonID; } void setCurrentHomeButtonUUID(QUuid homeButtonID) { _homeButtonID = homeButtonID; }
unsigned int getCurrentHomeButtonUUID() const { return _homeButtonID; } QUuid getCurrentHomeButtonUUID() const { return _homeButtonID; }
private: private:
bool _showTablet { false }; bool _showTablet { false };
QUuid _tabletUIID; // this is the entityID of the WebEntity which is part of (a child of) the tablet-ui. 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; QUuid _tabletEntityID;
// Get the position of the HMD // 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) { 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 tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var onHomeScreen = tablet.onHomeScreen(); var onHomeScreen = tablet.onHomeScreen();
if (onHomeScreen) { if (onHomeScreen) {
@ -219,7 +219,6 @@ WebTablet = function (url, width, dpi, hand, clientOnly) {
}; };
WebTablet.prototype.setHomeButtonTexture = function() { WebTablet.prototype.setHomeButtonTexture = function() {
print(this.homeButtonEntity);
Entities.editEntity(this.tabletEntityID, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})}); 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) { WebTablet.prototype.cleanUpOldTabletsOnJoint = function(jointIndex) {
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, jointIndex); var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, jointIndex);
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, jointIndex)); children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, jointIndex));
print("cleanup " + children);
children.forEach(function(childID) { children.forEach(function(childID) {
var props = Entities.getEntityProperties(childID, ["name"]); var props = Entities.getEntityProperties(childID, ["name"]);
if (props.name === "WebTablet Tablet") { if (props.name === "WebTablet Tablet") {
print("cleaning up " + props.name);
Entities.deleteEntity(childID); Entities.deleteEntity(childID);
} else {
print("not cleaning up " + props.name);
} }
}); });
}; };