fixed snapshot preview on windows

This commit is contained in:
SamGondelman 2016-07-06 11:57:29 -07:00
parent 79864df08e
commit 6a44ea76e5

View file

@ -247,14 +247,14 @@ function notify(notice, button, height, imageProperties, image) {
noticeHeight = notice.height * NOTIFICATION_3D_SCALE; noticeHeight = notice.height * NOTIFICATION_3D_SCALE;
notice.size = { x: noticeWidth, y: noticeHeight }; notice.size = { x: noticeWidth, y: noticeHeight };
notice.topMargin = 0.75 * notice.topMargin * NOTIFICATION_3D_SCALE;
notice.leftMargin = 2 * notice.leftMargin * NOTIFICATION_3D_SCALE;
notice.bottomMargin = 0;
notice.rightMargin = 0;
positions = calculate3DOverlayPositions(noticeWidth, noticeHeight, notice.y); positions = calculate3DOverlayPositions(noticeWidth, noticeHeight, notice.y);
if (!image) { if (!image) {
notice.topMargin = 0.75 * notice.topMargin * NOTIFICATION_3D_SCALE;
notice.leftMargin = 2 * notice.leftMargin * NOTIFICATION_3D_SCALE;
notice.bottomMargin = 0;
notice.rightMargin = 0;
notice.lineHeight = 10.0 * (fontSize / 12.0) * NOTIFICATION_3D_SCALE; notice.lineHeight = 10.0 * (fontSize / 12.0) * NOTIFICATION_3D_SCALE;
notice.isFacingAvatar = false; notice.isFacingAvatar = false;
@ -289,8 +289,8 @@ function notify(notice, button, height, imageProperties, image) {
height = height + 1.0; height = height + 1.0;
heights.push(height); heights.push(height);
times.push(new Date().getTime() / 1000); times.push(new Date().getTime() / 1000);
myAlpha.push(0);
last = notifications.length - 1; last = notifications.length - 1;
myAlpha.push(notifications[last].alpha);
createArrays(notifications[last], buttons[last], times[last], heights[last], myAlpha[last]); createArrays(notifications[last], buttons[last], times[last], heights[last], myAlpha[last]);
fadeIn(notifications[last], buttons[last]); fadeIn(notifications[last], buttons[last]);
@ -301,9 +301,11 @@ function notify(notice, button, height, imageProperties, image) {
y: notice.y + height, y: notice.y + height,
width: notice.width, width: notice.width,
height: imageHeight, height: imageHeight,
topMargin: 0, subImage: { x: 0, y: 0 },
leftMargin: 0, color: { red: 255, green: 255, blue: 255},
imageURL: imageProperties.path visible: true,
imageURL: imageProperties.path,
alpha: backgroundAlpha
}; };
notify(notice, button, imageHeight, imageProperties, true); notify(notice, button, imageHeight, imageProperties, true);
} }
@ -336,10 +338,6 @@ function createNotification(text, notificationType, imageProperties) {
level = (stack + 20.0); level = (stack + 20.0);
height = height + extraLine; height = height + extraLine;
if (imageProperties && imageProperties.path) {
imageProperties.path = Script.resolvePath(imageProperties.path);
}
noticeProperties = { noticeProperties = {
x: overlayLocationX, x: overlayLocationX,
y: level, y: level,
@ -397,7 +395,7 @@ function stringDivider(str, slotWidth, spaceReplacer) {
if (str.length > slotWidth && slotWidth > 0) { if (str.length > slotWidth && slotWidth > 0) {
left = str.substring(0, slotWidth); left = str.substring(0, slotWidth);
right = str.substring(slotWidth + 1); right = str.substring(slotWidth);
return left + spaceReplacer + stringDivider(right, slotWidth, spaceReplacer); return left + spaceReplacer + stringDivider(right, slotWidth, spaceReplacer);
} }
return str; return str;
@ -531,7 +529,7 @@ function onDomainConnectionRefused(reason) {
function onSnapshotTaken(path) { function onSnapshotTaken(path) {
var imageProperties = { var imageProperties = {
path: path, path: Script.resolvePath("file:///" + path),
aspectRatio: Window.innerWidth / Window.innerHeight aspectRatio: Window.innerWidth / Window.innerHeight
} }
createNotification(wordWrap("Snapshot saved to " + path), NotificationType.SNAPSHOT, imageProperties); createNotification(wordWrap("Snapshot saved to " + path), NotificationType.SNAPSHOT, imageProperties);