Merge pull request #15073 from danteruiz/fix-tablet-button-rotation

Case 21512: Very difficult to use the close button on the tablet (0.81.0)
This commit is contained in:
Shannon Romano 2019-03-04 10:49:16 -08:00 committed by GitHub
commit 6d297d91f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 29 deletions

View file

@ -413,32 +413,13 @@ EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& ove
overlayProps["dimensions"] = vec3toVariant(ratio * dimensions);
}
if (add || overlayProps.contains("rotation")) {
glm::quat rotation;
{
auto iter = overlayProps.find("rotation");
if (iter != overlayProps.end()) {
rotation = quatFromVariant(iter.value());
} else if (!add) {
EntityPropertyFlags desiredProperties;
desiredProperties += PROP_ROTATION;
rotation = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(id, desiredProperties).getRotation();
}
}
if (add && !overlayProps.contains("rotation") && !overlayProps.contains("localRotation")) {
overlayProps["rotation"] = quatToVariant(glm::angleAxis(-(float)M_PI_2, Vectors::RIGHT));
} else if (overlayProps.contains("rotation")) {
glm::quat rotation = quatFromVariant(overlayProps["rotation"]);
overlayProps["rotation"] = quatToVariant(glm::angleAxis(-(float)M_PI_2, rotation * Vectors::RIGHT) * rotation);
}
if (add || overlayProps.contains("localRotation")) {
glm::quat rotation;
{
auto iter = overlayProps.find("localRotation");
if (iter != overlayProps.end()) {
rotation = quatFromVariant(iter.value());
} else if (!add) {
EntityPropertyFlags desiredProperties;
desiredProperties += PROP_LOCAL_ROTATION;
rotation = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(id, desiredProperties).getLocalRotation();
}
}
} else if (overlayProps.contains("localRotation")) {
glm::quat rotation = quatFromVariant(overlayProps["localRotation"]);
overlayProps["localRotation"] = quatToVariant(glm::angleAxis(-(float)M_PI_2, rotation * Vectors::RIGHT) * rotation);
}

View file

@ -418,13 +418,11 @@ resizeTablet = function (width, newParentJointIndex, sensorToWorldScaleOverride)
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleOffsetOverride;
Entities.editEntity(HMD.homeButtonID, {
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
localRotation: { x: 0, y: 1, z: 0, w: 0 },
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
});
Entities.editEntity(HMD.homeButtonHighlightID, {
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
localRotation: { x: 0, y: 1, z: 0, w: 0 },
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
});
};
@ -482,13 +480,11 @@ reparentAndScaleTablet = function(width, reparentProps) {
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleOffsetOverride;
Entities.editEntity(HMD.homeButtonID, {
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
localRotation: { x: 0, y: 1, z: 0, w: 0 },
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
});
Entities.editEntity(HMD.homeButtonHighlightID, {
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
localRotation: { x: 0, y: 1, z: 0, w: 0 },
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
});
}