提交 a0515f04 编写于 作者: B Benjamin Pasero

notifications - animate toasts

上级 37b0eb1a
...@@ -24,4 +24,12 @@ ...@@ -24,4 +24,12 @@
.monaco-workbench > .notifications-toasts .notification-toast { .monaco-workbench > .notifications-toasts .notification-toast {
margin: 5px; /* enables separation and drop shadows around toasts */ margin: 5px; /* enables separation and drop shadows around toasts */
position: relative;
-webkit-transition: left 200ms linear;
-ms-transition: left 200ms linear;
-moz-transition: left 200ms linear;
-khtml-transition: left 200ms linear;
-o-transition: left 200ms linear;
transition: left 200ms linear;
} }
\ No newline at end of file
...@@ -178,7 +178,7 @@ export class NotificationsCenter extends Themable { ...@@ -178,7 +178,7 @@ export class NotificationsCenter extends Themable {
// Make sure notifications are not exceding available width // Make sure notifications are not exceding available width
availableWidth = this.workbenchDimensions.width; availableWidth = this.workbenchDimensions.width;
availableWidth -= (2 * 12); // adjust for paddings left and right availableWidth -= (2 * 8); // adjust for paddings left and right
// Make sure notifications are not exceeding available height // Make sure notifications are not exceeding available height
availableHeight = this.workbenchDimensions.height; availableHeight = this.workbenchDimensions.height;
......
...@@ -135,17 +135,15 @@ export class NotificationsToasts extends Themable { ...@@ -135,17 +135,15 @@ export class NotificationsToasts extends Themable {
this.removeToast(item); this.removeToast(item);
}); });
// Automatically hide notifications without buttons after a timeout // Automatically hide collapsed notifications
if (item.actions.primary.length === 0) { if (!item.expanded) {
let timeoutHandle: number; let timeoutHandle: number;
const hideAfterTimeout = () => { const hideAfterTimeout = () => {
timeoutHandle = setTimeout(() => { timeoutHandle = setTimeout(() => {
if (!notificationList.hasFocus()) { if (!notificationList.hasFocus() && !item.expanded) {
if (item.actions.primary.length === 0) { this.removeToast(item);
this.removeToast(item); // only remove if actions are still not there (they can change after the fact)
}
} else { } else {
hideAfterTimeout(); // push out disposal if item has focus hideAfterTimeout(); // push out disposal if item has focus or is expanded
} }
}, NotificationsToasts.PURGE_TIMEOUT[item.severity]); }, NotificationsToasts.PURGE_TIMEOUT[item.severity]);
}; };
...@@ -160,6 +158,13 @@ export class NotificationsToasts extends Themable { ...@@ -160,6 +158,13 @@ export class NotificationsToasts extends Themable {
// Context Key // Context Key
this.notificationsToastsVisibleContextKey.set(true); this.notificationsToastsVisibleContextKey.set(true);
// Animate In
notificationToastContainer.style.left = `${NotificationsToasts.MAX_DIMENSIONS.width}px`;
const animationHandle = setTimeout(() => {
notificationToastContainer.style.left = '0px';
});
itemDisposeables.push(toDisposable(() => clearTimeout(animationHandle)));
} }
private removeToast(item: INotificationViewItem): void { private removeToast(item: INotificationViewItem): void {
...@@ -313,7 +318,7 @@ export class NotificationsToasts extends Themable { ...@@ -313,7 +318,7 @@ export class NotificationsToasts extends Themable {
// Make sure notifications are not exceding available width // Make sure notifications are not exceding available width
availableWidth = this.workbenchDimensions.width; availableWidth = this.workbenchDimensions.width;
availableWidth -= (2 * 12); // adjust for paddings left and right availableWidth -= (2 * 8); // adjust for paddings left and right
// Make sure notifications are not exceeding available height // Make sure notifications are not exceeding available height
availableHeight = this.workbenchDimensions.height; availableHeight = this.workbenchDimensions.height;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册