7589 Fix notifications shrink with avatar

This commit is contained in:
luiscuenca 2017-11-10 17:22:41 -07:00
parent 469b68011c
commit 262dc091ce

View file

@ -210,7 +210,6 @@
notificationOrientation, notificationOrientation,
notificationPosition, notificationPosition,
buttonPosition; buttonPosition;
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
// Notification plane positions // Notification plane positions
noticeY = -y * NOTIFICATION_3D_SCALE - noticeHeight / 2; noticeY = -y * NOTIFICATION_3D_SCALE - noticeHeight / 2;
notificationPosition = { x: 0, y: noticeY, z: 0 }; notificationPosition = { x: 0, y: noticeY, z: 0 };
@ -224,8 +223,8 @@
// Translate plane // Translate plane
originOffset = Vec3.multiplyQbyV(Quat.fromPitchYawRollDegrees(0, NOTIFICATIONS_3D_DIRECTION, 0), originOffset = Vec3.multiplyQbyV(Quat.fromPitchYawRollDegrees(0, NOTIFICATIONS_3D_DIRECTION, 0),
{ x: 0, y: 0, z: -NOTIFICATIONS_3D_DISTANCE * sensorScaleFactor}); { x: 0, y: 0, z: -NOTIFICATIONS_3D_DISTANCE});
originOffset.y += NOTIFICATIONS_3D_ELEVATION * sensorScaleFactor; originOffset.y += NOTIFICATIONS_3D_ELEVATION;
notificationPosition = Vec3.sum(originOffset, notificationPosition); notificationPosition = Vec3.sum(originOffset, notificationPosition);
buttonPosition = Vec3.sum(originOffset, buttonPosition); buttonPosition = Vec3.sum(originOffset, buttonPosition);
@ -245,7 +244,6 @@
noticeHeight, noticeHeight,
positions, positions,
last; last;
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
if (isOnHMD) { if (isOnHMD) {
// Calculate 3D values from 2D overlay properties. // Calculate 3D values from 2D overlay properties.
@ -264,7 +262,7 @@
notice.leftMargin = 2 * notice.leftMargin * NOTIFICATION_3D_SCALE; notice.leftMargin = 2 * notice.leftMargin * NOTIFICATION_3D_SCALE;
notice.bottomMargin = 0; notice.bottomMargin = 0;
notice.rightMargin = 0; notice.rightMargin = 0;
notice.lineHeight = 10.0 * (fontSize * sensorScaleFactor / 12.0) * NOTIFICATION_3D_SCALE; notice.lineHeight = 10.0 * (fontSize * 1.0 / 12.0) * NOTIFICATION_3D_SCALE;
notice.isFacingAvatar = false; notice.isFacingAvatar = false;
notificationText = Overlays.addOverlay("text3d", notice); notificationText = Overlays.addOverlay("text3d", notice);
@ -369,7 +367,6 @@
buttonProperties, buttonProperties,
i; i;
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
if (text.length >= breakPoint) { if (text.length >= breakPoint) {
breaks = count; breaks = count;
} }
@ -391,7 +388,7 @@
alpha: backgroundAlpha, alpha: backgroundAlpha,
topMargin: topMargin, topMargin: topMargin,
leftMargin: leftMargin, leftMargin: leftMargin,
font: {size: fontSize * sensorScaleFactor}, font: {size: fontSize},
text: text text: text
}; };
@ -453,14 +450,13 @@
} }
function updateNotificationsTexts() { function updateNotificationsTexts() {
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
for (var i = 0; i < notifications.length; i++) { for (var i = 0; i < notifications.length; i++) {
var overlayType = Overlays.getOverlayType(notifications[i]); var overlayType = Overlays.getOverlayType(notifications[i]);
if (overlayType === "text3d") { if (overlayType === "text3d") {
var props = { var props = {
font: {size: fontSize * sensorScaleFactor}, font: {size: fontSize},
lineHeight: 10.0 * (fontSize * sensorScaleFactor / 12.0) * NOTIFICATION_3D_SCALE lineHeight: 10.0 * (fontSize * 1.0 / 12.0) * NOTIFICATION_3D_SCALE
}; };
Overlays.editOverlay(notifications[i], props); Overlays.editOverlay(notifications[i], props);
} }