Merge pull request #9460 from druiz17/touchUp

Tablet button clickable in desktop mode && correct icons for switch
This commit is contained in:
Seth Alves 2017-01-20 12:58:41 -08:00 committed by GitHub
commit 2f08972578
2 changed files with 16 additions and 2 deletions

View file

@ -42,6 +42,17 @@ var button;
var desktopOnlyViews = ['Mirror', 'Independent Mode', 'Entity Mode'];
function onHmdChanged(isHmd) {
//TODO change button icon when the hmd changes
if (isHmd) {
button.editProperties({
icon: "icons/tablet-icons/switch-a.svg",
text: "DESKTOP"
});
} else {
button.editProperties({
icon: "icons/tablet-icons/switch-i.svg",
text: "VR"
});
}
desktopOnlyViews.forEach(function (view) {
Menu.setMenuEnabled("View>" + view, !isHmd);
});

View file

@ -204,7 +204,7 @@ WebTablet.prototype.getOverlayObject = function () {
WebTablet.prototype.destroy = function () {
Overlays.deleteOverlay(this.webOverlayID);
Entities.deleteEntity(this.tabletEntityID);
Overlays.deleteEntity(this.homeButtonEntity);
Overlays.deleteOverlay(this.homeButtonEntity);
HMD.displayModeChanged.disconnect(this.myOnHmdChanged);
if (!HMD.active) {
@ -319,7 +319,10 @@ WebTablet.prototype.mousePressEvent = function (event) {
var entityPickResults = Entities.findRayIntersection(pickRay, true); // non-accurate picking
if (entityPickResults.intersects && entityPickResults.entityID === this.tabletEntityID) {
var overlayPickResults = Overlays.findRayIntersection(pickRay);
if (!overlayPickResults.intersects || !overlayPickResults.overlayID === this.webOverlayID) {
if (overlayPickResults.intersects && overlayPickResults.overlayID === HMD.homeButtonID) {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet.gotoHomeScreen();
} else if (!overlayPickResults.intersects || !overlayPickResults.overlayID === this.webOverlayID) {
this.dragging = true;
var invCameraXform = new Xform(Camera.orientation, Camera.position).inv();
this.initialLocalIntersectionPoint = invCameraXform.xformPoint(entityPickResults.intersection);